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,5 +1,5 @@
1
1
  import { S as invalidArgument, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { B as resolveLogLevel, D as MAX_IMAGE_UPLOAD_BYTES, E as MAX_DIRECT_IMAGE_UPLOAD_BYTES, M as sleep, O as MAX_NON_IMAGE_UPLOAD_BYTES, _ as randomUuid, j as CalmLensTransport, k as getRejectedUploadMimeTypeError, m as isAcceptedUploadMimeType, y as stringifyQuery } from "./CalmLensCdn-CL1P1v2t.js";
2
+ import { A as MAX_OTHER_DOCUMENT_UPLOAD_BYTES, D as MAX_DIRECT_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, P as CalmLensTransport, T as UPLOAD_MIME_DOCUMENTS, U as resolveLogLevel, _ as randomUuid, j as MAX_PDF_UPLOAD_BYTES, k as MAX_NON_IMAGE_UPLOAD_BYTES, m as isAcceptedUploadMimeType, y as stringifyQuery } from "./CalmLensCdn-DpJ7kIqG.js";
3
3
  // src/contract/AssetPayload.js
4
4
  const bufferInputToBytes = (value) => {
5
5
  if (value instanceof ArrayBuffer) return new Uint8Array(value);
@@ -98,7 +98,6 @@ const SERVER_OPTION_KEYS = {
98
98
  "authorId",
99
99
  "content",
100
100
  "context",
101
- "description",
102
101
  "externalId",
103
102
  "externalUrl",
104
103
  "folderId",
@@ -118,7 +117,6 @@ const SERVER_OPTION_KEYS = {
118
117
  "authorId",
119
118
  "content",
120
119
  "context",
121
- "description",
122
120
  "externalId",
123
121
  "externalUrl",
124
122
  "folderId",
@@ -171,7 +169,6 @@ const SERVER_OPTION_KEYS = {
171
169
  ],
172
170
  "assets.update": [
173
171
  "assetId",
174
- "description",
175
172
  "externalId",
176
173
  "externalUrl",
177
174
  "metadata",
@@ -327,7 +324,6 @@ const SERVER_OPTION_KEYS = {
327
324
  "text.classify": [
328
325
  "authorId",
329
326
  "context",
330
- "description",
331
327
  "externalId",
332
328
  "externalUrl",
333
329
  "folderId",
@@ -351,7 +347,6 @@ const SERVER_OPTION_KEYS = {
351
347
  const APP_OPTION_KEYS = {
352
348
  "assets.classify": [
353
349
  "content",
354
- "description",
355
350
  "externalUrl",
356
351
  "name",
357
352
  "part",
@@ -360,7 +355,6 @@ const APP_OPTION_KEYS = {
360
355
  ],
361
356
  "assets.create": [
362
357
  "content",
363
- "description",
364
358
  "externalUrl",
365
359
  "name",
366
360
  "part",
@@ -382,7 +376,6 @@ const NULLABLE_OPTION_KEYS = {
382
376
  "assets.classify": [
383
377
  "authorId",
384
378
  "context",
385
- "description",
386
379
  "externalId",
387
380
  "folderId",
388
381
  "metadata",
@@ -394,7 +387,6 @@ const NULLABLE_OPTION_KEYS = {
394
387
  "assets.create": [
395
388
  "authorId",
396
389
  "context",
397
- "description",
398
390
  "externalId",
399
391
  "folderId",
400
392
  "metadata",
@@ -406,7 +398,6 @@ const NULLABLE_OPTION_KEYS = {
406
398
  "assets.list": ["filter"],
407
399
  "assets.move": ["folderId"],
408
400
  "assets.update": [
409
- "description",
410
401
  "externalId",
411
402
  "externalUrl",
412
403
  "metadata",
@@ -423,7 +414,6 @@ const NULLABLE_OPTION_KEYS = {
423
414
  "text.classify": [
424
415
  "authorId",
425
416
  "context",
426
- "description",
427
417
  "externalId",
428
418
  "folderId",
429
419
  "metadata",
@@ -562,7 +552,6 @@ const uploadFields = (options) => Object.fromEntries(UPLOAD_OPTION_KEYS.flatMap(
562
552
  /** The asset fields an upload carries in its body: the API refuses them in the query string. */
563
553
  const UPLOAD_OPTION_KEYS = [
564
554
  "name",
565
- "description",
566
555
  "processingOptions",
567
556
  "visibility",
568
557
  "metadata",
@@ -598,13 +587,15 @@ const assertDeclaredPayloadSize = (payload, declared = payload.sizeInBytes) => {
598
587
  * Refuses content whose known size is over the API's limit for its type, so nothing is sent and
599
588
  * an oversized file fails at once instead of after its upload. In one request, images can be up
600
589
  * to 10 MiB (larger ones are uploaded in parts), audio and video up to 50 MiB and other files up
601
- * to 5,000 MiB. Sent in parts (`inParts`), audio and video can be up to 2 GiB; the API holds free
602
- * uploads, made before billing is set up, to 50 MiB itself. Images in parts are checked apart.
590
+ * to 5,000 MiB. Sent in parts (`inParts`), audio and video can be up to 2 GiB. However it is sent,
591
+ * a PDF can be up to 2,000 MiB and another document (Word, spreadsheet, presentation, OpenDocument
592
+ * or RTF) up to 50 MiB. The API holds free uploads, made before billing is set up, to 50 MiB
593
+ * itself. Images in parts are checked apart.
603
594
  */
604
595
  const assertUploadSize = (type, size, inParts) => {
605
596
  if (size === void 0) return;
606
- const mime = type.toLowerCase();
607
- const [limit, message] = mime.startsWith("image/") ? [MAX_DIRECT_IMAGE_UPLOAD_BYTES, "Images uploaded in one request can be at most 10 MiB; upload larger images in parts"] : mime.startsWith("audio/") || mime.startsWith("video/") ? [inParts ? MAX_LONG_MEDIA_UPLOAD_BYTES : MAX_MEDIA_UPLOAD_BYTES, "Audio and video files can be at most 50 MiB in one request, or 2 GiB in parts"] : [MAX_NON_IMAGE_UPLOAD_BYTES, "Files can be at most 5,000 MiB"];
597
+ const mime = normalizeUploadMimeType(type);
598
+ const [limit, message] = mime === "application/pdf" ? [MAX_PDF_UPLOAD_BYTES, "PDFs can be at most 2,000 MiB"] : UPLOAD_MIME_DOCUMENTS.includes(mime) ? [MAX_OTHER_DOCUMENT_UPLOAD_BYTES, "Documents other than PDFs can be at most 50 MiB"] : mime.startsWith("image/") ? [MAX_DIRECT_IMAGE_UPLOAD_BYTES, "Images uploaded in one request can be at most 10 MiB; upload larger images in parts"] : mime.startsWith("audio/") || mime.startsWith("video/") ? [inParts ? MAX_LONG_MEDIA_UPLOAD_BYTES : MAX_MEDIA_UPLOAD_BYTES, "Audio and video files can be at most 50 MiB in one request, or 2 GiB in parts"] : [MAX_NON_IMAGE_UPLOAD_BYTES, "Files can be at most 5,000 MiB"];
608
599
  if (size > limit) throw new CalmLensError(API_ERROR_CODES.UPLOAD_TOO_LARGE, {
609
600
  message,
610
601
  details: {
@@ -1,6 +1,6 @@
1
1
  import { c as HashList, l as HashListEntry } from "./Classification-C3pkrGYS-B7EygpJn.js";
2
- import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, Bn as AssetInfo, Cn as ProjectSettingsResource, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions, It as SignAssetUrlOptions, J as EnsureLensesOptions, Jt as UpgradePolicyOptions, K as DeleteMetadataFieldOptions, Kt as UpdatePolicyOptions, Lt as SignUploadTokenOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, Nt as RetryAssetOptions, P as CdnServeOptions, Pn as Policy, Q as FolderIdOptions, Qt as UploadPresetPage, Rn as AssetSearchQuery, Rt as SignedAssetUrl, Sn as MetadataFieldsResource, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateFolderOptions, V as CreateLensOptions, Vt as SubmitAssetOptions, W as DecideAssetOptions, Wt as UpdateHashListOptions, X as EnsureUploadPresetsOptions, Y as EnsureMetadataFieldsOptions, Yt as UploadAssetPartOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetIdOptions, _ as AssetPage, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetrieveAssetByExternalIdOptions, k as CalmLensServerClientOptions, kt as RequestOptions, ln as GetEventsResponse, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, pt as ListEventsOptions, q as EnsureLensOptions, qt as UpdateProjectSettingsOptions, r as Asset, rn as WaitForAssetDecisionOptions, rt as HashListIdOptions, sn as AssetReviewRequest, st as Lens, t as AddHashListEntryOptions, tn as VerifyWebhookSignatureOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vt as ListPoliciesOptions, wt as PolicyIdOptions, xn as Folder, xt as MoveFolderOptions, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SignedUploadToken } from "./CalmLensTypes-87kiUg0H.js";
3
- import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-B4rA_Dvm.js";
2
+ import { $t as UpdateLensOptions, At as PolicyIdOptions, B as CreateHashListOptions, Bn as AssetSearchQuery, Bt as RetryAssetOptions, Ct as ListPoliciesOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as MoveFolderOptions, G as DeleteAssetOptions, Gt as SignedAssetUrl, Hn as AssetInfo, Ht as SetPolicyAutomaticUpdatesOptions, I as ClassifyTextOptions, It as RequestOptions, J as EnsureLensesOptions, Jt as SubmitAssetOptions, K as DeleteMetadataFieldOptions, Kt as SignedUploadToken, Lt as ResetPolicyOptions, M as CdnAssetUrlOptions, Nt as RemoveAssetContentOptions, P as CdnServeOptions, Pt as RequestAssetReviewOptions, Qt as UpdateHashListOptions, Rn as Folder, Rt as RetrieveAssetByExternalIdOptions, St as ListLensesOptions, T as AssignPolicyOptions, Tt as MoveAssetOptions, U as CreatePolicyOptions, Ut as SignAssetUrlOptions, V as CreateLensOptions, W as DecideAssetOptions, Wt as SignUploadTokenOptions, X as EnsureUploadPresetsOptions, Xt as UpdateAssetOptions, Y as EnsureMetadataFieldsOptions, Z as EnsureUploadPresetsResponse, Zt as UpdateFolderOptions, _ as AssetPage, _n as MetadataFieldsResource, _t as ListAssetsOptions, an as UploadPresetIdOptions, at as GetAssetInfoOptions, b as AssetTimelinePage, bt as ListHashListEntriesOptions, ct as HashListIdOptions, dn as WaitForAssetDecisionOptions, en as UpdatePolicyOptions, ft as Lens, gt as ListAssetTimelineOptions, hn as AssetReviewRequest, ht as ListAssetChildrenOptions, it as FolderPage, jt as PolicyPage, k as CalmLensServerClientOptions, kt as Policy, ln as VerifyWebhookSignatureOptions, lt as HashListPage, mt as LensPage, nn as UpgradePolicyOptions, nt as EventsPage, o as AssetChildrenPage, on as UploadPresetPage, ot as HashListEntryIdOptions, pt as LensIdOptions, q as EnsureLensOptions, r as Asset, rn as UploadAssetPartOptions, rt as FolderIdOptions, st as HashListEntryPage, t as AddHashListEntryOptions, tn as UpdateProjectSettingsOptions, v as AssetSearchResponse, vn as ProjectSettingsResource, vt as ListEventsOptions, wt as ListUploadPresetsOptions, xt as ListHashListsOptions, yt as ListFoldersOptions, z as CreateFolderOptions, zt as RetrieveAssetOptions } from "./CalmLensTypes-DF7wh23M.js";
3
+ import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-CUMsersa.js";
4
4
  interface TransportRequest {
5
5
  /** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
6
6
  operation?: string;
@@ -80,17 +80,17 @@ declare class CalmLensServerClient {
80
80
  }, requestOptions?: RequestOptions): Promise<CalmLensResponse<T>>;
81
81
  get cdn(): {
82
82
  /**
83
- * Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
84
- * beneath, or a resource URL when `resource` is given, with its lens or transform and the
85
- * viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
86
- * claims are assertions from your app; CalmLens doesn't verify them.
83
+ * Builds an asset's CDN URL without a request: the URL of `resource` (`rendered` unless one
84
+ * is given) beneath the asset URL, with its lens or transform and the viewer claims, ready to
85
+ * fetch. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer claims are
86
+ * assertions from your app; CalmLens doesn't verify them.
87
87
  */
88
88
  getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
89
89
  /**
90
90
  * Signs a private asset's URL on your server, so browsers and apps can load it without an API
91
- * key until it expires. With `resource`, it is signed for that resource and ends in it; only a
92
- * URL signed for `original` serves the exact uploaded file, and any other serves every other
93
- * resource beneath its grant. Lenses, transforms and viewer claims are appended as
91
+ * key until it expires. It is signed for `resource` (`rendered` unless one is given) and ends
92
+ * in it; only a URL signed for `original` serves the exact uploaded file, and any other serves
93
+ * every other resource beneath its grant. Lenses, transforms and viewer claims are appended as
94
94
  * `getAssetUrl` appends them and aren't part of the signature.
95
95
  */
96
96
  signAssetUrl: (signOptions: SignAssetUrlOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<SignedAssetUrl>>;
@@ -239,7 +239,7 @@ declare class CalmLensServerClient {
239
239
  * pass the same ones with each `cursor`. `for await` over it yields every event waiting
240
240
  * after `cursor`; save the last page's `nextCursor` to resume later.
241
241
  */
242
- list: (options?: ListEventsOptions, requestOptions?: RequestOptions) => ListPromise<GetEventsResponse>;
242
+ list: (options?: ListEventsOptions, requestOptions?: RequestOptions) => ListPromise<EventsPage>;
243
243
  /**
244
244
  * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
245
245
  * parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to
@@ -1,6 +1,6 @@
1
1
  import { C as invalidConfig, S as invalidArgument, l as CalmLensError, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { C as validateBatchAssetsOptions, F as isReactNativeRuntime, L as copyLastResponse, P as isBrowserRuntime, R as listPages, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, i as appendSignedLocation, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery, z as readEnv } from "./CalmLensCdn-CL1P1v2t.js";
3
- import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-CHNNULpg.js";
2
+ import { B as copyLastResponse, C as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, R as isReactNativeRuntime, V as listPages, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, i as appendSignedLocation, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery } from "./CalmLensCdn-DpJ7kIqG.js";
3
+ import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-BYUqUitO.js";
4
4
  import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.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 CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, { message: "The API returned no signed asset URL" });
443
443
  return 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 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 && 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 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