@oeave/bakery3 0.1.0 → 0.3.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.
Files changed (77) hide show
  1. package/README.md +10 -10
  2. package/dist/bake/index.d.ts +3 -3
  3. package/dist/bake/index.js +4 -4
  4. package/dist/{bake-DaOlenyx.d.ts → bake-DZ-CJR6f.d.ts} +8 -1
  5. package/dist/catalog/index.d.ts +5 -5
  6. package/dist/catalog/index.js +3 -3
  7. package/dist/{chunk-TGFNQBKC.js → chunk-3T3FJOSD.js} +5 -5
  8. package/dist/chunk-3T3FJOSD.js.map +1 -0
  9. package/dist/{chunk-V3QINEEG.js → chunk-62M6XXNX.js} +58 -3
  10. package/dist/chunk-62M6XXNX.js.map +1 -0
  11. package/dist/{chunk-ARMTTZXZ.js → chunk-6FAMQZXB.js} +8 -8
  12. package/dist/chunk-6FAMQZXB.js.map +1 -0
  13. package/dist/{chunk-54WJDN5R.js → chunk-CSSJRP5W.js} +9 -6
  14. package/dist/chunk-CSSJRP5W.js.map +1 -0
  15. package/dist/{chunk-W6WQ5UP7.js → chunk-EN4ROBYQ.js} +32 -5
  16. package/dist/chunk-EN4ROBYQ.js.map +1 -0
  17. package/dist/chunk-KZLVTSBI.js +191 -0
  18. package/dist/chunk-KZLVTSBI.js.map +1 -0
  19. package/dist/{chunk-MD2U6S4N.js → chunk-LAKXC4WR.js} +218 -142
  20. package/dist/chunk-LAKXC4WR.js.map +1 -0
  21. package/dist/{chunk-HQTUFVMM.js → chunk-NEK5TBEH.js} +3 -3
  22. package/dist/chunk-NEK5TBEH.js.map +1 -0
  23. package/dist/chunk-OPM2L63B.js +253 -0
  24. package/dist/chunk-OPM2L63B.js.map +1 -0
  25. package/dist/{chunk-APBOWWSV.js → chunk-R5IUPOWI.js} +3 -3
  26. package/dist/chunk-R5IUPOWI.js.map +1 -0
  27. package/dist/{chunk-6YVQANMW.js → chunk-STRK4SZN.js} +262 -16
  28. package/dist/chunk-STRK4SZN.js.map +1 -0
  29. package/dist/{chunk-CX4WTVGH.js → chunk-WLEFNUOH.js} +411 -371
  30. package/dist/chunk-WLEFNUOH.js.map +1 -0
  31. package/dist/{chunk-25ZXSVQ3.js → chunk-X6GW43EX.js} +3 -3
  32. package/dist/{chunk-25ZXSVQ3.js.map → chunk-X6GW43EX.js.map} +1 -1
  33. package/dist/{chunk-WBIAFIHV.js → chunk-XK35ANPJ.js} +3 -3
  34. package/dist/{chunk-WBIAFIHV.js.map → chunk-XK35ANPJ.js.map} +1 -1
  35. package/dist/devtools/index.d.ts +3 -3
  36. package/dist/devtools/index.js +10 -9
  37. package/dist/hotspots/index.d.ts +237 -31
  38. package/dist/hotspots/index.js +1013 -118
  39. package/dist/hotspots/index.js.map +1 -1
  40. package/dist/index.d.ts +39 -8
  41. package/dist/index.js +11 -10
  42. package/dist/node/index.cjs +266 -141
  43. package/dist/node/index.cjs.map +1 -1
  44. package/dist/node/index.d.cts +152 -87
  45. package/dist/node/index.d.ts +27 -6
  46. package/dist/node/index.js +52 -3
  47. package/dist/node/index.js.map +1 -1
  48. package/dist/{prepare-C5qVvaw4.d.ts → prepare-BtjY4G3q.d.ts} +1 -1
  49. package/dist/presets/index.d.ts +37 -1
  50. package/dist/presets/index.js +4 -4
  51. package/dist/presets/index.js.map +1 -1
  52. package/dist/r3f/index.d.ts +4 -4
  53. package/dist/r3f/index.js +13 -12
  54. package/dist/r3f/index.js.map +1 -1
  55. package/dist/{room-S5TLCK4F.js → room-BM7Z7NKG.js} +6 -6
  56. package/dist/{room-S5TLCK4F.js.map → room-BM7Z7NKG.js.map} +1 -1
  57. package/dist/{rooms.gen-vhj6sFW5.d.ts → rooms.gen-DItzBR9k.d.ts} +112 -84
  58. package/dist/session-NPVBESWA.js +9 -0
  59. package/dist/{session-YCQS4MRH.js.map → session-NPVBESWA.js.map} +1 -1
  60. package/dist/{testRun-BIPXaVPb.d.ts → testRun-20OARnQr.d.ts} +12 -3
  61. package/dist/tsl/index.d.ts +14 -1
  62. package/dist/tsl/index.js +8 -2
  63. package/dist/tsl/index.js.map +1 -1
  64. package/package.json +1 -1
  65. package/dist/chunk-54WJDN5R.js.map +0 -1
  66. package/dist/chunk-6YVQANMW.js.map +0 -1
  67. package/dist/chunk-AF5BIELI.js +0 -70
  68. package/dist/chunk-AF5BIELI.js.map +0 -1
  69. package/dist/chunk-APBOWWSV.js.map +0 -1
  70. package/dist/chunk-ARMTTZXZ.js.map +0 -1
  71. package/dist/chunk-CX4WTVGH.js.map +0 -1
  72. package/dist/chunk-HQTUFVMM.js.map +0 -1
  73. package/dist/chunk-MD2U6S4N.js.map +0 -1
  74. package/dist/chunk-TGFNQBKC.js.map +0 -1
  75. package/dist/chunk-V3QINEEG.js.map +0 -1
  76. package/dist/chunk-W6WQ5UP7.js.map +0 -1
  77. package/dist/session-YCQS4MRH.js +0 -9
