calmlens 0.29.2 → 0.30.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/bin/calmlens.js +16 -17
- package/cjs/{BrowserUpload-CCXt4DAY.js → BrowserUpload-BNeTp6eF.js} +1 -1
- package/{esm/BrowserUpload-CeGsM9h1.d.ts → cjs/BrowserUpload-DS6KT6o_.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-D-BD_Ny1.d.ts → CalmLensAppClient-B4vzxEzg.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-ea-qXkmD.js → CalmLensAppClient-ClqGwUbl.js} +2 -2
- package/cjs/{CalmLensConnection-BrySN2M3.js → CalmLensConnection-og0jh-Fw.js} +1 -1
- package/{esm/CalmLensServerClient-BYN_N0lt.d.ts → cjs/CalmLensServerClient-BJl2Hsxr.d.ts} +12 -8
- package/cjs/{CalmLensServerClient-FD7H7KvL.js → CalmLensServerClient-KsXM77rO.js} +18 -17
- package/cjs/{CalmLensTypes-C2blKgTu.d.ts → CalmLensTypes-fAgF0_lq.d.ts} +206 -6
- package/cjs/{Classification-CMM2tZpJ-IdIh63n0.d.ts → Classification-DbXUPSvH-C0o2t4mg.d.ts} +15 -30
- package/{esm/Core-CNmoxDCW.d.ts → cjs/Core-DL531ZPG.d.ts} +2 -2
- package/cjs/{Core-DMFa3EUp.js → Core-eDiPpil9.js} +2 -2
- package/cjs/{ModerationContextLimits-1XP4ZTQk.js → ModerationContextLimits-BVBkcgSU.js} +1 -1
- package/{esm/ReactUpload-kqEe6gcN.d.ts → cjs/ReactUpload-BoS0lr7U.d.ts} +1 -1
- package/cjs/{ReactUpload-gaeiPSeH.js → ReactUpload-DAPAzAwY.js} +1 -1
- package/{esm/TestTriggers-CFnel6a9.d.ts → cjs/TestTriggers-CLjF01NU.d.ts} +1 -1
- package/cjs/{UploadController-CyPTBuZg.js → UploadController-BElzwMic.js} +1 -1
- package/{esm/WebhookPayload-DZWlnvcY.d.ts → cjs/WebhookPayload-DlGoY_db.d.ts} +11 -7
- 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/cjs/{index-Dl2qwS8L.d.ts → index-ChrzzIRt.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 +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +12 -12
- package/cjs/server.js +3 -3
- package/cjs/test-inputs.d.ts +1 -1
- package/cjs/testing.d.ts +12 -8
- package/cjs/testing.js +21 -19
- package/cjs/{ui-DNP1uWQy.js → ui-COjb2Hx6.js} +2 -2
- package/cjs/{ui-BtmJC-f9.d.ts → ui-DpZOLeVs.d.ts} +2 -2
- 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/esm/{BrowserUpload-Bu6eWqQS.js → BrowserUpload-BCmj5eGu.js} +1 -1
- package/{cjs/BrowserUpload-CeGsM9h1.d.ts → esm/BrowserUpload-DS6KT6o_.d.ts} +2 -2
- package/esm/{CalmLensAppClient-D-BD_Ny1.d.ts → CalmLensAppClient-B4vzxEzg.d.ts} +1 -1
- package/esm/{CalmLensAppClient-xp-fH6Lz.js → CalmLensAppClient-DcPVLn2y.js} +2 -2
- package/esm/{CalmLensConnection-DwG5yBk2.js → CalmLensConnection-Pm-g6a1l.js} +1 -1
- package/{cjs/CalmLensServerClient-BYN_N0lt.d.ts → esm/CalmLensServerClient-BJl2Hsxr.d.ts} +12 -8
- package/esm/{CalmLensServerClient-CKlNBBo3.js → CalmLensServerClient-C2HGsjkT.js} +17 -16
- package/esm/{CalmLensTypes-C2blKgTu.d.ts → CalmLensTypes-fAgF0_lq.d.ts} +206 -6
- package/esm/{Classification-CMM2tZpJ-IdIh63n0.d.ts → Classification-DbXUPSvH-C0o2t4mg.d.ts} +15 -30
- package/{cjs/Core-CNmoxDCW.d.ts → esm/Core-DL531ZPG.d.ts} +2 -2
- package/esm/{Core-DnCeTmvS.js → Core-KYgLJ0eb.js} +2 -2
- package/esm/{ModerationContextLimits-CtAyz60h.js → ModerationContextLimits-DmjWgTBa.js} +1 -1
- package/{cjs/ReactUpload-kqEe6gcN.d.ts → esm/ReactUpload-BoS0lr7U.d.ts} +1 -1
- package/esm/{ReactUpload-D30YlRui.js → ReactUpload-QW_RNxFp.js} +1 -1
- package/{cjs/TestTriggers-CFnel6a9.d.ts → esm/TestTriggers-CLjF01NU.d.ts} +1 -1
- package/esm/{UploadController-DENryQ8H.js → UploadController-Civ7QPwT.js} +1 -1
- package/{cjs/WebhookPayload-DZWlnvcY.d.ts → esm/WebhookPayload-DlGoY_db.d.ts} +11 -7
- 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/esm/{index-Dl2qwS8L.d.ts → index-ChrzzIRt.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 +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +12 -12
- package/esm/server.js +3 -3
- package/esm/test-inputs.d.ts +1 -1
- package/esm/testing.d.ts +12 -8
- package/esm/testing.js +21 -19
- package/esm/{ui-DUEBbRJ0.js → ui-BVXgDCO2.js} +2 -2
- package/esm/{ui-BtmJC-f9.d.ts → ui-DpZOLeVs.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 +1 -1
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_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-COjb2Hx6.js");
|
|
3
|
+
const require_Core = require("./Core-eDiPpil9.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BElzwMic.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 { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { $ as MediaPlayback, 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 INSTANT_LOAD_MS, 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 isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } 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 { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, 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 ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-fAgF0_lq.js";
|
|
2
|
+
import "./index-ChrzzIRt.js";
|
|
3
|
+
import { $ as MediaPlayback, 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 INSTANT_LOAD_MS, 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 isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-DL531ZPG.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-DS6KT6o_.js";
|
|
5
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, 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 ViewerState, y as createDocumentViewer } from "./ui-DpZOLeVs.js";
|
|
6
6
|
import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
7
7
|
/** Shows a text asset's text, escaped, in a scrolling region. */
|
|
8
8
|
export declare const CalmLensTextViewer: 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_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-COjb2Hx6.js");
|
|
3
|
+
const require_Core = require("./Core-eDiPpil9.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BElzwMic.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-BNeTp6eF.js");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
// src/viewers/Vue.ts
|
|
9
9
|
const optional$1 = (type) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createUploadController$1 } from "./UploadController-
|
|
1
|
+
import { n as createUploadController$1 } from "./UploadController-Civ7QPwT.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,5 +1,5 @@
|
|
|
1
|
-
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-
|
|
2
|
-
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-
|
|
1
|
+
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-DL531ZPG.js";
|
|
2
|
+
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-BoS0lr7U.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 { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-
|
|
1
|
+
import { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-fAgF0_lq.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,6 +1,6 @@
|
|
|
1
1
|
import { C as invalidConfig, S as invalidArgument } from "./CalmLensError-BDWThPCr.js";
|
|
2
|
-
import { T as validateAppClientOptions, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-
|
|
3
|
-
import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-
|
|
2
|
+
import { T as validateAppClientOptions, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-DmjWgTBa.js";
|
|
3
|
+
import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-Pm-g6a1l.js";
|
|
4
4
|
// src/client/CalmLensAppClient.ts
|
|
5
5
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
6
6
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as invalidArgument, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-BDWThPCr.js";
|
|
2
|
-
import { A as MAX_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, P as CalmLensTransport, S as stringifyQuery, U as resolveLogLevel, _ as isAcceptedUploadMimeType, b as randomUuid, j as MAX_NON_IMAGE_UPLOAD_BYTES, k as MAX_DIRECT_IMAGE_UPLOAD_BYTES, r as selectModerationContextItems } from "./ModerationContextLimits-
|
|
2
|
+
import { A as MAX_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, P as CalmLensTransport, S as stringifyQuery, U as resolveLogLevel, _ as isAcceptedUploadMimeType, b as randomUuid, j as MAX_NON_IMAGE_UPLOAD_BYTES, k as MAX_DIRECT_IMAGE_UPLOAD_BYTES, r as selectModerationContextItems } from "./ModerationContextLimits-DmjWgTBa.js";
|
|
3
3
|
// src/contract/AssetPayload.js
|
|
4
4
|
const bufferInputToBytes = (value) => {
|
|
5
5
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions,
|
|
3
|
-
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-
|
|
1
|
+
import { c as HashList, l as HashListEntry } from "./Classification-DbXUPSvH-C0o2t4mg.js";
|
|
2
|
+
import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, Bn as AssetInfo, Cn as ProjectSettingsResource, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions, It as SignAssetUrlOptions, J as EnsureLensesOptions, Jt as UpgradePolicyOptions, K as DeleteMetadataFieldOptions, Kt as UpdatePolicyOptions, Lt as SignUploadTokenOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, Nt as RetryAssetOptions, P as CdnServeOptions, Pn as Policy, Q as FolderIdOptions, Qt as UploadPresetPage, Rn as AssetSearchQuery, Rt as SignedAssetUrl, Sn as MetadataFieldsResource, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateFolderOptions, V as CreateLensOptions, Vt as SubmitAssetOptions, W as DecideAssetOptions, Wt as UpdateHashListOptions, X as EnsureUploadPresetsOptions, Y as EnsureMetadataFieldsOptions, Yt as UploadAssetPartOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetIdOptions, _ as AssetPage, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetrieveAssetByExternalIdOptions, k as CalmLensServerClientOptions, kt as RequestOptions, ln as GetEventsResponse, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, pt as ListEventsOptions, q as EnsureLensOptions, qt as UpdateProjectSettingsOptions, r as Asset, rn as WaitForAssetDecisionOptions, rt as HashListIdOptions, sn as AssetReviewRequest, st as Lens, t as AddHashListEntryOptions, tn as VerifyWebhookSignatureOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vt as ListPoliciesOptions, wt as PolicyIdOptions, xn as Folder, xt as MoveFolderOptions, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SignedUploadToken } from "./CalmLensTypes-fAgF0_lq.js";
|
|
3
|
+
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DlGoY_db.js";
|
|
4
4
|
interface TransportRequest {
|
|
5
5
|
/** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
|
|
6
6
|
operation?: string;
|
|
@@ -242,13 +242,17 @@ declare class CalmLensServerClient {
|
|
|
242
242
|
list: (options?: ListEventsOptions, requestOptions?: RequestOptions) => ListPromise<GetEventsResponse>;
|
|
243
243
|
/**
|
|
244
244
|
* Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
|
|
245
|
-
* parsed webhook delivery; events carry only the asset's ID
|
|
246
|
-
* event that isn't about an asset, and rejects with `asset/not-found` once the
|
|
247
|
-
* deleted. The asset's `
|
|
248
|
-
* `
|
|
245
|
+
* parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to
|
|
246
|
+
* `null` for an event that isn't about an asset, and rejects with `asset/not-found` once the
|
|
247
|
+
* asset is deleted. The asset's `sequence` orders it against events: an event with a higher
|
|
248
|
+
* `resource.sequence` happened after this state, one with an equal or lower one is reflected
|
|
249
|
+
* in it.
|
|
249
250
|
*/
|
|
250
251
|
retrieveAsset: (event: {
|
|
251
|
-
readonly
|
|
252
|
+
readonly resource?: {
|
|
253
|
+
readonly kind: string;
|
|
254
|
+
readonly id: string;
|
|
255
|
+
} | null;
|
|
252
256
|
}, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset> | null>;
|
|
253
257
|
};
|
|
254
258
|
get folders(): {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as invalidConfig, S as invalidArgument, l as CalmLensError, x as SDK_ERROR_CODES } from "./CalmLensError-BDWThPCr.js";
|
|
2
|
-
import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, y as pollForDecision } from "./ModerationContextLimits-
|
|
3
|
-
import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-
|
|
2
|
+
import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, y as pollForDecision } from "./ModerationContextLimits-DmjWgTBa.js";
|
|
3
|
+
import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-Pm-g6a1l.js";
|
|
4
4
|
import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
5
5
|
// src/contract/JsonUtils.js
|
|
6
6
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -153,8 +153,8 @@ const isOptional = (value, type, nullable) => value === void 0 || nullable && va
|
|
|
153
153
|
*/
|
|
154
154
|
const isWebhookEvent = (value) => {
|
|
155
155
|
if (!isObject(value) || typeof value.id !== "string" || typeof value.type !== "string" || typeof value.projectId !== "string" || typeof value.createdAt !== "number") return false;
|
|
156
|
-
const { severity, title, description,
|
|
157
|
-
return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) &&
|
|
156
|
+
const { severity, title, description, resource, facts } = value;
|
|
157
|
+
return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && (resource === void 0 || resource === null || isObject(resource) && typeof resource.kind === "string" && typeof resource.id === "string" && typeof resource.sequence === "number") && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
|
|
158
158
|
};
|
|
159
159
|
/**
|
|
160
160
|
* The value of one of an event's facts, by key, or `undefined` when the event doesn't carry it.
|
|
@@ -178,13 +178,13 @@ const getEventFacts = (event) => {
|
|
|
178
178
|
*/
|
|
179
179
|
const isTestWebhookEvent = (event) => Array.isArray(event?.facts) && event.facts.some((fact) => fact?.key === "test" && fact.value === true);
|
|
180
180
|
/**
|
|
181
|
-
* Whether to apply `event` after `lastSequence`, the highest `
|
|
182
|
-
* its
|
|
183
|
-
*
|
|
184
|
-
* earlier one returns `false`. Events
|
|
185
|
-
*
|
|
181
|
+
* Whether to apply `event` after `lastSequence`, the highest `resource.sequence` you have applied
|
|
182
|
+
* for its resource (`null` or `undefined` when none). Deliveries can arrive out of order: an event
|
|
183
|
+
* about a resource is newer only with a higher sequence, so a retried or repeated delivery of an
|
|
184
|
+
* earlier one returns `false`. Events about no resource have no sequence and are always new.
|
|
185
|
+
* Store the event's `resource.sequence` per `resource.id` once you have applied it.
|
|
186
186
|
*/
|
|
187
|
-
const
|
|
187
|
+
const isNewerEvent = (event, lastSequence) => !event.resource || lastSequence === null || lastSequence === void 0 || event.resource.sequence > lastSequence;
|
|
188
188
|
// src/client/ServedAssetInfo.ts
|
|
189
189
|
function parseServedAssetInfo(header) {
|
|
190
190
|
if (!header) return void 0;
|
|
@@ -688,12 +688,13 @@ sign: async (options) => {
|
|
|
688
688
|
} })),
|
|
689
689
|
/**
|
|
690
690
|
* Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
|
|
691
|
-
* parsed webhook delivery; events carry only the asset's ID
|
|
692
|
-
* event that isn't about an asset, and rejects with `asset/not-found` once the
|
|
693
|
-
* deleted. The asset's `
|
|
694
|
-
* `
|
|
691
|
+
* parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to
|
|
692
|
+
* `null` for an event that isn't about an asset, and rejects with `asset/not-found` once the
|
|
693
|
+
* asset is deleted. The asset's `sequence` orders it against events: an event with a higher
|
|
694
|
+
* `resource.sequence` happened after this state, one with an equal or lower one is reflected
|
|
695
|
+
* in it.
|
|
695
696
|
*/
|
|
696
|
-
retrieveAsset: async (event, requestOptions) => event.
|
|
697
|
+
retrieveAsset: async (event, requestOptions) => event.resource?.kind === "asset" ? this.assets.retrieve({ assetId: event.resource.id }, requestOptions) : null
|
|
697
698
|
};
|
|
698
699
|
}
|
|
699
700
|
get folders() {
|
|
@@ -949,4 +950,4 @@ sign: async (options) => {
|
|
|
949
950
|
}
|
|
950
951
|
}
|
|
951
952
|
};
|
|
952
|
-
export { WEBHOOK_TIMESTAMP_HEADER as a,
|
|
953
|
+
export { WEBHOOK_TIMESTAMP_HEADER as a, isNewerEvent as c, verifyWebhookSignature as d, signUploadTokenWithApiKey as f, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS as i, isTestWebhookEvent as l, stringifyJsonCanonical as m, WEBHOOK_DELIVERY_HEADER as n, getEventFact as o, decodeUploadToken as p, WEBHOOK_SIGNATURE_HEADER as r, getEventFacts as s, CalmLensServerClient as t, parseWebhookEvent as u };
|