calmlens 0.25.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/bin/calmlens.js +2383 -677
- package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-CTqIjCV5.js} +1 -1
- package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
- package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-CZm-9g22.js} +23 -16
- package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-C1w3SqmL.js} +165 -95
- package/cjs/CalmLensServerClient-B7PfocET.d.ts +346 -0
- package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-ucq3ITjd.js} +281 -315
- package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
- package/cjs/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/cjs/{Core-Cw4IxFUq.js → Core-D-1KCqT7.js} +39 -16
- package/cjs/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
- package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-BcYKgU2X.js} +859 -44
- package/cjs/ReactUpload-BTciTpwB.d.ts +27 -0
- package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BymgWiC8.js} +38 -2
- package/cjs/{TestTriggers-CiFcTHX3-BmfH4J3f.js → TestTriggers-Cvi7e2KA-DcT1pc_W.js} +91 -22
- package/{esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/cjs/{UploadController-ObdgTaBl.js → UploadController-C8GPbDKI.js} +16 -3
- package/{esm/WebhookPayload-DLGGOGW6.d.ts → cjs/WebhookPayload-mUmOFH55.d.ts} +152 -9
- package/cjs/app.d.ts +6 -6
- package/cjs/app.js +20 -2
- package/cjs/elements.d.ts +5 -5
- package/cjs/elements.js +105 -68
- package/cjs/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/cjs/index.d.ts +5 -5
- package/cjs/index.js +19 -1
- package/cjs/react-native.d.ts +3 -3
- package/cjs/react-native.js +7 -5
- package/cjs/react.d.ts +5 -4
- package/cjs/react.js +11 -15
- package/cjs/server.d.ts +6 -6
- package/cjs/server.js +20 -2
- package/cjs/test-inputs.d.ts +1 -1
- package/cjs/test-inputs.js +13 -13
- package/cjs/testing.d.ts +18 -21
- package/cjs/testing.js +99 -147
- package/cjs/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/cjs/{ui-CA16jyfZ.js → ui-CW8BqtZk.js} +7 -5
- package/cjs/ui.d.ts +3 -3
- package/cjs/ui.js +4 -3
- package/cjs/vue.d.ts +15 -8
- package/cjs/vue.js +30 -17
- package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-C01iLeOs.js} +1 -1
- package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
- package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-CgDogQQC.js} +23 -16
- package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CEwNbpEz.js} +160 -96
- package/esm/CalmLensServerClient-B7PfocET.d.ts +346 -0
- package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-TT6zrAG5.js} +281 -315
- package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
- package/esm/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/esm/{Core-CtbYmeXG.js → Core-CP6NaqJz.js} +39 -16
- package/esm/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
- package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-BmV8QD32.js} +476 -301
- package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-B72Oq3qE.js} +34 -4
- package/esm/ReactUpload-BTciTpwB.d.ts +27 -0
- package/esm/{TestTriggers-CiFcTHX3-BK2-sgOC.js → TestTriggers-Cvi7e2KA-BA83CRJb.js} +87 -23
- package/{cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/esm/{UploadController-C7fL3Iz9.js → UploadController-Q7xTqh5w.js} +11 -4
- package/{cjs/WebhookPayload-DLGGOGW6.d.ts → esm/WebhookPayload-mUmOFH55.d.ts} +152 -9
- package/esm/app.d.ts +6 -6
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +5 -5
- package/esm/elements.js +105 -69
- package/esm/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/esm/index.d.ts +5 -5
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +3 -3
- package/esm/react-native.js +6 -6
- package/esm/react.d.ts +5 -4
- package/esm/react.js +10 -16
- package/esm/server.d.ts +6 -6
- package/esm/server.js +3 -3
- package/esm/styles.css +37 -14
- package/esm/svelte/CalmLensAsset.svelte +1 -1
- package/esm/svelte/CalmLensUploader.svelte +17 -17
- package/esm/svelte/context.js +21 -0
- package/esm/svelte/index.d.ts +12 -0
- package/esm/svelte/index.js +1 -0
- package/esm/test-inputs.d.ts +1 -1
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +18 -21
- package/esm/testing.js +93 -141
- package/esm/{ui-B98AucZA.js → ui-BBDJJkFL.js} +7 -5
- package/esm/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/esm/ui.d.ts +3 -3
- package/esm/ui.js +4 -4
- package/esm/vue.d.ts +15 -8
- package/esm/vue.js +30 -19
- package/package.json +16 -6
- package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
- package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import { d as HashListEntry, u as HashList } from "./Classification-CxRedzgH-C9qlYW_J.js";
|
|
2
|
-
import { $ as GetAssetInfoOptions, $t as UpgradePolicyOptions, Bt as SetPolicyAutomaticUpdatesOptions, Ct as ListHashListEntriesOptions, Dt as ListUploadPresetsOptions, E as BatchAssetsResponse, En as ProjectSettingsResource, Et as ListPoliciesOptions, F as ClassifyTextOptions, Ft as RequestOptions, G as EnsureLensOptions, H as DecideAssetOptions, Ht as SignUploadTokenOptions, It as ResetPolicyOptions, J as EnsureUploadPresetsOptions, Jt as UpdateFolderOptions, K as EnsureLensesOptions, Kt as SubmitAssetOptions, L as CreateFolderOptions, Ln as Policy, Lt as RetrieveAssetOptions, Mt as PolicyIdOptions, N as CdnServeOptions, Nt as PolicyPage, O as CalmLensServerClientOptions, On as UploadPreset, Ot as MoveAssetOptions, Pt as RemoveAssetContentOptions, Q as FolderPage, Qt as UpdateProjectSettingsOptions, R as CreateHashListOptions, Rt as RetryAssetOptions, St as ListFoldersOptions, T as BatchAssetsOptions, Tn as MetadataFieldsResource, Tt as ListLensesOptions, U as DeleteAssetOptions, Un as AssetInfo, Ut as SignedAssetUrl, V as CreatePolicyOptions, Vn as AssetSearchQuery, Vt as SignAssetUrlOptions, W as DeleteMetadataFieldOptions, Wt as SignedUploadToken, X as ExplainAssetOptions, Xt as UpdateLensOptions, Y as EnsureUploadPresetsResponse, Yt as UpdateHashListOptions, Z as FolderIdOptions, Zt as UpdatePolicyOptions, _ as AssetSearchResponse, _t as LensPage, a as AssetChildrenPage, bt as ListAssetsOptions, cn as WaitForAssetDecisionOptions, ct as IterateAssetsOptions, dt as IterateHashListsOptions, en as UploadAssetPartOptions, et as HashListEntryIdOptions, ft as IterateLensesOptions, g as AssetPage, gt as LensIdOptions, ht as Lens, j as CdnAssetUrlOptions, kt as MoveFolderOptions, lt as IterateFoldersOptions, mt as IterateUploadPresetsOptions, n as Asset, nn as UploadPresetIdOptions, nt as HashListIdOptions, on as VerifyWebhookSignatureOptions, ot as IterateAssetChildrenOptions, pn as GetEventsResponse, pt as IteratePoliciesOptions, q as EnsureMetadataFieldsOptions, qt as UpdateAssetOptions, rn as UploadPresetPage, rt as HashListPage, st as IterateAssetTimelineOptions, t as AddHashListEntryOptions, tt as HashListEntryPage, ut as IterateHashListEntriesOptions, vt as ListAssetChildrenOptions, w as AssignPolicyOptions, wn as Folder, wt as ListHashListsOptions, xt as ListEventsOptions, y as AssetTimelinePage, yt as ListAssetTimelineOptions, z as CreateLensOptions } from "./CalmLensTypes-BhR7LFDu.js";
|
|
3
|
-
import "./WebhookPayload-DLGGOGW6.js";
|
|
4
|
-
interface LensCache {
|
|
5
|
-
readonly ensuredLenses: Map<string, Lens>;
|
|
6
|
-
readonly pendingEnsureLenses: Map<string, Promise<void>>;
|
|
7
|
-
}
|
|
8
|
-
declare const inspectSymbol: unique symbol;
|
|
9
|
-
/**
|
|
10
|
-
* The CalmLens API client for your server, authenticated with a project API key. Create one per
|
|
11
|
-
* project and reuse it; it holds no connections. Every method takes one options object and
|
|
12
|
-
* throws `CalmLensError` on failure. Browsers and apps upload with `CalmLensAppClient` instead.
|
|
13
|
-
*/
|
|
14
|
-
declare class CalmLensServerClient {
|
|
15
|
-
#private;
|
|
16
|
-
/**
|
|
17
|
-
* Verifies that a webhook delivery came from CalmLens: checks the `v1=` HMAC-SHA256 in
|
|
18
|
-
* `x-calmlens-signature` over `"<x-calmlens-timestamp>.<raw body>"` and rejects timestamps
|
|
19
|
-
* more than `toleranceSeconds` (default 300) from now, which stops replayed deliveries.
|
|
20
|
-
* Also exported as `verifyWebhookSignature`; `parseWebhookEvent` verifies and parses.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* const payload = await request.text();
|
|
25
|
-
* const isValid = await CalmLensServerClient.verifyWebhookSignature({
|
|
26
|
-
* payload,
|
|
27
|
-
* headers: request.headers,
|
|
28
|
-
* secret: process.env.CALMLENS_WEBHOOK_SECRET!,
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
static verifyWebhookSignature(options: VerifyWebhookSignatureOptions): Promise<boolean>;
|
|
33
|
-
constructor(options: CalmLensServerClientOptions, lenses?: LensCache);
|
|
34
|
-
/**
|
|
35
|
-
* A client with different cancellation, deadlines or retries for the calls made through it,
|
|
36
|
-
* sharing this client's credentials and lens cache. This client is unchanged.
|
|
37
|
-
*/
|
|
38
|
-
withRequestOptions(options: RequestOptions): CalmLensServerClient;
|
|
39
|
-
/** Keeps the API key out of `console.log`, `util.inspect` and `JSON.stringify`. */
|
|
40
|
-
[inspectSymbol](): string;
|
|
41
|
-
toJSON(): {
|
|
42
|
-
projectId: string;
|
|
43
|
-
baseUrl: string;
|
|
44
|
-
cdnBaseUrl: string;
|
|
45
|
-
};
|
|
46
|
-
private get projectPath();
|
|
47
|
-
private request;
|
|
48
|
-
private submitAsset;
|
|
49
|
-
get cdn(): {
|
|
50
|
-
/**
|
|
51
|
-
* Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
|
|
52
|
-
* beneath, or a resource URL when `resource` is given, with its lens or transform and the
|
|
53
|
-
* viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
|
|
54
|
-
* claims are assertions from your app; CalmLens doesn't verify them.
|
|
55
|
-
*/
|
|
56
|
-
getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
|
|
57
|
-
/**
|
|
58
|
-
* Signs a private asset's URL on your server, so browsers and apps can load it without an API
|
|
59
|
-
* key until it expires. Every resource is a path beneath it, as beneath a public asset URL;
|
|
60
|
-
* `/original` only when signed with `original: true`. With `resource`, returns that resource's
|
|
61
|
-
* URL beneath the grant; lenses, transforms and viewer claims are appended as `getAssetUrl`
|
|
62
|
-
* appends them and aren't part of the signature.
|
|
63
|
-
*/
|
|
64
|
-
signAssetUrl: (signOptions: SignAssetUrlOptions) => Promise<SignedAssetUrl>;
|
|
65
|
-
/**
|
|
66
|
-
* The display info of an asset URL, public or signed (`{url}/info`): its type, size,
|
|
67
|
-
* rendered file, preview and stream, and whether the viewer its claims describe can see it.
|
|
68
|
-
* A server can pass it to `CalmLensAsset` as `info`, so the first render is the real
|
|
69
|
-
* element.
|
|
70
|
-
*/
|
|
71
|
-
getAssetInfo: (url: string, options?: Omit<GetAssetInfoOptions, "fetch">) => Promise<AssetInfo>;
|
|
72
|
-
/**
|
|
73
|
-
* Fetches asset content or a preview from the CDN with the client's API key, and returns
|
|
74
|
-
* a `Response` with writable headers as soon as headers arrive, so the body streams.
|
|
75
|
-
* Non-2xx responses are returned, not thrown; `timeoutMs` covers only the wait for headers.
|
|
76
|
-
*/
|
|
77
|
-
serve: (options: CdnServeOptions) => Promise<Response>;
|
|
78
|
-
};
|
|
79
|
-
get text(): {
|
|
80
|
-
/**
|
|
81
|
-
* Moderates text and waits for the decision. Sends `text` as `text/plain` content named
|
|
82
|
-
* `text` unless you pass `name`.
|
|
83
|
-
*/
|
|
84
|
-
classify: (options: ClassifyTextOptions) => Promise<Asset>;
|
|
85
|
-
};
|
|
86
|
-
/** Assets: uploads, moderation and management. */
|
|
87
|
-
get assets(): {
|
|
88
|
-
/** Searches accessible assets by keyword or a natural-language description. */
|
|
89
|
-
search: (options: Partial<AssetSearchQuery> & {
|
|
90
|
-
query: string;
|
|
91
|
-
}) => Promise<AssetSearchResponse>;
|
|
92
|
-
/** Lists one page of the project's assets, with an optional filter and sort. */
|
|
93
|
-
list: (options?: ListAssetsOptions) => Promise<AssetPage>;
|
|
94
|
-
/**
|
|
95
|
-
* Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
|
|
96
|
-
* stable when other assets are inserted or deleted.
|
|
97
|
-
*/
|
|
98
|
-
iterate: (options?: IterateAssetsOptions) => AsyncGenerator<Asset, void, undefined>;
|
|
99
|
-
/** Retrieves an asset with its status and classification results. */
|
|
100
|
-
retrieve: (options: RetrieveAssetOptions) => Promise<Asset>;
|
|
101
|
-
/** Updates an asset's editable fields. */
|
|
102
|
-
update: (options: UpdateAssetOptions) => Promise<Asset>;
|
|
103
|
-
/** Lists one page of the assets extracted from a website or multimedia document. */
|
|
104
|
-
listChildren: (options?: ListAssetChildrenOptions) => Promise<AssetChildrenPage>;
|
|
105
|
-
/**
|
|
106
|
-
* Lists one page of an audio or video asset's findings timeline, in time order.
|
|
107
|
-
* `classification.moderation.timeline.segmentCount` says how many segments there are.
|
|
108
|
-
*/
|
|
109
|
-
listTimeline: (options: ListAssetTimelineOptions) => Promise<AssetTimelinePage>;
|
|
110
|
-
/** Yields every segment of an audio or video asset's findings timeline, in time order. */
|
|
111
|
-
iterateTimeline: (options: IterateAssetTimelineOptions) => AsyncGenerator<AssetTimelinePage["items"][number], void, undefined>;
|
|
112
|
-
/** Yields every child of an asset, fetching pages as needed. */
|
|
113
|
-
iterateChildren: (options: IterateAssetChildrenOptions) => AsyncGenerator<Asset, void, undefined>;
|
|
114
|
-
/**
|
|
115
|
-
* Uploads an asset and returns without waiting for its decision (`wait=false`), with
|
|
116
|
-
* `classification.status` `queued`. Retried safely with an `Idempotency-Key`.
|
|
117
|
-
*/
|
|
118
|
-
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
119
|
-
/**
|
|
120
|
-
* Uploads an asset and waits for its moderation decision. Documents, websites, audio, video
|
|
121
|
-
* and files over 20 MiB sent in parts still finish in the background and return `pending`.
|
|
122
|
-
* Retried safely with an `Idempotency-Key`.
|
|
123
|
-
*/
|
|
124
|
-
classify: (classifyOptions: SubmitAssetOptions) => Promise<Asset>;
|
|
125
|
-
/**
|
|
126
|
-
* Uploads the next part of a multipart upload. Whether the final part waits for the
|
|
127
|
-
* decision was chosen when the upload started; pass `wait` to override it.
|
|
128
|
-
*/
|
|
129
|
-
uploadPart: (partOptions: UploadAssetPartOptions) => Promise<Asset>;
|
|
130
|
-
/** Moves an asset into a folder, or to the project root with `folderId: null`. */
|
|
131
|
-
move: (options: MoveAssetOptions) => Promise<Asset>;
|
|
132
|
-
/**
|
|
133
|
-
* Processes an asset that failed (classification status `failed`) again. It returns to
|
|
134
|
-
* `processing` and is
|
|
135
|
-
* moderated like a new upload; its content must still be stored.
|
|
136
|
-
*/
|
|
137
|
-
retry: (options: RetryAssetOptions) => Promise<Asset>;
|
|
138
|
-
/**
|
|
139
|
-
* Records a reviewer's decision, replacing the policy's: the asset's moderation status
|
|
140
|
-
* becomes `decision`, the note joins its review history and the matching `asset.<status>`
|
|
141
|
-
* event is sent. An asset still pending moderation can only be blocked or purged. Purging
|
|
142
|
-
* needs `confirmPurge: true` and permanently deletes the stored content.
|
|
143
|
-
*/
|
|
144
|
-
decide: (options: DecideAssetOptions) => Promise<Asset>;
|
|
145
|
-
/**
|
|
146
|
-
* Completes the policy evidence behind a decided asset's moderation decision: its
|
|
147
|
-
* `classification.moderation.explanationComplete` becomes `true` and every action stays as
|
|
148
|
-
* decided. With `rerun: true` the asset is moderated again with the project's current policy
|
|
149
|
-
* and an `asset.rerun-requested` event is recorded; use it when the policy has changed since
|
|
150
|
-
* the decision (`asset/policy-changed`). The asset returns unchanged: it keeps its decision
|
|
151
|
-
* until the re-run's is stored, reported by `asset.classified` and `asset.<status>` events,
|
|
152
|
-
* and a failed re-run keeps it. A reviewed asset fails with `asset/reviewed`, and one whose
|
|
153
|
-
* content is gone with `asset/content-unavailable`.
|
|
154
|
-
*/
|
|
155
|
-
explain: (options: ExplainAssetOptions) => Promise<Asset>;
|
|
156
|
-
/**
|
|
157
|
-
* Waits until an asset is settled, its `classification.status` `completed` (with its
|
|
158
|
-
* decision in `classification.moderation.status`) or `failed`, and returns that asset,
|
|
159
|
-
* checking every few seconds. A `queued` or `processing` asset is still waiting, even when a
|
|
160
|
-
* reviewer has already decided it. Rejects with `sdk/timeout` if it is not settled within
|
|
161
|
-
* `timeoutMs` (default 60000). Webhooks report decisions without polling.
|
|
162
|
-
*/
|
|
163
|
-
waitForDecision: (waitOptions: WaitForAssetDecisionOptions) => Promise<Asset>;
|
|
164
|
-
/**
|
|
165
|
-
* Removes an asset's stored content (source, preview and retained extracted text) while
|
|
166
|
-
* keeping the asset record, metadata and classification results. The returned asset has
|
|
167
|
-
* `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
|
|
168
|
-
*/
|
|
169
|
-
removeContent: (options: RemoveAssetContentOptions) => Promise<Asset>;
|
|
170
|
-
/**
|
|
171
|
-
* Deletes an asset record together with its stored content. An asset extracted from another
|
|
172
|
-
* (one with a `parentId`) fails with `asset/child-not-deletable`: delete its parent instead.
|
|
173
|
-
*/
|
|
174
|
-
delete: (options: DeleteAssetOptions) => Promise<void>;
|
|
175
|
-
/**
|
|
176
|
-
* Deletes up to 500 assets (`operation: "delete"`) or removes their stored content
|
|
177
|
-
* (`"remove-content"`) in one request. Every asset must exist in the project and the key
|
|
178
|
-
* needs `assets:delete` for its folder, and a deletion can't name an asset extracted from
|
|
179
|
-
* another (`asset/child-not-deletable`), or nothing is queued. Resolves with
|
|
180
|
-
* `{ batchId, status: "queued", assetCount }` once queued; the work runs in the background
|
|
181
|
-
* and records `asset.deleted` or `asset.content-removed` for each asset, with a `batch-id`
|
|
182
|
-
* fact naming `batchId`. Assets under a safety hold are skipped. Not retried: it carries no
|
|
183
|
-
* `Idempotency-Key`.
|
|
184
|
-
*/
|
|
185
|
-
batch: (options: BatchAssetsOptions) => Promise<BatchAssetsResponse>;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Signs upload tokens on your server, so a browser or app can upload through an upload preset
|
|
189
|
-
* that requires one. Signing happens locally with your API key: it makes no request.
|
|
190
|
-
*/
|
|
191
|
-
get uploadTokens(): {
|
|
192
|
-
/**
|
|
193
|
-
* Signs a single-use token for one upload through `uploadPresetId`. Give `token` to the
|
|
194
|
-
* browser or app, which passes it to `CalmLensAppClient` as `token`.
|
|
195
|
-
*/
|
|
196
|
-
sign: (options: SignUploadTokenOptions) => Promise<SignedUploadToken>;
|
|
197
|
-
};
|
|
198
|
-
private buildAssets;
|
|
199
|
-
get events(): {
|
|
200
|
-
/**
|
|
201
|
-
* Lists project events after a cursor, oldest first. Call without `cursor` to get a cursor
|
|
202
|
-
* for "now", then poll with each response's `nextCursor`. Webhook deliveries carry each
|
|
203
|
-
* event's same fields as a flat JSON body. `types` and `assetId` narrow the feed to some
|
|
204
|
-
* event types or one asset's events; a cursor belongs to the filters it was issued with, so
|
|
205
|
-
* pass the same ones with each `cursor`.
|
|
206
|
-
*/
|
|
207
|
-
list: (options?: ListEventsOptions) => Promise<GetEventsResponse>;
|
|
208
|
-
/**
|
|
209
|
-
* Yields pages of events after `cursor` until no more are waiting. Save each page's
|
|
210
|
-
* `nextCursor` to resume later. Without `cursor`, yields one empty page whose `nextCursor`
|
|
211
|
-
* is "now".
|
|
212
|
-
*/
|
|
213
|
-
pages: (options?: ListEventsOptions) => AsyncGenerator<GetEventsResponse, void, undefined>;
|
|
214
|
-
};
|
|
215
|
-
private iterateEventPages;
|
|
216
|
-
private iteratePages;
|
|
217
|
-
get folders(): {
|
|
218
|
-
/**
|
|
219
|
-
* Lists one page of child folders, sorted by name unless `sort` says otherwise. Pass
|
|
220
|
-
* `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
|
|
221
|
-
*/
|
|
222
|
-
list: (options?: ListFoldersOptions) => Promise<FolderPage>;
|
|
223
|
-
/** Yields every child folder of `parentId` (or the project root), fetching pages as needed. */
|
|
224
|
-
iterate: (options?: IterateFoldersOptions) => AsyncGenerator<Folder, void, undefined>;
|
|
225
|
-
retrieve: (options: FolderIdOptions) => Promise<Folder>;
|
|
226
|
-
/** Creates a folder at the project root or inside `parentId`. */
|
|
227
|
-
create: (options: CreateFolderOptions) => Promise<Folder>;
|
|
228
|
-
update: (options: UpdateFolderOptions) => Promise<Folder>;
|
|
229
|
-
/** Deletes an empty folder; throws `folder/not-empty` otherwise. */
|
|
230
|
-
delete: (options: FolderIdOptions) => Promise<void>;
|
|
231
|
-
/** Moves a folder under `parentId`, or to the project root with `parentId: null`. */
|
|
232
|
-
move: (options: MoveFolderOptions) => Promise<Folder>;
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* Hash lists hold PDQ hashes of images the project never wants again. Image uploads are
|
|
236
|
-
* compared with every list: `flag` lists record matches, `block` lists also block close ones.
|
|
237
|
-
*/
|
|
238
|
-
get hashLists(): {
|
|
239
|
-
/** Lists one page of the project's hash lists, newest first unless `sort` says otherwise. */
|
|
240
|
-
list: (options?: ListHashListsOptions) => Promise<HashListPage>;
|
|
241
|
-
/** Yields every hash list, fetching pages as needed. */
|
|
242
|
-
iterate: (options?: IterateHashListsOptions) => AsyncGenerator<HashList, void, undefined>;
|
|
243
|
-
retrieve: (options: HashListIdOptions) => Promise<HashList>;
|
|
244
|
-
create: (options: CreateHashListOptions) => Promise<HashList>;
|
|
245
|
-
/** Renames a list or changes its action; the new action applies to later uploads. */
|
|
246
|
-
update: (options: UpdateHashListOptions) => Promise<HashList>;
|
|
247
|
-
/** Deletes the list and every entry in it. */
|
|
248
|
-
delete: (options: HashListIdOptions) => Promise<void>;
|
|
249
|
-
/** Yields every entry of a list, fetching pages as needed. */
|
|
250
|
-
iterateEntries: (options: IterateHashListEntriesOptions) => AsyncGenerator<HashListEntry, void, undefined>;
|
|
251
|
-
/** Lists one page of a list's entries, newest first unless `sort` says otherwise. */
|
|
252
|
-
listEntries: (options: ListHashListEntriesOptions) => Promise<HashListEntryPage>;
|
|
253
|
-
/** Adds a hash, or an image asset's hash; a hash already in the list returns its entry. */
|
|
254
|
-
addEntry: (options: AddHashListEntryOptions) => Promise<HashListEntry>;
|
|
255
|
-
removeEntry: (options: HashListEntryIdOptions) => Promise<void>;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Moderation policies belong to the organisation and its projects share them. Every change sends
|
|
259
|
-
* the policy's `revision`, so a policy changed since is refused. Through a project's key you can
|
|
260
|
-
* change only policies no other project uses.
|
|
261
|
-
*/
|
|
262
|
-
get policies(): {
|
|
263
|
-
/** Lists one page of the organisation's policies, oldest first unless `sort` says otherwise. */
|
|
264
|
-
list: (options?: ListPoliciesOptions) => Promise<PolicyPage>;
|
|
265
|
-
/** Yields every policy of the organisation, fetching pages as needed. */
|
|
266
|
-
iterate: (options?: IteratePoliciesOptions) => AsyncGenerator<Policy, void, undefined>;
|
|
267
|
-
retrieve: (options: PolicyIdOptions) => Promise<Policy>;
|
|
268
|
-
/** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
|
|
269
|
-
create: (options: CreatePolicyOptions) => Promise<Policy>;
|
|
270
|
-
/** Changes the name, description or settings; later moderation uses them. */
|
|
271
|
-
update: (options: UpdatePolicyOptions) => Promise<Policy>;
|
|
272
|
-
/** Restores the settings of the preset release a `pinned` or `copy` policy is pinned to. */
|
|
273
|
-
reset: (options: ResetPolicyOptions) => Promise<Policy>;
|
|
274
|
-
/** Moves an unchanged `pinned` or `copy` policy to the latest release of its preset. */
|
|
275
|
-
upgrade: (options: UpgradePolicyOptions) => Promise<Policy>;
|
|
276
|
-
/** Switches automatic updates on (`live`) or off (`pinned`) for the organisation's own preset policy. */
|
|
277
|
-
setAutomaticUpdates: (options: SetPolicyAutomaticUpdatesOptions) => Promise<Policy>;
|
|
278
|
-
/** Deletes a policy that no project or upload preset uses. */
|
|
279
|
-
delete: (options: PolicyIdOptions) => Promise<void>;
|
|
280
|
-
/** The policy the project moderates with. */
|
|
281
|
-
retrieveAssigned: () => Promise<Policy>;
|
|
282
|
-
/** Chooses the policy the project moderates with. */
|
|
283
|
-
assign: (options: AssignPolicyOptions) => Promise<Policy>;
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* The project's upload presets: the rules for uploads from browsers and apps. `ensure` creates or
|
|
287
|
-
* replaces presets by key, for deploys that declare them in code; send each preset's `revision`
|
|
288
|
-
* to refuse a change made since you read it.
|
|
289
|
-
*/
|
|
290
|
-
get uploadPresets(): {
|
|
291
|
-
/** Lists one page of the project's upload presets, oldest first unless `sort` says otherwise. */
|
|
292
|
-
list: (options?: ListUploadPresetsOptions) => Promise<UploadPresetPage>;
|
|
293
|
-
/** Yields every upload preset of the project, fetching pages as needed. */
|
|
294
|
-
iterate: (options?: IterateUploadPresetsOptions) => AsyncGenerator<UploadPreset, void, undefined>;
|
|
295
|
-
/**
|
|
296
|
-
* Creates each preset, or replaces it with the definition sent, by key. Every preset is
|
|
297
|
-
* checked before any is saved. Returns the stored presets in the order sent.
|
|
298
|
-
*/
|
|
299
|
-
ensure: (options: EnsureUploadPresetsOptions) => Promise<EnsureUploadPresetsResponse>;
|
|
300
|
-
/** Deletes an upload preset; assets already uploaded through it stay. */
|
|
301
|
-
delete: (options: UploadPresetIdOptions) => Promise<void>;
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
* The project's settings, with defaults filled in. `update` replaces them: settings left out
|
|
305
|
-
* return to their defaults. Send the `revision` you read to refuse a change made since.
|
|
306
|
-
*/
|
|
307
|
-
get projectSettings(): {
|
|
308
|
-
get: () => Promise<ProjectSettingsResource>;
|
|
309
|
-
update: (options: UpdateProjectSettingsOptions) => Promise<ProjectSettingsResource>;
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* The project's metadata fields. They share the project settings' `revision`; `ensure` creates
|
|
313
|
-
* or replaces fields by ID and keeps the others.
|
|
314
|
-
*/
|
|
315
|
-
get metadataFields(): {
|
|
316
|
-
list: () => Promise<MetadataFieldsResource>;
|
|
317
|
-
ensure: (options: EnsureMetadataFieldsOptions) => Promise<MetadataFieldsResource>;
|
|
318
|
-
/** Deletes a field definition; assets keep their values. */
|
|
319
|
-
delete: (options: DeleteMetadataFieldOptions) => Promise<void>;
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* The project's lenses: named image transforms the CDN applies at `/@<identifier>`. The CDN
|
|
323
|
-
* serves files made with each lens's current definition. `ensureLenses` creates or changes
|
|
324
|
-
* lenses by identifier, for applications that declare theirs in code.
|
|
325
|
-
*/
|
|
326
|
-
get lenses(): {
|
|
327
|
-
/** Lists one page of the project's lenses, newest first unless `sort` says otherwise. */
|
|
328
|
-
list: (options?: ListLensesOptions) => Promise<LensPage>;
|
|
329
|
-
/** Yields every lens of the project, fetching pages as needed. */
|
|
330
|
-
iterate: (options?: IterateLensesOptions) => AsyncGenerator<Lens, void, undefined>;
|
|
331
|
-
/** Creates a lens; its identifier must be new to the project. */
|
|
332
|
-
create: (options: CreateLensOptions) => Promise<Lens>;
|
|
333
|
-
retrieve: (options: LensIdOptions) => Promise<Lens>;
|
|
334
|
-
/** Changes a lens's name, description, type, transform or whether the CDN serves it. */
|
|
335
|
-
update: (options: UpdateLensOptions) => Promise<Lens>;
|
|
336
|
-
/** Deletes a lens; URLs that select it stop being served. */
|
|
337
|
-
delete: (options: LensIdOptions) => Promise<void>;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Creates a named lens, or changes it to this definition. Sending the same definition again
|
|
341
|
-
* returns the lens unchanged, from the client's lens cache once it has seen it.
|
|
342
|
-
*/
|
|
343
|
-
ensureLens(options: EnsureLensOptions): Promise<Lens>;
|
|
344
|
-
/**
|
|
345
|
-
* Create or update several named lenses. New definitions are sent in one API request, or in
|
|
346
|
-
* consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
|
|
347
|
-
* Each lens is created or changed as ensureLens() does.
|
|
348
|
-
*/
|
|
349
|
-
ensureLenses(options: EnsureLensesOptions): Promise<Lens[]>;
|
|
350
|
-
private submitEnsureLenses;
|
|
351
|
-
private submitEnsureLensesChunk;
|
|
352
|
-
}
|
|
353
|
-
export { CalmLensServerClient as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { I as UploadSnapshot, M as UploadController, N as UploadControllerOptions, P as UploadFile } from "./Core-DSMxC2GL.js";
|
|
2
|
-
interface UseCalmLensUploadResult<F extends UploadFile = UploadFile> extends UploadSnapshot<F> {
|
|
3
|
-
controller: UploadController<F>;
|
|
4
|
-
addFiles: UploadController<F>["addFiles"];
|
|
5
|
-
retry: UploadController<F>["retry"];
|
|
6
|
-
cancel: UploadController<F>["cancel"];
|
|
7
|
-
remove: UploadController<F>["remove"];
|
|
8
|
-
clear: UploadController<F>["clear"];
|
|
9
|
-
start: UploadController<F>["start"];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Uploads files through an upload preset and re-renders as each one uploads and is checked. Use
|
|
13
|
-
* it to build your own upload UI; `CalmLensUploader` is built on it. Uploads still running when
|
|
14
|
-
* the component unmounts are cancelled.
|
|
15
|
-
*/
|
|
16
|
-
declare const useCalmLensUpload: <F extends UploadFile = UploadFile>(options: UploadControllerOptions<F>) => UseCalmLensUploadResult<F>;
|
|
17
|
-
export { useCalmLensUpload as n, UseCalmLensUploadResult as t };
|