@calmlens/sdk 0.8.0 → 0.9.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/cjs/{CalmLensTypes-B7hr0SBv.d.ts → CalmLensTypes-CZqyni4p.d.ts} +7 -1
- package/cjs/{CalmLensUtils-CJ6o7KRU.js → CalmLensUtils-CArkVfj0.js} +59 -0
- package/cjs/index.d.ts +12 -4
- package/cjs/index.js +136 -77
- package/cjs/testing.d.ts +7 -4
- package/cjs/testing.js +163 -133
- package/esm/{CalmLensTypes-B7hr0SBv.d.ts → CalmLensTypes-CZqyni4p.d.ts} +7 -1
- package/esm/{CalmLensUtils-BZsX8yeO.js → CalmLensUtils-Bnikzonc.js} +42 -1
- package/esm/index.d.ts +12 -4
- package/esm/index.js +135 -76
- package/esm/testing.d.ts +7 -4
- package/esm/testing.js +162 -132
- package/package.json +4 -8
|
@@ -3542,6 +3542,12 @@ interface RetrieveAssetOptions {
|
|
|
3542
3542
|
interface RetryAssetOptions {
|
|
3543
3543
|
assetId: string;
|
|
3544
3544
|
}
|
|
3545
|
+
interface DeleteAssetOptions {
|
|
3546
|
+
assetId: string;
|
|
3547
|
+
}
|
|
3548
|
+
interface DeleteAssetContentOptions {
|
|
3549
|
+
assetId: string;
|
|
3550
|
+
}
|
|
3545
3551
|
type UpdateAssetOptions = PatchAssetBody & {
|
|
3546
3552
|
assetId: string;
|
|
3547
3553
|
};
|
|
@@ -3624,4 +3630,4 @@ interface ModerateTextOptions extends Omit<SubmitAssetCommonOptions, "name" | "v
|
|
|
3624
3630
|
name?: string;
|
|
3625
3631
|
}
|
|
3626
3632
|
//#endregion
|
|
3627
|
-
export {
|
|
3633
|
+
export { GetAssetResponse as A, EventCategory as B, RetryAssetOptions as C, UploadAssetPartOptions as D, UpdateFolderOptions as E, AssetBinaryPayloadInput as F, EventType as G, EventFactValues as H, Lens as I, AssetType as J, Asset as K, Folder as L, GetEventsResponse as M, PostAssetSignedUrlResponse as N, VerifyWebhookSignatureOptions as O, RequestErrorCode as P, Event as R, RetrieveAssetOptions as S, UpdateAssetOptions as T, EventFacts as U, EventFact as V, EventSeverity as W, MetadataItem as X, AssetVisibility as Y, ProcessingOptions as Z, MoveAssetOptions as _, CreateAssetSignedUrlOptions as a, MultipartUploadPartOptions as b, DeleteAssetContentOptions as c, EnsureLensesOptions as d, FolderIdOptions as f, ModerateTextOptions as g, ListEventsOptions as h, CdnServeOptions as i, GetAssetsPageResponse as j, GetAssetChildrenResponse as k, DeleteAssetOptions as l, ListAssetsOptions as m, CalmLensClientOptions as n, CreateFolderOptions as o, ListAssetChildrenOptions as p, AssetStatus as q, CdnAssetUrlOptions as r, CreateMultipartUploadPartOptions as s, AssetContentOptions as t, EnsureLensOptions as u, MoveFolderOptions as v, SubmitAssetOptions as w, RequestOptions as x, MultipartUploadOptions as y, TypedEvent as z };
|
|
@@ -434,6 +434,7 @@ const validateClientOptions = (options) => {
|
|
|
434
434
|
if (!options || typeof options !== "object") throw invalidOptions("Client options are required");
|
|
435
435
|
if (!options.apiKey) throw invalidOptions("API key is required");
|
|
436
436
|
if (!options.projectId) throw invalidOptions("Project ID is required");
|
|
437
|
+
encodePathSegment(options.projectId, "Project ID");
|
|
437
438
|
if (options.timeoutMs !== void 0 && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs <= 0)) throw invalidOptions("timeoutMs must be a positive integer");
|
|
438
439
|
assertHttpUrl("baseUrl", options.baseUrl);
|
|
439
440
|
assertHttpUrl("cdnBaseUrl", options.cdnBaseUrl);
|
|
@@ -449,6 +450,46 @@ const toTextAssetOptions = (_ref) => {
|
|
|
449
450
|
}
|
|
450
451
|
});
|
|
451
452
|
};
|
|
453
|
+
/**
|
|
454
|
+
* Encodes an identifier as one URL path segment. `.` and `..` are rejected because URL
|
|
455
|
+
* resolution would treat them as relative segments and send the request to another route.
|
|
456
|
+
*/
|
|
457
|
+
const encodePathSegment = (value, name) => {
|
|
458
|
+
if (typeof value !== "string" || !value) throw invalidOptions(`${name} is required`);
|
|
459
|
+
if (value === "." || value === "..") throw invalidOptions(`${name} cannot be "." or ".."`);
|
|
460
|
+
return encodeURIComponent(value);
|
|
461
|
+
};
|
|
462
|
+
/** Appends a CDN lens (`/@name`) or direct transform selector to an asset URL. */
|
|
463
|
+
const appendCdnSelector = (url, options) => {
|
|
464
|
+
if (options.lens && options.transform) throw invalidOptions("Specify either a lens or a transform, not both");
|
|
465
|
+
if (options.lens) return `${url}/@${encodePathSegment(options.lens, "Lens")}`;
|
|
466
|
+
if (!options.transform) return url;
|
|
467
|
+
const transform = options.transform.replace(/^\/+/, "");
|
|
468
|
+
if (transform.includes("..") || transform.includes("?") || transform.includes("#")) throw invalidOptions("Transform cannot contain \"..\", \"?\" or \"#\"");
|
|
469
|
+
return `${url}/${encodeURI(transform)}`;
|
|
470
|
+
};
|
|
471
|
+
const appendQueryValue = (parts, key, value) => {
|
|
472
|
+
if (value === void 0 || value === null) return;
|
|
473
|
+
if (Array.isArray(value)) {
|
|
474
|
+
for (const [index, item] of value.entries()) appendQueryValue(parts, `${key}[${index}]`, item);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (typeof value === "object") {
|
|
478
|
+
for (const [field, item] of Object.entries(value)) appendQueryValue(parts, `${key}[${field}]`, item);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* Serialises a query object the way the API parses it (qs bracket notation), for example
|
|
485
|
+
* `ordering[0][field]=createdAt&ordering[0][direction]=DESC`. Every key and value is
|
|
486
|
+
* percent-encoded and missing values are omitted.
|
|
487
|
+
*/
|
|
488
|
+
const stringifyQuery = (query) => {
|
|
489
|
+
const parts = [];
|
|
490
|
+
for (const [key, value] of Object.entries(query)) appendQueryValue(parts, key, value);
|
|
491
|
+
return parts.join("&");
|
|
492
|
+
};
|
|
452
493
|
//#endregion
|
|
453
494
|
Object.defineProperty(exports, "CalmLensError", {
|
|
454
495
|
enumerable: true,
|
|
@@ -510,6 +551,12 @@ Object.defineProperty(exports, "_objectWithoutProperties", {
|
|
|
510
551
|
return _objectWithoutProperties;
|
|
511
552
|
}
|
|
512
553
|
});
|
|
554
|
+
Object.defineProperty(exports, "appendCdnSelector", {
|
|
555
|
+
enumerable: true,
|
|
556
|
+
get: function() {
|
|
557
|
+
return appendCdnSelector;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
513
560
|
Object.defineProperty(exports, "assetDataToUint8Array", {
|
|
514
561
|
enumerable: true,
|
|
515
562
|
get: function() {
|
|
@@ -528,6 +575,12 @@ Object.defineProperty(exports, "calmLensError", {
|
|
|
528
575
|
return calmLensError;
|
|
529
576
|
}
|
|
530
577
|
});
|
|
578
|
+
Object.defineProperty(exports, "encodePathSegment", {
|
|
579
|
+
enumerable: true,
|
|
580
|
+
get: function() {
|
|
581
|
+
return encodePathSegment;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
531
584
|
Object.defineProperty(exports, "getAssetPayloadByteLength", {
|
|
532
585
|
enumerable: true,
|
|
533
586
|
get: function() {
|
|
@@ -558,6 +611,12 @@ Object.defineProperty(exports, "stringifyJsonCanonical", {
|
|
|
558
611
|
return stringifyJsonCanonical;
|
|
559
612
|
}
|
|
560
613
|
});
|
|
614
|
+
Object.defineProperty(exports, "stringifyQuery", {
|
|
615
|
+
enumerable: true,
|
|
616
|
+
get: function() {
|
|
617
|
+
return stringifyQuery;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
561
620
|
Object.defineProperty(exports, "toTextAssetOptions", {
|
|
562
621
|
enumerable: true,
|
|
563
622
|
get: function() {
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as GetAssetResponse, B as EventCategory, C as RetryAssetOptions, D as UploadAssetPartOptions, E as UpdateFolderOptions, G as EventType, H as EventFactValues, I as Lens, J as AssetType, K as Asset, L as Folder, M as GetEventsResponse, N as PostAssetSignedUrlResponse, O as VerifyWebhookSignatureOptions, P as RequestErrorCode, R as Event, S as RetrieveAssetOptions, T as UpdateAssetOptions, U as EventFacts, V as EventFact, W as EventSeverity, X as MetadataItem, Y as AssetVisibility, Z as ProcessingOptions, _ as MoveAssetOptions, a as CreateAssetSignedUrlOptions, b as MultipartUploadPartOptions, c as DeleteAssetContentOptions, d as EnsureLensesOptions, f as FolderIdOptions, g as ModerateTextOptions, h as ListEventsOptions, i as CdnServeOptions, j as GetAssetsPageResponse, k as GetAssetChildrenResponse, l as DeleteAssetOptions, m as ListAssetsOptions, n as CalmLensClientOptions, o as CreateFolderOptions, p as ListAssetChildrenOptions, q as AssetStatus, r as CdnAssetUrlOptions, s as CreateMultipartUploadPartOptions, t as AssetContentOptions, u as EnsureLensOptions, v as MoveFolderOptions, w as SubmitAssetOptions, x as RequestOptions, y as MultipartUploadOptions, z as TypedEvent } from "./CalmLensTypes-CZqyni4p.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/AssetSearch.d.ts
|
|
4
4
|
declare const ASSET_SEARCH_QUERY_SCHEMA: zod.ZodObject<{
|
|
@@ -7501,7 +7501,7 @@ declare class CalmLensClient {
|
|
|
7501
7501
|
* @param options - Pagination and filtering options
|
|
7502
7502
|
* @returns Promise with paginated assets
|
|
7503
7503
|
*/
|
|
7504
|
-
list: (options
|
|
7504
|
+
list: (options?: ListAssetsOptions) => Promise<GetAssetsPageResponse>;
|
|
7505
7505
|
/**
|
|
7506
7506
|
* Retrieve a specific asset by ID
|
|
7507
7507
|
* @param assetId - The asset ID
|
|
@@ -7515,7 +7515,7 @@ declare class CalmLensClient {
|
|
|
7515
7515
|
* @param options - Pagination options
|
|
7516
7516
|
* @returns Promise with paginated child assets
|
|
7517
7517
|
*/
|
|
7518
|
-
listChildren: ({ assetId, ...options }
|
|
7518
|
+
listChildren: ({ assetId, ...options }?: ListAssetChildrenOptions) => Promise<GetAssetChildrenResponse>;
|
|
7519
7519
|
/**
|
|
7520
7520
|
* Submit a new asset for processing (queued asynchronously)
|
|
7521
7521
|
* The asset will be queued for classification and returned immediately.
|
|
@@ -7550,6 +7550,14 @@ declare class CalmLensClient {
|
|
|
7550
7550
|
* moderated like a new upload; its content must still be stored.
|
|
7551
7551
|
*/
|
|
7552
7552
|
retry: ({ assetId }: RetryAssetOptions) => Promise<Asset>;
|
|
7553
|
+
/**
|
|
7554
|
+
* Removes an asset's stored content (source, preview and retained extracted text) while
|
|
7555
|
+
* keeping the asset record, metadata and moderation report. The returned asset has
|
|
7556
|
+
* `storageDeletedAt` set; the CDN no longer serves it.
|
|
7557
|
+
*/
|
|
7558
|
+
deleteContent: ({ assetId }: DeleteAssetContentOptions) => Promise<Asset>;
|
|
7559
|
+
/** Deletes an asset record together with its stored content. */
|
|
7560
|
+
delete: ({ assetId }: DeleteAssetOptions) => Promise<void>;
|
|
7553
7561
|
};
|
|
7554
7562
|
get events(): {
|
|
7555
7563
|
/**
|
|
@@ -7620,4 +7628,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
7620
7628
|
*/
|
|
7621
7629
|
export declare function verifyWebhookSignature({ payload, signature, timestamp, secret, toleranceSeconds, now }: VerifyWebhookSignatureOptions): Promise<boolean>;
|
|
7622
7630
|
//#endregion
|
|
7623
|
-
export { type Asset, type GetAssetChildrenResponse as AssetChildrenPage, type AssetContentOptions, type GetAssetsPageResponse as AssetPage, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, CalmLensClient, type CalmLensClientOptions, type CalmLensErrorDetails, type CdnAssetUrlOptions, type CdnServeOptions, type ClassificationCategoryReport, type ClassificationReport, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type EnsureLensOptions, type EnsureLensesOptions, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type Folder, type FolderIdOptions, type Lens, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type VerifyWebhookSignatureOptions, type WebhookEventPayload };
|
|
7631
|
+
export { type Asset, type GetAssetChildrenResponse as AssetChildrenPage, type AssetContentOptions, type GetAssetsPageResponse as AssetPage, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, CalmLensClient, type CalmLensClientOptions, type CalmLensErrorDetails, type CdnAssetUrlOptions, type CdnServeOptions, type ClassificationCategoryReport, type ClassificationReport, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type EnsureLensOptions, type EnsureLensesOptions, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type Folder, type FolderIdOptions, type Lens, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type VerifyWebhookSignatureOptions, type WebhookEventPayload };
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
2
|
+
const require_CalmLensUtils = require("./CalmLensUtils-CArkVfj0.js");
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
zod = require_CalmLensUtils.__toESM(zod);
|
|
5
5
|
require("zod/v4");
|
|
@@ -244,6 +244,42 @@ function generateMediaTestCode(signal, projectId) {
|
|
|
244
244
|
return `Calm Lens test ${[...suffix].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
245
245
|
}
|
|
246
246
|
//#endregion
|
|
247
|
+
//#region ../shared/src/CryptoUtils.ts
|
|
248
|
+
const encoder = new TextEncoder();
|
|
249
|
+
/** Lowercase hex of `bytes`, two characters per byte. */
|
|
250
|
+
const bytesToHex = (bytes) => Array.from(bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
251
|
+
(function() {
|
|
252
|
+
var _ref = require_CalmLensUtils._asyncToGenerator(function* (value) {
|
|
253
|
+
return bytesToHex(yield crypto.subtle.digest("SHA-256", encoder.encode(value)));
|
|
254
|
+
});
|
|
255
|
+
return function sha256Hex(_x) {
|
|
256
|
+
return _ref.apply(this, arguments);
|
|
257
|
+
};
|
|
258
|
+
})();
|
|
259
|
+
/** HMAC-SHA256 of `message` keyed with `secret` (both UTF-8 encoded), as lowercase hex. */
|
|
260
|
+
const hmacSha256Hex = function() {
|
|
261
|
+
var _ref2 = require_CalmLensUtils._asyncToGenerator(function* (secret, message) {
|
|
262
|
+
const key = yield crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
263
|
+
name: "HMAC",
|
|
264
|
+
hash: "SHA-256"
|
|
265
|
+
}, false, ["sign"]);
|
|
266
|
+
return bytesToHex(yield crypto.subtle.sign("HMAC", key, encoder.encode(message)));
|
|
267
|
+
});
|
|
268
|
+
return function hmacSha256Hex(_x2, _x3) {
|
|
269
|
+
return _ref2.apply(this, arguments);
|
|
270
|
+
};
|
|
271
|
+
}();
|
|
272
|
+
/**
|
|
273
|
+
* Compares two strings without leaking, through timing, where they first differ. Strings of
|
|
274
|
+
* different lengths are unequal immediately (the length itself is not secret here).
|
|
275
|
+
*/
|
|
276
|
+
const timingSafeEqual = (a, b) => {
|
|
277
|
+
if (a.length !== b.length) return false;
|
|
278
|
+
let difference = 0;
|
|
279
|
+
for (let index = 0; index < a.length; index++) difference |= a.charCodeAt(index) ^ b.charCodeAt(index);
|
|
280
|
+
return difference === 0;
|
|
281
|
+
};
|
|
282
|
+
//#endregion
|
|
247
283
|
//#region src/client/CalmLensWebhooks.ts
|
|
248
284
|
const WEBHOOK_DELIVERY_HEADER = "x-calmlens-delivery";
|
|
249
285
|
const WEBHOOK_TIMESTAMP_HEADER = "x-calmlens-timestamp";
|
|
@@ -268,39 +304,18 @@ const toWebhookEventPayload = (event) => {
|
|
|
268
304
|
}
|
|
269
305
|
};
|
|
270
306
|
};
|
|
271
|
-
const encoder = new TextEncoder();
|
|
272
|
-
const hmacSha256Hex = function() {
|
|
273
|
-
var _ref = require_CalmLensUtils._asyncToGenerator(function* (secret, message) {
|
|
274
|
-
const key = yield crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
275
|
-
name: "HMAC",
|
|
276
|
-
hash: "SHA-256"
|
|
277
|
-
}, false, ["sign"]);
|
|
278
|
-
const signature = yield crypto.subtle.sign("HMAC", key, encoder.encode(message));
|
|
279
|
-
return Array.from(new Uint8Array(signature), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
280
|
-
});
|
|
281
|
-
return function hmacSha256Hex(_x, _x2) {
|
|
282
|
-
return _ref.apply(this, arguments);
|
|
283
|
-
};
|
|
284
|
-
}();
|
|
285
|
-
/** Constant-time comparison of two strings of the same length. */
|
|
286
|
-
const timingSafeEqual = (a, b) => {
|
|
287
|
-
if (a.length !== b.length) return false;
|
|
288
|
-
let diff = 0;
|
|
289
|
-
for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
290
|
-
return diff === 0;
|
|
291
|
-
};
|
|
292
307
|
/** `v1=<hex HMAC-SHA256 of "<timestamp>.<body>">`, the `x-calmlens-signature` header value. */
|
|
293
308
|
const createWebhookSignatureHeader = function() {
|
|
294
|
-
var
|
|
309
|
+
var _ref = require_CalmLensUtils._asyncToGenerator(function* (secret, timestamp, body) {
|
|
295
310
|
return `v1=${yield hmacSha256Hex(secret, `${timestamp}.${body}`)}`;
|
|
296
311
|
});
|
|
297
|
-
return function createWebhookSignatureHeader(
|
|
298
|
-
return
|
|
312
|
+
return function createWebhookSignatureHeader(_x, _x2, _x3) {
|
|
313
|
+
return _ref.apply(this, arguments);
|
|
299
314
|
};
|
|
300
315
|
}();
|
|
301
316
|
/** Headers for one signed delivery of `body`. */
|
|
302
317
|
const createWebhookHeaders = function() {
|
|
303
|
-
var
|
|
318
|
+
var _ref2 = require_CalmLensUtils._asyncToGenerator(function* (options) {
|
|
304
319
|
var _options$timestampSec;
|
|
305
320
|
const timestamp = (_options$timestampSec = options.timestampSeconds) !== null && _options$timestampSec !== void 0 ? _options$timestampSec : Math.floor(Date.now() / 1e3);
|
|
306
321
|
return {
|
|
@@ -310,8 +325,8 @@ const createWebhookHeaders = function() {
|
|
|
310
325
|
[WEBHOOK_SIGNATURE_HEADER]: yield createWebhookSignatureHeader(options.secret, timestamp, options.body)
|
|
311
326
|
};
|
|
312
327
|
});
|
|
313
|
-
return function createWebhookHeaders(
|
|
314
|
-
return
|
|
328
|
+
return function createWebhookHeaders(_x4) {
|
|
329
|
+
return _ref2.apply(this, arguments);
|
|
315
330
|
};
|
|
316
331
|
}();
|
|
317
332
|
/**
|
|
@@ -319,7 +334,7 @@ const createWebhookHeaders = function() {
|
|
|
319
334
|
* `"<x-calmlens-timestamp>.<raw body>"`, and the timestamp must be within `toleranceSeconds`
|
|
320
335
|
* (default 300) of now. Returns `false` for anything missing or malformed.
|
|
321
336
|
*/
|
|
322
|
-
function verifyWebhookSignature(
|
|
337
|
+
function verifyWebhookSignature(_x5) {
|
|
323
338
|
return _verifyWebhookSignature.apply(this, arguments);
|
|
324
339
|
}
|
|
325
340
|
function _verifyWebhookSignature() {
|
|
@@ -427,12 +442,6 @@ const prepareSubmitAssetOptions = (options) => {
|
|
|
427
442
|
}
|
|
428
443
|
return options;
|
|
429
444
|
};
|
|
430
|
-
const appendCdnSelector = (url, options) => {
|
|
431
|
-
if (options.lens && options.transform) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Specify either a lens or a transform, not both" });
|
|
432
|
-
if (options.lens) return `${url}/@${encodeURIComponent(options.lens)}`;
|
|
433
|
-
if (!options.transform) return url;
|
|
434
|
-
return `${url}/${encodeURI(options.transform.replace(/^\/+/, ""))}`;
|
|
435
|
-
};
|
|
436
445
|
const getEnsureLensCacheKey = (options) => {
|
|
437
446
|
var _options$description, _options$transforms;
|
|
438
447
|
return require_CalmLensUtils.stringifyJsonCanonical({
|
|
@@ -514,6 +523,7 @@ const createApi = (options) => {
|
|
|
514
523
|
return new api_def.Api({
|
|
515
524
|
name: "Calm Lens",
|
|
516
525
|
baseUrl: options.baseUrl,
|
|
526
|
+
config: { queryHandling: { stringify: require_CalmLensUtils.stringifyQuery } },
|
|
517
527
|
middleware: [
|
|
518
528
|
(0, api_def.RequestCoalescingMiddleware)(),
|
|
519
529
|
{ beforeSend: (context) => {
|
|
@@ -645,12 +655,32 @@ const createEndpoints = (api) => {
|
|
|
645
655
|
method: "post",
|
|
646
656
|
path: "/assets/:assetId/retry"
|
|
647
657
|
});
|
|
658
|
+
const deleteAsset = api.endpoint().paramsOf().responseOf().build({
|
|
659
|
+
id: "deleteAsset",
|
|
660
|
+
method: "delete",
|
|
661
|
+
path: "/assets/:assetId"
|
|
662
|
+
});
|
|
663
|
+
const deleteAssetContent = api.endpoint().paramsOf().responseOf().build({
|
|
664
|
+
id: "deleteAssetContent",
|
|
665
|
+
method: "delete",
|
|
666
|
+
path: "/assets/:assetId/content"
|
|
667
|
+
});
|
|
648
668
|
const getEvents = api.endpoint().paramsOf().queryOf().responseOf().build({
|
|
649
669
|
id: "getEvents",
|
|
650
670
|
method: "get",
|
|
651
671
|
path: "/projects/:projectId/events"
|
|
652
672
|
});
|
|
653
|
-
|
|
673
|
+
const ensureLens = api.endpoint().bodyOf().paramsOf().responseOf().build({
|
|
674
|
+
id: "ensureLens",
|
|
675
|
+
method: "put",
|
|
676
|
+
path: "/lenses/:lensIdentifier"
|
|
677
|
+
});
|
|
678
|
+
const ensureLenses = api.endpoint().bodyOf().paramsOf().responseOf().build({
|
|
679
|
+
id: "ensureLenses",
|
|
680
|
+
method: "put",
|
|
681
|
+
path: "/projects/:projectId/lenses"
|
|
682
|
+
});
|
|
683
|
+
return encodePathParams({
|
|
654
684
|
getFolders,
|
|
655
685
|
getFolder,
|
|
656
686
|
postFolder,
|
|
@@ -667,18 +697,23 @@ const createEndpoints = (api) => {
|
|
|
667
697
|
postAssetPart,
|
|
668
698
|
moveAsset,
|
|
669
699
|
retryAsset,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}),
|
|
675
|
-
ensureLenses: api.endpoint().bodyOf().paramsOf().responseOf().build({
|
|
676
|
-
id: "ensureLenses",
|
|
677
|
-
method: "put",
|
|
678
|
-
path: "/projects/:projectId/lenses"
|
|
679
|
-
}),
|
|
700
|
+
deleteAsset,
|
|
701
|
+
deleteAssetContent,
|
|
702
|
+
ensureLens,
|
|
703
|
+
ensureLenses,
|
|
680
704
|
getEvents
|
|
681
|
-
};
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
/**
|
|
708
|
+
* api-def inserts `/:param` values into the path verbatim, so every endpoint encodes its path
|
|
709
|
+
* params here: an ID can never add path segments, a query string or a fragment.
|
|
710
|
+
*/
|
|
711
|
+
const encodePathParams = (endpoints) => {
|
|
712
|
+
for (const endpoint of Object.values(endpoints)) {
|
|
713
|
+
const submit = endpoint.submit.bind(endpoint);
|
|
714
|
+
endpoint.submit = (config) => submit(require_CalmLensUtils._objectSpread2(require_CalmLensUtils._objectSpread2({}, config), {}, { params: config.params && Object.fromEntries(Object.entries(config.params).map(([key, value]) => [key, require_CalmLensUtils.encodePathSegment(value, key)])) }));
|
|
715
|
+
}
|
|
716
|
+
return endpoints;
|
|
682
717
|
};
|
|
683
718
|
var CalmLensClient = class CalmLensClient {
|
|
684
719
|
/**
|
|
@@ -804,7 +839,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
804
839
|
isFinal: String((_part$isFinal2 = part.isFinal) !== null && _part$isFinal2 !== void 0 ? _part$isFinal2 : false)
|
|
805
840
|
});
|
|
806
841
|
setOptionalQueryValue(query, "sizeInBytes", (_part$sizeInBytes2 = part.sizeInBytes) !== null && _part$sizeInBytes2 !== void 0 ? _part$sizeInBytes2 : require_CalmLensUtils.getAssetPayloadByteLength(part));
|
|
807
|
-
const url = `${_this2.options.baseUrl.replace(/\/$/, "")}/assets/${
|
|
842
|
+
const url = `${_this2.options.baseUrl.replace(/\/$/, "")}/assets/${require_CalmLensUtils.encodePathSegment(assetId, "Asset ID")}/part?${query}`;
|
|
808
843
|
const response = yield _this2.getUploadFetch()(url, {
|
|
809
844
|
method: "POST",
|
|
810
845
|
headers: {
|
|
@@ -879,8 +914,8 @@ var CalmLensClient = class CalmLensClient {
|
|
|
879
914
|
let { assetIdentifier } = _ref4, options = require_CalmLensUtils._objectWithoutProperties(_ref4, _excluded3);
|
|
880
915
|
if (!assetIdentifier) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset identifier is required" });
|
|
881
916
|
const resource = (_options$resource = options.resource) !== null && _options$resource !== void 0 ? _options$resource : "content";
|
|
882
|
-
const url = `${this.options.cdnBaseUrl.replace(/\/$/, "")}/assets/${encodeURIComponent(this.options.projectId)}/${
|
|
883
|
-
return appendCdnSelector(url, options);
|
|
917
|
+
const url = `${this.options.cdnBaseUrl.replace(/\/$/, "")}/assets/${encodeURIComponent(this.options.projectId)}/${require_CalmLensUtils.encodePathSegment(assetIdentifier, "Asset identifier")}/${resource}`;
|
|
918
|
+
return require_CalmLensUtils.appendCdnSelector(url, options);
|
|
884
919
|
},
|
|
885
920
|
/**
|
|
886
921
|
* Fetch asset content or previews from the CDN.
|
|
@@ -931,14 +966,14 @@ var CalmLensClient = class CalmLensClient {
|
|
|
931
966
|
* @returns Promise with paginated assets
|
|
932
967
|
*/
|
|
933
968
|
list: function() {
|
|
934
|
-
var _ref9 = require_CalmLensUtils._asyncToGenerator(function* (options) {
|
|
969
|
+
var _ref9 = require_CalmLensUtils._asyncToGenerator(function* (options = {}) {
|
|
935
970
|
var _options$pageIndex;
|
|
936
971
|
return (yield _this5.endpoints.getAssetsPage.submit({
|
|
937
972
|
params: { projectId: _this5.options.projectId },
|
|
938
973
|
query: require_CalmLensUtils._objectSpread2(require_CalmLensUtils._objectSpread2({}, options), {}, { pageIndex: (_options$pageIndex = options.pageIndex) !== null && _options$pageIndex !== void 0 ? _options$pageIndex : 0 })
|
|
939
974
|
})).data;
|
|
940
975
|
});
|
|
941
|
-
return function list(
|
|
976
|
+
return function list() {
|
|
942
977
|
return _ref9.apply(this, arguments);
|
|
943
978
|
};
|
|
944
979
|
}(),
|
|
@@ -952,7 +987,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
952
987
|
if (!assetId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset ID is required" });
|
|
953
988
|
return (yield _this5.endpoints.getAsset.submit({ params: { assetId } })).data;
|
|
954
989
|
});
|
|
955
|
-
return function retrieve(
|
|
990
|
+
return function retrieve(_x7) {
|
|
956
991
|
return _ref10.apply(this, arguments);
|
|
957
992
|
};
|
|
958
993
|
}(),
|
|
@@ -965,7 +1000,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
965
1000
|
body
|
|
966
1001
|
})).data;
|
|
967
1002
|
});
|
|
968
|
-
return function update(
|
|
1003
|
+
return function update(_x8) {
|
|
969
1004
|
return _ref12.apply(this, arguments);
|
|
970
1005
|
};
|
|
971
1006
|
}(),
|
|
@@ -976,7 +1011,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
976
1011
|
* @returns Promise with paginated child assets
|
|
977
1012
|
*/
|
|
978
1013
|
listChildren: function() {
|
|
979
|
-
var _ref14 = require_CalmLensUtils._asyncToGenerator(function* (_ref13) {
|
|
1014
|
+
var _ref14 = require_CalmLensUtils._asyncToGenerator(function* (_ref13 = {}) {
|
|
980
1015
|
var _options$pageIndex2;
|
|
981
1016
|
let { assetId } = _ref13, options = require_CalmLensUtils._objectWithoutProperties(_ref13, _excluded6);
|
|
982
1017
|
if (!assetId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset ID is required" });
|
|
@@ -985,7 +1020,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
985
1020
|
query: require_CalmLensUtils._objectSpread2(require_CalmLensUtils._objectSpread2({}, options), {}, { pageIndex: (_options$pageIndex2 = options.pageIndex) !== null && _options$pageIndex2 !== void 0 ? _options$pageIndex2 : 0 })
|
|
986
1021
|
})).data;
|
|
987
1022
|
});
|
|
988
|
-
return function listChildren(
|
|
1023
|
+
return function listChildren() {
|
|
989
1024
|
return _ref14.apply(this, arguments);
|
|
990
1025
|
};
|
|
991
1026
|
}(),
|
|
@@ -1005,7 +1040,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1005
1040
|
query: { queue: true }
|
|
1006
1041
|
})).data;
|
|
1007
1042
|
});
|
|
1008
|
-
return function create(
|
|
1043
|
+
return function create(_x9) {
|
|
1009
1044
|
return _ref15.apply(this, arguments);
|
|
1010
1045
|
};
|
|
1011
1046
|
}(),
|
|
@@ -1027,7 +1062,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1027
1062
|
query: { queue: false }
|
|
1028
1063
|
})).data;
|
|
1029
1064
|
});
|
|
1030
|
-
return function moderate(
|
|
1065
|
+
return function moderate(_x10) {
|
|
1031
1066
|
return _ref16.apply(this, arguments);
|
|
1032
1067
|
};
|
|
1033
1068
|
}(),
|
|
@@ -1056,7 +1091,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1056
1091
|
}
|
|
1057
1092
|
return yield _this5.submitRawAssetPart(assetId, part, (_this$multipartUpload = _this5.multipartUploadQueues.get(assetId)) !== null && _this$multipartUpload !== void 0 ? _this$multipartUpload : false);
|
|
1058
1093
|
});
|
|
1059
|
-
return function uploadPart(
|
|
1094
|
+
return function uploadPart(_x11) {
|
|
1060
1095
|
return _ref17.apply(this, arguments);
|
|
1061
1096
|
};
|
|
1062
1097
|
}(),
|
|
@@ -1081,7 +1116,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1081
1116
|
params: { assetId }
|
|
1082
1117
|
})).data;
|
|
1083
1118
|
});
|
|
1084
|
-
return function createSignedUrl(
|
|
1119
|
+
return function createSignedUrl(_x12) {
|
|
1085
1120
|
return _ref19.apply(this, arguments);
|
|
1086
1121
|
};
|
|
1087
1122
|
}(),
|
|
@@ -1093,7 +1128,7 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1093
1128
|
body: { folderId }
|
|
1094
1129
|
})).data;
|
|
1095
1130
|
});
|
|
1096
|
-
return function move(
|
|
1131
|
+
return function move(_x13) {
|
|
1097
1132
|
return _ref20.apply(this, arguments);
|
|
1098
1133
|
};
|
|
1099
1134
|
}(),
|
|
@@ -1106,9 +1141,33 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1106
1141
|
if (!assetId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset ID is required" });
|
|
1107
1142
|
return (yield _this5.endpoints.retryAsset.submit({ params: { assetId } })).data;
|
|
1108
1143
|
});
|
|
1109
|
-
return function retry(
|
|
1144
|
+
return function retry(_x14) {
|
|
1110
1145
|
return _ref21.apply(this, arguments);
|
|
1111
1146
|
};
|
|
1147
|
+
}(),
|
|
1148
|
+
/**
|
|
1149
|
+
* Removes an asset's stored content (source, preview and retained extracted text) while
|
|
1150
|
+
* keeping the asset record, metadata and moderation report. The returned asset has
|
|
1151
|
+
* `storageDeletedAt` set; the CDN no longer serves it.
|
|
1152
|
+
*/
|
|
1153
|
+
deleteContent: function() {
|
|
1154
|
+
var _ref22 = require_CalmLensUtils._asyncToGenerator(function* ({ assetId }) {
|
|
1155
|
+
if (!assetId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset ID is required" });
|
|
1156
|
+
return (yield _this5.endpoints.deleteAssetContent.submit({ params: { assetId } })).data;
|
|
1157
|
+
});
|
|
1158
|
+
return function deleteContent(_x15) {
|
|
1159
|
+
return _ref22.apply(this, arguments);
|
|
1160
|
+
};
|
|
1161
|
+
}(),
|
|
1162
|
+
/** Deletes an asset record together with its stored content. */
|
|
1163
|
+
delete: function() {
|
|
1164
|
+
var _ref23 = require_CalmLensUtils._asyncToGenerator(function* ({ assetId }) {
|
|
1165
|
+
if (!assetId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Asset ID is required" });
|
|
1166
|
+
yield _this5.endpoints.deleteAsset.submit({ params: { assetId } });
|
|
1167
|
+
});
|
|
1168
|
+
return function _delete(_x16) {
|
|
1169
|
+
return _ref23.apply(this, arguments);
|
|
1170
|
+
};
|
|
1112
1171
|
}()
|
|
1113
1172
|
};
|
|
1114
1173
|
}
|
|
@@ -1121,14 +1180,14 @@ var CalmLensClient = class CalmLensClient {
|
|
|
1121
1180
|
* reshaped as `{ id, type, createdAt, projectId, data }`.
|
|
1122
1181
|
*/
|
|
1123
1182
|
list: function() {
|
|
1124
|
-
var
|
|
1183
|
+
var _ref24 = require_CalmLensUtils._asyncToGenerator(function* (options = {}) {
|
|
1125
1184
|
return (yield _this6.endpoints.getEvents.submit({
|
|
1126
1185
|
params: { projectId: _this6.options.projectId },
|
|
1127
1186
|
query: options
|
|
1128
1187
|
})).data;
|
|
1129
1188
|
});
|
|
1130
1189
|
return function list() {
|
|
1131
|
-
return
|
|
1190
|
+
return _ref24.apply(this, arguments);
|
|
1132
1191
|
};
|
|
1133
1192
|
}() };
|
|
1134
1193
|
}
|
|
@@ -1136,36 +1195,36 @@ list: function() {
|
|
|
1136
1195
|
var _this7 = this;
|
|
1137
1196
|
return {
|
|
1138
1197
|
list: function() {
|
|
1139
|
-
var
|
|
1198
|
+
var _ref25 = require_CalmLensUtils._asyncToGenerator(function* () {
|
|
1140
1199
|
return (yield _this7.endpoints.getFolders.submit({ params: { projectId: _this7.options.projectId } })).data.folders;
|
|
1141
1200
|
});
|
|
1142
1201
|
return function list() {
|
|
1143
|
-
return
|
|
1202
|
+
return _ref25.apply(this, arguments);
|
|
1144
1203
|
};
|
|
1145
1204
|
}(),
|
|
1146
1205
|
retrieve: function() {
|
|
1147
|
-
var
|
|
1206
|
+
var _ref26 = require_CalmLensUtils._asyncToGenerator(function* ({ folderId }) {
|
|
1148
1207
|
if (!folderId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Folder ID is required" });
|
|
1149
1208
|
return (yield _this7.endpoints.getFolder.submit({ params: { folderId } })).data;
|
|
1150
1209
|
});
|
|
1151
1210
|
return function retrieve(_x17) {
|
|
1152
|
-
return
|
|
1211
|
+
return _ref26.apply(this, arguments);
|
|
1153
1212
|
};
|
|
1154
1213
|
}(),
|
|
1155
1214
|
create: function() {
|
|
1156
|
-
var
|
|
1215
|
+
var _ref27 = require_CalmLensUtils._asyncToGenerator(function* (options) {
|
|
1157
1216
|
return (yield _this7.endpoints.postFolder.submit({
|
|
1158
1217
|
params: { projectId: _this7.options.projectId },
|
|
1159
1218
|
body: options
|
|
1160
1219
|
})).data;
|
|
1161
1220
|
});
|
|
1162
1221
|
return function create(_x18) {
|
|
1163
|
-
return
|
|
1222
|
+
return _ref27.apply(this, arguments);
|
|
1164
1223
|
};
|
|
1165
1224
|
}(),
|
|
1166
1225
|
update: function() {
|
|
1167
|
-
var
|
|
1168
|
-
let { folderId } =
|
|
1226
|
+
var _ref29 = require_CalmLensUtils._asyncToGenerator(function* (_ref28) {
|
|
1227
|
+
let { folderId } = _ref28, body = require_CalmLensUtils._objectWithoutProperties(_ref28, _excluded8);
|
|
1169
1228
|
if (!folderId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Folder ID is required" });
|
|
1170
1229
|
return (yield _this7.endpoints.patchFolder.submit({
|
|
1171
1230
|
params: { folderId },
|
|
@@ -1173,20 +1232,20 @@ list: function() {
|
|
|
1173
1232
|
})).data;
|
|
1174
1233
|
});
|
|
1175
1234
|
return function update(_x19) {
|
|
1176
|
-
return
|
|
1235
|
+
return _ref29.apply(this, arguments);
|
|
1177
1236
|
};
|
|
1178
1237
|
}(),
|
|
1179
1238
|
delete: function() {
|
|
1180
|
-
var
|
|
1239
|
+
var _ref30 = require_CalmLensUtils._asyncToGenerator(function* ({ folderId }) {
|
|
1181
1240
|
if (!folderId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Folder ID is required" });
|
|
1182
1241
|
yield _this7.endpoints.deleteFolder.submit({ params: { folderId } });
|
|
1183
1242
|
});
|
|
1184
1243
|
return function _delete(_x20) {
|
|
1185
|
-
return
|
|
1244
|
+
return _ref30.apply(this, arguments);
|
|
1186
1245
|
};
|
|
1187
1246
|
}(),
|
|
1188
1247
|
move: function() {
|
|
1189
|
-
var
|
|
1248
|
+
var _ref31 = require_CalmLensUtils._asyncToGenerator(function* ({ folderId, parentId }) {
|
|
1190
1249
|
if (!folderId) throw require_CalmLensUtils.calmLensError({ id: "upload/invalid-payload" }, { message: "Folder ID is required" });
|
|
1191
1250
|
return (yield _this7.endpoints.moveFolder.submit({
|
|
1192
1251
|
params: { folderId },
|
|
@@ -1194,7 +1253,7 @@ list: function() {
|
|
|
1194
1253
|
})).data;
|
|
1195
1254
|
});
|
|
1196
1255
|
return function move(_x21) {
|
|
1197
|
-
return
|
|
1256
|
+
return _ref31.apply(this, arguments);
|
|
1198
1257
|
};
|
|
1199
1258
|
}()
|
|
1200
1259
|
};
|
package/cjs/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as GetAssetResponse, C as RetryAssetOptions, D as UploadAssetPartOptions, E as UpdateFolderOptions, F as AssetBinaryPayloadInput, I as Lens, K as Asset, L as Folder, M as GetEventsResponse, N as PostAssetSignedUrlResponse, S as RetrieveAssetOptions, T as UpdateAssetOptions, _ as MoveAssetOptions, a as CreateAssetSignedUrlOptions, c as DeleteAssetContentOptions, d as EnsureLensesOptions, f as FolderIdOptions, g as ModerateTextOptions, h as ListEventsOptions, i as CdnServeOptions, j as GetAssetsPageResponse, k as GetAssetChildrenResponse, l as DeleteAssetOptions, m as ListAssetsOptions, n as CalmLensClientOptions, o as CreateFolderOptions, p as ListAssetChildrenOptions, q as AssetStatus, r as CdnAssetUrlOptions, u as EnsureLensOptions, v as MoveFolderOptions, w as SubmitAssetOptions } from "./CalmLensTypes-CZqyni4p.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/Permissions.d.ts
|
|
4
4
|
declare const GRANT_SCHEMA: zod.ZodObject<{
|
|
@@ -107,7 +107,7 @@ interface MockCalmLensClientOptions extends CalmLensClientOptions {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
/** A `MockCalmLensClient` method, named like its path on the client. */
|
|
110
|
-
type MockCalmLensOperation = "assets.list" | "assets.retrieve" | "assets.update" | "assets.listChildren" | "assets.create" | "assets.moderate" | "assets.uploadPart" | "assets.createSignedUrl" | "assets.move" | "assets.retry" | "text.moderate" | "cdn.serve" | "events.list" | "folders.list" | "folders.retrieve" | "folders.create" | "folders.update" | "folders.delete" | "folders.move" | "ensureLens" | "ensureLenses";
|
|
110
|
+
type MockCalmLensOperation = "assets.list" | "assets.retrieve" | "assets.update" | "assets.listChildren" | "assets.create" | "assets.moderate" | "assets.uploadPart" | "assets.createSignedUrl" | "assets.move" | "assets.retry" | "assets.deleteContent" | "assets.delete" | "text.moderate" | "cdn.serve" | "events.list" | "folders.list" | "folders.retrieve" | "folders.create" | "folders.update" | "folders.delete" | "folders.move" | "ensureLens" | "ensureLenses";
|
|
111
111
|
/** One recorded call: the method and the options object it was given, exactly as passed. */
|
|
112
112
|
interface MockCalmLensCall {
|
|
113
113
|
operation: MockCalmLensOperation;
|
|
@@ -145,6 +145,7 @@ export declare class MockCalmLensClient {
|
|
|
145
145
|
}): void;
|
|
146
146
|
/** Calls recorded for one operation, oldest first. */
|
|
147
147
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
148
|
+
private findOwnAsset;
|
|
148
149
|
private begin;
|
|
149
150
|
get cdn(): {
|
|
150
151
|
getAssetUrl: ({ assetIdentifier, ...options }: CdnAssetUrlOptions) => string;
|
|
@@ -158,9 +159,9 @@ export declare class MockCalmLensClient {
|
|
|
158
159
|
moderate: (options: ModerateTextOptions) => Promise<Asset>;
|
|
159
160
|
};
|
|
160
161
|
get assets(): {
|
|
161
|
-
list: (options
|
|
162
|
+
list: (options?: ListAssetsOptions) => Promise<GetAssetsPageResponse>;
|
|
162
163
|
retrieve: (options: RetrieveAssetOptions) => Promise<GetAssetResponse>;
|
|
163
|
-
listChildren: (childrenOptions
|
|
164
|
+
listChildren: (childrenOptions?: ListAssetChildrenOptions) => Promise<GetAssetChildrenResponse>;
|
|
164
165
|
update: (options: UpdateAssetOptions) => Promise<Asset>;
|
|
165
166
|
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
166
167
|
moderate: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
@@ -168,6 +169,8 @@ export declare class MockCalmLensClient {
|
|
|
168
169
|
createSignedUrl: (signedUrlOptions: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
|
|
169
170
|
move: (options: MoveAssetOptions) => Promise<Asset>;
|
|
170
171
|
retry: (options: RetryAssetOptions) => Promise<Asset>;
|
|
172
|
+
deleteContent: (options: DeleteAssetContentOptions) => Promise<Asset>;
|
|
173
|
+
delete: (options: DeleteAssetOptions) => Promise<void>;
|
|
171
174
|
};
|
|
172
175
|
get folders(): {
|
|
173
176
|
list: () => Promise<Folder[]>;
|