calmlens 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bin/calmlens.js +594 -88
- package/{esm/BrowserUpload-D-NnAN7g.d.ts → cjs/BrowserUpload-B2kmc3Y_.d.ts} +2 -2
- package/cjs/{BrowserUpload-CeSwiMo5.js → BrowserUpload-B5IJpb8m.js} +1 -1
- package/{esm/CalmLensAppClient-gG16T2py.d.ts → cjs/CalmLensAppClient-CMVh0y5w.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-0UVCuNqW.js → CalmLensAppClient-DWClthAd.js} +3 -3
- package/cjs/{CalmLensOptionKeys-CYY6elxg.js → CalmLensOptionKeys-DsPvFCox.js} +139 -31
- package/cjs/{CalmLensServerClient-nfu6_YEW.js → CalmLensServerClient-B35N3hCo.js} +66 -9
- package/cjs/{CalmLensServerClient-BHx3x_nZ.d.ts → CalmLensServerClient-izj412cc.d.ts} +43 -7
- package/cjs/{CalmLensTypes-CUB0YYVz.d.ts → CalmLensTypes-SmOCgKI3.d.ts} +858 -70
- package/cjs/{Classification-Q5zGpR8l-CEWjnE39.d.ts → Classification-CxRedzgH-C9qlYW_J.d.ts} +35 -0
- package/cjs/{Core-Dc3cteU7.js → Core-5Mrihf2l.js} +10 -7
- package/{esm/Core-C82YmjjX.d.ts → cjs/Core-Dt_HUNvH.d.ts} +9 -5
- package/cjs/{ModerationContextLimits-BxOmeSqq.js → ModerationContextLimits-Bm8DxcJ_.js} +64 -12
- package/cjs/{ReactUpload-BK2O3dnK.js → ReactUpload-BJCjlqEb.js} +1 -1
- package/cjs/{ReactUpload-DiiXfKvj.d.ts → ReactUpload-Bd7Hea4w.d.ts} +1 -1
- package/{esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts → cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts} +7 -5
- package/cjs/{TestTriggers-BTyXtX0Q-ATuFDhLX.js → TestTriggers-CiFcTHX3-BmfH4J3f.js} +35 -22
- package/cjs/{UploadController-DLyiLDTB.js → UploadController-DoD51qnV.js} +2 -2
- package/{esm/WebhookPayload-BLT2y_Jy.d.ts → cjs/WebhookPayload-C7KAk3iR.d.ts} +28 -1
- package/cjs/app.d.ts +6 -6
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/{esm/index-CKRgjV16.d.ts → cjs/index-BJf0y_Uk.d.ts} +3 -3
- package/cjs/index.d.ts +5 -5
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +3 -3
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +6 -6
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.d.ts +1 -1
- package/cjs/test-inputs.js +13 -13
- package/cjs/testing.d.ts +22 -9
- package/cjs/testing.js +399 -57
- package/cjs/{ui-CTBUxnVp.d.ts → ui-DNXPuzha.d.ts} +2 -2
- package/cjs/{ui-CZ8exACq.js → ui-DPLnhovP.js} +3 -3
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/{cjs/BrowserUpload-D-NnAN7g.d.ts → esm/BrowserUpload-B2kmc3Y_.d.ts} +2 -2
- package/esm/{BrowserUpload-i9OhCzMJ.js → BrowserUpload-BheeMat4.js} +1 -1
- package/{cjs/CalmLensAppClient-gG16T2py.d.ts → esm/CalmLensAppClient-CMVh0y5w.d.ts} +1 -1
- package/esm/{CalmLensAppClient-CK4_Py0c.js → CalmLensAppClient-D51UlnU3.js} +3 -3
- package/esm/{CalmLensOptionKeys-BGZlIsT2.js → CalmLensOptionKeys-BmYuSh9G.js} +139 -31
- package/esm/{CalmLensServerClient-dAQUcDWb.js → CalmLensServerClient-CJCjmAXh.js} +66 -9
- package/esm/{CalmLensServerClient-BHx3x_nZ.d.ts → CalmLensServerClient-izj412cc.d.ts} +43 -7
- package/esm/{CalmLensTypes-CUB0YYVz.d.ts → CalmLensTypes-SmOCgKI3.d.ts} +858 -70
- package/esm/{Classification-Q5zGpR8l-CEWjnE39.d.ts → Classification-CxRedzgH-C9qlYW_J.d.ts} +35 -0
- package/esm/{Core-BxeIud_S.js → Core-5A2CZKsC.js} +10 -7
- package/{cjs/Core-C82YmjjX.d.ts → esm/Core-Dt_HUNvH.d.ts} +9 -5
- package/esm/{ModerationContextLimits-B6_RalCQ.js → ModerationContextLimits-DeqK3UAt.js} +64 -12
- package/esm/{ReactUpload-DiiXfKvj.d.ts → ReactUpload-Bd7Hea4w.d.ts} +1 -1
- package/esm/{ReactUpload-DxwVqfX1.js → ReactUpload-OkhH4jXm.js} +1 -1
- package/{cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts → esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts} +7 -5
- package/esm/{TestTriggers-BTyXtX0Q-GRB9jQwo.js → TestTriggers-CiFcTHX3-BK2-sgOC.js} +35 -22
- package/esm/{UploadController-D9Z-h00Q.js → UploadController-BssSSy8Y.js} +2 -2
- package/{cjs/WebhookPayload-BLT2y_Jy.d.ts → esm/WebhookPayload-C7KAk3iR.d.ts} +28 -1
- package/esm/app.d.ts +6 -6
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/{cjs/index-CKRgjV16.d.ts → esm/index-BJf0y_Uk.d.ts} +3 -3
- package/esm/index.d.ts +5 -5
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +3 -3
- package/esm/react.js +5 -5
- package/esm/server.d.ts +6 -6
- package/esm/server.js +2 -2
- package/esm/test-inputs.d.ts +1 -1
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +22 -9
- package/esm/testing.js +393 -51
- package/esm/{ui-Cr7s6JHm.js → ui-CZVG46z9.js} +3 -3
- package/esm/{ui-CTBUxnVp.d.ts → ui-DNXPuzha.d.ts} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
2
|
-
import { G as AssetSession, W as AssetOptions, Y as AssetView, at as ImageViewerOptions, ct as TextViewerOptions, ft as WebsiteViewerOptions, it as DocumentViewerOptions, ot as PdfAssetOptions, st as SpreadsheetViewerOptions, ut as ViewerOptions } from "./Core-
|
|
1
|
+
import "./CalmLensTypes-SmOCgKI3.js";
|
|
2
|
+
import { G as AssetSession, W as AssetOptions, Y as AssetView, at as ImageViewerOptions, ct as TextViewerOptions, ft as WebsiteViewerOptions, it as DocumentViewerOptions, ot as PdfAssetOptions, st as SpreadsheetViewerOptions, ut as ViewerOptions } from "./Core-Dt_HUNvH.js";
|
|
3
3
|
import "pdfjs-dist";
|
|
4
4
|
/** A viewer mounted into an element, which it owns the children of. */
|
|
5
5
|
interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_UploadController = require("./UploadController-
|
|
3
|
-
require("./Core-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-Bm8DxcJ_.js");
|
|
2
|
+
const require_UploadController = require("./UploadController-DoD51qnV.js");
|
|
3
|
+
require("./Core-5Mrihf2l.js");
|
|
4
4
|
// src/ui/viewers/PdfLoader.ts
|
|
5
5
|
let loading;
|
|
6
6
|
/**
|
package/cjs/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as getAssetViewKey, A as CustomUploadResult, B as AssetDisplay, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as AssetSession, H as AssetImageOptions, I as UploadSnapshot, J as AssetVideoOptions, K as AssetSessionState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, Q as getAssetView, R as createUploadController, 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, h as UploaderProps, 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-
|
|
2
|
-
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-
|
|
1
|
+
import { $ as getAssetViewKey, A as CustomUploadResult, B as AssetDisplay, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as AssetSession, H as AssetImageOptions, I as UploadSnapshot, J as AssetVideoOptions, K as AssetSessionState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, Q as getAssetView, R as createUploadController, 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, h as UploaderProps, 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-Dt_HUNvH.js";
|
|
2
|
+
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-DNXPuzha.js";
|
|
3
3
|
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 };
|
package/cjs/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_UploadController = require("./UploadController-
|
|
4
|
-
const require_Core = require("./Core-
|
|
2
|
+
const require_ui = require("./ui-DPLnhovP.js");
|
|
3
|
+
const require_UploadController = require("./UploadController-DoD51qnV.js");
|
|
4
|
+
const require_Core = require("./Core-5Mrihf2l.js");
|
|
5
5
|
exports.ASSET_FILE_ICON_SIZE = require_Core.ASSET_FILE_ICON_SIZE;
|
|
6
6
|
exports.ASSET_VIEWERS = require_ui.ASSET_VIEWERS;
|
|
7
7
|
exports.AssetSession = require_Core.AssetSession;
|
package/cjs/vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as CalmLensAppClientOptions,
|
|
2
|
-
import "./index-
|
|
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-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
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-
|
|
1
|
+
import { D as CalmLensAppClientOptions, h as AssetModerationStatus, r as AssetAvailability, sn as ViewerClaims } from "./CalmLensTypes-SmOCgKI3.js";
|
|
2
|
+
import "./index-BJf0y_Uk.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-Dt_HUNvH.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-B2kmc3Y_.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-DNXPuzha.js";
|
|
6
6
|
import { 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<{
|
package/cjs/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_UploadController = require("./UploadController-
|
|
4
|
-
const require_Core = require("./Core-
|
|
2
|
+
const require_ui = require("./ui-DPLnhovP.js");
|
|
3
|
+
const require_UploadController = require("./UploadController-DoD51qnV.js");
|
|
4
|
+
const require_Core = require("./Core-5Mrihf2l.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-B5IJpb8m.js");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
// src/viewers/Vue.ts
|
|
9
9
|
const optional$1 = (type) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as UploadItem$1, I as UploadSnapshot$1, M as UploadController, N as UploadControllerOptions$1, O as CalmLensUpload$1, P as UploadFile, h as UploaderProps$1 } from "./Core-
|
|
2
|
-
import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-
|
|
1
|
+
import { F as UploadItem$1, I as UploadSnapshot$1, M as UploadController, N as UploadControllerOptions$1, O as CalmLensUpload$1, P as UploadFile, h as UploaderProps$1 } from "./Core-Dt_HUNvH.js";
|
|
2
|
+
import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-Bd7Hea4w.js";
|
|
3
3
|
type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
|
|
4
4
|
type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
|
|
5
5
|
type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createUploadController$1 } from "./UploadController-
|
|
1
|
+
import { n as createUploadController$1 } from "./UploadController-BssSSy8Y.js";
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => createUploadController$1(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as CalmLensAppClientOptions,
|
|
1
|
+
import { D as CalmLensAppClientOptions, Lt as RetrieveAssetOptions, an as UploadedAsset, en as UploadAssetPartOptions, in as UploadPresetSubmitAssetOptions, j as CdnAssetUrlOptions } from "./CalmLensTypes-SmOCgKI3.js";
|
|
2
2
|
declare const inspectSymbol: unique symbol;
|
|
3
3
|
/**
|
|
4
4
|
* The CalmLens client for browsers and React Native apps. It uploads through an upload preset,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as invalidArgument, S as validateAppClientOptions, V as invalidConfig, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-
|
|
2
|
-
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-
|
|
1
|
+
import { B as invalidArgument, S as validateAppClientOptions, V as invalidConfig, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-DeqK3UAt.js";
|
|
2
|
+
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-BmYuSh9G.js";
|
|
3
3
|
// src/client/CalmLensAppClient.ts
|
|
4
4
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
5
5
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -74,7 +74,7 @@ var CalmLensAppClient = class {
|
|
|
74
74
|
});
|
|
75
75
|
return expectUploadedAsset(data);
|
|
76
76
|
}
|
|
77
|
-
const data = await this.#connection.
|
|
77
|
+
const data = await this.#connection.submitUpload(this.uploadsPath, options, wait, token ? { Authorization: `Bearer ${token}` } : {});
|
|
78
78
|
const uploaded = expectUploadedAsset(data);
|
|
79
79
|
if (token) this.#uploadTokens.set(uploaded.id, token);
|
|
80
80
|
return uploaded;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as getRejectedUploadMimeTypeError, B as invalidArgument, D as MAX_DIRECT_IMAGE_UPLOAD_BYTES, H as API_ERROR_CODES, M as CalmLensTransport, N as sleep, O as MAX_IMAGE_UPLOAD_BYTES, R as CalmLensError, _ as randomUuid, k as MAX_NON_IMAGE_UPLOAD_BYTES, m as isAcceptedUploadMimeType, r as selectModerationContextItems, y as stringifyQuery, z as SDK_ERROR_CODES } from "./ModerationContextLimits-
|
|
1
|
+
import { A as getRejectedUploadMimeTypeError, B as invalidArgument, D as MAX_DIRECT_IMAGE_UPLOAD_BYTES, H as API_ERROR_CODES, M as CalmLensTransport, N as sleep, O as MAX_IMAGE_UPLOAD_BYTES, R as CalmLensError, _ as randomUuid, k as MAX_NON_IMAGE_UPLOAD_BYTES, m as isAcceptedUploadMimeType, r as selectModerationContextItems, y as stringifyQuery, z as SDK_ERROR_CODES } from "./ModerationContextLimits-DeqK3UAt.js";
|
|
2
2
|
// src/contract/AssetPayload.js
|
|
3
3
|
const bufferInputToBytes = (value) => {
|
|
4
4
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -135,18 +135,97 @@ const splitsIntoParts = (content, partSizeBytes) => {
|
|
|
135
135
|
* build a Blob from bytes, and every fetch accepts a Uint8Array.
|
|
136
136
|
*/
|
|
137
137
|
const toBodyBytes = (value) => value.buffer instanceof ArrayBuffer ? value : Uint8Array.from(value);
|
|
138
|
-
|
|
138
|
+
/** The bytes of an upload's content or part, as a Blob, bytes or a one-shot stream. */
|
|
139
|
+
const toUploadData = (payload) => {
|
|
139
140
|
const data = assetToData(payload);
|
|
140
141
|
if (data instanceof Response) {
|
|
141
142
|
if (!data.body) throw new CalmLensError(API_ERROR_CODES.INVALID_UPLOAD_PAYLOAD, { message: "Response upload data must have a body" });
|
|
142
143
|
return data.body;
|
|
143
144
|
}
|
|
144
|
-
if (data instanceof
|
|
145
|
+
if (data instanceof Blob) return data;
|
|
146
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
145
147
|
if ("getReader" in data) return data;
|
|
146
148
|
return toBodyBytes(data);
|
|
147
149
|
};
|
|
150
|
+
/** An upload's bytes as a raw part body (parts after the first carry no options). */
|
|
151
|
+
const toRawUploadBody = (payload) => toUploadData(payload);
|
|
152
|
+
const textEncoder = new TextEncoder();
|
|
153
|
+
/**
|
|
154
|
+
* An upload form: `multipart/form-data` with the asset's fields as the JSON `options` part, then
|
|
155
|
+
* the bytes as the `file` part. Asset fields never go in the URL, which proxies and servers log.
|
|
156
|
+
* Bytes stay bytes (React Native can't build a Blob from them), a Blob stays a Blob, and a stream
|
|
157
|
+
* is wrapped so the file is still sent as it is read.
|
|
158
|
+
*/
|
|
159
|
+
const toUploadForm = (options, payload) => {
|
|
160
|
+
const boundary = `calmlens-${randomUuid()}`;
|
|
161
|
+
const head = `--${boundary}\r\nContent-Disposition: form-data; name="options"\r\nContent-Type: application/json\r\n\r\n${JSON.stringify(options)}\r\n--${boundary}\r\nContent-Disposition: form-data; name="file"\r\nContent-Type: ${payload.type.replace(/[\r\n]/g, "")}\r\n\r\n`;
|
|
162
|
+
const tail = `\r\n--${boundary}--\r\n`;
|
|
163
|
+
const contentType = `multipart/form-data; boundary=${boundary}`;
|
|
164
|
+
const data = toUploadData(payload);
|
|
165
|
+
if (data instanceof Blob) return {
|
|
166
|
+
body: new Blob([
|
|
167
|
+
head,
|
|
168
|
+
data,
|
|
169
|
+
tail
|
|
170
|
+
]),
|
|
171
|
+
contentType
|
|
172
|
+
};
|
|
173
|
+
const headBytes = textEncoder.encode(head);
|
|
174
|
+
const tailBytes = textEncoder.encode(tail);
|
|
175
|
+
if (data instanceof Uint8Array) {
|
|
176
|
+
const body = new Uint8Array(headBytes.length + data.length + tailBytes.length);
|
|
177
|
+
body.set(headBytes);
|
|
178
|
+
body.set(data, headBytes.length);
|
|
179
|
+
body.set(tailBytes, headBytes.length + data.length);
|
|
180
|
+
return {
|
|
181
|
+
body,
|
|
182
|
+
contentType
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
const reader = data.getReader();
|
|
186
|
+
let stage = "head";
|
|
187
|
+
return {
|
|
188
|
+
body: new ReadableStream({
|
|
189
|
+
async pull(controller) {
|
|
190
|
+
if (stage === "head") {
|
|
191
|
+
stage = "file";
|
|
192
|
+
controller.enqueue(headBytes);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (stage === "done") return;
|
|
196
|
+
const { done, value } = await reader.read();
|
|
197
|
+
if (!done) {
|
|
198
|
+
if (value.byteLength) controller.enqueue(value);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
stage = "done";
|
|
202
|
+
controller.enqueue(tailBytes);
|
|
203
|
+
controller.close();
|
|
204
|
+
},
|
|
205
|
+
cancel: (reason) => reader.cancel(reason)
|
|
206
|
+
}),
|
|
207
|
+
contentType
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
/** The options an upload sends, without the transport ones and without empty values. */
|
|
211
|
+
const uploadFields = (options) => Object.fromEntries(UPLOAD_OPTION_KEYS.flatMap((key) => options[key] === void 0 || options[key] === null ? [] : [[key, options[key]]]));
|
|
212
|
+
/** The asset fields an upload carries in its body: the API refuses them in the query string. */
|
|
213
|
+
const UPLOAD_OPTION_KEYS = [
|
|
214
|
+
"name",
|
|
215
|
+
"description",
|
|
216
|
+
"processingOptions",
|
|
217
|
+
"visibility",
|
|
218
|
+
"metadata",
|
|
219
|
+
"tags",
|
|
220
|
+
"authorId",
|
|
221
|
+
"context",
|
|
222
|
+
"externalId",
|
|
223
|
+
"externalUrl",
|
|
224
|
+
"folderId",
|
|
225
|
+
"uploadPresetId"
|
|
226
|
+
];
|
|
148
227
|
const setOptionalQueryValue = (params, key, value) => {
|
|
149
|
-
if (value !== void 0 && value !== null) params.set(key,
|
|
228
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
150
229
|
};
|
|
151
230
|
const assertValidUploadMimeType = (mimeType) => {
|
|
152
231
|
if (!isAcceptedUploadMimeType(mimeType)) throw new CalmLensError(API_ERROR_CODES.UNSUPPORTED_UPLOAD_TYPE, {
|
|
@@ -313,54 +392,62 @@ var CalmLensConnection = class {
|
|
|
313
392
|
deadline: "body"
|
|
314
393
|
});
|
|
315
394
|
}
|
|
316
|
-
upload(url,
|
|
395
|
+
upload(url, body, headers, idempotencyKey, text) {
|
|
317
396
|
return this.transport.json({
|
|
318
397
|
method: "POST",
|
|
319
398
|
url,
|
|
320
399
|
headers,
|
|
321
|
-
body
|
|
400
|
+
body,
|
|
322
401
|
idempotencyKey,
|
|
323
|
-
timeoutMs:
|
|
402
|
+
timeoutMs: text ? this.timeoutMs : this.options.uploadTimeoutMs,
|
|
324
403
|
deadline: "body",
|
|
325
404
|
fetch: this.options.uploadFetch
|
|
326
405
|
});
|
|
327
406
|
}
|
|
328
407
|
/**
|
|
329
|
-
* Uploads file content or a first multipart part to `uploadsPath` (`.../assets`)
|
|
330
|
-
*
|
|
408
|
+
* Uploads file content or a first multipart part to `uploadsPath` (`.../assets`). Plain text
|
|
409
|
+
* goes as a JSON body; other content as an upload form, the asset's fields in its options part
|
|
410
|
+
* and the bytes in its file part. Either way the query holds only transport values.
|
|
331
411
|
*/
|
|
332
|
-
|
|
333
|
-
const query = new URLSearchParams();
|
|
334
|
-
query.set("name", options.name);
|
|
335
|
-
query.set("wait", String(wait));
|
|
336
|
-
setOptionalQueryValue(query, "description", options.description);
|
|
337
|
-
setOptionalQueryValue(query, "processingOptions", options.processingOptions);
|
|
338
|
-
setOptionalQueryValue(query, "visibility", options.visibility);
|
|
339
|
-
setOptionalQueryValue(query, "metadata", options.metadata);
|
|
340
|
-
setOptionalQueryValue(query, "tags", options.tags);
|
|
341
|
-
setOptionalQueryValue(query, "authorId", options.authorId);
|
|
342
|
-
setOptionalQueryValue(query, "context", options.context);
|
|
343
|
-
setOptionalQueryValue(query, "externalId", options.externalId);
|
|
344
|
-
setOptionalQueryValue(query, "externalUrl", options.externalUrl);
|
|
345
|
-
setOptionalQueryValue(query, "folderId", options.folderId);
|
|
346
|
-
setOptionalQueryValue(query, "uploadPresetId", options.uploadPresetId);
|
|
412
|
+
submitUpload(uploadsPath, options, wait, authHeaders = {}) {
|
|
347
413
|
const isMultipart = "part" in options;
|
|
348
414
|
const payload = isMultipart ? options.part : options.content;
|
|
415
|
+
const multipartOptions = options;
|
|
416
|
+
const idempotencyKey = options.idempotencyKey ?? newIdempotencyKey();
|
|
417
|
+
const fields = uploadFields(options);
|
|
418
|
+
if (isTextPayload(payload)) {
|
|
419
|
+
const { sizeInBytes: _size, ...text } = payload;
|
|
420
|
+
const body = isMultipart ? {
|
|
421
|
+
...fields,
|
|
422
|
+
part: text,
|
|
423
|
+
...multipartOptions.sizeInBytes === void 0 ? {} : { sizeInBytes: multipartOptions.sizeInBytes },
|
|
424
|
+
...multipartOptions.totalSizeInBytes === void 0 ? {} : { totalSizeInBytes: multipartOptions.totalSizeInBytes }
|
|
425
|
+
} : {
|
|
426
|
+
...fields,
|
|
427
|
+
content: text
|
|
428
|
+
};
|
|
429
|
+
return this.upload(this.url(uploadsPath, { wait }), JSON.stringify(body), {
|
|
430
|
+
...authHeaders,
|
|
431
|
+
"Content-Type": "application/json"
|
|
432
|
+
}, idempotencyKey, true);
|
|
433
|
+
}
|
|
434
|
+
const query = new URLSearchParams();
|
|
435
|
+
query.set("wait", String(wait));
|
|
349
436
|
query.set("contentType", payload.type);
|
|
350
437
|
setOptionalQueryValue(query, "sizeInBytes", payload.sizeInBytes ?? getAssetPayloadByteLength(payload));
|
|
351
438
|
if (isMultipart) {
|
|
352
439
|
const part = payload;
|
|
353
|
-
const multipartOptions = options;
|
|
354
440
|
query.set("partNumber", String(part.partNumber ?? 1));
|
|
355
441
|
query.set("isFinal", String(part.isFinal ?? false));
|
|
356
442
|
setOptionalQueryValue(query, "sizeInBytes", part.sizeInBytes ?? multipartOptions.sizeInBytes);
|
|
357
443
|
setOptionalQueryValue(query, "totalSizeInBytes", multipartOptions.totalSizeInBytes);
|
|
358
444
|
}
|
|
359
|
-
|
|
445
|
+
const form = toUploadForm(fields, payload);
|
|
446
|
+
return this.upload(this.url(`${uploadsPath}?${query}`), form.body, {
|
|
360
447
|
...authHeaders,
|
|
361
|
-
"Content-Type":
|
|
448
|
+
"Content-Type": form.contentType,
|
|
362
449
|
"X-CalmLens-Upload": isMultipart ? "part" : "content"
|
|
363
|
-
},
|
|
450
|
+
}, idempotencyKey, false);
|
|
364
451
|
}
|
|
365
452
|
/** Content larger than this is uploaded in parts. */
|
|
366
453
|
get partSizeBytes() {
|
|
@@ -380,7 +467,7 @@ var CalmLensConnection = class {
|
|
|
380
467
|
const count = Math.ceil(source.size / partSize);
|
|
381
468
|
const key = idempotencyKey ?? newIdempotencyKey();
|
|
382
469
|
const part = (partNumber) => source.slice((partNumber - 1) * partSize, Math.min(partNumber * partSize, source.size));
|
|
383
|
-
const first = await this.
|
|
470
|
+
const first = await this.submitUpload(uploadsPath, {
|
|
384
471
|
...fields,
|
|
385
472
|
part: {
|
|
386
473
|
...part(1),
|
|
@@ -434,10 +521,10 @@ var CalmLensConnection = class {
|
|
|
434
521
|
});
|
|
435
522
|
if (wait !== void 0) query.set("wait", String(wait));
|
|
436
523
|
setOptionalQueryValue(query, "sizeInBytes", part.sizeInBytes ?? getAssetPayloadByteLength(part));
|
|
437
|
-
return this.upload(this.url(`${partPath}?${query}`), part, {
|
|
524
|
+
return this.upload(this.url(`${partPath}?${query}`), toRawUploadBody(part), {
|
|
438
525
|
...authHeaders,
|
|
439
526
|
"X-CalmLens-Upload": "part"
|
|
440
|
-
}, idempotencyKey ?? newIdempotencyKey());
|
|
527
|
+
}, idempotencyKey ?? newIdempotencyKey(), isTextPayload(part));
|
|
441
528
|
}
|
|
442
529
|
};
|
|
443
530
|
// src/client/CalmLensOptionKeys.ts
|
|
@@ -672,6 +759,9 @@ const SERVER_OPTION_KEYS = {
|
|
|
672
759
|
"transform",
|
|
673
760
|
"type"
|
|
674
761
|
],
|
|
762
|
+
"metadataFields.delete": ["fieldId", "revision"],
|
|
763
|
+
"metadataFields.ensure": ["fields", "revision"],
|
|
764
|
+
"metadataFields.list": [],
|
|
675
765
|
"policies.assign": ["policyId"],
|
|
676
766
|
"policies.create": [
|
|
677
767
|
"description",
|
|
@@ -715,6 +805,12 @@ const SERVER_OPTION_KEYS = {
|
|
|
715
805
|
"presetVersion",
|
|
716
806
|
"revision"
|
|
717
807
|
],
|
|
808
|
+
"projectSettings.get": [],
|
|
809
|
+
"projectSettings.update": [
|
|
810
|
+
"revision",
|
|
811
|
+
"searchIndexingBudgetUnits",
|
|
812
|
+
"settings"
|
|
813
|
+
],
|
|
718
814
|
"text.classify": [
|
|
719
815
|
"authorId",
|
|
720
816
|
"context",
|
|
@@ -729,6 +825,18 @@ const SERVER_OPTION_KEYS = {
|
|
|
729
825
|
"text",
|
|
730
826
|
"uploadPresetId",
|
|
731
827
|
"visibility"
|
|
828
|
+
],
|
|
829
|
+
"uploadPresets.delete": ["uploadPresetId"],
|
|
830
|
+
"uploadPresets.ensure": ["uploadPresets"],
|
|
831
|
+
"uploadPresets.iterate": [
|
|
832
|
+
"cursor",
|
|
833
|
+
"pageSize",
|
|
834
|
+
"sort"
|
|
835
|
+
],
|
|
836
|
+
"uploadPresets.list": [
|
|
837
|
+
"cursor",
|
|
838
|
+
"pageSize",
|
|
839
|
+
"sort"
|
|
732
840
|
]
|
|
733
841
|
};
|
|
734
842
|
/** The option keys each `CalmLensAppClient` method sends to the API. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as invalidArgument, C as validateBatchAssetsOptions, F as isBrowserRuntime, I as isReactNativeRuntime, R as CalmLensError, T as validateServerClientOptions, V as invalidConfig, a as appendAssetLocation, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateRequestOptions, z as SDK_ERROR_CODES } from "./ModerationContextLimits-
|
|
2
|
-
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-
|
|
1
|
+
import { B as invalidArgument, C as validateBatchAssetsOptions, F as isBrowserRuntime, I as isReactNativeRuntime, R as CalmLensError, T as validateServerClientOptions, V as invalidConfig, a as appendAssetLocation, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateRequestOptions, z as SDK_ERROR_CODES } from "./ModerationContextLimits-DeqK3UAt.js";
|
|
2
|
+
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-BmYuSh9G.js";
|
|
3
3
|
import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -189,7 +189,7 @@ const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
|
|
|
189
189
|
name: options.name,
|
|
190
190
|
description: options.description ?? null,
|
|
191
191
|
type: options.type,
|
|
192
|
-
active: options.active,
|
|
192
|
+
active: options.active ?? true,
|
|
193
193
|
transform: options.transform ?? null
|
|
194
194
|
});
|
|
195
195
|
const requireId = (value, name) => encodePathSegment(value, name);
|
|
@@ -222,6 +222,8 @@ const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
|
222
222
|
*/
|
|
223
223
|
var CalmLensServerClient = class CalmLensServerClient {
|
|
224
224
|
#apiKey;
|
|
225
|
+
/** The options this client was created with, without the API key, for `withRequestOptions`. */
|
|
226
|
+
#options;
|
|
225
227
|
#settings;
|
|
226
228
|
#lenses;
|
|
227
229
|
#connection;
|
|
@@ -249,6 +251,7 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
249
251
|
if ((isBrowserRuntime() || isReactNativeRuntime()) && !options.dangerouslyAllowBrowser) throw invalidConfig("CalmLensServerClient is running in a browser or app, where anyone could read the API key. Call CalmLens from your server, upload from the browser or app with CalmLensAppClient, or set dangerouslyAllowBrowser: true for trusted internal tools.");
|
|
250
252
|
const { apiKey, ...rest } = options;
|
|
251
253
|
this.#apiKey = apiKey;
|
|
254
|
+
this.#options = rest;
|
|
252
255
|
this.#settings = {
|
|
253
256
|
...resolveConnectionOptions(rest),
|
|
254
257
|
cdnBaseUrl: (rest.cdnBaseUrl ?? getMockHooks(rest)?.defaultCdnBaseUrl ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "")
|
|
@@ -266,7 +269,7 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
266
269
|
withRequestOptions(options) {
|
|
267
270
|
validateRequestOptions(options);
|
|
268
271
|
return new CalmLensServerClient({
|
|
269
|
-
...this.#
|
|
272
|
+
...this.#options,
|
|
270
273
|
...options,
|
|
271
274
|
apiKey: this.#apiKey
|
|
272
275
|
}, this.#lenses);
|
|
@@ -300,7 +303,7 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
300
303
|
partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
|
|
301
304
|
retrieve: (assetId) => this.buildAssets().retrieve({ assetId })
|
|
302
305
|
}));
|
|
303
|
-
if ("content" in body || "part" in body) return expectAsset(await this.#connection.
|
|
306
|
+
if ("content" in body || "part" in body) return expectAsset(await this.#connection.submitUpload(uploadsPath, body, wait));
|
|
304
307
|
const { idempotencyKey, ...fields } = body;
|
|
305
308
|
const data = await this.#connection.json("POST", uploadsPath, {
|
|
306
309
|
query: { wait },
|
|
@@ -315,8 +318,7 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
315
318
|
* Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
|
|
316
319
|
* beneath, or a resource URL when `resource` is given, with its lens or transform and the
|
|
317
320
|
* viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
|
|
318
|
-
* claims are your app
|
|
319
|
-
* and anyone holding the URL can add it.
|
|
321
|
+
* claims are assertions from your app; CalmLens doesn't verify them.
|
|
320
322
|
*/
|
|
321
323
|
getAssetUrl: (urlOptions) => {
|
|
322
324
|
const { projectId, ...options } = checked("cdn.getAssetUrl", urlOptions);
|
|
@@ -470,8 +472,9 @@ sign: async (options) => {
|
|
|
470
472
|
*/
|
|
471
473
|
create: async (options) => this.submitAsset(checked("assets.create", options), false),
|
|
472
474
|
/**
|
|
473
|
-
* Uploads an asset and waits for its moderation decision.
|
|
474
|
-
* in the background
|
|
475
|
+
* Uploads an asset and waits for its moderation decision. Documents, websites, audio, video
|
|
476
|
+
* and files over 20 MiB sent in parts still finish in the background and return `pending`.
|
|
477
|
+
* Retried safely with an `Idempotency-Key`.
|
|
475
478
|
*/
|
|
476
479
|
classify: async (classifyOptions) => {
|
|
477
480
|
const options = checked("assets.classify", classifyOptions);
|
|
@@ -773,6 +776,60 @@ sign: async (options) => {
|
|
|
773
776
|
};
|
|
774
777
|
}
|
|
775
778
|
/**
|
|
779
|
+
* The project's upload presets: the rules for uploads from browsers and apps. `ensure` creates or
|
|
780
|
+
* replaces presets by key, for deploys that declare them in code; send each preset's `revision`
|
|
781
|
+
* to refuse a change made since you read it.
|
|
782
|
+
*/
|
|
783
|
+
get uploadPresets() {
|
|
784
|
+
return {
|
|
785
|
+
/** Lists one page of the project's upload presets, oldest first unless `sort` says otherwise. */
|
|
786
|
+
list: async (options = {}) => this.request("GET", `${this.projectPath}/upload-presets`, { query: checked("uploadPresets.list", options) }),
|
|
787
|
+
/** Yields every upload preset of the project, fetching pages as needed. */
|
|
788
|
+
iterate: (options = {}) => {
|
|
789
|
+
checked("uploadPresets.iterate", options);
|
|
790
|
+
return this.iteratePages((cursor) => this.uploadPresets.list({
|
|
791
|
+
...options,
|
|
792
|
+
cursor
|
|
793
|
+
}));
|
|
794
|
+
},
|
|
795
|
+
/**
|
|
796
|
+
* Creates each preset, or replaces it with the definition sent, by key. Every preset is
|
|
797
|
+
* checked before any is saved. Returns the stored presets in the order sent.
|
|
798
|
+
*/
|
|
799
|
+
ensure: async (options) => this.request("PUT", `${this.projectPath}/upload-presets`, { body: checked("uploadPresets.ensure", options) }),
|
|
800
|
+
/** Deletes an upload preset; assets already uploaded through it stay. */
|
|
801
|
+
delete: async (options) => {
|
|
802
|
+
const { uploadPresetId } = checked("uploadPresets.delete", options);
|
|
803
|
+
await this.request("DELETE", `/upload-presets/${requireId(uploadPresetId, "Upload preset ID")}`);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* The project's settings, with defaults filled in. `update` replaces them: settings left out
|
|
809
|
+
* return to their defaults. Send the `revision` you read to refuse a change made since.
|
|
810
|
+
*/
|
|
811
|
+
get projectSettings() {
|
|
812
|
+
return {
|
|
813
|
+
get: async () => this.request("GET", `${this.projectPath}/settings`),
|
|
814
|
+
update: async (options) => this.request("PUT", `${this.projectPath}/settings`, { body: checked("projectSettings.update", options) })
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* The project's metadata fields. They share the project settings' `revision`; `ensure` creates
|
|
819
|
+
* or replaces fields by ID and keeps the others.
|
|
820
|
+
*/
|
|
821
|
+
get metadataFields() {
|
|
822
|
+
return {
|
|
823
|
+
list: async () => this.request("GET", `${this.projectPath}/metadata-fields`),
|
|
824
|
+
ensure: async (options) => this.request("PUT", `${this.projectPath}/metadata-fields`, { body: checked("metadataFields.ensure", options) }),
|
|
825
|
+
/** Deletes a field definition; assets keep their values. */
|
|
826
|
+
delete: async (options) => {
|
|
827
|
+
const { fieldId, ...query } = checked("metadataFields.delete", options);
|
|
828
|
+
await this.request("DELETE", `${this.projectPath}/metadata-fields/${requireId(fieldId, "Metadata field ID")}`, { query });
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
776
833
|
* The project's lenses: named image transforms the CDN applies at `/@<identifier>`. The CDN
|
|
777
834
|
* serves files made with each lens's current definition. `ensureLenses` creates or changes
|
|
778
835
|
* lenses by identifier, for applications that declare theirs in code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as HashListEntry, u as HashList } from "./Classification-
|
|
2
|
-
import { $ as
|
|
3
|
-
import "./WebhookPayload-
|
|
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-SmOCgKI3.js";
|
|
3
|
+
import "./WebhookPayload-C7KAk3iR.js";
|
|
4
4
|
interface LensCache {
|
|
5
5
|
readonly ensuredLenses: Map<string, Lens>;
|
|
6
6
|
readonly pendingEnsureLenses: Map<string, Promise<void>>;
|
|
@@ -51,8 +51,7 @@ declare class CalmLensServerClient {
|
|
|
51
51
|
* Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
|
|
52
52
|
* beneath, or a resource URL when `resource` is given, with its lens or transform and the
|
|
53
53
|
* viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
|
|
54
|
-
* claims are your app
|
|
55
|
-
* and anyone holding the URL can add it.
|
|
54
|
+
* claims are assertions from your app; CalmLens doesn't verify them.
|
|
56
55
|
*/
|
|
57
56
|
getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
|
|
58
57
|
/**
|
|
@@ -118,8 +117,9 @@ declare class CalmLensServerClient {
|
|
|
118
117
|
*/
|
|
119
118
|
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
120
119
|
/**
|
|
121
|
-
* Uploads an asset and waits for its moderation decision.
|
|
122
|
-
* in the background
|
|
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
123
|
*/
|
|
124
124
|
classify: (classifyOptions: SubmitAssetOptions) => Promise<Asset>;
|
|
125
125
|
/**
|
|
@@ -282,6 +282,42 @@ declare class CalmLensServerClient {
|
|
|
282
282
|
/** Chooses the policy the project moderates with. */
|
|
283
283
|
assign: (options: AssignPolicyOptions) => Promise<Policy>;
|
|
284
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
|
+
};
|
|
285
321
|
/**
|
|
286
322
|
* The project's lenses: named image transforms the CDN applies at `/@<identifier>`. The CDN
|
|
287
323
|
* serves files made with each lens's current definition. `ensureLenses` creates or changes
|