@liforma/publisher 0.1.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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/createPublisher.d.ts +282 -0
- package/dist/createPublisher.d.ts.map +1 -0
- package/dist/createPublisher.js +194 -0
- package/dist/createPublisher.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +64 -0
- package/dist/errors.js.map +1 -0
- package/dist/hash.d.ts +4 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +21 -0
- package/dist/hash.js.map +1 -0
- package/dist/http.d.ts +20 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +93 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs.d.ts +15 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +127 -0
- package/dist/jobs.js.map +1 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +19 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schemas.d.ts +384 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +199 -0
- package/dist/schemas.js.map +1 -0
- package/dist/upload.d.ts +18 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +67 -0
- package/dist/upload.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const authoringJobErrorSchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodString;
|
|
4
|
+
message: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export declare const authoringJobSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
status: z.ZodEnum<{
|
|
9
|
+
queued: "queued";
|
|
10
|
+
running: "running";
|
|
11
|
+
waiting_processor: "waiting_processor";
|
|
12
|
+
succeeded: "succeeded";
|
|
13
|
+
failed: "failed";
|
|
14
|
+
}>;
|
|
15
|
+
kind: z.ZodEnum<{
|
|
16
|
+
location: "location";
|
|
17
|
+
clothes: "clothes";
|
|
18
|
+
hair: "hair";
|
|
19
|
+
}>;
|
|
20
|
+
pollUrl: z.ZodString;
|
|
21
|
+
targetId: z.ZodString;
|
|
22
|
+
requiredOk: z.ZodBoolean;
|
|
23
|
+
claimCount: z.ZodNumber;
|
|
24
|
+
failureCount: z.ZodNumber;
|
|
25
|
+
nextRunAt: z.ZodNullable<z.ZodString>;
|
|
26
|
+
stage: z.ZodNullable<z.ZodString>;
|
|
27
|
+
progress: z.ZodObject<{
|
|
28
|
+
requiredVerified: z.ZodNumber;
|
|
29
|
+
requiredTotal: z.ZodNumber;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
32
|
+
code: z.ZodString;
|
|
33
|
+
message: z.ZodString;
|
|
34
|
+
}, z.core.$strict>>;
|
|
35
|
+
enrichment: z.ZodObject<{
|
|
36
|
+
status: z.ZodEnum<{
|
|
37
|
+
running: "running";
|
|
38
|
+
failed: "failed";
|
|
39
|
+
pending: "pending";
|
|
40
|
+
complete: "complete";
|
|
41
|
+
not_applicable: "not_applicable";
|
|
42
|
+
}>;
|
|
43
|
+
verified: z.ZodNumber;
|
|
44
|
+
total: z.ZodNumber;
|
|
45
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
46
|
+
code: z.ZodString;
|
|
47
|
+
message: z.ZodString;
|
|
48
|
+
}, z.core.$strict>>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const publishResourceStubSchema: z.ZodObject<{
|
|
52
|
+
kind: z.ZodEnum<{
|
|
53
|
+
location: "location";
|
|
54
|
+
clothes: "clothes";
|
|
55
|
+
hair: "hair";
|
|
56
|
+
}>;
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
status: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export declare const createPublishResponseSchema: z.ZodObject<{
|
|
61
|
+
job: z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
status: z.ZodEnum<{
|
|
64
|
+
queued: "queued";
|
|
65
|
+
running: "running";
|
|
66
|
+
waiting_processor: "waiting_processor";
|
|
67
|
+
succeeded: "succeeded";
|
|
68
|
+
failed: "failed";
|
|
69
|
+
}>;
|
|
70
|
+
kind: z.ZodEnum<{
|
|
71
|
+
location: "location";
|
|
72
|
+
clothes: "clothes";
|
|
73
|
+
hair: "hair";
|
|
74
|
+
}>;
|
|
75
|
+
pollUrl: z.ZodString;
|
|
76
|
+
targetId: z.ZodString;
|
|
77
|
+
requiredOk: z.ZodBoolean;
|
|
78
|
+
claimCount: z.ZodNumber;
|
|
79
|
+
failureCount: z.ZodNumber;
|
|
80
|
+
nextRunAt: z.ZodNullable<z.ZodString>;
|
|
81
|
+
stage: z.ZodNullable<z.ZodString>;
|
|
82
|
+
progress: z.ZodObject<{
|
|
83
|
+
requiredVerified: z.ZodNumber;
|
|
84
|
+
requiredTotal: z.ZodNumber;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
87
|
+
code: z.ZodString;
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
enrichment: z.ZodObject<{
|
|
91
|
+
status: z.ZodEnum<{
|
|
92
|
+
running: "running";
|
|
93
|
+
failed: "failed";
|
|
94
|
+
pending: "pending";
|
|
95
|
+
complete: "complete";
|
|
96
|
+
not_applicable: "not_applicable";
|
|
97
|
+
}>;
|
|
98
|
+
verified: z.ZodNumber;
|
|
99
|
+
total: z.ZodNumber;
|
|
100
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
101
|
+
code: z.ZodString;
|
|
102
|
+
message: z.ZodString;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
resource: z.ZodObject<{
|
|
107
|
+
kind: z.ZodEnum<{
|
|
108
|
+
location: "location";
|
|
109
|
+
clothes: "clothes";
|
|
110
|
+
hair: "hair";
|
|
111
|
+
}>;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
status: z.ZodString;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
export declare const getJobResponseSchema: z.ZodObject<{
|
|
117
|
+
job: z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
status: z.ZodEnum<{
|
|
120
|
+
queued: "queued";
|
|
121
|
+
running: "running";
|
|
122
|
+
waiting_processor: "waiting_processor";
|
|
123
|
+
succeeded: "succeeded";
|
|
124
|
+
failed: "failed";
|
|
125
|
+
}>;
|
|
126
|
+
kind: z.ZodEnum<{
|
|
127
|
+
location: "location";
|
|
128
|
+
clothes: "clothes";
|
|
129
|
+
hair: "hair";
|
|
130
|
+
}>;
|
|
131
|
+
pollUrl: z.ZodString;
|
|
132
|
+
targetId: z.ZodString;
|
|
133
|
+
requiredOk: z.ZodBoolean;
|
|
134
|
+
claimCount: z.ZodNumber;
|
|
135
|
+
failureCount: z.ZodNumber;
|
|
136
|
+
nextRunAt: z.ZodNullable<z.ZodString>;
|
|
137
|
+
stage: z.ZodNullable<z.ZodString>;
|
|
138
|
+
progress: z.ZodObject<{
|
|
139
|
+
requiredVerified: z.ZodNumber;
|
|
140
|
+
requiredTotal: z.ZodNumber;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
143
|
+
code: z.ZodString;
|
|
144
|
+
message: z.ZodString;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
enrichment: z.ZodObject<{
|
|
147
|
+
status: z.ZodEnum<{
|
|
148
|
+
running: "running";
|
|
149
|
+
failed: "failed";
|
|
150
|
+
pending: "pending";
|
|
151
|
+
complete: "complete";
|
|
152
|
+
not_applicable: "not_applicable";
|
|
153
|
+
}>;
|
|
154
|
+
verified: z.ZodNumber;
|
|
155
|
+
total: z.ZodNumber;
|
|
156
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
157
|
+
code: z.ZodString;
|
|
158
|
+
message: z.ZodString;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
}, z.core.$strict>;
|
|
163
|
+
export declare const createUploadResponseSchema: z.ZodObject<{
|
|
164
|
+
upload: z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
status: z.ZodLiteral<"pending">;
|
|
167
|
+
expiresAt: z.ZodString;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
put: z.ZodObject<{
|
|
170
|
+
url: z.ZodString;
|
|
171
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
172
|
+
}, z.core.$strict>;
|
|
173
|
+
}, z.core.$strict>;
|
|
174
|
+
export declare const completeUploadResponseSchema: z.ZodObject<{
|
|
175
|
+
upload: z.ZodObject<{
|
|
176
|
+
id: z.ZodString;
|
|
177
|
+
status: z.ZodEnum<{
|
|
178
|
+
uploaded: "uploaded";
|
|
179
|
+
claimed: "claimed";
|
|
180
|
+
}>;
|
|
181
|
+
bytes: z.ZodNullable<z.ZodNumber>;
|
|
182
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
export declare const clothesResourceSchema: z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"clothes">;
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
avatarId: z.ZodString;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
status: z.ZodString;
|
|
191
|
+
source: z.ZodString;
|
|
192
|
+
renderKind: z.ZodString;
|
|
193
|
+
catalogueKey: z.ZodNullable<z.ZodString>;
|
|
194
|
+
assetPath: z.ZodNullable<z.ZodString>;
|
|
195
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
196
|
+
createdAt: z.ZodString;
|
|
197
|
+
updatedAt: z.ZodString;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
export declare const hairResourceSchema: z.ZodObject<{
|
|
200
|
+
kind: z.ZodLiteral<"hair">;
|
|
201
|
+
id: z.ZodString;
|
|
202
|
+
avatarId: z.ZodString;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
status: z.ZodString;
|
|
205
|
+
source: z.ZodString;
|
|
206
|
+
catalogueKey: z.ZodNullable<z.ZodString>;
|
|
207
|
+
assetPath: z.ZodNullable<z.ZodString>;
|
|
208
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
209
|
+
createdAt: z.ZodString;
|
|
210
|
+
updatedAt: z.ZodString;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
export declare const locationResourceSchema: z.ZodObject<{
|
|
213
|
+
kind: z.ZodLiteral<"location">;
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
status: z.ZodString;
|
|
216
|
+
name: z.ZodString;
|
|
217
|
+
depthEncoding: z.ZodNullable<z.ZodString>;
|
|
218
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
219
|
+
}, z.core.$strict>;
|
|
220
|
+
export declare const getClothesResponseSchema: z.ZodObject<{
|
|
221
|
+
resource: z.ZodObject<{
|
|
222
|
+
kind: z.ZodLiteral<"clothes">;
|
|
223
|
+
id: z.ZodString;
|
|
224
|
+
avatarId: z.ZodString;
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
status: z.ZodString;
|
|
227
|
+
source: z.ZodString;
|
|
228
|
+
renderKind: z.ZodString;
|
|
229
|
+
catalogueKey: z.ZodNullable<z.ZodString>;
|
|
230
|
+
assetPath: z.ZodNullable<z.ZodString>;
|
|
231
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
232
|
+
createdAt: z.ZodString;
|
|
233
|
+
updatedAt: z.ZodString;
|
|
234
|
+
}, z.core.$strict>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
export declare const getHairResponseSchema: z.ZodObject<{
|
|
237
|
+
resource: z.ZodObject<{
|
|
238
|
+
kind: z.ZodLiteral<"hair">;
|
|
239
|
+
id: z.ZodString;
|
|
240
|
+
avatarId: z.ZodString;
|
|
241
|
+
name: z.ZodString;
|
|
242
|
+
status: z.ZodString;
|
|
243
|
+
source: z.ZodString;
|
|
244
|
+
catalogueKey: z.ZodNullable<z.ZodString>;
|
|
245
|
+
assetPath: z.ZodNullable<z.ZodString>;
|
|
246
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
247
|
+
createdAt: z.ZodString;
|
|
248
|
+
updatedAt: z.ZodString;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
}, z.core.$strict>;
|
|
251
|
+
export declare const getLocationResponseSchema: z.ZodObject<{
|
|
252
|
+
resource: z.ZodObject<{
|
|
253
|
+
kind: z.ZodLiteral<"location">;
|
|
254
|
+
id: z.ZodString;
|
|
255
|
+
status: z.ZodString;
|
|
256
|
+
name: z.ZodString;
|
|
257
|
+
depthEncoding: z.ZodNullable<z.ZodString>;
|
|
258
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
259
|
+
}, z.core.$strict>;
|
|
260
|
+
}, z.core.$strict>;
|
|
261
|
+
export declare const characterSchema: z.ZodObject<{
|
|
262
|
+
id: z.ZodString;
|
|
263
|
+
projectId: z.ZodString;
|
|
264
|
+
name: z.ZodString;
|
|
265
|
+
avatarId: z.ZodString;
|
|
266
|
+
voice: z.ZodString;
|
|
267
|
+
sttLang: z.ZodString;
|
|
268
|
+
clothesId: z.ZodNullable<z.ZodString>;
|
|
269
|
+
hairId: z.ZodNullable<z.ZodString>;
|
|
270
|
+
personality: z.ZodNullable<z.ZodString>;
|
|
271
|
+
generalInstructions: z.ZodNullable<z.ZodString>;
|
|
272
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
273
|
+
createdAt: z.ZodString;
|
|
274
|
+
updatedAt: z.ZodString;
|
|
275
|
+
}, z.core.$strict>;
|
|
276
|
+
export declare const placeSchema: z.ZodObject<{
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
name: z.ZodString;
|
|
279
|
+
locationId: z.ZodString;
|
|
280
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
281
|
+
createdAt: z.ZodString;
|
|
282
|
+
updatedAt: z.ZodString;
|
|
283
|
+
}, z.core.$strict>;
|
|
284
|
+
export declare const experienceSchema: z.ZodObject<{
|
|
285
|
+
id: z.ZodString;
|
|
286
|
+
projectId: z.ZodString;
|
|
287
|
+
title: z.ZodString;
|
|
288
|
+
slug: z.ZodString;
|
|
289
|
+
status: z.ZodString;
|
|
290
|
+
published: z.ZodBoolean;
|
|
291
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
292
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
293
|
+
createdAt: z.ZodString;
|
|
294
|
+
updatedAt: z.ZodString;
|
|
295
|
+
}, z.core.$strict>;
|
|
296
|
+
export declare const createCharacterResponseSchema: z.ZodObject<{
|
|
297
|
+
character: z.ZodObject<{
|
|
298
|
+
id: z.ZodString;
|
|
299
|
+
projectId: z.ZodString;
|
|
300
|
+
name: z.ZodString;
|
|
301
|
+
avatarId: z.ZodString;
|
|
302
|
+
voice: z.ZodString;
|
|
303
|
+
sttLang: z.ZodString;
|
|
304
|
+
clothesId: z.ZodNullable<z.ZodString>;
|
|
305
|
+
hairId: z.ZodNullable<z.ZodString>;
|
|
306
|
+
personality: z.ZodNullable<z.ZodString>;
|
|
307
|
+
generalInstructions: z.ZodNullable<z.ZodString>;
|
|
308
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
309
|
+
createdAt: z.ZodString;
|
|
310
|
+
updatedAt: z.ZodString;
|
|
311
|
+
}, z.core.$strict>;
|
|
312
|
+
}, z.core.$strict>;
|
|
313
|
+
export declare const createPlaceResponseSchema: z.ZodObject<{
|
|
314
|
+
place: z.ZodObject<{
|
|
315
|
+
id: z.ZodString;
|
|
316
|
+
name: z.ZodString;
|
|
317
|
+
locationId: z.ZodString;
|
|
318
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
319
|
+
createdAt: z.ZodString;
|
|
320
|
+
updatedAt: z.ZodString;
|
|
321
|
+
}, z.core.$strict>;
|
|
322
|
+
}, z.core.$strict>;
|
|
323
|
+
export declare const experienceResponseSchema: z.ZodObject<{
|
|
324
|
+
experience: z.ZodObject<{
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
projectId: z.ZodString;
|
|
327
|
+
title: z.ZodString;
|
|
328
|
+
slug: z.ZodString;
|
|
329
|
+
status: z.ZodString;
|
|
330
|
+
published: z.ZodBoolean;
|
|
331
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
332
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
333
|
+
createdAt: z.ZodString;
|
|
334
|
+
updatedAt: z.ZodString;
|
|
335
|
+
}, z.core.$strict>;
|
|
336
|
+
}, z.core.$strict>;
|
|
337
|
+
export declare const authoringAvatarSchema: z.ZodObject<{
|
|
338
|
+
id: z.ZodString;
|
|
339
|
+
displayName: z.ZodString;
|
|
340
|
+
defaultVoiceId: z.ZodString;
|
|
341
|
+
defaultSttLang: z.ZodString;
|
|
342
|
+
clothes: z.ZodArray<z.ZodObject<{
|
|
343
|
+
id: z.ZodString;
|
|
344
|
+
name: z.ZodString;
|
|
345
|
+
source: z.ZodString;
|
|
346
|
+
libraryScope: z.ZodString;
|
|
347
|
+
}, z.core.$strict>>;
|
|
348
|
+
hair: z.ZodArray<z.ZodObject<{
|
|
349
|
+
id: z.ZodString;
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
source: z.ZodString;
|
|
352
|
+
libraryScope: z.ZodString;
|
|
353
|
+
}, z.core.$strict>>;
|
|
354
|
+
}, z.core.$strict>;
|
|
355
|
+
export declare const listAvatarsResponseSchema: z.ZodObject<{
|
|
356
|
+
avatars: z.ZodArray<z.ZodObject<{
|
|
357
|
+
id: z.ZodString;
|
|
358
|
+
displayName: z.ZodString;
|
|
359
|
+
defaultVoiceId: z.ZodString;
|
|
360
|
+
defaultSttLang: z.ZodString;
|
|
361
|
+
clothes: z.ZodArray<z.ZodObject<{
|
|
362
|
+
id: z.ZodString;
|
|
363
|
+
name: z.ZodString;
|
|
364
|
+
source: z.ZodString;
|
|
365
|
+
libraryScope: z.ZodString;
|
|
366
|
+
}, z.core.$strict>>;
|
|
367
|
+
hair: z.ZodArray<z.ZodObject<{
|
|
368
|
+
id: z.ZodString;
|
|
369
|
+
name: z.ZodString;
|
|
370
|
+
source: z.ZodString;
|
|
371
|
+
libraryScope: z.ZodString;
|
|
372
|
+
}, z.core.$strict>>;
|
|
373
|
+
}, z.core.$strict>>;
|
|
374
|
+
}, z.core.$strict>;
|
|
375
|
+
export type AuthoringJob = z.infer<typeof authoringJobSchema>;
|
|
376
|
+
export type ClothesResource = z.infer<typeof clothesResourceSchema>;
|
|
377
|
+
export type HairResource = z.infer<typeof hairResourceSchema>;
|
|
378
|
+
export type LocationResource = z.infer<typeof locationResourceSchema>;
|
|
379
|
+
export type CharacterResource = z.infer<typeof characterSchema>;
|
|
380
|
+
export type PlaceResource = z.infer<typeof placeSchema>;
|
|
381
|
+
export type ExperienceResource = z.infer<typeof experienceSchema>;
|
|
382
|
+
export type AuthoringAvatar = z.infer<typeof authoringAvatarSchema>;
|
|
383
|
+
export type CreatePublishResponse = z.infer<typeof createPublishResponseSchema>;
|
|
384
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,u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CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const isoDateTime = z.string().min(1);
|
|
3
|
+
const nullableString = z.string().nullable();
|
|
4
|
+
export const authoringJobErrorSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
code: z.string(),
|
|
7
|
+
message: z.string()
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
export const authoringJobSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
status: z.enum(['queued', 'running', 'waiting_processor', 'succeeded', 'failed']),
|
|
14
|
+
kind: z.enum(['clothes', 'hair', 'location']),
|
|
15
|
+
pollUrl: z.string(),
|
|
16
|
+
targetId: z.string(),
|
|
17
|
+
requiredOk: z.boolean(),
|
|
18
|
+
claimCount: z.number().int(),
|
|
19
|
+
failureCount: z.number().int(),
|
|
20
|
+
nextRunAt: isoDateTime.nullable(),
|
|
21
|
+
stage: z.string().nullable(),
|
|
22
|
+
progress: z
|
|
23
|
+
.object({
|
|
24
|
+
requiredVerified: z.number().int(),
|
|
25
|
+
requiredTotal: z.number().int()
|
|
26
|
+
})
|
|
27
|
+
.strict(),
|
|
28
|
+
error: authoringJobErrorSchema.nullable(),
|
|
29
|
+
enrichment: z
|
|
30
|
+
.object({
|
|
31
|
+
status: z.enum(['pending', 'running', 'complete', 'failed', 'not_applicable']),
|
|
32
|
+
verified: z.number().int(),
|
|
33
|
+
total: z.number().int(),
|
|
34
|
+
error: authoringJobErrorSchema.nullable()
|
|
35
|
+
})
|
|
36
|
+
.strict()
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
export const publishResourceStubSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
kind: z.enum(['clothes', 'hair', 'location']),
|
|
42
|
+
id: z.string(),
|
|
43
|
+
status: z.string()
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
export const createPublishResponseSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
job: authoringJobSchema,
|
|
49
|
+
resource: publishResourceStubSchema
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
export const getJobResponseSchema = z.object({ job: authoringJobSchema }).strict();
|
|
53
|
+
export const createUploadResponseSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
upload: z
|
|
56
|
+
.object({
|
|
57
|
+
id: z.string(),
|
|
58
|
+
status: z.literal('pending'),
|
|
59
|
+
expiresAt: isoDateTime
|
|
60
|
+
})
|
|
61
|
+
.strict(),
|
|
62
|
+
put: z
|
|
63
|
+
.object({
|
|
64
|
+
url: z.string().url(),
|
|
65
|
+
headers: z.record(z.string(), z.string())
|
|
66
|
+
})
|
|
67
|
+
.strict()
|
|
68
|
+
})
|
|
69
|
+
.strict();
|
|
70
|
+
export const completeUploadResponseSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
upload: z
|
|
73
|
+
.object({
|
|
74
|
+
id: z.string(),
|
|
75
|
+
status: z.enum(['uploaded', 'claimed']),
|
|
76
|
+
bytes: z.number().int().nullable(),
|
|
77
|
+
sha256: z.string().nullable()
|
|
78
|
+
})
|
|
79
|
+
.strict()
|
|
80
|
+
})
|
|
81
|
+
.strict();
|
|
82
|
+
export const clothesResourceSchema = z
|
|
83
|
+
.object({
|
|
84
|
+
kind: z.literal('clothes'),
|
|
85
|
+
id: z.string(),
|
|
86
|
+
avatarId: z.string(),
|
|
87
|
+
name: z.string(),
|
|
88
|
+
status: z.string(),
|
|
89
|
+
source: z.string(),
|
|
90
|
+
renderKind: z.string(),
|
|
91
|
+
catalogueKey: nullableString,
|
|
92
|
+
assetPath: nullableString,
|
|
93
|
+
externalId: nullableString,
|
|
94
|
+
createdAt: isoDateTime,
|
|
95
|
+
updatedAt: isoDateTime
|
|
96
|
+
})
|
|
97
|
+
.strict();
|
|
98
|
+
export const hairResourceSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
kind: z.literal('hair'),
|
|
101
|
+
id: z.string(),
|
|
102
|
+
avatarId: z.string(),
|
|
103
|
+
name: z.string(),
|
|
104
|
+
status: z.string(),
|
|
105
|
+
source: z.string(),
|
|
106
|
+
catalogueKey: nullableString,
|
|
107
|
+
assetPath: nullableString,
|
|
108
|
+
externalId: nullableString,
|
|
109
|
+
createdAt: isoDateTime,
|
|
110
|
+
updatedAt: isoDateTime
|
|
111
|
+
})
|
|
112
|
+
.strict();
|
|
113
|
+
export const locationResourceSchema = z
|
|
114
|
+
.object({
|
|
115
|
+
kind: z.literal('location'),
|
|
116
|
+
id: z.string(),
|
|
117
|
+
status: z.string(),
|
|
118
|
+
name: z.string(),
|
|
119
|
+
depthEncoding: nullableString,
|
|
120
|
+
externalId: nullableString
|
|
121
|
+
})
|
|
122
|
+
.strict();
|
|
123
|
+
export const getClothesResponseSchema = z.object({ resource: clothesResourceSchema }).strict();
|
|
124
|
+
export const getHairResponseSchema = z.object({ resource: hairResourceSchema }).strict();
|
|
125
|
+
export const getLocationResponseSchema = z.object({ resource: locationResourceSchema }).strict();
|
|
126
|
+
export const characterSchema = z
|
|
127
|
+
.object({
|
|
128
|
+
id: z.string(),
|
|
129
|
+
projectId: z.string(),
|
|
130
|
+
name: z.string(),
|
|
131
|
+
avatarId: z.string(),
|
|
132
|
+
voice: z.string(),
|
|
133
|
+
sttLang: z.string(),
|
|
134
|
+
clothesId: nullableString,
|
|
135
|
+
hairId: nullableString,
|
|
136
|
+
personality: nullableString,
|
|
137
|
+
generalInstructions: nullableString,
|
|
138
|
+
externalId: nullableString,
|
|
139
|
+
createdAt: isoDateTime,
|
|
140
|
+
updatedAt: isoDateTime
|
|
141
|
+
})
|
|
142
|
+
.strict();
|
|
143
|
+
export const placeSchema = z
|
|
144
|
+
.object({
|
|
145
|
+
id: z.string(),
|
|
146
|
+
name: z.string(),
|
|
147
|
+
locationId: z.string(),
|
|
148
|
+
externalId: nullableString,
|
|
149
|
+
createdAt: isoDateTime,
|
|
150
|
+
updatedAt: isoDateTime
|
|
151
|
+
})
|
|
152
|
+
.strict();
|
|
153
|
+
export const experienceSchema = z
|
|
154
|
+
.object({
|
|
155
|
+
id: z.string(),
|
|
156
|
+
projectId: z.string(),
|
|
157
|
+
title: z.string(),
|
|
158
|
+
slug: z.string(),
|
|
159
|
+
status: z.string(),
|
|
160
|
+
published: z.boolean(),
|
|
161
|
+
attributes: z.record(z.string(), z.string()),
|
|
162
|
+
externalId: nullableString,
|
|
163
|
+
createdAt: isoDateTime,
|
|
164
|
+
updatedAt: isoDateTime
|
|
165
|
+
})
|
|
166
|
+
.strict();
|
|
167
|
+
export const createCharacterResponseSchema = z.object({ character: characterSchema }).strict();
|
|
168
|
+
export const createPlaceResponseSchema = z.object({ place: placeSchema }).strict();
|
|
169
|
+
export const experienceResponseSchema = z.object({ experience: experienceSchema }).strict();
|
|
170
|
+
export const authoringAvatarSchema = z
|
|
171
|
+
.object({
|
|
172
|
+
id: z.string(),
|
|
173
|
+
displayName: z.string(),
|
|
174
|
+
defaultVoiceId: z.string(),
|
|
175
|
+
defaultSttLang: z.string(),
|
|
176
|
+
clothes: z.array(z
|
|
177
|
+
.object({
|
|
178
|
+
id: z.string(),
|
|
179
|
+
name: z.string(),
|
|
180
|
+
source: z.string(),
|
|
181
|
+
libraryScope: z.string()
|
|
182
|
+
})
|
|
183
|
+
.strict()),
|
|
184
|
+
hair: z.array(z
|
|
185
|
+
.object({
|
|
186
|
+
id: z.string(),
|
|
187
|
+
name: z.string(),
|
|
188
|
+
source: z.string(),
|
|
189
|
+
libraryScope: z.string()
|
|
190
|
+
})
|
|
191
|
+
.strict())
|
|
192
|
+
})
|
|
193
|
+
.strict();
|
|
194
|
+
export const listAvatarsResponseSchema = z
|
|
195
|
+
.object({
|
|
196
|
+
avatars: z.array(authoringAvatarSchema)
|
|
197
|
+
})
|
|
198
|
+
.strict();
|
|
199
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACtC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC;KACD,MAAM,EAAE,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KACjC,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CA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qB,GAAG,CAAC;KACpC,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,CAAC,CAAC,KAAK,CACf,CAAC;SACC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;KACxB,CAAC;SACD,MAAM,EAAE,CACV;IACD,IAAI,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC;SACC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;KACxB,CAAC;SACD,MAAM,EAAE,CACV;CACD,CAAC;KACD,MAAM,EAAE,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACxC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;CACvC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/dist/upload.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ImageBytes } from './hash.js';
|
|
2
|
+
export type { ImageBytes };
|
|
3
|
+
import { type PublisherHttp } from './http.js';
|
|
4
|
+
export type UploadedImage = {
|
|
5
|
+
readonly uploadId: string;
|
|
6
|
+
readonly purpose: 'colour' | 'depth';
|
|
7
|
+
readonly contentType: string;
|
|
8
|
+
readonly bytes: number;
|
|
9
|
+
readonly sha256: string;
|
|
10
|
+
};
|
|
11
|
+
export type UploadImageOptions = {
|
|
12
|
+
readonly contentType: string;
|
|
13
|
+
readonly signal?: AbortSignal;
|
|
14
|
+
};
|
|
15
|
+
export declare function uploadImage(http: PublisherHttp, input: ImageBytes, options: UploadImageOptions): Promise<UploadedImage>;
|
|
16
|
+
export declare function uploadDepthMap(http: PublisherHttp, input: ImageBytes, options: UploadImageOptions): Promise<UploadedImage>;
|
|
17
|
+
export declare function uploadIdFromImage(image: UploadedImage | string): string;
|
|
18
|
+
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAErE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3B,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAG9E,MAAM,MAAM,aAAa,GAAG;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B,CAAC;AAEF,wBAAsB,WAAW,CAChC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAAC,aAAa,CAAC,CAExB;AAED,wBAAsB,cAAc,CACnC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAAC,aAAa,CAAC,CAExB;AAyED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,CASvE"}
|
package/dist/upload.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LiformaPublisherError } from './errors.js';
|
|
2
|
+
import { sha256Hex, toUint8Array } from './hash.js';
|
|
3
|
+
import { projectPath, publisherRequest } from './http.js';
|
|
4
|
+
import { completeUploadResponseSchema, createUploadResponseSchema } from './schemas.js';
|
|
5
|
+
export async function uploadImage(http, input, options) {
|
|
6
|
+
return uploadWithPurpose(http, input, { ...options, purpose: 'colour' });
|
|
7
|
+
}
|
|
8
|
+
export async function uploadDepthMap(http, input, options) {
|
|
9
|
+
return uploadWithPurpose(http, input, { ...options, purpose: 'depth' });
|
|
10
|
+
}
|
|
11
|
+
async function uploadWithPurpose(http, input, options) {
|
|
12
|
+
const bytes = await toUint8Array(input);
|
|
13
|
+
if (bytes.byteLength === 0) {
|
|
14
|
+
throw new LiformaPublisherError('Image bytes must be non-empty.', { code: 'INVALID_IMAGE_INPUT' });
|
|
15
|
+
}
|
|
16
|
+
const contentType = options.contentType.trim();
|
|
17
|
+
if (!contentType) {
|
|
18
|
+
throw new LiformaPublisherError('contentType is required.', { code: 'INVALID_IMAGE_INPUT' });
|
|
19
|
+
}
|
|
20
|
+
const sha256 = sha256Hex(bytes);
|
|
21
|
+
const created = await publisherRequest(http, projectPath(http, '/uploads'), createUploadResponseSchema, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: {
|
|
24
|
+
purpose: options.purpose,
|
|
25
|
+
contentType,
|
|
26
|
+
bytes: bytes.byteLength,
|
|
27
|
+
sha256
|
|
28
|
+
},
|
|
29
|
+
signal: options.signal
|
|
30
|
+
});
|
|
31
|
+
const putHeaders = { ...created.data.put.headers };
|
|
32
|
+
let putResponse;
|
|
33
|
+
try {
|
|
34
|
+
putResponse = await http.fetchImpl(created.data.put.url, {
|
|
35
|
+
method: 'PUT',
|
|
36
|
+
headers: putHeaders,
|
|
37
|
+
body: Buffer.from(bytes),
|
|
38
|
+
signal: options.signal
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new LiformaPublisherError(error instanceof Error ? error.message : 'Presigned upload PUT failed.', { code: 'UPLOAD_PUT_FAILED', retryable: true, cause: error });
|
|
43
|
+
}
|
|
44
|
+
if (!putResponse.ok) {
|
|
45
|
+
const text = await putResponse.text().catch(() => '');
|
|
46
|
+
throw new LiformaPublisherError(text.trim().slice(0, 500) || `Presigned upload PUT failed (${putResponse.status}).`, { code: 'UPLOAD_PUT_FAILED', status: putResponse.status, retryable: putResponse.status >= 500 });
|
|
47
|
+
}
|
|
48
|
+
const completed = await publisherRequest(http, projectPath(http, `/uploads/${encodeURIComponent(created.data.upload.id)}/complete`), completeUploadResponseSchema, { method: 'POST', signal: options.signal });
|
|
49
|
+
return {
|
|
50
|
+
uploadId: completed.data.upload.id,
|
|
51
|
+
purpose: options.purpose,
|
|
52
|
+
contentType,
|
|
53
|
+
bytes: completed.data.upload.bytes ?? bytes.byteLength,
|
|
54
|
+
sha256: completed.data.upload.sha256 ?? sha256
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function uploadIdFromImage(image) {
|
|
58
|
+
if (typeof image === 'string') {
|
|
59
|
+
const id = image.trim();
|
|
60
|
+
if (!id) {
|
|
61
|
+
throw new LiformaPublisherError('uploadId is required.', { code: 'INVALID_BODY' });
|
|
62
|
+
}
|
|
63
|
+
return id;
|
|
64
|
+
}
|
|
65
|
+
return image.uploadId;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=upload.js.map
|