@alliumcloud/asset-manager 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1540 -0
- package/dist/index.d.mts +397 -0
- package/dist/index.d.ts +397 -0
- package/dist/index.js +440 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +430 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared primitive types and SDK config used across all modules.
|
|
3
|
+
*/
|
|
4
|
+
type AssetManagerSDKConfig = {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
jwksUri?: string;
|
|
7
|
+
accessTokenProvider: () => string | Promise<string>;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
/** @internal - dev only, not for production use */
|
|
10
|
+
_devBaseUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
type AssetType = "UNREAL_PROJECT" | "OTHER_3D";
|
|
13
|
+
type UploadStatus = "PENDING" | "COMPLETED" | "FAILED";
|
|
14
|
+
type ValidationStatus = "PENDING" | "VALID" | "INVALID";
|
|
15
|
+
type BuildStatus = "PENDING" | "BUILDING" | "COMPLETED" | "FAILED";
|
|
16
|
+
type SourceType = "UNIVERSAL_SCENE";
|
|
17
|
+
declare const SUPPORTED_UNREAL_ENGINE_VERSIONS: readonly ["5.0.3", "5.2.1"];
|
|
18
|
+
type SupportedUnrealEngineVersion = (typeof SUPPORTED_UNREAL_ENGINE_VERSIONS)[number];
|
|
19
|
+
declare const UNREAL_PROJECT_VERSION_TARGETS: readonly ["Development", "Shipping"];
|
|
20
|
+
type UnrealProjectVersionTarget = (typeof UNREAL_PROJECT_VERSION_TARGETS)[number];
|
|
21
|
+
type ProjectVersionState = "new" | "odyssey_plugin_version_invalid" | "failed_missing_unreal_plugin_version" | "failed_missing_unreal_project" | "failed_missing_package_archive_url" | "failed_missing_package_archive_checksum" | "upload_complete" | "upload_invalid" | "upload_failed" | "upload_validating" | "builder_pod_creating" | "builder_pod_failed_to_create" | "builder_pod_timed_out_creating" | "builder_pod_waiting_for_ready" | "builder_pod_failed" | "builder_pod_ready" | "builder_downloading_project_version" | "builder_downloading_project_version_failed" | "builder_finding_project_file_failed" | "builder_copying_plugin_version" | "builder_copying_plugin_version_failed" | "builder_downloading_plugin_version" | "builder_downloading_plugin_version_failed" | "builder_validating" | "builder_validation_failed" | "builder_update_unreal_project_name" | "builder_settings_uploaded" | "builder_building" | "builder_failed" | "builder_retrying" | "builder_uploading" | "builder_upload_failed" | "builder_upload_complete" | "package_validator_required" | "package_validator_pod_creating" | "package_validator_pod_failed_to_create" | "package_validator_pod_waiting_for_ready" | "package_validator_pod_timed_out" | "package_validator_pod_ready" | "package_validator_failed" | "package_validator_retrying" | "package_validator_validating" | "package_validator_updating_unreal_project_name" | "package_validator_updating_project_path" | "package_validator_complete" | "volume_copy_pvcs_creating" | "volume_copy_pvcs_bound" | "volume_copy_pvcs_failed" | "volume_copy_pods_creating" | "volume_copy_pods_failed_to_create" | "volume_copy_pods_timed_out_creating" | "volume_copy_pods_waiting_for_ready" | "volume_copy_pods_failed" | "volume_copy_pods_ready" | "volume_copy_region_copying" | "volume_copy_region_failed" | "volume_copy_region_complete" | "volume_copy_failed" | "volume_copy_retrying" | "volume_copy_complete" | "volume_copy_expiring" | "volume_copy_expired" | "expiring" | "expired";
|
|
22
|
+
type ProjectVersionStateGroup = "uploading" | "validating" | "building" | "deploying" | "complete" | "failed" | "uploaded" | "expired";
|
|
23
|
+
type HealthResponse = {
|
|
24
|
+
status: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
};
|
|
27
|
+
type RedisHealthResponse = {
|
|
28
|
+
status: string;
|
|
29
|
+
latencyMs?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Unreal project version types.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
type UnrealProjectVersion = {
|
|
37
|
+
id: string;
|
|
38
|
+
orgId: string;
|
|
39
|
+
projectId: string;
|
|
40
|
+
authorUserId: string;
|
|
41
|
+
appType: string;
|
|
42
|
+
unrealProjectId: string;
|
|
43
|
+
buildRegion: string | null;
|
|
44
|
+
levelFilePath: string | null;
|
|
45
|
+
levelName: string | null;
|
|
46
|
+
name: string;
|
|
47
|
+
packageArchiveSha256Sum: string;
|
|
48
|
+
packageArchiveUrl: string;
|
|
49
|
+
pluginVersionId: string;
|
|
50
|
+
selfPackaged: boolean;
|
|
51
|
+
state: ProjectVersionState;
|
|
52
|
+
stateGroup: ProjectVersionStateGroup;
|
|
53
|
+
symbolsArchiveSha256Sum: string;
|
|
54
|
+
symbolsArchiveUrl: string;
|
|
55
|
+
bridgeToolkitFileSettings: Record<string, any>;
|
|
56
|
+
stateChanges: Record<string, any>;
|
|
57
|
+
target: string;
|
|
58
|
+
uploader: string;
|
|
59
|
+
uploadId: string | null;
|
|
60
|
+
objectName: string | null;
|
|
61
|
+
downloadUrl: string | null;
|
|
62
|
+
uploadSha256Sum: string | null;
|
|
63
|
+
unrealEngineVersion: string | null;
|
|
64
|
+
volumeCopyRegionsComplete: string[];
|
|
65
|
+
volumeRegions: string[];
|
|
66
|
+
volumeSizeGb: number;
|
|
67
|
+
unrealProjectDirectoryPath: string | null;
|
|
68
|
+
disableMultiplayer: boolean | null;
|
|
69
|
+
lastPingFromBuilder: Date | null;
|
|
70
|
+
lastPingFromVolumeCopyRegion: Date | null;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
};
|
|
74
|
+
type CreateUnrealProjectVersionInput = {
|
|
75
|
+
orgId: string;
|
|
76
|
+
projectId: string;
|
|
77
|
+
authorUserId: string;
|
|
78
|
+
appType: string;
|
|
79
|
+
unrealProjectId: string;
|
|
80
|
+
name: string;
|
|
81
|
+
pluginVersionId: string;
|
|
82
|
+
selfPackaged: boolean;
|
|
83
|
+
state: ProjectVersionState;
|
|
84
|
+
target: UnrealProjectVersionTarget;
|
|
85
|
+
uploader: string;
|
|
86
|
+
packageArchiveSha256Sum: string;
|
|
87
|
+
packageArchiveUrl: string;
|
|
88
|
+
symbolsArchiveSha256Sum: string;
|
|
89
|
+
symbolsArchiveUrl: string;
|
|
90
|
+
bridgeToolkitFileSettings: Record<string, any>;
|
|
91
|
+
stateChanges: Record<string, any>;
|
|
92
|
+
volumeCopyRegionsComplete: string[];
|
|
93
|
+
volumeRegions: string[];
|
|
94
|
+
volumeSizeGb: number;
|
|
95
|
+
buildRegion?: string;
|
|
96
|
+
unrealEngineVersion?: SupportedUnrealEngineVersion;
|
|
97
|
+
uploadId?: string;
|
|
98
|
+
objectName?: string;
|
|
99
|
+
downloadUrl?: string;
|
|
100
|
+
uploadSha256Sum?: string;
|
|
101
|
+
unrealProjectDirectoryPath?: string;
|
|
102
|
+
disableMultiplayer?: boolean;
|
|
103
|
+
lastPingFromBuilder?: Date;
|
|
104
|
+
lastPingFromVolumeCopyRegion?: Date;
|
|
105
|
+
levelFilePath?: string;
|
|
106
|
+
levelName?: string;
|
|
107
|
+
};
|
|
108
|
+
type UpdateUnrealProjectVersionInput = Record<string, any>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Asset-related types.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
type AssetResponse = {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
orgId: string;
|
|
118
|
+
projectId: string;
|
|
119
|
+
assetType: AssetType;
|
|
120
|
+
sourceType: SourceType;
|
|
121
|
+
uploadStatus: UploadStatus;
|
|
122
|
+
validationStatus: ValidationStatus;
|
|
123
|
+
buildStatus: BuildStatus;
|
|
124
|
+
uploadId: string | null;
|
|
125
|
+
objectName: string | null;
|
|
126
|
+
downloadUrl: string | null;
|
|
127
|
+
thumb: string | null;
|
|
128
|
+
description: string | null;
|
|
129
|
+
createdAt: Date;
|
|
130
|
+
updatedAt: Date;
|
|
131
|
+
};
|
|
132
|
+
type UnrealProjectResponse = {
|
|
133
|
+
assetId: string;
|
|
134
|
+
orgId: string;
|
|
135
|
+
projectId: string;
|
|
136
|
+
displayName: string;
|
|
137
|
+
unrealProjectVersion: string;
|
|
138
|
+
unrealPluginVersion: string;
|
|
139
|
+
versions?: UnrealProjectVersion[];
|
|
140
|
+
createdAt: Date;
|
|
141
|
+
updatedAt: Date;
|
|
142
|
+
};
|
|
143
|
+
type Other3dResponse = {
|
|
144
|
+
assetId: string;
|
|
145
|
+
orgId: string;
|
|
146
|
+
projectId: string;
|
|
147
|
+
displayName: string;
|
|
148
|
+
unrealPluginVersion: string;
|
|
149
|
+
createdAt: Date;
|
|
150
|
+
updatedAt: Date;
|
|
151
|
+
};
|
|
152
|
+
type AssetWithRelations = AssetResponse & {
|
|
153
|
+
unrealProjects?: UnrealProjectResponse[];
|
|
154
|
+
other3d?: Other3dResponse[];
|
|
155
|
+
};
|
|
156
|
+
type CreateAssetInput = {
|
|
157
|
+
name: string;
|
|
158
|
+
orgId: string;
|
|
159
|
+
projectId: string;
|
|
160
|
+
assetType: AssetType;
|
|
161
|
+
sourceType: SourceType;
|
|
162
|
+
storageBucket: string;
|
|
163
|
+
storagePath: string;
|
|
164
|
+
};
|
|
165
|
+
type UpdateUnrealProjectInput = {
|
|
166
|
+
displayName?: string;
|
|
167
|
+
unrealProjectVersion?: string;
|
|
168
|
+
unrealPluginVersion?: string;
|
|
169
|
+
};
|
|
170
|
+
type UpdateOther3dInput = {
|
|
171
|
+
displayName?: string;
|
|
172
|
+
unrealPluginVersion?: string;
|
|
173
|
+
};
|
|
174
|
+
type UpdateAssetInput = {
|
|
175
|
+
name?: string;
|
|
176
|
+
uploadStatus?: UploadStatus;
|
|
177
|
+
validationStatus?: ValidationStatus;
|
|
178
|
+
buildStatus?: BuildStatus;
|
|
179
|
+
storageBucket?: string;
|
|
180
|
+
storagePath?: string;
|
|
181
|
+
uploadId?: string;
|
|
182
|
+
objectName?: string;
|
|
183
|
+
downloadUrl?: string;
|
|
184
|
+
thumb?: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
unrealProject?: UpdateUnrealProjectInput;
|
|
187
|
+
other3d?: UpdateOther3dInput;
|
|
188
|
+
};
|
|
189
|
+
type UpdateAssetStatusInput = {
|
|
190
|
+
uploadStatus?: UploadStatus;
|
|
191
|
+
validationStatus?: ValidationStatus;
|
|
192
|
+
buildStatus?: BuildStatus;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* User types.
|
|
197
|
+
*/
|
|
198
|
+
type User = {
|
|
199
|
+
id: string;
|
|
200
|
+
createdAt: Date;
|
|
201
|
+
updatedAt: Date;
|
|
202
|
+
};
|
|
203
|
+
type CreateUserInput = {
|
|
204
|
+
id?: string;
|
|
205
|
+
};
|
|
206
|
+
type UpdateUserInput = {
|
|
207
|
+
id?: string;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Upload and session recovery types.
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
type InitiateUploadRequest = {
|
|
215
|
+
orgId: string;
|
|
216
|
+
projectId: string;
|
|
217
|
+
userId: string;
|
|
218
|
+
assetType: AssetType;
|
|
219
|
+
assetFilename: string;
|
|
220
|
+
assetDisplayName?: string;
|
|
221
|
+
unrealProjectId?: string;
|
|
222
|
+
unrealProjectDisplayName?: string;
|
|
223
|
+
unrealEngineVersion?: SupportedUnrealEngineVersion;
|
|
224
|
+
selfPackaged?: boolean;
|
|
225
|
+
target?: UnrealProjectVersionTarget;
|
|
226
|
+
other_3dId?: string;
|
|
227
|
+
other_3dDisplayName?: string;
|
|
228
|
+
buildRegion?: string;
|
|
229
|
+
volumeRegions?: string[];
|
|
230
|
+
};
|
|
231
|
+
type InitiateUploadResponse = {
|
|
232
|
+
orgId: string;
|
|
233
|
+
projectId: string;
|
|
234
|
+
assetId: string;
|
|
235
|
+
assetVersionId: string;
|
|
236
|
+
uploadId: string;
|
|
237
|
+
objectName: string;
|
|
238
|
+
};
|
|
239
|
+
type CompleteUploadRequest = {
|
|
240
|
+
orgId: string;
|
|
241
|
+
projectId: string;
|
|
242
|
+
assetId: string;
|
|
243
|
+
assetType: AssetType;
|
|
244
|
+
assetVersionId: string;
|
|
245
|
+
uploadId: string;
|
|
246
|
+
objectName: string;
|
|
247
|
+
parts: {
|
|
248
|
+
partNumber: number;
|
|
249
|
+
etag: string;
|
|
250
|
+
}[];
|
|
251
|
+
failed?: boolean;
|
|
252
|
+
sha256Sum?: string;
|
|
253
|
+
};
|
|
254
|
+
type AbortUploadRequest = {
|
|
255
|
+
orgId: string;
|
|
256
|
+
projectId: string;
|
|
257
|
+
assetId: string;
|
|
258
|
+
assetType: AssetType;
|
|
259
|
+
assetVersionId: string;
|
|
260
|
+
uploadId: string;
|
|
261
|
+
objectName: string;
|
|
262
|
+
};
|
|
263
|
+
type UploadSession = {
|
|
264
|
+
orgId: string;
|
|
265
|
+
projectId: string;
|
|
266
|
+
assetId: string;
|
|
267
|
+
assetVersionId: string;
|
|
268
|
+
uploadId: string;
|
|
269
|
+
objectName: string;
|
|
270
|
+
};
|
|
271
|
+
type UploadPart = {
|
|
272
|
+
partNumber: number;
|
|
273
|
+
etag: string;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Deep sanitization types.
|
|
278
|
+
*/
|
|
279
|
+
type DeletionStepResult = {
|
|
280
|
+
step: string;
|
|
281
|
+
success: boolean;
|
|
282
|
+
skipped?: boolean;
|
|
283
|
+
error?: string;
|
|
284
|
+
};
|
|
285
|
+
type DeleteProjectReport = {
|
|
286
|
+
assetId: string;
|
|
287
|
+
assetType: "UNREAL_PROJECT" | "OTHER_3D";
|
|
288
|
+
orgId: string;
|
|
289
|
+
projectId: string;
|
|
290
|
+
steps: DeletionStepResult[];
|
|
291
|
+
fullyDeleted: boolean;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Health module — server and Redis health checks.
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
interface HealthHandle {
|
|
299
|
+
getHealth(): Promise<HealthResponse>;
|
|
300
|
+
getRedisHealth(): Promise<RedisHealthResponse>;
|
|
301
|
+
testRedis(): Promise<void>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Assets module — CRUD operations for assets.
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
interface AssetsHandle {
|
|
309
|
+
create(data: CreateAssetInput): Promise<AssetWithRelations>;
|
|
310
|
+
getAll(): Promise<AssetWithRelations[]>;
|
|
311
|
+
getById(assetId: string): Promise<AssetWithRelations>;
|
|
312
|
+
getByOrg(orgId: string): Promise<AssetWithRelations[]>;
|
|
313
|
+
getByProject(projectId: string): Promise<AssetWithRelations[]>;
|
|
314
|
+
update(assetId: string, data: UpdateAssetInput): Promise<AssetWithRelations>;
|
|
315
|
+
updateStatus(assetId: string, data: UpdateAssetStatusInput): Promise<AssetWithRelations>;
|
|
316
|
+
markAsUploaded(assetId: string): Promise<AssetWithRelations>;
|
|
317
|
+
markAsValidated(assetId: string): Promise<AssetWithRelations>;
|
|
318
|
+
markAsFailed(assetId: string, stage: "upload" | "validation" | "build"): Promise<AssetWithRelations>;
|
|
319
|
+
uploadThumb(assetId: string, userId: string, file: File | Blob): Promise<AssetWithRelations>;
|
|
320
|
+
delete(assetId: string): Promise<void>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Versions module — Unreal project version operations.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
interface VersionsHandle {
|
|
328
|
+
create(data: CreateUnrealProjectVersionInput): Promise<UnrealProjectVersion>;
|
|
329
|
+
getById(versionId: string): Promise<UnrealProjectVersion>;
|
|
330
|
+
getByAsset(assetId: string): Promise<UnrealProjectVersion[]>;
|
|
331
|
+
update(versionId: string, data: UpdateUnrealProjectVersionInput): Promise<UnrealProjectVersion>;
|
|
332
|
+
delete(versionId: string): Promise<void>;
|
|
333
|
+
deleteByAsset(assetId: string): Promise<void>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Users module — user management operations.
|
|
338
|
+
*/
|
|
339
|
+
|
|
340
|
+
interface UsersHandle {
|
|
341
|
+
getAll(): Promise<User[]>;
|
|
342
|
+
getById(userId: string): Promise<User>;
|
|
343
|
+
create(data: CreateUserInput): Promise<User>;
|
|
344
|
+
update(userId: string, data: UpdateUserInput): Promise<User>;
|
|
345
|
+
delete(userId: string): Promise<void>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Upload module — multipart upload lifecycle management.
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
interface UploadHandle {
|
|
353
|
+
initiate(data: InitiateUploadRequest): Promise<InitiateUploadResponse>;
|
|
354
|
+
getSignedUrl(orgId: string, projectId: string, assetId: string, assetVersionId: string, uploadId: string, objectName: string, partNumber: number): Promise<string>;
|
|
355
|
+
batchGetSignedUrls(orgId: string, projectId: string, assetId: string, assetVersionId: string, uploadId: string, objectName: string, partNumbers: number[]): Promise<Record<number, string>>;
|
|
356
|
+
complete(data: CompleteUploadRequest): Promise<AssetWithRelations>;
|
|
357
|
+
abort(data: AbortUploadRequest): Promise<void>;
|
|
358
|
+
deleteRecords(data: AbortUploadRequest): Promise<void>;
|
|
359
|
+
getSession(filename: string): Promise<UploadSession | null>;
|
|
360
|
+
listParts(objectName: string, uploadId: string): Promise<UploadPart[]>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Sanitization module — deep project deletion operations.
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
interface SanitizationHandle {
|
|
368
|
+
deleteProjectAndFootprint(assetId: string): Promise<DeleteProjectReport>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* SDK Error factories.
|
|
373
|
+
*/
|
|
374
|
+
interface AlliumError extends Error {
|
|
375
|
+
readonly code: string;
|
|
376
|
+
}
|
|
377
|
+
/** Type guard — works for all Allium error factories */
|
|
378
|
+
declare function isAlliumError(err: unknown): err is AlliumError;
|
|
379
|
+
|
|
380
|
+
interface AssetManagerSDKHandle {
|
|
381
|
+
health: HealthHandle;
|
|
382
|
+
assets: AssetsHandle;
|
|
383
|
+
versions: VersionsHandle;
|
|
384
|
+
users: UsersHandle;
|
|
385
|
+
upload: UploadHandle;
|
|
386
|
+
sanitization: SanitizationHandle;
|
|
387
|
+
}
|
|
388
|
+
declare function createAssetManagerSDK(config: AssetManagerSDKConfig): AssetManagerSDKHandle;
|
|
389
|
+
declare const AssetManagerSDK: {
|
|
390
|
+
/**
|
|
391
|
+
* Create a new SDK client instance.
|
|
392
|
+
* @param config SDK configuration — apiKey is required, timeout is optional.
|
|
393
|
+
*/
|
|
394
|
+
readonly create: (config: AssetManagerSDKConfig) => AssetManagerSDKHandle;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
export { type AbortUploadRequest, type AlliumError, type AssetManagerSDKConfig, type AssetManagerSDKHandle, type AssetType, type AssetWithRelations, type BuildStatus, type CompleteUploadRequest, type CreateUserInput, type DeleteProjectReport, type DeletionStepResult, type HealthResponse, type InitiateUploadRequest, type InitiateUploadResponse, type RedisHealthResponse, type UnrealProjectVersion, type UpdateAssetInput, type UpdateUnrealProjectVersionInput, type UpdateUserInput, type UploadPart, type UploadSession, type UploadStatus, type User, type ValidationStatus, createAssetManagerSDK, AssetManagerSDK as default, isAlliumError };
|