calmlens 0.31.1 → 0.33.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 (80) hide show
  1. package/bin/calmlens.js +54 -42
  2. package/cjs/{BrowserUpload-BwBE37LM.js → BrowserUpload-Al3ER3ki.js} +1 -1
  3. package/cjs/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-CURmX-DR.d.ts} +2 -2
  4. package/cjs/{CalmLensAppClient-CdlcDd5l.d.ts → CalmLensAppClient-DII9cdTD.d.ts} +3 -3
  5. package/cjs/{CalmLensAppClient-D6Y7MgH_.js → CalmLensAppClient-DWIy2yPF.js} +4 -4
  6. package/cjs/{CalmLensCdn-Q68faCEE.js → CalmLensCdn-6ZqvG8-v.js} +56 -22
  7. package/cjs/{CalmLensConnection-j2aBsuNx.js → CalmLensConnection-Qp9ucGHO.js} +7 -16
  8. package/cjs/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CPwGfFR-.d.ts} +10 -10
  9. package/cjs/{CalmLensServerClient-CjK691kq.js → CalmLensServerClient-DRLyvnA1.js} +19 -19
  10. package/cjs/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DF7wh23M.d.ts} +16527 -16498
  11. package/cjs/{Core-Ccy4-_sN.d.ts → Core-Dnm9bJPB.d.ts} +2 -2
  12. package/cjs/{Core-Dsj4tRNP.js → Core-rYZedJhi.js} +2 -2
  13. package/cjs/{ReactUpload-DBhppuxM.d.ts → ReactUpload-B7wrDPk8.d.ts} +1 -1
  14. package/cjs/{ReactUpload-B7SdNAel.js → ReactUpload-Bj6-CciJ.js} +1 -1
  15. package/{esm/TestTriggers-Daxebd0V.d.ts → cjs/TestTriggers-CjDhhz78.d.ts} +1 -11
  16. package/cjs/{UploadController-DsIENVY1.js → UploadController-DCr7oN6L.js} +1 -1
  17. package/cjs/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-CUMsersa.d.ts} +1 -1
  18. package/cjs/app.d.ts +5 -5
  19. package/cjs/app.js +2 -2
  20. package/cjs/elements.d.ts +4 -4
  21. package/cjs/elements.js +4 -4
  22. package/cjs/{index-CWUnLKoF.d.ts → index-B511mjeS.d.ts} +2 -2
  23. package/cjs/index.d.ts +4 -4
  24. package/cjs/index.js +1 -1
  25. package/cjs/react-native.d.ts +2 -2
  26. package/cjs/react-native.js +4 -4
  27. package/cjs/react.d.ts +4 -4
  28. package/cjs/react.js +5 -5
  29. package/cjs/server.d.ts +5 -5
  30. package/cjs/server.js +2 -2
  31. package/cjs/test-inputs.d.ts +15 -3
  32. package/cjs/test-inputs.js +105 -2
  33. package/cjs/testing.d.ts +14 -6
  34. package/cjs/testing.js +122 -53
  35. package/cjs/{ui-sjnJhloQ.d.ts → ui-B83Pqjom.d.ts} +2 -2
  36. package/cjs/{ui-BC70R8KT.js → ui-BS9eFCI7.js} +8 -8
  37. package/cjs/ui.d.ts +2 -2
  38. package/cjs/ui.js +3 -3
  39. package/cjs/vue.d.ts +5 -5
  40. package/cjs/vue.js +4 -4
  41. package/esm/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-CURmX-DR.d.ts} +2 -2
  42. package/esm/{BrowserUpload-DSLCpWgz.js → BrowserUpload-DOcZaSWT.js} +1 -1
  43. package/esm/{CalmLensAppClient-BKanqwYL.js → CalmLensAppClient-B7IkEK2D.js} +4 -4
  44. package/esm/{CalmLensAppClient-CdlcDd5l.d.ts → CalmLensAppClient-DII9cdTD.d.ts} +3 -3
  45. package/esm/{CalmLensCdn-CL1P1v2t.js → CalmLensCdn-DpJ7kIqG.js} +39 -23
  46. package/esm/{CalmLensConnection-CHNNULpg.js → CalmLensConnection-BYUqUitO.js} +7 -16
  47. package/esm/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CPwGfFR-.d.ts} +10 -10
  48. package/esm/{CalmLensServerClient-CBjSqROz.js → CalmLensServerClient-DpkreSH6.js} +19 -19
  49. package/esm/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DF7wh23M.d.ts} +16527 -16498
  50. package/esm/{Core-WxPuobo_.js → Core-DGF84gwM.js} +2 -2
  51. package/esm/{Core-Ccy4-_sN.d.ts → Core-Dnm9bJPB.d.ts} +2 -2
  52. package/esm/{ReactUpload-DBhppuxM.d.ts → ReactUpload-B7wrDPk8.d.ts} +1 -1
  53. package/esm/{ReactUpload-U49veoZl.js → ReactUpload-rDvF5arL.js} +1 -1
  54. package/{cjs/TestTriggers-Daxebd0V.d.ts → esm/TestTriggers-CjDhhz78.d.ts} +1 -11
  55. package/esm/{UploadController-X2gEFMGy.js → UploadController-cXocXbjd.js} +1 -1
  56. package/esm/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-CUMsersa.d.ts} +1 -1
  57. package/esm/app.d.ts +5 -5
  58. package/esm/app.js +2 -2
  59. package/esm/elements.d.ts +4 -4
  60. package/esm/elements.js +4 -4
  61. package/esm/{index-CWUnLKoF.d.ts → index-B511mjeS.d.ts} +2 -2
  62. package/esm/index.d.ts +4 -4
  63. package/esm/index.js +1 -1
  64. package/esm/react-native.d.ts +2 -2
  65. package/esm/react-native.js +4 -4
  66. package/esm/react.d.ts +4 -4
  67. package/esm/react.js +5 -5
  68. package/esm/server.d.ts +5 -5
  69. package/esm/server.js +2 -2
  70. package/esm/test-inputs.d.ts +15 -3
  71. package/esm/test-inputs.js +105 -2
  72. package/esm/testing.d.ts +14 -6
  73. package/esm/testing.js +122 -53
  74. package/esm/{ui-sjnJhloQ.d.ts → ui-B83Pqjom.d.ts} +2 -2
  75. package/esm/{ui-DS85DGfi.js → ui-C0wgePYT.js} +8 -8
  76. package/esm/ui.d.ts +2 -2
  77. package/esm/ui.js +3 -3
  78. package/esm/vue.d.ts +5 -5
  79. package/esm/vue.js +4 -4
  80. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensCdn = require("./CalmLensCdn-Q68faCEE.js");
