New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@casual-simulation/aux-records

Package Overview
Dependencies
Maintainers
2
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casual-simulation/aux-records - npm Package Compare versions

Comparing version 3.2.2-alpha.5685728183 to 3.2.2-alpha.5694783443

33

AIController.d.ts

@@ -55,2 +55,3 @@ import { InvalidSubscriptionTierError, NotLoggedInError, NotSubscribedError, NotSupportedError, ServerError } from './Errors';

generateSkybox(request: AIGenerateSkyboxRequest): Promise<AIGenerateSkyboxResponse>;
getSkybox(request: AIGetSkyboxRequest): Promise<AIGetSkyboxResponse>;
private _matchesSubscriptionTiers;

@@ -144,4 +145,3 @@ }

success: true;
fileUrl: string;
thumbnailUrl: string;
skyboxId: string;
}

@@ -155,2 +155,31 @@ export interface AIGenerateSkyboxFailure {

}
export interface AIGetSkyboxRequest {
/**
* The ID of the skybox.
*/
skyboxId: string;
/**
* The ID of the user that is currently logged in.
*/
userId: string;
/**
* The subscription tier of the user.
* Should be null if the user is not logged in or if they do not have a subscription.
*/
userSubscriptionTier: string;
}
export type AIGetSkyboxResponse = AIGetSkyboxSuccess | AIGetSkyboxFailure;
export interface AIGetSkyboxSuccess {
success: true;
status: 'pending' | 'generated';
fileUrl?: string;
thumbnailUrl?: string;
}
export interface AIGetSkyboxFailure {
success: false;
errorCode: ServerError | NotLoggedInError | NotSubscribedError | InvalidSubscriptionTierError | NotSupportedError;
errorMessage: string;
allowedSubscriptionTiers?: string[];
currentSubscriptionTier?: string;
}
//# sourceMappingURL=AIController.d.ts.map

@@ -161,2 +161,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

