calmlens 0.25.0 → 0.27.1

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 (95) hide show
  1. package/README.md +15 -15
  2. package/bin/calmlens.js +2383 -677
  3. package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-CTqIjCV5.js} +1 -1
  4. package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-D4sEmd0X.d.ts} +2 -2
  5. package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
  6. package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-CZm-9g22.js} +23 -16
  7. package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-C1w3SqmL.js} +165 -95
  8. package/cjs/CalmLensServerClient-B7PfocET.d.ts +346 -0
  9. package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-ucq3ITjd.js} +281 -315
  10. package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
  11. package/cjs/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
  12. package/cjs/{Core-Cw4IxFUq.js → Core-D-1KCqT7.js} +39 -16
  13. package/cjs/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
  14. package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-BcYKgU2X.js} +859 -44
  15. package/cjs/ReactUpload-BTciTpwB.d.ts +27 -0
  16. package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BymgWiC8.js} +38 -2
  17. package/cjs/{TestTriggers-CiFcTHX3-BmfH4J3f.js → TestTriggers-Cvi7e2KA-DcT1pc_W.js} +91 -22
  18. package/{esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
  19. package/cjs/{UploadController-ObdgTaBl.js → UploadController-C8GPbDKI.js} +16 -3
  20. package/{esm/WebhookPayload-DLGGOGW6.d.ts → cjs/WebhookPayload-mUmOFH55.d.ts} +152 -9
  21. package/cjs/app.d.ts +6 -6
  22. package/cjs/app.js +20 -2
  23. package/cjs/elements.d.ts +5 -5
  24. package/cjs/elements.js +105 -68
  25. package/cjs/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
  26. package/cjs/index.d.ts +5 -5
  27. package/cjs/index.js +19 -1
  28. package/cjs/react-native.d.ts +3 -3
  29. package/cjs/react-native.js +7 -5
  30. package/cjs/react.d.ts +5 -4
  31. package/cjs/react.js +11 -15
  32. package/cjs/server.d.ts +6 -6
  33. package/cjs/server.js +20 -2
  34. package/cjs/test-inputs.d.ts +1 -1
  35. package/cjs/test-inputs.js +13 -13
  36. package/cjs/testing.d.ts +18 -21
  37. package/cjs/testing.js +99 -147
  38. package/cjs/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
  39. package/cjs/{ui-CA16jyfZ.js → ui-CW8BqtZk.js} +7 -5
  40. package/cjs/ui.d.ts +3 -3
  41. package/cjs/ui.js +4 -3
  42. package/cjs/vue.d.ts +15 -8
  43. package/cjs/vue.js +30 -17
  44. package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-C01iLeOs.js} +1 -1
  45. package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-D4sEmd0X.d.ts} +2 -2
  46. package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
  47. package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-CgDogQQC.js} +23 -16
  48. package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CEwNbpEz.js} +160 -96
  49. package/esm/CalmLensServerClient-B7PfocET.d.ts +346 -0
  50. package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-TT6zrAG5.js} +281 -315
  51. package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
  52. package/esm/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
  53. package/esm/{Core-CtbYmeXG.js → Core-CP6NaqJz.js} +39 -16
  54. package/esm/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
  55. package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-BmV8QD32.js} +476 -301
  56. package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-B72Oq3qE.js} +34 -4
  57. package/esm/ReactUpload-BTciTpwB.d.ts +27 -0
  58. package/esm/{TestTriggers-CiFcTHX3-BK2-sgOC.js → TestTriggers-Cvi7e2KA-BA83CRJb.js} +87 -23
  59. package/{cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
  60. package/esm/{UploadController-C7fL3Iz9.js → UploadController-Q7xTqh5w.js} +11 -4
  61. package/{cjs/WebhookPayload-DLGGOGW6.d.ts → esm/WebhookPayload-mUmOFH55.d.ts} +152 -9
  62. package/esm/app.d.ts +6 -6
  63. package/esm/app.js +3 -3
  64. package/esm/elements.d.ts +5 -5
  65. package/esm/elements.js +105 -69
  66. package/esm/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
  67. package/esm/index.d.ts +5 -5
  68. package/esm/index.js +1 -1
  69. package/esm/react-native.d.ts +3 -3
  70. package/esm/react-native.js +6 -6
  71. package/esm/react.d.ts +5 -4
  72. package/esm/react.js +10 -16
  73. package/esm/server.d.ts +6 -6
  74. package/esm/server.js +3 -3
  75. package/esm/styles.css +37 -14
  76. package/esm/svelte/CalmLensAsset.svelte +1 -1
  77. package/esm/svelte/CalmLensUploader.svelte +17 -17
  78. package/esm/svelte/context.js +21 -0
  79. package/esm/svelte/index.d.ts +12 -0
  80. package/esm/svelte/index.js +1 -0
  81. package/esm/test-inputs.d.ts +1 -1
  82. package/esm/test-inputs.js +1 -1
  83. package/esm/testing.d.ts +18 -21
  84. package/esm/testing.js +93 -141
  85. package/esm/{ui-B98AucZA.js → ui-BBDJJkFL.js} +7 -5
  86. package/esm/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
  87. package/esm/ui.d.ts +3 -3
  88. package/esm/ui.js +4 -4
  89. package/esm/vue.d.ts +15 -8
  90. package/esm/vue.js +30 -19
  91. package/package.json +16 -6
  92. package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  93. package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
  94. package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  95. package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
package/esm/vue.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as CalmLensAppClientOptions, h as AssetModerationStatus, r as AssetAvailability, sn as ViewerClaims } from "./CalmLensTypes-BhR7LFDu.js";
2
- import "./index-AAWuerkU.js";
3
- import { $ as getAssetViewKey, A as CustomUploadResult, B as AssetDisplay, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, G as AssetSession, H as AssetImageOptions, J as AssetVideoOptions, K as AssetSessionState, L as UploadStage, M as UploadController, P as UploadFile, Q as getAssetView, S as formatBytes, T as getUploadItemMessage, U as AssetImageSource, V as AssetDocumentOptions, W as AssetOptions, X as MediaPlayback, Y as AssetView, Z as getAssetAspectRatio, _ as DEFAULT_MESSAGES, _t as formatViewerMessage, a as ProgressFetchOptions, at as ImageViewerOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, ct as TextViewerOptions, d as AssetDisplayOptions, dt as ViewerTextOptions, et as getPeakHeights, f as AssetEventHandlers, ft as WebsiteViewerOptions, g as CalmLensMessages, gt as ViewerMessages, ht as DEFAULT_VIEWER_MESSAGES, i as CALMLENS_STYLES, it as DocumentViewerOptions, j as UploadClient, k as CustomUploadContext, l as IconName, lt as ViewerAsset, m as UploaderDisplayOptions, mt as isSpreadsheetFormat, n as CalmLensTheme, nt as pickAssetSource, o as createProgressFetch, ot as PdfAssetOptions, p as AssetProps, pt as getAssetViewerKind, q as AssetSpreadsheetOptions, r as resolveTheme, rt as AssetViewerKind, s as ICONS, st as SpreadsheetViewerOptions, t as CALMLENS_THEME, tt as getPlayedPercent, u as ASSET_FILE_ICON_SIZE, ut as ViewerOptions, v as UploadItemView, vt as resolveViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as isFileAccepted } from "./Core-DSMxC2GL.js";
4
- import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-D2lemMIU.js";
5
- import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-CcuGKTcL.js";
6
- import { MaybeRefOrGetter, PropType, ShallowRef } from "vue";
1
+ import { O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-HUERg5hI.js";
2
+ import "./index-Ck7x1YjM.js";
3
+ import { $ as getAssetAspectRatio, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as MediaPlayback, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-DXAs8mcx.js";
4
+ import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-D4sEmd0X.js";
5
+ import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-BfJNO3c6.js";
6
+ import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
7
7
  /** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
8
8
  export declare const CalmLensImageViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
9
  /** The asset URL, public or signed. */
@@ -714,12 +714,19 @@ export interface UseCalmLensUploadResult<F extends UploadFile = File> {
714
714
  clear: UploadController<F>["clear"];
715
715
  start: UploadController<F>["start"];
716
716
  }
717
+ /**
718
+ * Gives every `CalmLensUploader` and `useCalmLensUpload` in this component's descendants these
719
+ * upload options, such as `uploadPresetId` and `tokenUrl`, so they needn't be passed to each one.
720
+ * Call it in `setup`, or pass the app to provide them app-wide. An option a component sets itself
721
+ * wins, and a nested call adds to the outer one's options.
722
+ */
723
+ export declare const provideCalmLens: <F extends UploadFile = File>(options: CalmLensProvidedOptions<F>, app?: App) => void;
717
724
  /**
718
725
  * Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
719
726
  * is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
720
727
  * still running when the component unmounts are cancelled.
721
728
  */
722
- export declare const useCalmLensUpload: <F extends UploadFile = File>(options: MaybeRefOrGetter<UploadControllerOptions<F>>) => UseCalmLensUploadResult<F>;
729
+ export declare const useCalmLensUpload: <F extends UploadFile = File>(own: MaybeRefOrGetter<UploadControllerOptions<F>>) => UseCalmLensUploadResult<F>;
723
730
  /**
724
731
  * A drop zone and file list that uploads through an upload preset, shows each file's progress
725
732
  * and moderation decision, and emits `uploaded` for finished uploads.
@@ -1090,4 +1097,4 @@ export declare const CalmLensAsset: import("vue").DefineComponent<import("vue").
1090
1097
  messages: Partial<CalmLensMessages>;
1091
1098
  onAgeConfirmRequest: () => void;
1092
1099
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1093
- export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex };
1100
+ export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
package/esm/vue.js CHANGED
@@ -1,9 +1,9 @@
1
- import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-B98AucZA.js";
2
- import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-C7fL3Iz9.js";
3
- import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-CtbYmeXG.js";
1
+ import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-BBDJJkFL.js";
2
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-Q7xTqh5w.js";
3
+ import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-CP6NaqJz.js";
4
4
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
- import { t as createUploadController } from "./BrowserUpload-Co4T6uGk.js";
6
- import { computed, defineComponent, h, onBeforeUnmount, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
5
+ import { t as createUploadController } from "./BrowserUpload-C01iLeOs.js";
6
+ import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, ref, shallowRef, toValue, watch, watchEffect } from "vue";
7
7
  // src/viewers/Vue.ts
8
8
  const optional$1 = (type) => ({
9
9
  type,
@@ -82,14 +82,30 @@ const subscribeSnapshot = (controller) => {
82
82
  }, { immediate: true });
83
83
  return snapshot;
84
84
  };
85
+ const CALMLENS_PROVIDED_KEY = Symbol("calmlens");
86
+ /**
87
+ * Gives every `CalmLensUploader` and `useCalmLensUpload` in this component's descendants these
88
+ * upload options, such as `uploadPresetId` and `tokenUrl`, so they needn't be passed to each one.
89
+ * Call it in `setup`, or pass the app to provide them app-wide. An option a component sets itself
90
+ * wins, and a nested call adds to the outer one's options.
91
+ */
92
+ const provideCalmLens = (options, app) => {
93
+ if (app) {
94
+ app.provide(CALMLENS_PROVIDED_KEY, options);
95
+ return;
96
+ }
97
+ provide(CALMLENS_PROVIDED_KEY, withProvidedOptions(inject(CALMLENS_PROVIDED_KEY, void 0), options));
98
+ };
85
99
  /**
86
100
  * Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
87
101
  * is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
88
102
  * still running when the component unmounts are cancelled.
89
103
  */
90
- const useCalmLensUpload = (options) => {
91
- const controller = createUploadController$1(toValue(options));
92
- watchEffect(() => controller.setOptions(toValue(options)));
104
+ const useCalmLensUpload = (own) => {
105
+ const provided = inject(CALMLENS_PROVIDED_KEY, void 0);
106
+ const options = () => withProvidedOptions(provided, toValue(own));
107
+ const controller = createUploadController$1(options());
108
+ watchEffect(() => controller.setOptions(options()));
93
109
  const snapshot = subscribeSnapshot(controller);
94
110
  onScopeDispose(() => controller.clear());
95
111
  return {
@@ -257,17 +273,12 @@ const CalmLensUploader = defineComponent({
257
273
  h("div", { class: "calmlens-upload__body" }, [
258
274
  h("span", { class: "calmlens-upload__name" }, item.file.name),
259
275
  h("span", { class: "calmlens-upload__size" }, itemView.size),
260
- itemView.busy && h("div", {
276
+ itemView.busy && h("progress", {
261
277
  class: "calmlens-progress",
262
- role: "progressbar",
263
278
  "aria-label": itemView.message,
264
- "aria-valuemin": 0,
265
- "aria-valuemax": 100,
266
- "aria-valuenow": itemView.progressPercent
267
- }, [h("div", {
268
- class: "calmlens-progress__bar",
269
- style: itemView.progressPercent === void 0 ? void 0 : { width: `${itemView.progressPercent}%` }
270
- })]),
279
+ max: 100,
280
+ value: itemView.progressPercent
281
+ }),
271
282
  itemView.message && h("p", {
272
283
  class: "calmlens-upload__message",
273
284
  role: "status"
@@ -501,7 +512,7 @@ const CalmLensAsset = defineComponent({
501
512
  "aria-busy": current.kind === "pending" ? "true" : void 0,
502
513
  style: {
503
514
  aspectRatio: ratio,
504
- backgroundColor: state.value.info?.content?.preview?.averageColor ?? void 0,
515
+ "--calmlens-average-color": state.value.info?.content?.preview?.averageColor ?? void 0,
505
516
  "--calmlens-fit": props.fit
506
517
  }
507
518
  }, [
@@ -594,4 +605,4 @@ const CalmLensAsset = defineComponent({
594
605
  };
595
606
  }
596
607
  });
597
- export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, CalmLensImageViewer, CalmLensSpreadsheetViewer, CalmLensTextViewer, CalmLensUploader, CalmLensWebsiteViewer, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload };
608
+ export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, CalmLensImageViewer, CalmLensSpreadsheetViewer, CalmLensTextViewer, CalmLensUploader, CalmLensWebsiteViewer, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, provideCalmLens, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload, withProvidedOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calmlens",
3
- "version": "0.25.0",
3
+ "version": "0.27.1",
4
4
  "description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://calmlens.com/docs/sdk/javascript",
@@ -30,12 +30,13 @@
30
30
  "prepublishOnly": "npm run check && npm run test && npm run build",
31
31
  "test": "bun test --parallel=4 ./tests/",
32
32
  "check:fix": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check --write",
33
- "check": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check",
33
+ "check": "tsc --noEmit --project tsconfig.json && tsc --project tsconfig.contract.json && npx @biomejs/biome check",
34
34
  "cleanup": "rimraf esm && rimraf cjs && rimraf bin",
35
- "build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run build:cli && npm run verify:package",
35
+ "build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run build:cli && npm run verify:package && npm run verify:types",
36
36
  "build:cli": "bun scripts/build-cli.ts",
37
37
  "build:cli:binary": "bun scripts/build-cli.ts --binary",
38
- "verify:package": "node scripts/verify-package.mjs"
38
+ "verify:package": "node scripts/verify-package.mjs",
39
+ "verify:types": "node scripts/check-minimum-typescript.mjs"
39
40
  },
40
41
  "keywords": [
41
42
  "calmlens",
@@ -62,18 +63,19 @@
62
63
  "@types/bun": "^1.4.4",
63
64
  "@types/node": "26.6.5",
64
65
  "@types/react": "19.3.0",
66
+ "hls.js": "1.7.3",
65
67
  "json-schema-to-ts": "^3.1.1",
68
+ "pdfjs-dist": "6.4.299",
66
69
  "react-native": "0.86.3",
67
70
  "rimraf": "6.1.3",
68
71
  "rolldown": "1.2.15",
69
72
  "rolldown-plugin-dts": "0.28.8",
70
73
  "svelte": "5.57.2",
71
74
  "typescript": "7.0.2",
75
+ "typescript-minimum": "npm:typescript@5.9.3",
72
76
  "vue": "3.5.44"
73
77
  },
74
78
  "dependencies": {
75
- "hls.js": "1.7.3",
76
- "pdfjs-dist": "6.4.299",
77
79
  "zod": "^4.6.7"
78
80
  },
79
81
  "exports": {
@@ -210,12 +212,20 @@
210
212
  "url": "https://github.com/CalmLens/sdks/issues"
211
213
  },
212
214
  "peerDependencies": {
215
+ "hls.js": "^1.6.0",
216
+ "pdfjs-dist": ">=5",
213
217
  "react": ">=19",
214
218
  "react-native": ">=0.79",
215
219
  "svelte": ">=5",
216
220
  "vue": ">=3.3"
217
221
  },
218
222
  "peerDependenciesMeta": {
223
+ "hls.js": {
224
+ "optional": true
225
+ },
226
+ "pdfjs-dist": {
227
+ "optional": true
228
+ },
219
229
  "react": {
220
230
  "optional": true
221
231
  },
@@ -1,353 +0,0 @@
1
- import { d as HashListEntry, u as HashList } from "./Classification-CxRedzgH-C9qlYW_J.js";
2
- import { $ as GetAssetInfoOptions, $t as UpgradePolicyOptions, Bt as SetPolicyAutomaticUpdatesOptions, Ct as ListHashListEntriesOptions, Dt as ListUploadPresetsOptions, E as BatchAssetsResponse, En as ProjectSettingsResource, Et as ListPoliciesOptions, F as ClassifyTextOptions, Ft as RequestOptions, G as EnsureLensOptions, H as DecideAssetOptions, Ht as SignUploadTokenOptions, It as ResetPolicyOptions, J as EnsureUploadPresetsOptions, Jt as UpdateFolderOptions, K as EnsureLensesOptions, Kt as SubmitAssetOptions, L as CreateFolderOptions, Ln as Policy, Lt as RetrieveAssetOptions, Mt as PolicyIdOptions, N as CdnServeOptions, Nt as PolicyPage, O as CalmLensServerClientOptions, On as UploadPreset, Ot as MoveAssetOptions, Pt as RemoveAssetContentOptions, Q as FolderPage, Qt as UpdateProjectSettingsOptions, R as CreateHashListOptions, Rt as RetryAssetOptions, St as ListFoldersOptions, T as BatchAssetsOptions, Tn as MetadataFieldsResource, Tt as ListLensesOptions, U as DeleteAssetOptions, Un as AssetInfo, Ut as SignedAssetUrl, V as CreatePolicyOptions, Vn as AssetSearchQuery, Vt as SignAssetUrlOptions, W as DeleteMetadataFieldOptions, Wt as SignedUploadToken, X as ExplainAssetOptions, Xt as UpdateLensOptions, Y as EnsureUploadPresetsResponse, Yt as UpdateHashListOptions, Z as FolderIdOptions, Zt as UpdatePolicyOptions, _ as AssetSearchResponse, _t as LensPage, a as AssetChildrenPage, bt as ListAssetsOptions, cn as WaitForAssetDecisionOptions, ct as IterateAssetsOptions, dt as IterateHashListsOptions, en as UploadAssetPartOptions, et as HashListEntryIdOptions, ft as IterateLensesOptions, g as AssetPage, gt as LensIdOptions, ht as Lens, j as CdnAssetUrlOptions, kt as MoveFolderOptions, lt as IterateFoldersOptions, mt as IterateUploadPresetsOptions, n as Asset, nn as UploadPresetIdOptions, nt as HashListIdOptions, on as VerifyWebhookSignatureOptions, ot as IterateAssetChildrenOptions, pn as GetEventsResponse, pt as IteratePoliciesOptions, q as EnsureMetadataFieldsOptions, qt as UpdateAssetOptions, rn as UploadPresetPage, rt as HashListPage, st as IterateAssetTimelineOptions, t as AddHashListEntryOptions, tt as HashListEntryPage, ut as IterateHashListEntriesOptions, vt as ListAssetChildrenOptions, w as AssignPolicyOptions, wn as Folder, wt as ListHashListsOptions, xt as ListEventsOptions, y as AssetTimelinePage, yt as ListAssetTimelineOptions, z as CreateLensOptions } from "./CalmLensTypes-BhR7LFDu.js";
3
- import "./WebhookPayload-DLGGOGW6.js";
4
- interface LensCache {
5
- readonly ensuredLenses: Map<string, Lens>;
6
- readonly pendingEnsureLenses: Map<string, Promise<void>>;
7
- }
8
- declare const inspectSymbol: unique symbol;
9
- /**
10
- * The CalmLens API client for your server, authenticated with a project API key. Create one per
11
- * project and reuse it; it holds no connections. Every method takes one options object and
12
- * throws `CalmLensError` on failure. Browsers and apps upload with `CalmLensAppClient` instead.
13
- */
14
- declare class CalmLensServerClient {
15
- #private;
16
- /**
17
- * Verifies that a webhook delivery came from CalmLens: checks the `v1=` HMAC-SHA256 in
18
- * `x-calmlens-signature` over `"<x-calmlens-timestamp>.<raw body>"` and rejects timestamps
19
- * more than `toleranceSeconds` (default 300) from now, which stops replayed deliveries.
20
- * Also exported as `verifyWebhookSignature`; `parseWebhookEvent` verifies and parses.
21
- *
22
- * @example
23
- * ```ts
24
- * const payload = await request.text();
25
- * const isValid = await CalmLensServerClient.verifyWebhookSignature({
26
- * payload,
27
- * headers: request.headers,
28
- * secret: process.env.CALMLENS_WEBHOOK_SECRET!,
29
- * });
30
- * ```
31
- */
32
- static verifyWebhookSignature(options: VerifyWebhookSignatureOptions): Promise<boolean>;
33
- constructor(options: CalmLensServerClientOptions, lenses?: LensCache);
34
- /**
35
- * A client with different cancellation, deadlines or retries for the calls made through it,
36
- * sharing this client's credentials and lens cache. This client is unchanged.
37
- */
38
- withRequestOptions(options: RequestOptions): CalmLensServerClient;
39
- /** Keeps the API key out of `console.log`, `util.inspect` and `JSON.stringify`. */
40
- [inspectSymbol](): string;
41
- toJSON(): {
42
- projectId: string;
43
- baseUrl: string;
44
- cdnBaseUrl: string;
45
- };
46
- private get projectPath();
47
- private request;
48
- private submitAsset;
49
- get cdn(): {
50
- /**
51
- * Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
52
- * beneath, or a resource URL when `resource` is given, with its lens or transform and the
53
- * viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
54
- * claims are assertions from your app; CalmLens doesn't verify them.
55
- */
56
- getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
57
- /**
58
- * Signs a private asset's URL on your server, so browsers and apps can load it without an API
59
- * key until it expires. Every resource is a path beneath it, as beneath a public asset URL;
60
- * `/original` only when signed with `original: true`. With `resource`, returns that resource's
61
- * URL beneath the grant; lenses, transforms and viewer claims are appended as `getAssetUrl`
62
- * appends them and aren't part of the signature.
63
- */
64
- signAssetUrl: (signOptions: SignAssetUrlOptions) => Promise<SignedAssetUrl>;
65
- /**
66
- * The display info of an asset URL, public or signed (`{url}/info`): its type, size,
67
- * rendered file, preview and stream, and whether the viewer its claims describe can see it.
68
- * A server can pass it to `CalmLensAsset` as `info`, so the first render is the real
69
- * element.
70
- */
71
- getAssetInfo: (url: string, options?: Omit<GetAssetInfoOptions, "fetch">) => Promise<AssetInfo>;
72
- /**
73
- * Fetches asset content or a preview from the CDN with the client's API key, and returns
74
- * a `Response` with writable headers as soon as headers arrive, so the body streams.
75
- * Non-2xx responses are returned, not thrown; `timeoutMs` covers only the wait for headers.
76
- */
77
- serve: (options: CdnServeOptions) => Promise<Response>;
78
- };
79
- get text(): {
80
- /**
81
- * Moderates text and waits for the decision. Sends `text` as `text/plain` content named
82
- * `text` unless you pass `name`.
83
- */
84
- classify: (options: ClassifyTextOptions) => Promise<Asset>;
85
- };
86
- /** Assets: uploads, moderation and management. */
87
- get assets(): {
88
- /** Searches accessible assets by keyword or a natural-language description. */
89
- search: (options: Partial<AssetSearchQuery> & {
90
- query: string;
91
- }) => Promise<AssetSearchResponse>;
92
- /** Lists one page of the project's assets, with an optional filter and sort. */
93
- list: (options?: ListAssetsOptions) => Promise<AssetPage>;
94
- /**
95
- * Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
96
- * stable when other assets are inserted or deleted.
97
- */
98
- iterate: (options?: IterateAssetsOptions) => AsyncGenerator<Asset, void, undefined>;
99
- /** Retrieves an asset with its status and classification results. */
100
- retrieve: (options: RetrieveAssetOptions) => Promise<Asset>;
101
- /** Updates an asset's editable fields. */
102
- update: (options: UpdateAssetOptions) => Promise<Asset>;
103
- /** Lists one page of the assets extracted from a website or multimedia document. */
104
- listChildren: (options?: ListAssetChildrenOptions) => Promise<AssetChildrenPage>;
105
- /**
106
- * Lists one page of an audio or video asset's findings timeline, in time order.
107
- * `classification.moderation.timeline.segmentCount` says how many segments there are.
108
- */
109
- listTimeline: (options: ListAssetTimelineOptions) => Promise<AssetTimelinePage>;
110
- /** Yields every segment of an audio or video asset's findings timeline, in time order. */
111
- iterateTimeline: (options: IterateAssetTimelineOptions) => AsyncGenerator<AssetTimelinePage["items"][number], void, undefined>;
112
- /** Yields every child of an asset, fetching pages as needed. */
113
- iterateChildren: (options: IterateAssetChildrenOptions) => AsyncGenerator<Asset, void, undefined>;
114
- /**
115
- * Uploads an asset and returns without waiting for its decision (`wait=false`), with
116
- * `classification.status` `queued`. Retried safely with an `Idempotency-Key`.
117
- */
118
- create: (options: SubmitAssetOptions) => Promise<Asset>;
119
- /**
120
- * Uploads an asset and waits for its moderation decision. Documents, websites, audio, video
121
- * and files over 20 MiB sent in parts still finish in the background and return `pending`.
122
- * Retried safely with an `Idempotency-Key`.
123
- */
124
- classify: (classifyOptions: SubmitAssetOptions) => Promise<Asset>;
125
- /**
126
- * Uploads the next part of a multipart upload. Whether the final part waits for the
127
- * decision was chosen when the upload started; pass `wait` to override it.
128
- */
129
- uploadPart: (partOptions: UploadAssetPartOptions) => Promise<Asset>;
130
- /** Moves an asset into a folder, or to the project root with `folderId: null`. */
131
- move: (options: MoveAssetOptions) => Promise<Asset>;
132
- /**
133
- * Processes an asset that failed (classification status `failed`) again. It returns to
134
- * `processing` and is
135
- * moderated like a new upload; its content must still be stored.
136
- */
137
- retry: (options: RetryAssetOptions) => Promise<Asset>;
138
- /**
139
- * Records a reviewer's decision, replacing the policy's: the asset's moderation status
140
- * becomes `decision`, the note joins its review history and the matching `asset.<status>`
141
- * event is sent. An asset still pending moderation can only be blocked or purged. Purging
142
- * needs `confirmPurge: true` and permanently deletes the stored content.
143
- */
144
- decide: (options: DecideAssetOptions) => Promise<Asset>;
145
- /**
146
- * Completes the policy evidence behind a decided asset's moderation decision: its
147
- * `classification.moderation.explanationComplete` becomes `true` and every action stays as
148
- * decided. With `rerun: true` the asset is moderated again with the project's current policy
149
- * and an `asset.rerun-requested` event is recorded; use it when the policy has changed since
150
- * the decision (`asset/policy-changed`). The asset returns unchanged: it keeps its decision
151
- * until the re-run's is stored, reported by `asset.classified` and `asset.<status>` events,
152
- * and a failed re-run keeps it. A reviewed asset fails with `asset/reviewed`, and one whose
153
- * content is gone with `asset/content-unavailable`.
154
- */
155
- explain: (options: ExplainAssetOptions) => Promise<Asset>;
156
- /**
157
- * Waits until an asset is settled, its `classification.status` `completed` (with its
158
- * decision in `classification.moderation.status`) or `failed`, and returns that asset,
159
- * checking every few seconds. A `queued` or `processing` asset is still waiting, even when a
160
- * reviewer has already decided it. Rejects with `sdk/timeout` if it is not settled within
161
- * `timeoutMs` (default 60000). Webhooks report decisions without polling.
162
- */
163
- waitForDecision: (waitOptions: WaitForAssetDecisionOptions) => Promise<Asset>;
164
- /**
165
- * Removes an asset's stored content (source, preview and retained extracted text) while
166
- * keeping the asset record, metadata and classification results. The returned asset has
167
- * `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
168
- */
169
- removeContent: (options: RemoveAssetContentOptions) => Promise<Asset>;
170
- /**
171
- * Deletes an asset record together with its stored content. An asset extracted from another
172
- * (one with a `parentId`) fails with `asset/child-not-deletable`: delete its parent instead.
173
- */
174
- delete: (options: DeleteAssetOptions) => Promise<void>;
175
- /**
176
- * Deletes up to 500 assets (`operation: "delete"`) or removes their stored content
177
- * (`"remove-content"`) in one request. Every asset must exist in the project and the key
178
- * needs `assets:delete` for its folder, and a deletion can't name an asset extracted from
179
- * another (`asset/child-not-deletable`), or nothing is queued. Resolves with
180
- * `{ batchId, status: "queued", assetCount }` once queued; the work runs in the background
181
- * and records `asset.deleted` or `asset.content-removed` for each asset, with a `batch-id`
182
- * fact naming `batchId`. Assets under a safety hold are skipped. Not retried: it carries no
183
- * `Idempotency-Key`.
184
- */
185
- batch: (options: BatchAssetsOptions) => Promise<BatchAssetsResponse>;
186
- };
187
- /**
188
- * Signs upload tokens on your server, so a browser or app can upload through an upload preset
189
- * that requires one. Signing happens locally with your API key: it makes no request.
190
- */
191
- get uploadTokens(): {
192
- /**
193
- * Signs a single-use token for one upload through `uploadPresetId`. Give `token` to the
194
- * browser or app, which passes it to `CalmLensAppClient` as `token`.
195
- */
196
- sign: (options: SignUploadTokenOptions) => Promise<SignedUploadToken>;
197
- };
198
- private buildAssets;
199
- get events(): {
200
- /**
201
- * Lists project events after a cursor, oldest first. Call without `cursor` to get a cursor
202
- * for "now", then poll with each response's `nextCursor`. Webhook deliveries carry each
203
- * event's same fields as a flat JSON body. `types` and `assetId` narrow the feed to some
204
- * event types or one asset's events; a cursor belongs to the filters it was issued with, so
205
- * pass the same ones with each `cursor`.
206
- */
207
- list: (options?: ListEventsOptions) => Promise<GetEventsResponse>;
208
- /**
209
- * Yields pages of events after `cursor` until no more are waiting. Save each page's
210
- * `nextCursor` to resume later. Without `cursor`, yields one empty page whose `nextCursor`
211
- * is "now".
212
- */
213
- pages: (options?: ListEventsOptions) => AsyncGenerator<GetEventsResponse, void, undefined>;
214
- };
215
- private iterateEventPages;
216
- private iteratePages;
217
- get folders(): {
218
- /**
219
- * Lists one page of child folders, sorted by name unless `sort` says otherwise. Pass
220
- * `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
221
- */
222
- list: (options?: ListFoldersOptions) => Promise<FolderPage>;
223
- /** Yields every child folder of `parentId` (or the project root), fetching pages as needed. */
224
- iterate: (options?: IterateFoldersOptions) => AsyncGenerator<Folder, void, undefined>;
225
- retrieve: (options: FolderIdOptions) => Promise<Folder>;
226
- /** Creates a folder at the project root or inside `parentId`. */
227
- create: (options: CreateFolderOptions) => Promise<Folder>;
228
- update: (options: UpdateFolderOptions) => Promise<Folder>;
229
- /** Deletes an empty folder; throws `folder/not-empty` otherwise. */
230
- delete: (options: FolderIdOptions) => Promise<void>;
231
- /** Moves a folder under `parentId`, or to the project root with `parentId: null`. */
232
- move: (options: MoveFolderOptions) => Promise<Folder>;
233
- };
234
- /**
235
- * Hash lists hold PDQ hashes of images the project never wants again. Image uploads are
236
- * compared with every list: `flag` lists record matches, `block` lists also block close ones.
237
- */
238
- get hashLists(): {
239
- /** Lists one page of the project's hash lists, newest first unless `sort` says otherwise. */
240
- list: (options?: ListHashListsOptions) => Promise<HashListPage>;
241
- /** Yields every hash list, fetching pages as needed. */
242
- iterate: (options?: IterateHashListsOptions) => AsyncGenerator<HashList, void, undefined>;
243
- retrieve: (options: HashListIdOptions) => Promise<HashList>;
244
- create: (options: CreateHashListOptions) => Promise<HashList>;
245
- /** Renames a list or changes its action; the new action applies to later uploads. */
246
- update: (options: UpdateHashListOptions) => Promise<HashList>;
247
- /** Deletes the list and every entry in it. */
248
- delete: (options: HashListIdOptions) => Promise<void>;
249
- /** Yields every entry of a list, fetching pages as needed. */
250
- iterateEntries: (options: IterateHashListEntriesOptions) => AsyncGenerator<HashListEntry, void, undefined>;
251
- /** Lists one page of a list's entries, newest first unless `sort` says otherwise. */
252
- listEntries: (options: ListHashListEntriesOptions) => Promise<HashListEntryPage>;
253
- /** Adds a hash, or an image asset's hash; a hash already in the list returns its entry. */
254
- addEntry: (options: AddHashListEntryOptions) => Promise<HashListEntry>;
255
- removeEntry: (options: HashListEntryIdOptions) => Promise<void>;
256
- };
257
- /**
258
- * Moderation policies belong to the organisation and its projects share them. Every change sends
259
- * the policy's `revision`, so a policy changed since is refused. Through a project's key you can
260
- * change only policies no other project uses.
261
- */
262
- get policies(): {
263
- /** Lists one page of the organisation's policies, oldest first unless `sort` says otherwise. */
264
- list: (options?: ListPoliciesOptions) => Promise<PolicyPage>;
265
- /** Yields every policy of the organisation, fetching pages as needed. */
266
- iterate: (options?: IteratePoliciesOptions) => AsyncGenerator<Policy, void, undefined>;
267
- retrieve: (options: PolicyIdOptions) => Promise<Policy>;
268
- /** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
269
- create: (options: CreatePolicyOptions) => Promise<Policy>;
270
- /** Changes the name, description or settings; later moderation uses them. */
271
- update: (options: UpdatePolicyOptions) => Promise<Policy>;
272
- /** Restores the settings of the preset release a `pinned` or `copy` policy is pinned to. */
273
- reset: (options: ResetPolicyOptions) => Promise<Policy>;
274
- /** Moves an unchanged `pinned` or `copy` policy to the latest release of its preset. */
275
- upgrade: (options: UpgradePolicyOptions) => Promise<Policy>;
276
- /** Switches automatic updates on (`live`) or off (`pinned`) for the organisation's own preset policy. */
277
- setAutomaticUpdates: (options: SetPolicyAutomaticUpdatesOptions) => Promise<Policy>;
278
- /** Deletes a policy that no project or upload preset uses. */
279
- delete: (options: PolicyIdOptions) => Promise<void>;
280
- /** The policy the project moderates with. */
281
- retrieveAssigned: () => Promise<Policy>;
282
- /** Chooses the policy the project moderates with. */
283
- assign: (options: AssignPolicyOptions) => Promise<Policy>;
284
- };
285
- /**
286
- * The project's upload presets: the rules for uploads from browsers and apps. `ensure` creates or
287
- * replaces presets by key, for deploys that declare them in code; send each preset's `revision`
288
- * to refuse a change made since you read it.
289
- */
290
- get uploadPresets(): {
291
- /** Lists one page of the project's upload presets, oldest first unless `sort` says otherwise. */
292
- list: (options?: ListUploadPresetsOptions) => Promise<UploadPresetPage>;
293
- /** Yields every upload preset of the project, fetching pages as needed. */
294
- iterate: (options?: IterateUploadPresetsOptions) => AsyncGenerator<UploadPreset, void, undefined>;
295
- /**
296
- * Creates each preset, or replaces it with the definition sent, by key. Every preset is
297
- * checked before any is saved. Returns the stored presets in the order sent.
298
- */
299
- ensure: (options: EnsureUploadPresetsOptions) => Promise<EnsureUploadPresetsResponse>;
300
- /** Deletes an upload preset; assets already uploaded through it stay. */
301
- delete: (options: UploadPresetIdOptions) => Promise<void>;
302
- };
303
- /**
304
- * The project's settings, with defaults filled in. `update` replaces them: settings left out
305
- * return to their defaults. Send the `revision` you read to refuse a change made since.
306
- */
307
- get projectSettings(): {
308
- get: () => Promise<ProjectSettingsResource>;
309
- update: (options: UpdateProjectSettingsOptions) => Promise<ProjectSettingsResource>;
310
- };
311
- /**
312
- * The project's metadata fields. They share the project settings' `revision`; `ensure` creates
313
- * or replaces fields by ID and keeps the others.
314
- */
315
- get metadataFields(): {
316
- list: () => Promise<MetadataFieldsResource>;
317
- ensure: (options: EnsureMetadataFieldsOptions) => Promise<MetadataFieldsResource>;
318
- /** Deletes a field definition; assets keep their values. */
319
- delete: (options: DeleteMetadataFieldOptions) => Promise<void>;
320
- };
321
- /**
322
- * The project's lenses: named image transforms the CDN applies at `/@<identifier>`. The CDN
323
- * serves files made with each lens's current definition. `ensureLenses` creates or changes
324
- * lenses by identifier, for applications that declare theirs in code.
325
- */
326
- get lenses(): {
327
- /** Lists one page of the project's lenses, newest first unless `sort` says otherwise. */
328
- list: (options?: ListLensesOptions) => Promise<LensPage>;
329
- /** Yields every lens of the project, fetching pages as needed. */
330
- iterate: (options?: IterateLensesOptions) => AsyncGenerator<Lens, void, undefined>;
331
- /** Creates a lens; its identifier must be new to the project. */
332
- create: (options: CreateLensOptions) => Promise<Lens>;
333
- retrieve: (options: LensIdOptions) => Promise<Lens>;
334
- /** Changes a lens's name, description, type, transform or whether the CDN serves it. */
335
- update: (options: UpdateLensOptions) => Promise<Lens>;
336
- /** Deletes a lens; URLs that select it stop being served. */
337
- delete: (options: LensIdOptions) => Promise<void>;
338
- };
339
- /**
340
- * Creates a named lens, or changes it to this definition. Sending the same definition again
341
- * returns the lens unchanged, from the client's lens cache once it has seen it.
342
- */
343
- ensureLens(options: EnsureLensOptions): Promise<Lens>;
344
- /**
345
- * Create or update several named lenses. New definitions are sent in one API request, or in
346
- * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
347
- * Each lens is created or changed as ensureLens() does.
348
- */
349
- ensureLenses(options: EnsureLensesOptions): Promise<Lens[]>;
350
- private submitEnsureLenses;
351
- private submitEnsureLensesChunk;
352
- }
353
- export { CalmLensServerClient as t };
@@ -1,17 +0,0 @@
1
- import { I as UploadSnapshot, M as UploadController, N as UploadControllerOptions, P as UploadFile } from "./Core-DSMxC2GL.js";
2
- interface UseCalmLensUploadResult<F extends UploadFile = UploadFile> extends UploadSnapshot<F> {
3
- controller: UploadController<F>;
4
- addFiles: UploadController<F>["addFiles"];
5
- retry: UploadController<F>["retry"];
6
- cancel: UploadController<F>["cancel"];
7
- remove: UploadController<F>["remove"];
8
- clear: UploadController<F>["clear"];
9
- start: UploadController<F>["start"];
10
- }
11
- /**
12
- * Uploads files through an upload preset and re-renders as each one uploads and is checked. Use
13
- * it to build your own upload UI; `CalmLensUploader` is built on it. Uploads still running when
14
- * the component unmounts are cancelled.
15
- */
16
- declare const useCalmLensUpload: <F extends UploadFile = UploadFile>(options: UploadControllerOptions<F>) => UseCalmLensUploadResult<F>;
17
- export { useCalmLensUpload as n, UseCalmLensUploadResult as t };