3
- const require_CalmLensConnection = require("./CalmLensConnection-j2aBsuNx.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-6ZqvG8-v.js");
3
+ const require_CalmLensConnection = require("./CalmLensConnection-Qp9ucGHO.js");
4
4
  const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
5
5
  // src/contract/JsonUtils.js
6
6
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -413,10 +413,10 @@ var CalmLensServerClient = class {
413
413
  get cdn() {
414
414
  return {
415
415
  /**
416
- * Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
417
- * beneath, or a resource URL when `resource` is given, with its lens or transform and the
418
- * viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
419
- * claims are assertions from your app; CalmLens doesn't verify them.
416
+ * Builds an asset's CDN URL without a request: the URL of `resource` (`rendered` unless one
417
+ * is given) beneath the asset URL, with its lens or transform and the viewer claims, ready to
418
+ * fetch. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer claims are
419
+ * assertions from your app; CalmLens doesn't verify them.
420
420
  */
421
421
  getAssetUrl: (urlOptions) => {
422
422
  const { projectId, ...options } = checked("cdn.getAssetUrl", urlOptions);
@@ -424,9 +424,9 @@ var CalmLensServerClient = class {
424
424
  },
425
425
  /**
426
426
  * Signs a private asset's URL on your server, so browsers and apps can load it without an API
427
- * key until it expires. With `resource`, it is signed for that resource and ends in it; only a
428
- * URL signed for `original` serves the exact uploaded file, and any other serves every other
429
- * resource beneath its grant. Lenses, transforms and viewer claims are appended as
427
+ * key until it expires. It is signed for `resource` (`rendered` unless one is given) and ends
428
+ * in it; only a URL signed for `original` serves the exact uploaded file, and any other serves
429
+ * every other resource beneath its grant. Lenses, transforms and viewer claims are appended as
430
430
  * `getAssetUrl` appends them and aren't part of the signature.
431
431
  */
432
432
  signAssetUrl: async (signOptions, requestOptions) => {
@@ -437,7 +437,7 @@ var CalmLensServerClient = class {
437
437
  const signed = await this.#send("cdn.signAssetUrl", requestOptions, "POST", `/projects/${project}/signed-asset-urls`, { body: {
438
438
  ...assetId !== void 0 ? { assetId } : { externalId },
439
439
  expiresIn: expiresIn ?? 900,
440
- ...location.resource !== void 0 ? { resource: location.resource } : {}
440
+ resource: location.resource ?? "rendered"
441
441
  } });
442
442
  if (!signed || typeof signed.url !== "string" || !signed.url || typeof signed.expiresAt !== "number") throw new require_CalmLensError.CalmLensError(require_CalmLensError.SDK_ERROR_CODES.INVALID_RESPONSE, { message: "The API returned no signed asset URL" });
443
443
  return require_CalmLensCdn.copyLastResponse({
@@ -461,13 +461,10 @@ var CalmLensServerClient = class {
461
461
  * Non-2xx responses are returned, not thrown; `timeoutMs` covers only the wait for headers.
462
462
  */
463
463
  serve: async (options, requestOptions) => {
464
- const { init, resource = "rendered", ...urlOptions } = checked("cdn.serve", options);
464
+ const { init, ...urlOptions } = checked("cdn.serve", options);
465
465
  const connection = this.#connection.forCall("cdn.serve", requestOptions);
466
466
  if (requestOptions?.extraBody) throw require_CalmLensError.invalidArgument("cdn.serve sends no body: extraBody can't apply");
467
- const url = this.cdn.getAssetUrl({
468
- ...urlOptions,
469
- resource
470
- });
467
+ const url = this.cdn.getAssetUrl(urlOptions);
471
468
  const extraQuery = requestOptions?.extraQuery && require_CalmLensCdn.stringifyQuery(requestOptions.extraQuery);
472
469
  const method = init?.method?.toUpperCase() ?? "GET";
473
470
  const { response } = await connection.transport.send({
@@ -682,10 +679,13 @@ sign: async (options) => {
682
679
  * pass the same ones with each `cursor`. `for await` over it yields every event waiting
683
680
  * after `cursor`; save the last page's `nextCursor` to resume later.
684
681
  */
685
- list: (options = {}, requestOptions) => this.#paginate("events.list", options, requestOptions, ({ types, ...query }) => this.#send("events.list", requestOptions, "GET", `${this.#projectPath}/events`, { query: {
686
- ...query,
687
- types: types?.length ? types.join(",") : void 0
688
- } })),
682
+ list: (options = {}, requestOptions) => this.#paginate("events.list", options, requestOptions, ({ types, ...query }) => {
683
+ if (types != null && (!Array.isArray(types) || types.some((type) => typeof type !== "string"))) throw require_CalmLensError.invalidArgument("types must be an array of event types");
684
+ return this.#send("events.list", requestOptions, "GET", `${this.#projectPath}/events`, { query: {
685
+ ...query,
686
+ types: types?.length ? types.join(",") : void 0
687
+ } });
688
+ }),
689
689
  /**
690
690
  * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
691
691
  * parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to