success: true,
skyboxId: result.skyboxId,
};
}
else {
return result;
}
}
catch (err) {
console.error('[AIController] Error handling generate skybox request:', err);
return {
success: false,
errorCode: 'server_error',
errorMessage: 'A server error occurred.',
};
}
});
}
getSkybox(request) {
return __awaiter(this, void 0, void 0, function* () {
try {
if (!this._generateSkybox) {
return {
success: false,
errorCode: 'not_supported',
errorMessage: 'This operation is not supported.',
};
}
if (!request.userId) {
return {
success: false,
errorCode: 'not_logged_in',
errorMessage: 'The user must be logged in. Please provide a sessionKey or a recordKey.',
};
}
if (!this._matchesSubscriptionTiers(request.userSubscriptionTier, this._allowedGenerateSkyboxSubscriptionTiers)) {
if (!request.userSubscriptionTier) {
return {
success: false,
errorCode: 'not_subscribed',
errorMessage: 'The user must be subscribed in order to use this operation.',
allowedSubscriptionTiers: [
...this
._allowedGenerateSkyboxSubscriptionTiers,
],
};
}
else {
return {
success: false,
errorCode: 'invalid_subscription_tier',
errorMessage: 'This operation is not available to the user at their current subscription tier.',
allowedSubscriptionTiers: [
...this
._allowedGenerateSkyboxSubscriptionTiers,
],
currentSubscriptionTier: request.userSubscriptionTier,
};
}
}
const result = yield this._generateSkybox.getSkybox(request.skyboxId);
if (result.success === true) {
return {
success: true,
status: result.status,
fileUrl: result.fileUrl,

@@ -171,3 +235,3 @@ thumbnailUrl: result.thumbnailUrl,

catch (err) {
console.error('[AIController] Error handling generate skybox request:', err);
console.error('[AIController] Error handling get skybox request:', err);
return {

@@ -174,0 +238,0 @@ success: false,

25

AIGenerateSkyboxInterface.d.ts

@@ -11,2 +11,7 @@ import { ServerError } from './Errors';

generateSkybox(request: AIGenerateSkyboxInterfaceRequest): Promise<AIGenerateSkyboxInterfaceResponse>;
/**
* Attempts to get the skybox with the given ID.
* @param skyboxId The ID of the skybox.
*/
getSkybox(skyboxId: string): Promise<AIGetSkyboxInterfaceResponse>;
}

@@ -51,9 +56,5 @@ export interface AIGenerateSkyboxInterfaceRequest {

/**
* The URL of the file that was generated.
* The ID of the skybox.
*/
fileUrl: string;
/**
* The URL of the thumbnail for the file.
*/
thumbnailUrl?: string;
skyboxId: string;
}

@@ -65,2 +66,14 @@ export interface AIGenerateSkyboxInterfaceResponseFailure {

}
export type AIGetSkyboxInterfaceResponse = AIGetSkyboxInterfaceResponseSuccess | AIGetSkyboxInterfaceResponseFailure;
export interface AIGetSkyboxInterfaceResponseSuccess {
success: true;
status: 'pending' | 'generated';
fileUrl: string | null;
thumbnailUrl: string | null;
}
export interface AIGetSkyboxInterfaceResponseFailure {
success: false;
errorCode: ServerError;
errorMessage: string;
}
//# sourceMappingURL=AIGenerateSkyboxInterface.d.ts.map

@@ -1,2 +0,2 @@

import { AIGenerateSkyboxInterface, AIGenerateSkyboxInterfaceRequest, AIGenerateSkyboxInterfaceResponse } from './AIGenerateSkyboxInterface';
import { AIGenerateSkyboxInterface, AIGenerateSkyboxInterfaceRequest, AIGenerateSkyboxInterfaceResponse, AIGetSkyboxInterfaceResponse } from './AIGenerateSkyboxInterface';
/**

@@ -9,2 +9,3 @@ * Implements the AI generate skybox interface for Blockade Labs (https://www.blockadelabs.com/).

generateSkybox(request: AIGenerateSkyboxInterfaceRequest): Promise<AIGenerateSkyboxInterfaceResponse>;
getSkybox(skyboxId: string): Promise<AIGetSkyboxInterfaceResponse>;
private _downloadStatus;

@@ -11,0 +12,0 @@ }

@@ -42,34 +42,59 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

console.log(`[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: ID recieved.`);
for (let i = 0; i < 4; i++) {
const seconds = i === 0 ? 10 : i === 1 ? 20 : i === 2 ? 40 : 60;
console.log(`[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Waiting ${seconds} seconds...`);
yield wait(seconds);
const status = yield this._downloadStatus(id);
console.log(`[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Status: ${status.status}`);
if (isFinished(status)) {
if (isError(status)) {
return {
success: false,
errorCode: 'server_error',
errorMessage: status.error_message,
};
}
else {
console.log(`[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Skybox Generated.`);
return {
success: true,
fileUrl: status.file_url,
thumbnailUrl: status.thumb_url,
};
}
}
}
console.error(`[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}] Timed out.`);
return {
success: false,
errorCode: 'server_error',
errorMessage: 'The request timed out.',
success: true,
skyboxId: String(id),
};
// for (let i = 0; i < 4; i++) {
// const seconds = i === 0 ? 10 : i === 1 ? 20 : i === 2 ? 40 : 60;
// console.log(
// `[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Waiting ${seconds} seconds...`
// );
// await wait(seconds);
// const status = await this._downloadStatus(id);
// console.log(
// `[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Status: ${status.status}`
// );
// if (isFinished(status)) {
// if (isError(status)) {
// return {
// success: false,
// errorCode: 'server_error',
// errorMessage: status.error_message,
// };
// } else {
// console.log(
// `[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}]: Skybox Generated.`
// );
// return {
// success: true,
// fileUrl: status.file_url,
// thumbnailUrl: status.thumb_url,
// };
// }
// }
// }
// console.error(
// `[BlockadeLabsGenerateSkyboxInterface] [generateSkybox] [${id}] Timed out.`
// );
// return {
// success: false,
// errorCode: 'server_error',
// errorMessage: 'The request timed out.',
// };
});
}
getSkybox(skyboxId) {
return __awaiter(this, void 0, void 0, function* () {
console.log(`[BlockadeLabsGenerateSkyboxInterface] [getSkybox]: Getting skybox status...`);
const id = parseInt(skyboxId);
const status = yield this._downloadStatus(id);
console.log(`[BlockadeLabsGenerateSkyboxInterface] [getSkybox] [${id}]: Status recieved:`, status);
return {
success: true,
status: isFinished(status) ? 'generated' : 'pending',
fileUrl: status.file_url,
thumbnailUrl: status.thumb_url,
};
});
}
_downloadStatus(id) {

@@ -94,9 +119,2 @@ return __awaiter(this, void 0, void 0, function* () {

}
function wait(seconds) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, seconds * 1000);
});
}
//# sourceMappingURL=BlockadeLabsGenerateSkyboxInterface.js.map
{
"name": "@casual-simulation/aux-records",
"version": "3.2.2-alpha.5685728183",
"version": "3.2.2-alpha.5694783443",
"description": "Helpers and managers used by the CasualOS records system.",

@@ -47,3 +47,3 @@ "keywords": [],

},
"gitHead": "cf7f0341f31d208cd3dd4d1c95f4a11917eea22a"
"gitHead": "38f9d2559a32ed9a9ffb228d36a0af558df8b40a"
}

@@ -121,2 +121,3 @@ import { AuthController } from './AuthController';

private _aiSkybox;
private _aiGetSkybox;
private _listData;

@@ -123,0 +124,0 @@ private _handleRecordFileOptions;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc