calmlens 0.20.0 → 0.21.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 +13 -9
- package/bin/calmlens.js +1329 -664
- package/cjs/{BrowserUpload-CjSHjx3C.js → BrowserUpload-CeSwiMo5.js} +1 -1
- package/cjs/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-NaCxOVlM.js → CalmLensAppClient-0UVCuNqW.js} +30 -10
- package/cjs/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/cjs/{CalmLensOptionKeys-p2QK687A.js → CalmLensOptionKeys-CYY6elxg.js} +183 -347
- package/cjs/{CalmLensServerClient-C-jsjn8m.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +106 -48
- package/cjs/{CalmLensServerClient-BDzTthxE.js → CalmLensServerClient-nfu6_YEW.js} +288 -88
- package/cjs/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/cjs/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/cjs/Core-C82YmjjX.d.ts +823 -0
- package/cjs/Core-Dc3cteU7.js +998 -0
- package/cjs/FileIcons-4qSX7DW2.d.ts +67 -0
- package/cjs/{ModerationContextLimits-2nIv7Zh3.js → ModerationContextLimits-BxOmeSqq.js} +669 -269
- package/cjs/{ReactUpload-BdTRCTGA.js → ReactUpload-BK2O3dnK.js} +1 -1
- package/cjs/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/cjs/{TestTriggers-DbhsNPdg-DjvVuc2h.js → TestTriggers-BTyXtX0Q-ATuFDhLX.js} +342 -34
- package/{esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/cjs/{UploadController-MLVs97Zt.js → UploadController-DLyiLDTB.js} +34 -14
- package/cjs/{WebhookPayload-DkukERKE.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/cjs/app.d.ts +6 -7
- package/cjs/app.js +4 -3
- package/cjs/elements.d.ts +123 -22
- package/cjs/elements.js +553 -156
- package/cjs/file-icons.d.ts +2 -67
- package/cjs/index-CKRgjV16.d.ts +16 -0
- package/cjs/index.d.ts +5 -6
- package/cjs/index.js +3 -2
- package/cjs/react-native.d.ts +52 -11
- package/cjs/react-native.js +231 -99
- package/cjs/react.d.ts +42 -9
- package/cjs/react.js +381 -118
- package/cjs/server.d.ts +48 -7
- package/cjs/server.js +7 -3
- package/cjs/test-inputs.d.ts +2 -2
- package/cjs/test-inputs.js +13 -9
- package/cjs/testing.d.ts +24 -14
- package/cjs/testing.js +1413 -402
- package/cjs/ui-CTBUxnVp.d.ts +139 -0
- package/cjs/ui-CZ8exACq.js +1359 -0
- package/cjs/ui.d.ts +3 -2
- package/cjs/ui.js +45 -22
- package/cjs/vue.d.ts +802 -199
- package/cjs/vue.js +359 -127
- package/esm/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/esm/{BrowserUpload-CAVkRotw.js → BrowserUpload-i9OhCzMJ.js} +1 -1
- package/esm/{CalmLensAppClient-PQ9VBvlW.js → CalmLensAppClient-CK4_Py0c.js} +30 -10
- package/esm/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/esm/{CalmLensOptionKeys-Do2mPP6w.js → CalmLensOptionKeys-BGZlIsT2.js} +182 -340
- package/esm/{CalmLensServerClient-C-jsjn8m.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +106 -48
- package/esm/{CalmLensServerClient-C_H5aAsV.js → CalmLensServerClient-dAQUcDWb.js} +265 -89
- package/esm/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/esm/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/esm/Core-BxeIud_S.js +843 -0
- package/esm/Core-C82YmjjX.d.ts +823 -0
- package/esm/FileIcons-4qSX7DW2.d.ts +67 -0
- package/esm/{ModerationContextLimits-Chw-AzgL.js → ModerationContextLimits-B6_RalCQ.js} +624 -254
- package/esm/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/esm/{ReactUpload-CMmL0R5Q.js → ReactUpload-DxwVqfX1.js} +1 -1
- package/esm/{TestTriggers-DbhsNPdg-CUdrv8Nm.js → TestTriggers-BTyXtX0Q-GRB9jQwo.js} +319 -35
- package/{cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/esm/{UploadController-BJZghJpg.js → UploadController-D9Z-h00Q.js} +34 -14
- package/esm/{WebhookPayload-DkukERKE.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/esm/app.d.ts +6 -7
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +123 -22
- package/esm/elements.js +497 -128
- package/esm/file-icons.d.ts +2 -67
- package/esm/index-CKRgjV16.d.ts +16 -0
- package/esm/index.d.ts +5 -6
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +52 -11
- package/esm/react-native.js +205 -75
- package/esm/react.d.ts +42 -9
- package/esm/react.js +327 -91
- package/esm/server.d.ts +48 -7
- package/esm/server.js +3 -3
- package/esm/styles.css +142 -22
- package/esm/svelte/AssetViewer.svelte +25 -0
- package/esm/svelte/CalmLensAsset.svelte +318 -0
- package/esm/svelte/CalmLensDocumentViewer.svelte +7 -0
- package/esm/svelte/CalmLensImageViewer.svelte +7 -0
- package/esm/svelte/CalmLensSpreadsheetViewer.svelte +7 -0
- package/esm/svelte/CalmLensTextViewer.svelte +7 -0
- package/esm/svelte/CalmLensWebsiteViewer.svelte +7 -0
- package/esm/svelte/index.d.ts +29 -6
- package/esm/svelte/index.js +7 -2
- package/esm/test-inputs.d.ts +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +24 -14
- package/esm/testing.js +1409 -398
- package/esm/ui-CTBUxnVp.d.ts +139 -0
- package/esm/ui-Cr7s6JHm.js +1258 -0
- package/esm/ui.d.ts +3 -2
- package/esm/ui.js +4 -3
- package/esm/vue.d.ts +802 -199
- package/esm/vue.js +308 -103
- package/package.json +3 -1
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/cjs/index-DxbJ_Xaa.d.ts +0 -253
- package/cjs/ui-BSqPGKrZ.d.ts +0 -539
- package/cjs/ui-CX1z2pD9.js +0 -586
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/esm/index-DxbJ_Xaa.d.ts +0 -253
- package/esm/svelte/CalmLensMedia.svelte +0 -134
- package/esm/ui-BSqPGKrZ.d.ts +0 -539
- package/esm/ui-CXH7xJpb.js +0 -461
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
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-B6_RalCQ.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-BGZlIsT2.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) => {
|
|
@@ -11,6 +11,10 @@ const UPLOAD_TOKEN_PREFIX = "clut_";
|
|
|
11
11
|
const UPLOAD_TOKEN_MAX_TTL_SECONDS = 3600;
|
|
12
12
|
const SIGNING_CONTEXT = "calmlens-upload-token:v1:";
|
|
13
13
|
const toBase64Url = (value) => btoa(String.fromCharCode(...new TextEncoder().encode(value))).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
14
|
+
const fromBase64Url = (value) => {
|
|
15
|
+
const binary = atob(value.replaceAll("-", "+").replaceAll("_", "/"));
|
|
16
|
+
return new TextDecoder().decode(Uint8Array.from(binary, (char) => char.charCodeAt(0)));
|
|
17
|
+
};
|
|
14
18
|
/**
|
|
15
19
|
* The part of an API key a token names so the backend can find the key's hash. The same rule as
|
|
16
20
|
* the stored `keyPrefix`: the fixed `clsk_<region>_` part plus four random characters.
|
|
@@ -24,6 +28,26 @@ const signUploadToken = async (claims, apiKey) => {
|
|
|
24
28
|
const signature = await hmacSha256Hex(await signingSecret(apiKey), SIGNING_CONTEXT + body);
|
|
25
29
|
return `${UPLOAD_TOKEN_PREFIX}${body}.${signature}`;
|
|
26
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Reads a token's claims without checking its signature, or returns undefined when it isn't
|
|
33
|
+
* well formed. Verify it with `verifyUploadTokenSignature` before trusting the claims.
|
|
34
|
+
*/
|
|
35
|
+
const decodeUploadToken = (token) => {
|
|
36
|
+
if (!token.startsWith("clut_")) return void 0;
|
|
37
|
+
const [body, signature, extra] = token.slice(5).split(".");
|
|
38
|
+
if (!body || !signature || extra !== void 0 || !/^[0-9a-f]{64}$/.test(signature)) return;
|
|
39
|
+
try {
|
|
40
|
+
const claims = JSON.parse(fromBase64Url(body));
|
|
41
|
+
if (claims.v !== 1 || typeof claims.u !== "string" || typeof claims.k !== "string" || typeof claims.e !== "number" || typeof claims.n !== "string" || claims.x !== void 0 && typeof claims.x !== "string") return;
|
|
42
|
+
return {
|
|
43
|
+
claims,
|
|
44
|
+
body,
|
|
45
|
+
signature
|
|
46
|
+
};
|
|
47
|
+
} catch {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
27
51
|
// src/client/CalmLensUploadTokens.ts
|
|
28
52
|
/**
|
|
29
53
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -33,11 +57,11 @@ const signUploadToken = async (claims, apiKey) => {
|
|
|
33
57
|
*/
|
|
34
58
|
const signUploadTokenWithApiKey = async (apiKey, options, { now = Date.now(), nonce = crypto.randomUUID() } = {}) => {
|
|
35
59
|
if (!options || typeof options !== "object") throw invalidArgument("Options are required");
|
|
36
|
-
const { uploadPresetId, externalId,
|
|
60
|
+
const { uploadPresetId, externalId, expiresIn = 600 } = options;
|
|
37
61
|
encodePathSegment(uploadPresetId, "Upload preset ID");
|
|
38
|
-
if (!Number.isInteger(
|
|
62
|
+
if (!Number.isInteger(expiresIn) || expiresIn < 1 || expiresIn > 3600) throw invalidArgument(`expiresIn must be a whole number from 1 to ${UPLOAD_TOKEN_MAX_TTL_SECONDS}`);
|
|
39
63
|
if (externalId !== void 0 && (typeof externalId !== "string" || !externalId)) throw invalidArgument("externalId must be a non-empty string");
|
|
40
|
-
const expiresAt = now +
|
|
64
|
+
const expiresAt = now + expiresIn * 1e3;
|
|
41
65
|
return {
|
|
42
66
|
token: await signUploadToken({
|
|
43
67
|
v: 1,
|
|
@@ -128,22 +152,45 @@ const isOptional = (value, type, nullable) => value === void 0 || nullable && va
|
|
|
128
152
|
*/
|
|
129
153
|
const isWebhookEvent = (value) => {
|
|
130
154
|
if (!isObject(value) || typeof value.id !== "string" || typeof value.type !== "string" || typeof value.projectId !== "string" || typeof value.createdAt !== "number") return false;
|
|
131
|
-
const { severity, title, description, assetId, asset, facts } = value;
|
|
132
|
-
return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && isOptional(assetId, "string", true) && (asset === void 0 || asset === null || isObject(asset) && typeof asset.id === "string") && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
|
|
155
|
+
const { severity, title, description, assetId, assetSequence, asset, facts } = value;
|
|
156
|
+
return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && isOptional(assetId, "string", true) && isOptional(assetSequence, "number", true) && (asset === void 0 || asset === null || isObject(asset) && typeof asset.id === "string") && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* The value of one of an event's facts, by key, or `undefined` when the event doesn't carry it.
|
|
160
|
+
* Typed by the event's `type`, so `getEventFact(event, "flagged-categories")` on an
|
|
161
|
+
* `asset.blocked` event is a list of categories. The fact's `url`, when it has one, is on the fact
|
|
162
|
+
* in `event.facts`.
|
|
163
|
+
*/
|
|
164
|
+
const getEventFact = (event, key) => event?.facts?.find((fact) => fact?.key === key)?.value;
|
|
165
|
+
/**
|
|
166
|
+
* An event's facts as an object of values by key, such as `{ "flagged-categories": ["hate"] }`.
|
|
167
|
+
* A key the event repeats keeps its first value, as `getEventFact` reads it.
|
|
168
|
+
*/
|
|
169
|
+
const getEventFacts = (event) => {
|
|
170
|
+
const values = {};
|
|
171
|
+
for (const fact of event?.facts ?? []) if (fact && typeof fact.key === "string" && !Object.hasOwn(values, fact.key)) values[fact.key] = fact.value;
|
|
172
|
+
return values;
|
|
133
173
|
};
|
|
134
174
|
/**
|
|
135
175
|
* Whether a webhook event is a test send from the portal or the CLI rather than a real event: it
|
|
136
176
|
* carries the registered `{ key: "test", value: true }` fact.
|
|
137
177
|
*/
|
|
138
178
|
const isTestWebhookEvent = (event) => Array.isArray(event?.facts) && event.facts.some((fact) => fact?.key === "test" && fact.value === true);
|
|
179
|
+
/**
|
|
180
|
+
* Whether to apply `event` after `lastSequence`, the highest `assetSequence` you have applied for
|
|
181
|
+
* its asset (`null` or `undefined` when none). Deliveries can arrive out of order: an event about
|
|
182
|
+
* an asset is newer only with a higher `assetSequence`, so a retried or repeated delivery of an
|
|
183
|
+
* earlier one returns `false`. Events that aren't about an asset have no sequence and are always
|
|
184
|
+
* new. Store the event's `assetSequence` per `assetId` once you have applied it.
|
|
185
|
+
*/
|
|
186
|
+
const isNewerAssetEvent = (event, lastSequence) => event.assetSequence === null || event.assetSequence === void 0 || lastSequence === null || lastSequence === void 0 || event.assetSequence > lastSequence;
|
|
139
187
|
const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
|
|
140
188
|
identifier: options.identifier,
|
|
141
189
|
name: options.name,
|
|
142
190
|
description: options.description ?? null,
|
|
143
191
|
type: options.type,
|
|
144
192
|
active: options.active,
|
|
145
|
-
transform: options.transform ?? null
|
|
146
|
-
version: options.version
|
|
193
|
+
transform: options.transform ?? null
|
|
147
194
|
});
|
|
148
195
|
const requireId = (value, name) => encodePathSegment(value, name);
|
|
149
196
|
/**
|
|
@@ -243,20 +290,20 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
243
290
|
request(method, path, options = {}) {
|
|
244
291
|
return this.#connection.json(method, path, options);
|
|
245
292
|
}
|
|
246
|
-
async submitAsset(options,
|
|
293
|
+
async submitAsset(options, wait) {
|
|
247
294
|
const body = prepareSubmitAssetOptions(options, {
|
|
248
295
|
deferUploadChecks: this.#connection.deferUploadChecks,
|
|
249
296
|
partSizeBytes: this.#connection.partSizeBytes
|
|
250
297
|
});
|
|
251
298
|
const uploadsPath = `${this.projectPath}/assets`;
|
|
252
|
-
if ("content" in body && splitsIntoParts(body.content, this.#connection.partSizeBytes)) return expectAsset(await this.#connection.submitInParts(uploadsPath, body,
|
|
299
|
+
if ("content" in body && splitsIntoParts(body.content, this.#connection.partSizeBytes)) return expectAsset(await this.#connection.submitInParts(uploadsPath, body, wait, {
|
|
253
300
|
partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
|
|
254
301
|
retrieve: (assetId) => this.buildAssets().retrieve({ assetId })
|
|
255
302
|
}));
|
|
256
|
-
if ("content" in body || "part" in body) return expectAsset(await this.#connection.submitRawUpload(uploadsPath, body,
|
|
303
|
+
if ("content" in body || "part" in body) return expectAsset(await this.#connection.submitRawUpload(uploadsPath, body, wait));
|
|
257
304
|
const { idempotencyKey, ...fields } = body;
|
|
258
305
|
const data = await this.#connection.json("POST", uploadsPath, {
|
|
259
|
-
query: {
|
|
306
|
+
query: { wait },
|
|
260
307
|
body: fields,
|
|
261
308
|
idempotencyKey: idempotencyKey ?? newIdempotencyKey()
|
|
262
309
|
});
|
|
@@ -265,32 +312,59 @@ var CalmLensServerClient = class CalmLensServerClient {
|
|
|
265
312
|
get cdn() {
|
|
266
313
|
return {
|
|
267
314
|
/**
|
|
268
|
-
* Builds
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
315
|
+
* Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
|
|
316
|
+
* beneath, or a resource URL when `resource` is given, with its lens or transform and the
|
|
317
|
+
* viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
|
|
318
|
+
* claims are your app's unsigned assertions: CalmLens does not verify an age confirmation,
|
|
319
|
+
* and anyone holding the URL can add it.
|
|
273
320
|
*/
|
|
274
321
|
getAssetUrl: (urlOptions) => {
|
|
275
|
-
const {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
322
|
+
const { projectId, ...options } = checked("cdn.getAssetUrl", urlOptions);
|
|
323
|
+
return buildAssetUrl(this.#settings.cdnBaseUrl, projectId ?? this.#settings.projectId, options);
|
|
324
|
+
},
|
|
325
|
+
/**
|
|
326
|
+
* Signs a private asset's URL on your server, so browsers and apps can load it without an API
|
|
327
|
+
* key until it expires. Every resource is a path beneath it, as beneath a public asset URL;
|
|
328
|
+
* `/original` only when signed with `original: true`. With `resource`, returns that resource's
|
|
329
|
+
* URL beneath the grant; lenses, transforms and viewer claims are appended as `getAssetUrl`
|
|
330
|
+
* appends them and aren't part of the signature.
|
|
331
|
+
*/
|
|
332
|
+
signAssetUrl: async (signOptions) => {
|
|
333
|
+
const options = checked("cdn.signAssetUrl", signOptions);
|
|
334
|
+
validateSignAssetUrlOptions(options);
|
|
335
|
+
const { projectId, assetId, externalId, expiresIn, original, ...location } = options;
|
|
336
|
+
const project = requireId(projectId ?? this.#settings.projectId, "Project ID");
|
|
337
|
+
const signed = await this.request("POST", `/projects/${project}/signed-asset-urls`, { body: {
|
|
338
|
+
...assetId !== void 0 ? { assetId } : { externalId },
|
|
339
|
+
expiresIn: expiresIn ?? 900,
|
|
340
|
+
original: original ?? false
|
|
341
|
+
} });
|
|
342
|
+
if (!signed || typeof signed.url !== "string" || !signed.url || typeof signed.expiresAt !== "number") throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, { message: "The API returned no signed asset URL" });
|
|
343
|
+
return {
|
|
344
|
+
url: appendAssetLocation(signed.url, location),
|
|
345
|
+
expiresAt: signed.expiresAt
|
|
346
|
+
};
|
|
283
347
|
},
|
|
284
348
|
/**
|
|
349
|
+
* The display info of an asset URL, public or signed (`{url}/info`): its type, size,
|
|
350
|
+
* rendered file, preview and stream, and whether the viewer its claims describe can see it.
|
|
351
|
+
* A server can pass it to `CalmLensAsset` as `info`, so the first render is the real
|
|
352
|
+
* element.
|
|
353
|
+
*/
|
|
354
|
+
getAssetInfo: (url, options = {}) => getAssetInfo(url, {
|
|
355
|
+
...options,
|
|
356
|
+
fetch: this.#settings.cdnFetch
|
|
357
|
+
}),
|
|
358
|
+
/**
|
|
285
359
|
* Fetches asset content or a preview from the CDN with the client's API key, and returns
|
|
286
360
|
* the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
|
|
287
361
|
* returned, not thrown; `timeoutMs` covers only the wait for headers.
|
|
288
362
|
*/
|
|
289
363
|
serve: async (options) => {
|
|
290
|
-
const {
|
|
364
|
+
const { init, resource = "rendered", ...urlOptions } = checked("cdn.serve", options);
|
|
291
365
|
const url = this.cdn.getAssetUrl({
|
|
292
|
-
|
|
293
|
-
|
|
366
|
+
...urlOptions,
|
|
367
|
+
resource
|
|
294
368
|
});
|
|
295
369
|
const method = init?.method?.toUpperCase() ?? "GET";
|
|
296
370
|
const { response } = await this.#connection.transport.send({
|
|
@@ -335,7 +409,7 @@ sign: async (options) => {
|
|
|
335
409
|
return {
|
|
336
410
|
/** Searches accessible assets by keyword or a natural-language description. */
|
|
337
411
|
search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: checked("assets.search", options) }),
|
|
338
|
-
/** Lists one page of the project's assets, with optional filter and
|
|
412
|
+
/** Lists one page of the project's assets, with an optional filter and sort. */
|
|
339
413
|
list: async (options = {}) => this.request("GET", `${this.projectPath}/assets`, { query: checked("assets.list", options) }),
|
|
340
414
|
/**
|
|
341
415
|
* Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
|
|
@@ -363,6 +437,24 @@ sign: async (options) => {
|
|
|
363
437
|
const { assetId, ...query } = checked("assets.listChildren", options);
|
|
364
438
|
return this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query });
|
|
365
439
|
},
|
|
440
|
+
/**
|
|
441
|
+
* Lists one page of an audio or video asset's findings timeline, in time order.
|
|
442
|
+
* `classification.moderation.timeline.segmentCount` says how many segments there are.
|
|
443
|
+
*/
|
|
444
|
+
listTimeline: async (options) => {
|
|
445
|
+
const { assetId, ...query } = checked("assets.listTimeline", options);
|
|
446
|
+
const assetPath = `${this.projectPath}/assets/${requireId(assetId, "Asset ID")}`;
|
|
447
|
+
return this.request("GET", `${assetPath}/timeline`, { query });
|
|
448
|
+
},
|
|
449
|
+
/** Yields every segment of an audio or video asset's findings timeline, in time order. */
|
|
450
|
+
iterateTimeline: (options) => {
|
|
451
|
+
checked("assets.iterateTimeline", options);
|
|
452
|
+
requireId(options?.assetId, "Asset ID");
|
|
453
|
+
return this.iteratePages((cursor) => this.buildAssets().listTimeline({
|
|
454
|
+
...options,
|
|
455
|
+
cursor
|
|
456
|
+
}));
|
|
457
|
+
},
|
|
366
458
|
/** Yields every child of an asset, fetching pages as needed. */
|
|
367
459
|
iterateChildren: (options) => {
|
|
368
460
|
checked("assets.iterateChildren", options);
|
|
@@ -373,11 +465,10 @@ sign: async (options) => {
|
|
|
373
465
|
}));
|
|
374
466
|
},
|
|
375
467
|
/**
|
|
376
|
-
* Uploads an asset and
|
|
377
|
-
* status
|
|
378
|
-
* `Idempotency-Key`.
|
|
468
|
+
* Uploads an asset and returns without waiting for its decision (`wait=false`), with
|
|
469
|
+
* `classification.status` `queued`. Retried safely with an `Idempotency-Key`.
|
|
379
470
|
*/
|
|
380
|
-
create: async (options) => this.submitAsset(checked("assets.create", options),
|
|
471
|
+
create: async (options) => this.submitAsset(checked("assets.create", options), false),
|
|
381
472
|
/**
|
|
382
473
|
* Uploads an asset and waits for its moderation decision. Audio and video still finish
|
|
383
474
|
* in the background. Retried safely with an `Idempotency-Key`.
|
|
@@ -385,33 +476,17 @@ sign: async (options) => {
|
|
|
385
476
|
classify: async (classifyOptions) => {
|
|
386
477
|
const options = checked("assets.classify", classifyOptions);
|
|
387
478
|
if (options && "content" in options && "plainText" in options.content && (typeof options.content.plainText !== "string" || !options.content.plainText.trim())) throw invalidPayload("Text to classify must be a non-empty string");
|
|
388
|
-
return this.submitAsset(options,
|
|
479
|
+
return this.submitAsset(options, true);
|
|
389
480
|
},
|
|
390
481
|
/**
|
|
391
|
-
* Uploads the next part of a multipart upload.
|
|
392
|
-
*
|
|
482
|
+
* Uploads the next part of a multipart upload. Whether the final part waits for the
|
|
483
|
+
* decision was chosen when the upload started; pass `wait` to override it.
|
|
393
484
|
*/
|
|
394
485
|
uploadPart: async (partOptions) => {
|
|
395
486
|
const { assetId, ...options } = checked("assets.uploadPart", partOptions);
|
|
396
487
|
const encodedAssetId = requireId(assetId, "Asset ID");
|
|
397
488
|
return expectAsset(await this.#connection.uploadPart(`/assets/${encodedAssetId}/part`, options));
|
|
398
489
|
},
|
|
399
|
-
/**
|
|
400
|
-
* Creates a short-lived signed CDN URL, so browsers can load private content without
|
|
401
|
-
* an API key.
|
|
402
|
-
*/
|
|
403
|
-
createSignedUrl: async (signedUrlOptions) => {
|
|
404
|
-
const { assetId, ...options } = checked("assets.createSignedUrl", signedUrlOptions);
|
|
405
|
-
const encodedAssetId = requireId(assetId, "Asset ID");
|
|
406
|
-
validateSignedUrlOptions(options);
|
|
407
|
-
return this.request("POST", `/assets/${encodedAssetId}/signed-url`, { body: {
|
|
408
|
-
viewerClaims: options.viewerClaims,
|
|
409
|
-
resource: options.resource,
|
|
410
|
-
expiresInSeconds: options.expiresInSeconds ?? 900,
|
|
411
|
-
lens: options.lens,
|
|
412
|
-
transform: transformSelector(options.transform)
|
|
413
|
-
} });
|
|
414
|
-
},
|
|
415
490
|
/** Moves an asset into a folder, or to the project root with `folderId: null`. */
|
|
416
491
|
move: async (options) => {
|
|
417
492
|
const { assetId, folderId } = checked("assets.move", options);
|
|
@@ -437,20 +512,25 @@ sign: async (options) => {
|
|
|
437
512
|
return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body });
|
|
438
513
|
},
|
|
439
514
|
/**
|
|
440
|
-
* Completes the policy evidence behind a decided asset's moderation decision:
|
|
441
|
-
* `classification.moderation.
|
|
515
|
+
* Completes the policy evidence behind a decided asset's moderation decision: its
|
|
516
|
+
* `classification.moderation.explanationComplete` becomes `true` and every action stays as
|
|
442
517
|
* decided. With `rerun: true` the asset is moderated again with the project's current policy
|
|
443
|
-
* and
|
|
444
|
-
* (`asset/policy-changed`).
|
|
518
|
+
* and an `asset.rerun-requested` event is recorded; use it when the policy has changed since
|
|
519
|
+
* the decision (`asset/policy-changed`). The asset returns unchanged: it keeps its decision
|
|
520
|
+
* until the re-run's is stored, reported by `asset.classified` and `asset.<status>` events,
|
|
521
|
+
* and a failed re-run keeps it. A reviewed asset fails with `asset/reviewed`, and one whose
|
|
522
|
+
* content is gone with `asset/content-unavailable`.
|
|
445
523
|
*/
|
|
446
524
|
explain: async (options) => {
|
|
447
525
|
const { assetId, rerun } = checked("assets.explain", options);
|
|
448
526
|
return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} });
|
|
449
527
|
},
|
|
450
528
|
/**
|
|
451
|
-
* Waits until an asset
|
|
452
|
-
*
|
|
453
|
-
*
|
|
529
|
+
* Waits until an asset is settled, its `classification.status` `completed` (with its
|
|
530
|
+
* decision in `classification.moderation.status`) or `failed`, and returns that asset,
|
|
531
|
+
* checking every few seconds. A `queued` or `processing` asset is still waiting, even when a
|
|
532
|
+
* reviewer has already decided it. Rejects with `sdk/timeout` if it is not settled within
|
|
533
|
+
* `timeoutMs` (default 60000). Webhooks report decisions without polling.
|
|
454
534
|
*/
|
|
455
535
|
waitForDecision: async (waitOptions) => {
|
|
456
536
|
const { assetId, ...options } = checked("assets.waitForDecision", waitOptions);
|
|
@@ -463,11 +543,14 @@ sign: async (options) => {
|
|
|
463
543
|
* keeping the asset record, metadata and classification results. The returned asset has
|
|
464
544
|
* `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
|
|
465
545
|
*/
|
|
466
|
-
|
|
467
|
-
const { assetId } = checked("assets.
|
|
546
|
+
removeContent: async (options) => {
|
|
547
|
+
const { assetId } = checked("assets.removeContent", options);
|
|
468
548
|
return this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}/content`);
|
|
469
549
|
},
|
|
470
|
-
/**
|
|
550
|
+
/**
|
|
551
|
+
* Deletes an asset record together with its stored content. An asset extracted from another
|
|
552
|
+
* (one with a `parentId`) fails with `asset/child-not-deletable`: delete its parent instead.
|
|
553
|
+
*/
|
|
471
554
|
delete: async (options) => {
|
|
472
555
|
const { assetId } = checked("assets.delete", options);
|
|
473
556
|
await this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}`);
|
|
@@ -475,10 +558,12 @@ sign: async (options) => {
|
|
|
475
558
|
/**
|
|
476
559
|
* Deletes up to 500 assets (`operation: "delete"`) or removes their stored content
|
|
477
560
|
* (`"remove-content"`) in one request. Every asset must exist in the project and the key
|
|
478
|
-
* needs `assets:delete` for its folder,
|
|
479
|
-
* `
|
|
480
|
-
* `
|
|
481
|
-
*
|
|
561
|
+
* needs `assets:delete` for its folder, and a deletion can't name an asset extracted from
|
|
562
|
+
* another (`asset/child-not-deletable`), or nothing is queued. Resolves with
|
|
563
|
+
* `{ batchId, status: "queued", assetCount }` once queued; the work runs in the background
|
|
564
|
+
* and records `asset.deleted` or `asset.content-removed` for each asset, with a `batch-id`
|
|
565
|
+
* fact naming `batchId`. Assets under a safety hold are skipped. Not retried: it carries no
|
|
566
|
+
* `Idempotency-Key`.
|
|
482
567
|
*/
|
|
483
568
|
batch: async (options) => {
|
|
484
569
|
const { assetIds, operation } = checked("assets.batch", options);
|
|
@@ -497,10 +582,18 @@ sign: async (options) => {
|
|
|
497
582
|
return {
|
|
498
583
|
/**
|
|
499
584
|
* Lists project events after a cursor, oldest first. Call without `cursor` to get a cursor
|
|
500
|
-
* for "now", then poll with each response's `nextCursor`. Webhook deliveries carry
|
|
501
|
-
*
|
|
585
|
+
* for "now", then poll with each response's `nextCursor`. Webhook deliveries carry each
|
|
586
|
+
* event's same fields as a flat JSON body. `types` and `assetId` narrow the feed to some
|
|
587
|
+
* event types or one asset's events; a cursor belongs to the filters it was issued with, so
|
|
588
|
+
* pass the same ones with each `cursor`.
|
|
502
589
|
*/
|
|
503
|
-
list: async (options = {}) =>
|
|
590
|
+
list: async (options = {}) => {
|
|
591
|
+
const { types, ...query } = checked("events.list", options);
|
|
592
|
+
return this.request("GET", `${this.projectPath}/events`, { query: {
|
|
593
|
+
...query,
|
|
594
|
+
types: types?.length ? types.join(",") : void 0
|
|
595
|
+
} });
|
|
596
|
+
},
|
|
504
597
|
/**
|
|
505
598
|
* Yields pages of events after `cursor` until no more are waiting. Save each page's
|
|
506
599
|
* `nextCursor` to resume later. Without `cursor`, yields one empty page whose `nextCursor`
|
|
@@ -538,10 +631,18 @@ sign: async (options) => {
|
|
|
538
631
|
get folders() {
|
|
539
632
|
return {
|
|
540
633
|
/**
|
|
541
|
-
* Lists one page of child folders, sorted by name unless `
|
|
634
|
+
* Lists one page of child folders, sorted by name unless `sort` says otherwise. Pass
|
|
542
635
|
* `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
|
|
543
636
|
*/
|
|
544
637
|
list: async (options = {}) => this.request("GET", `${this.projectPath}/folders`, { query: checked("folders.list", options) }),
|
|
638
|
+
/** Yields every child folder of `parentId` (or the project root), fetching pages as needed. */
|
|
639
|
+
iterate: (options = {}) => {
|
|
640
|
+
checked("folders.iterate", options);
|
|
641
|
+
return this.iteratePages((cursor) => this.folders.list({
|
|
642
|
+
...options,
|
|
643
|
+
cursor
|
|
644
|
+
}));
|
|
645
|
+
},
|
|
545
646
|
retrieve: async (options) => {
|
|
546
647
|
const { folderId } = checked("folders.retrieve", options);
|
|
547
648
|
return this.request("GET", `/folders/${requireId(folderId, "Folder ID")}`);
|
|
@@ -570,8 +671,16 @@ sign: async (options) => {
|
|
|
570
671
|
*/
|
|
571
672
|
get hashLists() {
|
|
572
673
|
return {
|
|
573
|
-
/** Lists one page of the project's hash lists, newest first. */
|
|
674
|
+
/** Lists one page of the project's hash lists, newest first unless `sort` says otherwise. */
|
|
574
675
|
list: async (options = {}) => this.request("GET", `${this.projectPath}/hash-lists`, { query: checked("hashLists.list", options) }),
|
|
676
|
+
/** Yields every hash list, fetching pages as needed. */
|
|
677
|
+
iterate: (options = {}) => {
|
|
678
|
+
checked("hashLists.iterate", options);
|
|
679
|
+
return this.iteratePages((cursor) => this.hashLists.list({
|
|
680
|
+
...options,
|
|
681
|
+
cursor
|
|
682
|
+
}));
|
|
683
|
+
},
|
|
575
684
|
retrieve: async (options) => {
|
|
576
685
|
const { hashListId } = checked("hashLists.retrieve", options);
|
|
577
686
|
return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
|
|
@@ -587,7 +696,16 @@ sign: async (options) => {
|
|
|
587
696
|
const { hashListId } = checked("hashLists.delete", options);
|
|
588
697
|
await this.request("DELETE", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
|
|
589
698
|
},
|
|
590
|
-
/**
|
|
699
|
+
/** Yields every entry of a list, fetching pages as needed. */
|
|
700
|
+
iterateEntries: (options) => {
|
|
701
|
+
checked("hashLists.iterateEntries", options);
|
|
702
|
+
requireId(options?.hashListId, "Hash list ID");
|
|
703
|
+
return this.iteratePages((cursor) => this.hashLists.listEntries({
|
|
704
|
+
...options,
|
|
705
|
+
cursor
|
|
706
|
+
}));
|
|
707
|
+
},
|
|
708
|
+
/** Lists one page of a list's entries, newest first unless `sort` says otherwise. */
|
|
591
709
|
listEntries: async (options) => {
|
|
592
710
|
const { hashListId, ...query } = checked("hashLists.listEntries", options);
|
|
593
711
|
return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { query });
|
|
@@ -604,29 +722,42 @@ sign: async (options) => {
|
|
|
604
722
|
};
|
|
605
723
|
}
|
|
606
724
|
/**
|
|
607
|
-
* Moderation policies belong to the
|
|
608
|
-
*
|
|
609
|
-
*
|
|
725
|
+
* Moderation policies belong to the organisation and its projects share them. Every change sends
|
|
726
|
+
* the policy's `revision`, so a policy changed since is refused. Through a project's key you can
|
|
727
|
+
* change only policies no other project uses.
|
|
610
728
|
*/
|
|
611
729
|
get policies() {
|
|
612
|
-
const policyPath = (policyId) =>
|
|
730
|
+
const policyPath = (policyId) => `/policies/${requireId(policyId, "Policy ID")}`;
|
|
613
731
|
return {
|
|
614
|
-
/** Lists the organisation's policies
|
|
615
|
-
list: async () => this.request("GET",
|
|
732
|
+
/** Lists one page of the organisation's policies, oldest first unless `sort` says otherwise. */
|
|
733
|
+
list: async (options = {}) => this.request("GET", "/policies", { query: checked("policies.list", options) }),
|
|
734
|
+
/** Yields every policy of the organisation, fetching pages as needed. */
|
|
735
|
+
iterate: (options = {}) => {
|
|
736
|
+
checked("policies.iterate", options);
|
|
737
|
+
return this.iteratePages((cursor) => this.policies.list({
|
|
738
|
+
...options,
|
|
739
|
+
cursor
|
|
740
|
+
}));
|
|
741
|
+
},
|
|
616
742
|
retrieve: async (options) => this.request("GET", policyPath(checked("policies.retrieve", options).policyId)),
|
|
617
743
|
/** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
|
|
618
|
-
create: async (options) => this.request("POST",
|
|
744
|
+
create: async (options) => this.request("POST", "/policies", { body: checked("policies.create", options) }),
|
|
619
745
|
/** Changes the name, description or settings; later moderation uses them. */
|
|
620
746
|
update: async (options) => {
|
|
621
747
|
const { policyId, ...body } = checked("policies.update", options);
|
|
622
748
|
return this.request("PATCH", policyPath(policyId), { body });
|
|
623
749
|
},
|
|
624
|
-
/**
|
|
625
|
-
|
|
626
|
-
const { policyId, ...body } = checked("policies.
|
|
627
|
-
return this.request("POST", `${policyPath(policyId)}/
|
|
750
|
+
/** Restores the settings of the preset release a `pinned` or `copy` policy is pinned to. */
|
|
751
|
+
reset: async (options) => {
|
|
752
|
+
const { policyId, ...body } = checked("policies.reset", options);
|
|
753
|
+
return this.request("POST", `${policyPath(policyId)}/reset`, { body });
|
|
754
|
+
},
|
|
755
|
+
/** Moves an unchanged `pinned` or `copy` policy to the latest release of its preset. */
|
|
756
|
+
upgrade: async (options) => {
|
|
757
|
+
const { policyId, ...body } = checked("policies.upgrade", options);
|
|
758
|
+
return this.request("POST", `${policyPath(policyId)}/upgrade`, { body });
|
|
628
759
|
},
|
|
629
|
-
/** Switches automatic updates on or off for the organisation's own preset policy. */
|
|
760
|
+
/** Switches automatic updates on (`live`) or off (`pinned`) for the organisation's own preset policy. */
|
|
630
761
|
setAutomaticUpdates: async (options) => {
|
|
631
762
|
const { policyId, ...body } = checked("policies.setAutomaticUpdates", options);
|
|
632
763
|
return this.request("PUT", `${policyPath(policyId)}/automatic-updates`, { body });
|
|
@@ -635,13 +766,58 @@ sign: async (options) => {
|
|
|
635
766
|
delete: async (options) => {
|
|
636
767
|
await this.request("DELETE", policyPath(checked("policies.delete", options).policyId));
|
|
637
768
|
},
|
|
769
|
+
/** The policy the project moderates with. */
|
|
770
|
+
retrieveAssigned: async () => this.request("GET", `${this.projectPath}/policy`),
|
|
638
771
|
/** Chooses the policy the project moderates with. */
|
|
639
772
|
assign: async (options) => this.request("PUT", `${this.projectPath}/policy`, { body: checked("policies.assign", options) })
|
|
640
773
|
};
|
|
641
774
|
}
|
|
642
775
|
/**
|
|
643
|
-
*
|
|
644
|
-
*
|
|
776
|
+
* The project's lenses: named image transforms the CDN applies at `/@<identifier>`. The CDN
|
|
777
|
+
* serves files made with each lens's current definition. `ensureLenses` creates or changes
|
|
778
|
+
* lenses by identifier, for applications that declare theirs in code.
|
|
779
|
+
*/
|
|
780
|
+
get lenses() {
|
|
781
|
+
const lensPath = (lensId) => `/lenses/${requireId(lensId, "Lens ID")}`;
|
|
782
|
+
const forget = (matches) => {
|
|
783
|
+
for (const [cacheKey, lens] of this.#lenses.ensuredLenses) if (matches(lens)) this.#lenses.ensuredLenses.delete(cacheKey);
|
|
784
|
+
};
|
|
785
|
+
return {
|
|
786
|
+
/** Lists one page of the project's lenses, newest first unless `sort` says otherwise. */
|
|
787
|
+
list: async (options = {}) => this.request("GET", `${this.projectPath}/lenses`, { query: checked("lenses.list", options) }),
|
|
788
|
+
/** Yields every lens of the project, fetching pages as needed. */
|
|
789
|
+
iterate: (options = {}) => {
|
|
790
|
+
checked("lenses.iterate", options);
|
|
791
|
+
return this.iteratePages((cursor) => this.lenses.list({
|
|
792
|
+
...options,
|
|
793
|
+
cursor
|
|
794
|
+
}));
|
|
795
|
+
},
|
|
796
|
+
/** Creates a lens; its identifier must be new to the project. */
|
|
797
|
+
create: async (options) => {
|
|
798
|
+
const lens = await this.request("POST", `${this.projectPath}/lenses`, { body: checked("lenses.create", options) });
|
|
799
|
+
forget((cached) => cached.identifier === lens.identifier);
|
|
800
|
+
return lens;
|
|
801
|
+
},
|
|
802
|
+
retrieve: async (options) => this.request("GET", lensPath(checked("lenses.retrieve", options).lensId)),
|
|
803
|
+
/** Changes a lens's name, description, type, transform or whether the CDN serves it. */
|
|
804
|
+
update: async (options) => {
|
|
805
|
+
const { lensId, ...body } = checked("lenses.update", options);
|
|
806
|
+
const lens = await this.request("PATCH", lensPath(lensId), { body });
|
|
807
|
+
forget((cached) => cached.id === lens.id);
|
|
808
|
+
return lens;
|
|
809
|
+
},
|
|
810
|
+
/** Deletes a lens; URLs that select it stop being served. */
|
|
811
|
+
delete: async (options) => {
|
|
812
|
+
const { lensId } = checked("lenses.delete", options);
|
|
813
|
+
await this.request("DELETE", lensPath(lensId));
|
|
814
|
+
forget((cached) => cached.id === lensId);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Creates a named lens, or changes it to this definition. Sending the same definition again
|
|
820
|
+
* returns the lens unchanged, from the client's lens cache once it has seen it.
|
|
645
821
|
*/
|
|
646
822
|
async ensureLens(options) {
|
|
647
823
|
checked("ensureLens", options);
|
|
@@ -652,7 +828,7 @@ sign: async (options) => {
|
|
|
652
828
|
/**
|
|
653
829
|
* Create or update several named lenses. New definitions are sent in one API request, or in
|
|
654
830
|
* consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
|
|
655
|
-
* Each lens
|
|
831
|
+
* Each lens is created or changed as ensureLens() does.
|
|
656
832
|
*/
|
|
657
833
|
async ensureLenses(options) {
|
|
658
834
|
const { lenses } = checked("ensureLenses", options);
|
|
@@ -701,4 +877,4 @@ sign: async (options) => {
|
|
|
701
877
|
}
|
|
702
878
|
}
|
|
703
879
|
};
|
|
704
|
-
export { WEBHOOK_TIMESTAMP_HEADER as a,
|
|
880
|
+
export { WEBHOOK_TIMESTAMP_HEADER as a, isNewerAssetEvent 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 };
|