@@ -1,9 +1,9 @@
1
- import { Q as QualityPreset, O as OutputSpec, R as RenderSpec, C as ColorSpec } from '../bake-DaOlenyx.js';
2
- export { F as FrameSequenceIndex } from '../bake-DaOlenyx.js';
3
- import { B as BatchProgress, R as Recorded, c as Bakery3Error, W as WebhookPayload, d as Bakery3Client, e as RenderRecord, C as CostEstimate, f as BatchOpenRequest, b as Batch, A as AssetImportKind, g as AssetImportResponse, h as RetryPolicy, i as RenderSet, T as TestRunOptions } from '../testRun-BIPXaVPb.js';
4
- export { j as BatchAddRequest, k as BatchAddResponse, l as BatchExportLine, m as BatchItemOutcome, n as BatchItemRecord, o as BatchItemRequest, p as BatchItemsPage, q as BatchPageRefused, a as BatchRecord, F as FlushOptions, r as RenderSetFailure, s as RenderSetImage, t as WaitOptions } from '../testRun-BIPXaVPb.js';
1
+ import { Q as QualityPreset, O as OutputSpec, R as RenderSpec, C as ColorSpec } from '../bake-DZ-CJR6f.js';
2
+ export { F as FrameSequenceIndex } from '../bake-DZ-CJR6f.js';
3
+ import { B as BatchProgress, R as Recorded, c as Bakery3Error, W as WebhookPayload, d as Bakery3Client, e as RenderRecord, C as CostEstimate, f as BatchOpenRequest, b as Batch, A as AssetImportKind, g as AssetImportResponse, h as AssetDeleteResponse, i as RetryPolicy, j as RenderSet, T as TestRunOptions } from '../testRun-20OARnQr.js';
4
+ export { k as BatchAddRequest, l as BatchAddResponse, m as BatchExportLine, n as BatchItemOutcome, o as BatchItemRecord, p as BatchItemRequest, q as BatchItemsPage, r as BatchPageRefused, a as BatchRecord, F as FlushOptions, s as RenderSetFailure, t as RenderSetImage, u as WaitOptions } from '../testRun-20OARnQr.js';
5
5
  import { H as HdriPresetName } from '../catalog.gen-BM-aNf7n.js';
6
- import { R as RoomPresetName, a as RoomPresetLighting } from '../rooms.gen-vhj6sFW5.js';
6
+ import { R as RoomPresetName, a as RoomPresetLighting } from '../rooms.gen-DItzBR9k.js';
7
7
  import '../animation-B1h0Ryvj.js';
8
8
 
9
9
  /**
@@ -495,6 +495,27 @@ declare class AssetsApi {
495
495
  import(url: string, options?: {
496
496
  kind?: AssetImportKind;
497
497
  }): Promise<AssetImportResponse>;
498
+ /**
499
+ * Delete one uploaded file from the project now, rather than when
500
+ * retention would. `deleted` is false when the project held no such file,
501
+ * so deleting twice is not an error. The next render that needs the file
502
+ * uploads it again; a render still queued that needs it can fail, and a
503
+ * failed render costs nothing.
504
+ *
505
+ * await api.assets.delete('sha256:9f2b…');
506
+ * // { hash: 'sha256:9f2b…', deleted: true }
507
+ */
508
+ delete(hash: string): Promise<AssetDeleteResponse>;
509
+ /**
510
+ * Delete every uploaded file in the project, a page per request until
511
+ * none is left. Resolves with how many were deleted.
512
+ *
513
+ * await api.assets.deleteAll();
514
+ * // { deleted: 240 }
515
+ */
516
+ deleteAll(): Promise<{
517
+ deleted: number;
518
+ }>;
498
519
  }
499
520
  type Request = <T>(method: string, path: string, body?: unknown) => Promise<T>;
500
521
  declare class TokensApi {
@@ -573,4 +594,4 @@ declare class BatchesApi {
573
594
  get(id: string): Promise<Batch>;
574
595
  }
575
596
 
576
- export { type Angle, Bakery3Error, Bakery3Server, type Bakery3ServerOptions, Batch, type BatchEnvironment, BatchOpenRequest, type BatchProduct, BatchProgress, type BatchRoom, type BrowserToken, type BrowserTokenOptions, CostEstimate, type ImageShot, type ProductSkip, Recorded, type RenderBatchOptions, type RenderBatchProgress, type RenderBatchRecorded, type RenderBatchRun, RenderRecord, RenderSet, RenderSpec, RetryPolicy, type Shot, type ShotSettings, TestRunOptions, type VideoShot, type View, type ViewWord, verifyWebhook };
597
+ export { type Angle, AssetDeleteResponse, Bakery3Error, Bakery3Server, type Bakery3ServerOptions, Batch, type BatchEnvironment, BatchOpenRequest, type BatchProduct, BatchProgress, type BatchRoom, type BrowserToken, type BrowserTokenOptions, CostEstimate, type ImageShot, type ProductSkip, Recorded, type RenderBatchOptions, type RenderBatchProgress, type RenderBatchRecorded, type RenderBatchRun, RenderRecord, RenderSet, RenderSpec, RetryPolicy, type Shot, type ShotSettings, TestRunOptions, type VideoShot, type View, type ViewWord, verifyWebhook };
@@ -1,11 +1,17 @@
1
- import { warnIfKeyIsExposed, Bakery3Client, quoteKey, testSettings, sampleOf, Batch } from '../chunk-25ZXSVQ3.js';
1
+ import { warnIfKeyIsExposed, Bakery3Client, quoteKey, testSettings, sampleOf, Batch } from '../chunk-X6GW43EX.js';
2
2
  import { RenderSet, emptyRecorded } from '../chunk-ZEBVAIJJ.js';
3
- import { QUALITY, isClipFormat, isVideoFormat, protocolVersionFor, SDK_VERSION } from '../chunk-APBOWWSV.js';
3
+ import { QUALITY, isClipFormat, isVideoFormat, protocolVersionFor, SDK_VERSION } from '../chunk-R5IUPOWI.js';
4
4
  import { HDRI_PRESETS, PRESETS_VERSION, PEDESTAL_PRESETS } from '../chunk-6NYR73Y7.js';
5
- import { ROOM_PRESETS } from '../chunk-MD2U6S4N.js';
5
+ import { ROOM_PRESETS } from '../chunk-LAKXC4WR.js';
6
6
  import { Bakery3Error } from '../chunk-3G5QL4F4.js';
7
7
  export { Bakery3Error, BatchPageRefused } from '../chunk-3G5QL4F4.js';
8
8
 
9
+ // src/protocol/asset.ts
10
+ var ASSET_HASH_PATTERN = /^sha256:[0-9a-f]{64}$/;
11
+ function isAssetHash(value) {
12
+ return typeof value === "string" && ASSET_HASH_PATTERN.test(value);
13
+ }
14
+
9
15
  // src/frame.ts
10
16
  var VIEW_WORDS = {
11
17
  front: { azimuthDeg: 0, elevationDeg: 6 },
@@ -1175,6 +1181,49 @@ var AssetsApi = class {
1175
1181
  ...options.kind ? { kind: options.kind } : {}
1176
1182
  });
1177
1183
  }
1184
+ /**
1185
+ * Delete one uploaded file from the project now, rather than when
1186
+ * retention would. `deleted` is false when the project held no such file,
1187
+ * so deleting twice is not an error. The next render that needs the file
1188
+ * uploads it again; a render still queued that needs it can fail, and a
1189
+ * failed render costs nothing.
1190
+ *
1191
+ * await api.assets.delete('sha256:9f2b…');
1192
+ * // { hash: 'sha256:9f2b…', deleted: true }
1193
+ */
1194
+ async delete(hash) {
1195
+ if (!isAssetHash(hash)) {
1196
+ throw new Bakery3Error({
1197
+ code: "InvalidRequest",
1198
+ message: `"${String(hash).slice(0, 80)}" is not an asset hash. Expected sha256: followed by 64 lowercase hex characters.`,
1199
+ fix: "Pass the hash an import or a manifest gave you, or call assets.deleteAll() for every file.",
1200
+ docs: "https://bakery3.com/docs/uploads#delete-your-uploaded-files"
1201
+ });
1202
+ }
1203
+ return this.client().request(
1204
+ "DELETE",
1205
+ `/v1/assets/${hash}`
1206
+ );
1207
+ }
1208
+ /**
1209
+ * Delete every uploaded file in the project, a page per request until
1210
+ * none is left. Resolves with how many were deleted.
1211
+ *
1212
+ * await api.assets.deleteAll();
1213
+ * // { deleted: 240 }
1214
+ */
1215
+ async deleteAll() {
1216
+ const client = this.client();
1217
+ let deleted = 0;
1218
+ for (; ; ) {
1219
+ const page = await client.request(
1220
+ "DELETE",
1221
+ "/v1/assets"
1222
+ );
1223
+ deleted += page.deleted;
1224
+ if (!page.more || page.deleted === 0) return { deleted };
1225
+ }
1226
+ }
1178
1227
  };
1179
1228
  var TokensApi = class {
1180
1229
  constructor(request) {