calmlens 0.4.0 → 0.18.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/LICENSE +21 -0
- package/README.md +673 -130
- package/bin/calmlens.js +15994 -1164
- package/bin/package.json +1 -0
- package/cjs/BrowserUpload-BT091eOB.d.ts +11 -0
- package/cjs/BrowserUpload-CQwXEGFv.js +10 -0
- package/cjs/CalmLensAppClient-CHQGu-Do.js +89 -0
- package/cjs/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
- package/cjs/CalmLensConnection-B8Bu2j3y.js +659 -0
- package/cjs/CalmLensServerClient-C5o2A8MW.js +645 -0
- package/cjs/CalmLensServerClient-JtP687a3.d.ts +235 -0
- package/cjs/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
- package/cjs/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
- package/cjs/CryptoUtils-B_x8lMIx-YBW1-bvL.js +42 -0
- package/cjs/FileIcons-Ob003MdS.js +175 -0
- package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +91 -0
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
- package/cjs/ModerationContextLimits-DelWfmiJ.js +1311 -0
- package/cjs/ReactUpload-CAyCsyG6.d.ts +17 -0
- package/cjs/ReactUpload-Cfg5JYUq.js +54 -0
- package/cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
- package/cjs/TestTriggers-DTc_iMJF-BjMPq4_3.js +1327 -0
- package/cjs/UploadController-BGO1eyzb.js +618 -0
- package/cjs/WebhookPayload-2aL31v0J.d.ts +352 -0
- package/cjs/app.d.ts +7 -0
- package/cjs/app.js +13 -0
- package/cjs/elements.d.ts +88 -0
- package/cjs/elements.js +555 -0
- package/cjs/file-icons.d.ts +67 -0
- package/cjs/file-icons.js +10 -0
- package/cjs/index-CI4BzN4W.d.ts +252 -0
- package/cjs/index.d.ts +6 -163
- package/cjs/index.js +9 -796
- package/cjs/react-native.d.ts +56 -0
- package/cjs/react-native.js +495 -0
- package/cjs/react.d.ts +30 -0
- package/cjs/react.js +370 -0
- package/cjs/server.d.ts +33 -0
- package/cjs/server.js +20 -0
- package/cjs/test-inputs.d.ts +2 -0
- package/cjs/test-inputs.js +10 -0
- package/cjs/testing.d.ts +309 -80
- package/cjs/testing.js +10453 -689
- package/cjs/ui-CC1GOoMg.js +583 -0
- package/cjs/ui-wIiMfqMB.d.ts +526 -0
- package/cjs/ui.d.ts +2 -0
- package/cjs/ui.js +27 -0
- package/cjs/vue.d.ts +490 -0
- package/cjs/vue.js +419 -0
- package/esm/BrowserUpload-BT091eOB.d.ts +11 -0
- package/esm/BrowserUpload-D2xBWqhm.js +5 -0
- package/esm/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
- package/esm/CalmLensAppClient-DuFas_dW.js +84 -0
- package/esm/CalmLensConnection-MxwwLXdl.js +582 -0
- package/esm/CalmLensServerClient-D80_mKpW.js +586 -0
- package/esm/CalmLensServerClient-JtP687a3.d.ts +235 -0
- package/esm/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
- package/esm/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
- package/esm/CryptoUtils-B_x8lMIx-DhuWGzqn.js +25 -0
- package/esm/FileIcons-M6dzjFxd.js +128 -0
- package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +46 -0
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
- package/esm/ModerationContextLimits-BaX2QnU8.js +1114 -0
- package/esm/ReactUpload-CAyCsyG6.d.ts +17 -0
- package/esm/ReactUpload-CL2XC8WS.js +37 -0
- package/esm/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
- package/esm/TestTriggers-DTc_iMJF-HfB533Gx.js +1267 -0
- package/esm/UploadController-qjoYGCwx.js +589 -0
- package/esm/WebhookPayload-2aL31v0J.d.ts +352 -0
- package/esm/app.d.ts +7 -0
- package/esm/app.js +4 -0
- package/esm/elements.d.ts +88 -0
- package/esm/elements.js +528 -0
- package/esm/file-icons.d.ts +67 -0
- package/esm/file-icons.js +1 -0
- package/esm/index-CI4BzN4W.d.ts +252 -0
- package/esm/index.d.ts +6 -163
- package/esm/index.js +1 -794
- package/esm/react-native.d.ts +56 -0
- package/esm/react-native.js +467 -0
- package/esm/react.d.ts +30 -0
- package/esm/react.js +343 -0
- package/esm/server.d.ts +33 -0
- package/esm/server.js +4 -0
- package/esm/styles.css +147 -0
- package/esm/svelte/CalmLensMedia.svelte +134 -0
- package/esm/svelte/CalmLensUploader.svelte +175 -0
- package/esm/svelte/Icon.svelte +7 -0
- package/esm/svelte/index.d.ts +37 -0
- package/esm/svelte/index.js +6 -0
- package/esm/test-inputs.d.ts +2 -0
- package/esm/test-inputs.js +1 -0
- package/esm/testing.d.ts +309 -80
- package/esm/testing.js +10432 -656
- package/esm/ui-CCY3yXFn.js +458 -0
- package/esm/ui-wIiMfqMB.d.ts +526 -0
- package/esm/ui.d.ts +2 -0
- package/esm/ui.js +3 -0
- package/esm/vue.d.ts +490 -0
- package/esm/vue.js +392 -0
- package/package.json +173 -34
- package/cjs/CalmLensTypes-DkqoKBwF.d.ts +0 -1761
- package/cjs/CalmLensUtils-CjdO9v--.js +0 -549
- package/esm/CalmLensTypes-DkqoKBwF.d.ts +0 -1761
- package/esm/CalmLensUtils-B3Eiz2Ro.js +0 -430
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { Ft as TypedEvent, Pt as EventAsset } from "./CalmLensTypes-9Vt16pc7.js";
|
|
2
|
+
import * as zod from "zod";
|
|
3
|
+
/** Error codes the CalmLens API documents, by name. */
|
|
4
|
+
declare const API_ERROR_CODES: {
|
|
5
|
+
readonly INVALID_VIEWER_CLAIMS: "viewer/invalid-claims";
|
|
6
|
+
readonly AGE_CONFIRMATION_REQUIRED: "viewer/age-confirmation-required";
|
|
7
|
+
readonly INVALID_VIEWER_REGION: "viewer/invalid-region";
|
|
8
|
+
readonly VIEWER_REGION_REQUIRED: "viewer/region-required";
|
|
9
|
+
readonly REGIONAL_EVIDENCE_REQUIRED: "asset/regional-evidence-required";
|
|
10
|
+
readonly INVALID_TYPE: "validation/invalid-type";
|
|
11
|
+
readonly TOO_SMALL: "validation/too-small";
|
|
12
|
+
readonly TOO_BIG: "validation/too-big";
|
|
13
|
+
readonly INVALID_FORMAT: "validation/invalid-format";
|
|
14
|
+
readonly INVALID_VALUE: "validation/invalid-value";
|
|
15
|
+
readonly UNKNOWN_FIELD: "validation/unknown-field";
|
|
16
|
+
readonly UNSUPPORTED_CONTENT_TYPE: "validation/unsupported-content-type";
|
|
17
|
+
readonly INVALID_FILTER: "validation/invalid-filter";
|
|
18
|
+
readonly INVALID_ORDERING_FIELD: "validation/invalid-ordering-field";
|
|
19
|
+
readonly ROUTE_NOT_FOUND: "misc/route-not-found";
|
|
20
|
+
readonly INTERNAL_ERROR: "misc/internal-error";
|
|
21
|
+
readonly UNAUTHENTICATED: "auth/unauthenticated";
|
|
22
|
+
readonly TOKEN_EXPIRED: "auth/token-expired";
|
|
23
|
+
readonly INVALID_TOKEN: "auth/invalid-token";
|
|
24
|
+
readonly SEARCH_UNAVAILABLE: "search/unavailable";
|
|
25
|
+
readonly INVALID_TRANSFORM: "asset/invalid-transform";
|
|
26
|
+
readonly INVALID_TRANSFORM_OPTIONS: "asset/invalid-transform-options";
|
|
27
|
+
readonly REMOTE_URL_REDIRECT_LIMIT: "asset/remote-url-redirect-limit";
|
|
28
|
+
readonly COPYRIGHT_CONTENT_HELD: "copyright/content-held";
|
|
29
|
+
readonly DOWNLOAD_PERMISSION_REQUIRED: "asset/api-key-missing-permission";
|
|
30
|
+
readonly INVALID_CURSOR: "validation/invalid-cursor";
|
|
31
|
+
readonly MISSING_TOKEN: "auth/missing-token";
|
|
32
|
+
readonly INVALID_API_KEY: "auth/invalid-api-key";
|
|
33
|
+
readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
|
|
34
|
+
readonly API_KEY_NOT_ACCEPTED: "auth/api-key-not-accepted";
|
|
35
|
+
readonly PERMISSION_DENIED: "auth/permission-denied";
|
|
36
|
+
readonly FILE_TOO_LARGE: "upload/file-too-large";
|
|
37
|
+
readonly MULTIPART_IMAGE_TOO_SMALL: "upload/multipart-image-too-small";
|
|
38
|
+
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
39
|
+
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
40
|
+
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
41
|
+
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
42
|
+
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
43
|
+
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
|
44
|
+
readonly USE_UPLOAD_PART: "upload/use-upload-part";
|
|
45
|
+
readonly UPLOAD_NOT_OPEN: "upload/not-open";
|
|
46
|
+
readonly INVALID_UPLOAD_PART_NUMBER: "upload/invalid-part-number";
|
|
47
|
+
readonly UPLOAD_MISSING: "upload/missing";
|
|
48
|
+
readonly UPLOAD_SIZE_MISMATCH: "upload/size-mismatch";
|
|
49
|
+
readonly INVALID_IDEMPOTENCY_KEY: "idempotency/invalid-key";
|
|
50
|
+
readonly IDEMPOTENCY_KEY_REUSED: "idempotency/key-reused";
|
|
51
|
+
readonly IDEMPOTENT_REQUEST_IN_PROGRESS: "idempotency/request-in-progress";
|
|
52
|
+
readonly ASSET_NOT_FOUND: "asset/not-found";
|
|
53
|
+
readonly PROJECT_NOT_FOUND: "project/not-found";
|
|
54
|
+
readonly ASSET_REVIEW_CHANGED: "asset/review-changed";
|
|
55
|
+
readonly ASSET_REVIEW_NOTE_REQUIRED: "asset/review-note-required";
|
|
56
|
+
readonly ASSET_UPDATE_FAILED: "asset/update-failed";
|
|
57
|
+
readonly ASSET_SAFETY_HELD: "asset/safety-held";
|
|
58
|
+
readonly ASSET_PROCESSING: "asset/processing";
|
|
59
|
+
readonly ASSET_DECISION_NOT_ALLOWED: "asset/decision-not-allowed";
|
|
60
|
+
readonly ASSET_DECISION_UNCHANGED: "asset/decision-unchanged";
|
|
61
|
+
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
62
|
+
readonly ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable";
|
|
63
|
+
readonly ASSET_CONTENT_PURGED: "asset/content-purged";
|
|
64
|
+
readonly ASSET_NOT_DECIDED: "asset/not-decided";
|
|
65
|
+
readonly ASSET_POLICY_CHANGED: "asset/policy-changed";
|
|
66
|
+
readonly ASSET_REVIEWED: "asset/reviewed";
|
|
67
|
+
readonly SUPPORT_TICKET_NOT_FOUND: "support/ticket-not-found";
|
|
68
|
+
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
69
|
+
readonly FOLDER_NOT_FOUND: "folder/not-found";
|
|
70
|
+
readonly DUPLICATE_FOLDER_NAME: "folder/duplicate-name";
|
|
71
|
+
readonly FOLDER_NOT_EMPTY: "folder/not-empty";
|
|
72
|
+
readonly FOLDER_PARENT_CYCLE: "folder/parent-cycle";
|
|
73
|
+
readonly LENS_VERSION_CONFLICT: "lens/version-conflict";
|
|
74
|
+
readonly LENS_IDENTIFIER_RESERVED: "lens/identifier-reserved";
|
|
75
|
+
readonly HASH_LIST_NOT_FOUND: "hash-list/not-found";
|
|
76
|
+
readonly HASH_LIST_ENTRY_NOT_FOUND: "hash-list/entry-not-found";
|
|
77
|
+
readonly HASH_LIST_LIMIT_REACHED: "hash-list/limit-reached";
|
|
78
|
+
readonly HASH_LIST_ENTRY_LIMIT_REACHED: "hash-list/entry-limit-reached";
|
|
79
|
+
readonly HASH_LIST_ASSET_NOT_HASHED: "hash-list/asset-not-hashed";
|
|
80
|
+
readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
|
|
81
|
+
readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
|
|
82
|
+
readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
|
|
83
|
+
readonly REMOTE_URL_NOT_ALLOWED: "upload/remote-url-not-allowed";
|
|
84
|
+
readonly WEBSITE_RATE_LIMIT_EXCEEDED: "upload/website-rate-limit-exceeded";
|
|
85
|
+
readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
|
|
86
|
+
readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
|
|
87
|
+
readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
|
|
88
|
+
readonly UPLOAD_PRESET_ORIGIN_NOT_ALLOWED: "upload-preset/origin-not-allowed";
|
|
89
|
+
readonly UPLOAD_PRESET_FIELD_NOT_ALLOWED: "upload-preset/field-not-allowed";
|
|
90
|
+
readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
|
|
91
|
+
readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
|
|
92
|
+
readonly UPLOAD_TOKEN_USED: "upload-token/used";
|
|
93
|
+
readonly INVALID_REMOTE_URL: "asset/invalid-remote-url";
|
|
94
|
+
readonly REMOTE_URL_UNAVAILABLE: "asset/remote-url-unavailable";
|
|
95
|
+
readonly APPEAL_NOT_FOUND: "appeal/not-found";
|
|
96
|
+
readonly APPEAL_JUDGMENT_NOT_FOUND: "appeal/judgment-not-found";
|
|
97
|
+
readonly APPEAL_ASSET_NOT_FOUND: "appeal/asset-not-found";
|
|
98
|
+
readonly APPEAL_PERMISSION_DENIED: "appeal/permission-denied";
|
|
99
|
+
readonly APPEAL_ALREADY_REVIEWED: "appeal/already-reviewed";
|
|
100
|
+
readonly APPEAL_DECISION_CHANGED: "appeal/decision-changed";
|
|
101
|
+
readonly APPEAL_INVALID_ACTION: "appeal/invalid-action";
|
|
102
|
+
readonly APPEAL_SAFETY_HELD: "appeal/safety-held";
|
|
103
|
+
readonly APPEAL_CONTENT_UNAVAILABLE: "appeal/content-unavailable";
|
|
104
|
+
};
|
|
105
|
+
type ApiErrorCode = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES];
|
|
106
|
+
type CalmLensErrorDetails = Record<string, unknown>;
|
|
107
|
+
/** Codes for failures the SDK detects itself, before or instead of an API error response. */
|
|
108
|
+
declare const SDK_ERROR_CODES: {
|
|
109
|
+
/** The request could not be completed: DNS, TLS, a refused or reset connection, a truncated body. */
|
|
110
|
+
readonly TRANSPORT_ERROR: "sdk/transport-error";
|
|
111
|
+
/** The request did not finish within `timeoutMs`. */
|
|
112
|
+
readonly TIMEOUT: "sdk/timeout";
|
|
113
|
+
/** The caller's `AbortSignal` cancelled the request. */
|
|
114
|
+
readonly CANCELLED: "sdk/cancelled";
|
|
115
|
+
/** A successful response whose body is not the JSON the operation returns. */
|
|
116
|
+
readonly INVALID_RESPONSE: "sdk/invalid-response";
|
|
117
|
+
/** An HTTP failure without a CalmLens error body, for example from a proxy, or a redirect. */
|
|
118
|
+
readonly HTTP_ERROR: "sdk/http-error";
|
|
119
|
+
/** A response body larger than `maxResponseBytes`. */
|
|
120
|
+
readonly RESPONSE_TOO_LARGE: "sdk/response-too-large";
|
|
121
|
+
/** A method argument is missing or invalid, for example an empty asset ID. */
|
|
122
|
+
readonly INVALID_ARGUMENT: "sdk/invalid-argument";
|
|
123
|
+
/** The client options are invalid, for example a missing API key. */
|
|
124
|
+
readonly INVALID_CONFIG: "sdk/invalid-config";
|
|
125
|
+
/** No `fetch` implementation is available in this runtime. */
|
|
126
|
+
readonly NO_FETCH: "sdk/no-fetch";
|
|
127
|
+
/** A webhook delivery whose signature or timestamp did not verify. */
|
|
128
|
+
readonly INVALID_WEBHOOK_SIGNATURE: "sdk/invalid-webhook-signature";
|
|
129
|
+
/** A verified webhook delivery whose body is not a webhook event. */
|
|
130
|
+
readonly INVALID_WEBHOOK_PAYLOAD: "sdk/invalid-webhook-payload";
|
|
131
|
+
};
|
|
132
|
+
type SdkErrorCode = (typeof SDK_ERROR_CODES)[keyof typeof SDK_ERROR_CODES];
|
|
133
|
+
/** Every error code the SDK can throw: the documented API codes and the SDK's own `sdk/*` codes. */
|
|
134
|
+
declare const CALMLENS_ERROR_CODES: {
|
|
135
|
+
readonly INVALID_VIEWER_CLAIMS: "viewer/invalid-claims";
|
|
136
|
+
readonly AGE_CONFIRMATION_REQUIRED: "viewer/age-confirmation-required";
|
|
137
|
+
readonly INVALID_VIEWER_REGION: "viewer/invalid-region";
|
|
138
|
+
readonly VIEWER_REGION_REQUIRED: "viewer/region-required";
|
|
139
|
+
readonly REGIONAL_EVIDENCE_REQUIRED: "asset/regional-evidence-required";
|
|
140
|
+
readonly INVALID_TYPE: "validation/invalid-type";
|
|
141
|
+
readonly TOO_SMALL: "validation/too-small";
|
|
142
|
+
readonly TOO_BIG: "validation/too-big";
|
|
143
|
+
readonly INVALID_FORMAT: "validation/invalid-format";
|
|
144
|
+
readonly INVALID_VALUE: "validation/invalid-value";
|
|
145
|
+
readonly UNKNOWN_FIELD: "validation/unknown-field";
|
|
146
|
+
readonly UNSUPPORTED_CONTENT_TYPE: "validation/unsupported-content-type";
|
|
147
|
+
readonly INVALID_FILTER: "validation/invalid-filter";
|
|
148
|
+
readonly INVALID_ORDERING_FIELD: "validation/invalid-ordering-field";
|
|
149
|
+
readonly ROUTE_NOT_FOUND: "misc/route-not-found";
|
|
150
|
+
readonly INTERNAL_ERROR: "misc/internal-error";
|
|
151
|
+
readonly UNAUTHENTICATED: "auth/unauthenticated";
|
|
152
|
+
readonly TOKEN_EXPIRED: "auth/token-expired";
|
|
153
|
+
readonly INVALID_TOKEN: "auth/invalid-token";
|
|
154
|
+
readonly SEARCH_UNAVAILABLE: "search/unavailable";
|
|
155
|
+
readonly INVALID_TRANSFORM: "asset/invalid-transform";
|
|
156
|
+
readonly INVALID_TRANSFORM_OPTIONS: "asset/invalid-transform-options";
|
|
157
|
+
readonly REMOTE_URL_REDIRECT_LIMIT: "asset/remote-url-redirect-limit";
|
|
158
|
+
readonly COPYRIGHT_CONTENT_HELD: "copyright/content-held";
|
|
159
|
+
readonly DOWNLOAD_PERMISSION_REQUIRED: "asset/api-key-missing-permission";
|
|
160
|
+
readonly INVALID_CURSOR: "validation/invalid-cursor";
|
|
161
|
+
readonly MISSING_TOKEN: "auth/missing-token";
|
|
162
|
+
readonly INVALID_API_KEY: "auth/invalid-api-key";
|
|
163
|
+
readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
|
|
164
|
+
readonly API_KEY_NOT_ACCEPTED: "auth/api-key-not-accepted";
|
|
165
|
+
readonly PERMISSION_DENIED: "auth/permission-denied";
|
|
166
|
+
readonly FILE_TOO_LARGE: "upload/file-too-large";
|
|
167
|
+
readonly MULTIPART_IMAGE_TOO_SMALL: "upload/multipart-image-too-small";
|
|
168
|
+
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
169
|
+
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
170
|
+
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
171
|
+
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
172
|
+
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
173
|
+
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
|
174
|
+
readonly USE_UPLOAD_PART: "upload/use-upload-part";
|
|
175
|
+
readonly UPLOAD_NOT_OPEN: "upload/not-open";
|
|
176
|
+
readonly INVALID_UPLOAD_PART_NUMBER: "upload/invalid-part-number";
|
|
177
|
+
readonly UPLOAD_MISSING: "upload/missing";
|
|
178
|
+
readonly UPLOAD_SIZE_MISMATCH: "upload/size-mismatch";
|
|
179
|
+
readonly INVALID_IDEMPOTENCY_KEY: "idempotency/invalid-key";
|
|
180
|
+
readonly IDEMPOTENCY_KEY_REUSED: "idempotency/key-reused";
|
|
181
|
+
readonly IDEMPOTENT_REQUEST_IN_PROGRESS: "idempotency/request-in-progress";
|
|
182
|
+
readonly ASSET_NOT_FOUND: "asset/not-found";
|
|
183
|
+
readonly PROJECT_NOT_FOUND: "project/not-found";
|
|
184
|
+
readonly ASSET_REVIEW_CHANGED: "asset/review-changed";
|
|
185
|
+
readonly ASSET_REVIEW_NOTE_REQUIRED: "asset/review-note-required";
|
|
186
|
+
readonly ASSET_UPDATE_FAILED: "asset/update-failed";
|
|
187
|
+
readonly ASSET_SAFETY_HELD: "asset/safety-held";
|
|
188
|
+
readonly ASSET_PROCESSING: "asset/processing";
|
|
189
|
+
readonly ASSET_DECISION_NOT_ALLOWED: "asset/decision-not-allowed";
|
|
190
|
+
readonly ASSET_DECISION_UNCHANGED: "asset/decision-unchanged";
|
|
191
|
+
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
192
|
+
readonly ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable";
|
|
193
|
+
readonly ASSET_CONTENT_PURGED: "asset/content-purged";
|
|
194
|
+
readonly ASSET_NOT_DECIDED: "asset/not-decided";
|
|
195
|
+
readonly ASSET_POLICY_CHANGED: "asset/policy-changed";
|
|
196
|
+
readonly ASSET_REVIEWED: "asset/reviewed";
|
|
197
|
+
readonly SUPPORT_TICKET_NOT_FOUND: "support/ticket-not-found";
|
|
198
|
+
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
199
|
+
readonly FOLDER_NOT_FOUND: "folder/not-found";
|
|
200
|
+
readonly DUPLICATE_FOLDER_NAME: "folder/duplicate-name";
|
|
201
|
+
readonly FOLDER_NOT_EMPTY: "folder/not-empty";
|
|
202
|
+
readonly FOLDER_PARENT_CYCLE: "folder/parent-cycle";
|
|
203
|
+
readonly LENS_VERSION_CONFLICT: "lens/version-conflict";
|
|
204
|
+
readonly LENS_IDENTIFIER_RESERVED: "lens/identifier-reserved";
|
|
205
|
+
readonly HASH_LIST_NOT_FOUND: "hash-list/not-found";
|
|
206
|
+
readonly HASH_LIST_ENTRY_NOT_FOUND: "hash-list/entry-not-found";
|
|
207
|
+
readonly HASH_LIST_LIMIT_REACHED: "hash-list/limit-reached";
|
|
208
|
+
readonly HASH_LIST_ENTRY_LIMIT_REACHED: "hash-list/entry-limit-reached";
|
|
209
|
+
readonly HASH_LIST_ASSET_NOT_HASHED: "hash-list/asset-not-hashed";
|
|
210
|
+
readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
|
|
211
|
+
readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
|
|
212
|
+
readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
|
|
213
|
+
readonly REMOTE_URL_NOT_ALLOWED: "upload/remote-url-not-allowed";
|
|
214
|
+
readonly WEBSITE_RATE_LIMIT_EXCEEDED: "upload/website-rate-limit-exceeded";
|
|
215
|
+
readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
|
|
216
|
+
readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
|
|
217
|
+
readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
|
|
218
|
+
readonly UPLOAD_PRESET_ORIGIN_NOT_ALLOWED: "upload-preset/origin-not-allowed";
|
|
219
|
+
readonly UPLOAD_PRESET_FIELD_NOT_ALLOWED: "upload-preset/field-not-allowed";
|
|
220
|
+
readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
|
|
221
|
+
readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
|
|
222
|
+
readonly UPLOAD_TOKEN_USED: "upload-token/used";
|
|
223
|
+
readonly INVALID_REMOTE_URL: "asset/invalid-remote-url";
|
|
224
|
+
readonly REMOTE_URL_UNAVAILABLE: "asset/remote-url-unavailable";
|
|
225
|
+
readonly APPEAL_NOT_FOUND: "appeal/not-found";
|
|
226
|
+
readonly APPEAL_JUDGMENT_NOT_FOUND: "appeal/judgment-not-found";
|
|
227
|
+
readonly APPEAL_ASSET_NOT_FOUND: "appeal/asset-not-found";
|
|
228
|
+
readonly APPEAL_PERMISSION_DENIED: "appeal/permission-denied";
|
|
229
|
+
readonly APPEAL_ALREADY_REVIEWED: "appeal/already-reviewed";
|
|
230
|
+
readonly APPEAL_DECISION_CHANGED: "appeal/decision-changed";
|
|
231
|
+
readonly APPEAL_INVALID_ACTION: "appeal/invalid-action";
|
|
232
|
+
readonly APPEAL_SAFETY_HELD: "appeal/safety-held";
|
|
233
|
+
readonly APPEAL_CONTENT_UNAVAILABLE: "appeal/content-unavailable";
|
|
234
|
+
/** The request could not be completed: DNS, TLS, a refused or reset connection, a truncated body. */
|
|
235
|
+
readonly TRANSPORT_ERROR: "sdk/transport-error";
|
|
236
|
+
/** The request did not finish within `timeoutMs`. */
|
|
237
|
+
readonly TIMEOUT: "sdk/timeout";
|
|
238
|
+
/** The caller's `AbortSignal` cancelled the request. */
|
|
239
|
+
readonly CANCELLED: "sdk/cancelled";
|
|
240
|
+
/** A successful response whose body is not the JSON the operation returns. */
|
|
241
|
+
readonly INVALID_RESPONSE: "sdk/invalid-response";
|
|
242
|
+
/** An HTTP failure without a CalmLens error body, for example from a proxy, or a redirect. */
|
|
243
|
+
readonly HTTP_ERROR: "sdk/http-error";
|
|
244
|
+
/** A response body larger than `maxResponseBytes`. */
|
|
245
|
+
readonly RESPONSE_TOO_LARGE: "sdk/response-too-large";
|
|
246
|
+
/** A method argument is missing or invalid, for example an empty asset ID. */
|
|
247
|
+
readonly INVALID_ARGUMENT: "sdk/invalid-argument";
|
|
248
|
+
/** The client options are invalid, for example a missing API key. */
|
|
249
|
+
readonly INVALID_CONFIG: "sdk/invalid-config";
|
|
250
|
+
/** No `fetch` implementation is available in this runtime. */
|
|
251
|
+
readonly NO_FETCH: "sdk/no-fetch";
|
|
252
|
+
/** A webhook delivery whose signature or timestamp did not verify. */
|
|
253
|
+
readonly INVALID_WEBHOOK_SIGNATURE: "sdk/invalid-webhook-signature";
|
|
254
|
+
/** A verified webhook delivery whose body is not a webhook event. */
|
|
255
|
+
readonly INVALID_WEBHOOK_PAYLOAD: "sdk/invalid-webhook-payload";
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* A known error code. Codes added to the API after this SDK version are still delivered as plain
|
|
259
|
+
* strings, so compare against `string` and fall back to the HTTP status.
|
|
260
|
+
*/
|
|
261
|
+
type CalmLensErrorCode = ApiErrorCode | SdkErrorCode;
|
|
262
|
+
interface CalmLensErrorOptions {
|
|
263
|
+
message?: string;
|
|
264
|
+
status?: number;
|
|
265
|
+
details?: CalmLensErrorDetails;
|
|
266
|
+
cause?: unknown;
|
|
267
|
+
/** The `X-Request-Id` response header. */
|
|
268
|
+
requestId?: string;
|
|
269
|
+
/** The response headers, when there was a response. */
|
|
270
|
+
headers?: Headers;
|
|
271
|
+
/** Seconds to wait before retrying, from the `Retry-After` response header. */
|
|
272
|
+
retryAfter?: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Every failure the SDK reports, whether the API returned an error or the request never
|
|
276
|
+
* completed. Branch on `code`; `status`, `requestId`, `headers` and `retryAfter` describe the
|
|
277
|
+
* HTTP response when there was one, and `cause` holds the underlying error.
|
|
278
|
+
*
|
|
279
|
+
* `instanceof CalmLensError` and `CalmLensError.isCalmLensError(value)` both recognise errors
|
|
280
|
+
* from any copy of the SDK, so they work when ESM and CommonJS builds are loaded side by side.
|
|
281
|
+
*/
|
|
282
|
+
declare class CalmLensError extends Error {
|
|
283
|
+
/** A stable identifier such as `asset/not-found` or `sdk/timeout`. */
|
|
284
|
+
readonly code: CalmLensErrorCode | (string & {});
|
|
285
|
+
/** The HTTP status, when the API responded. */
|
|
286
|
+
readonly status?: number;
|
|
287
|
+
/** Structured diagnostics from the API, such as validation issues. */
|
|
288
|
+
readonly details?: CalmLensErrorDetails;
|
|
289
|
+
/** The `X-Request-Id` response header. Include it when you contact support. */
|
|
290
|
+
readonly requestId?: string;
|
|
291
|
+
/** The response headers, when the API responded. */
|
|
292
|
+
readonly headers?: Headers;
|
|
293
|
+
/** Seconds to wait before retrying, from the `Retry-After` response header. */
|
|
294
|
+
readonly retryAfter?: number;
|
|
295
|
+
constructor(code: CalmLensErrorCode | (string & {}) | {
|
|
296
|
+
id: string;
|
|
297
|
+
defaultMessage?: string;
|
|
298
|
+
}, options?: CalmLensErrorOptions);
|
|
299
|
+
/** True for any `CalmLensError`, including one created by another copy or build of the SDK. */
|
|
300
|
+
static isCalmLensError(value: unknown): value is CalmLensError;
|
|
301
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
302
|
+
/** The resource does not exist or is not visible to this API key. */
|
|
303
|
+
isNotFound(): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Whether repeating the same request may succeed: transport failures, timeouts (a request's
|
|
306
|
+
* `timeoutMs` or `waitForDecision`'s deadline), throttling (429), gateway errors (502, 503, 504)
|
|
307
|
+
* and idempotent requests still in progress. Only repeat a create or upload with the same
|
|
308
|
+
* `idempotencyKey`.
|
|
309
|
+
*/
|
|
310
|
+
isRetryable(): boolean;
|
|
311
|
+
}
|
|
312
|
+
/** A webhook body; narrow on `type` to get typed `facts`. */
|
|
313
|
+
type WebhookEventPayload = TypedEvent;
|
|
314
|
+
/** Consumer boundary: future event types, facts and fields must not break installed clients. */
|
|
315
|
+
declare const RECEIVED_WEBHOOK_EVENT_PAYLOAD_SCHEMA: zod.ZodObject<{
|
|
316
|
+
id: zod.ZodString;
|
|
317
|
+
type: zod.ZodString;
|
|
318
|
+
projectId: zod.ZodString;
|
|
319
|
+
createdAt: zod.ZodNumber;
|
|
320
|
+
severity: zod.ZodOptional<zod.ZodString>;
|
|
321
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
322
|
+
description: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
323
|
+
assetId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
324
|
+
asset: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
325
|
+
id: zod.ZodString;
|
|
326
|
+
}, zod.core.$loose>>>;
|
|
327
|
+
facts: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
328
|
+
key: zod.ZodString;
|
|
329
|
+
value: zod.ZodUnknown;
|
|
330
|
+
url: zod.ZodOptional<zod.ZodString>;
|
|
331
|
+
}, zod.core.$loose>>>;
|
|
332
|
+
}, zod.core.$loose>;
|
|
333
|
+
type ReceivedFact = zod.infer<typeof RECEIVED_WEBHOOK_EVENT_PAYLOAD_SCHEMA>["facts"];
|
|
334
|
+
/**
|
|
335
|
+
* The schema only requires what parsing needs, so future fields still parse. The type describes
|
|
336
|
+
* the payload CalmLens sends today, including the asset snapshot; fields added later arrive too,
|
|
337
|
+
* untyped.
|
|
338
|
+
*/
|
|
339
|
+
interface ReceivedWebhookEventPayload {
|
|
340
|
+
id: string;
|
|
341
|
+
type: string;
|
|
342
|
+
projectId: string;
|
|
343
|
+
createdAt: number;
|
|
344
|
+
severity?: string;
|
|
345
|
+
title?: string;
|
|
346
|
+
description?: string | null;
|
|
347
|
+
assetId?: string | null;
|
|
348
|
+
asset?: (EventAsset & Record<string, unknown>) | null;
|
|
349
|
+
facts?: ReceivedFact;
|
|
350
|
+
[key: string]: unknown;
|
|
351
|
+
}
|
|
352
|
+
export { CalmLensErrorCode as a, SdkErrorCode as c, CalmLensError as i, ApiErrorCode as l, WebhookEventPayload as n, CalmLensErrorDetails as o, CALMLENS_ERROR_CODES as r, CalmLensErrorOptions as s, ReceivedWebhookEventPayload as t };
|
package/esm/app.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as selectModerationContextItems, i as ModerationContextItem, n as MODERATION_CONTEXT_USED_CHARACTERS, o as HashList, r as MODERATION_CONTEXT_USED_ITEMS, s as HashListEntry, t as ModerationContext } from "./ModerationContext-9lGm-Mna-CcmbRnOy.js";
|
|
2
|
+
import { $ as IterateAssetsOptions, $t as ExtractedText, A as ClassifyTextOptions, At as WebhookPayloadInput, B as EnsureLensesOptions, Bt as EventSeverity, C as BatchAssetsResponse, Ct as UploadAssetPartOptions, D as CdnResource, Dt as ViewerClaims, E as CdnAssetUrlOptions, Et as VerifyWebhookSignatureOptions, F as CreateMultipartUploadPartOptions, Ft as TypedEvent, G as HashListEntryIdOptions, Gt as Order, H as FolderIdOptions, I as DecideAssetOptions, It as EventCategory, J as HashListPage, Jt as AssetSearchQuery, K as HashListEntryPage, Kt as LensType, L as DeleteAssetContentOptions, Lt as EventFact, M as CreateAssetSignedUrlOptions, Mt as GetEventsResponse, N as CreateFolderOptions, O as CdnServeOptions, Ot as WaitForAssetDecisionOptions, P as CreateHashListOptions, Pt as EventAsset, Q as IterateAssetChildrenOptions, Qt as AssetSafetyHoldReason, R as DeleteAssetOptions, Rt as EventFactValues, S as BatchAssetsOptions, St as UpdateHashListOptions, T as CalmLensServerClientOptions, Tt as UploadedAsset, Ut as Folder, V as ExplainAssetOptions, Vt as EventType, W as GetAssetUrlOptions, Wt as CursorPage, X as ImageTransform, Xt as AssetImage, Y as IdempotencyOptions, Z as ImageTransformOptions, Zt as AssetSafetyHold, _ as AssetSearchResult, _t as SignedUploadToken, a as AssetClassification, b as AssetUploadStatus, bt as UpdateAssetOptions, c as AssetContent, ct as MoveAssetOptions, d as AssetContentStatus, dt as MultipartUploadPartOptions, en as FileMetadata, et as Lens, f as AssetModeration, ft as RequestOptions, g as AssetSearchResponse, gt as SignUploadTokenOptions, h as AssetPage, ht as SearchAssetsOptions, i as AssetChildrenPage, it as ListEventsOptions, j as ConnectionOptions, jt as AssetBatchOperation, k as CdnTransform, kt as WebhookHeadersInput, l as AssetContentOptions, lt as MoveFolderOptions, m as AssetModerationStatus, mt as RetryAssetOptions, n as Asset, nn as ProcessingOptions, nt as ListAssetChildrenOptions, o as AssetClassificationFailureReason, ot as ListHashListEntriesOptions, p as AssetModerationDecision, pt as RetrieveAssetOptions, q as HashListIdOptions, qt as AssetSearchMatchField, r as AssetChecksums, rt as ListAssetsOptions, s as AssetClassificationStatus, st as ListHashListsOptions, t as AddHashListEntryOptions, tn as MetadataItem, tt as LensTransform, u as AssetContentRemovalReason, ut as MultipartUploadOptions, v as AssetType, vt as SignedUrl, w as CalmLensAppClientOptions, wt as UploadPresetSubmitAssetOptions, x as AssetVisibility, xt as UpdateFolderOptions, y as AssetUpload, yt as SubmitAssetOptions, z as EnsureLensOptions, zt as EventFacts } from "./CalmLensTypes-9Vt16pc7.js";
|
|
3
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-CV_K26Ce.js";
|
|
4
|
+
import { a as CalmLensErrorCode, c as SdkErrorCode, i as CalmLensError, l as ApiErrorCode, o as CalmLensErrorDetails, r as CALMLENS_ERROR_CODES, s as CalmLensErrorOptions, t as ReceivedWebhookEventPayload } from "./WebhookPayload-2aL31v0J.js";
|
|
5
|
+
import { a as ProcessingFeatureId, c as ProcessingFeatures, d as getAssetUrl, i as DetectedPerson, l as SDK_VERSION, n as BoundingBox, o as ProcessingFeatureResults, r as DetectedFace, s as ProcessingFeatureStage, t as AgeRange, u as DEFAULT_CDN_BASE_URL } from "./index-CI4BzN4W.js";
|
|
6
|
+
import { a as ClassificationNotEvaluatedReason, c as ModerationQualifier, i as ClassificationLabel, l as PolicyAction, n as ClassificationCategory, o as ClassificationQualifierResults, r as ClassificationCategoryReport, s as Likelihood, t as ClassificationCategories } from "./Classification-94kSYWZw-CMnQKW13.js";
|
|
7
|
+
export { type AddHashListEntryOptions, type AgeRange, type ApiErrorCode, type Asset, type AssetBatchOperation, type AssetChecksums, type AssetChildrenPage, type AssetClassification, type AssetClassificationFailureReason, type AssetClassificationStatus, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetImage, type AssetModeration, type AssetModerationDecision, type AssetModerationStatus, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetType, type AssetUpload, type AssetUploadStatus, type AssetVisibility, type BatchAssetsOptions, type BatchAssetsResponse, type BoundingBox, CALMLENS_ERROR_CODES, CalmLensAppClient, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnResource, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassifyTextOptions, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateHashListOptions, type CreateMultipartUploadPartOptions, type CursorPage, DEFAULT_CDN_BASE_URL, type DecideAssetOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExplainAssetOptions, type ExtractedText, type FileMetadata, type Folder, type FolderIdOptions, type GetAssetUrlOptions, type HashList, type HashListEntry, type HashListEntryIdOptions, type HashListEntryPage, type HashListIdOptions, type HashListPage, type IdempotencyOptions, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type ListHashListEntriesOptions, type ListHashListsOptions, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, type MetadataItem, type ModerationContext, type ModerationContextItem, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type PolicyAction, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UpdateHashListOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type ViewerClaims, type WaitForAssetDecisionOptions, type ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput, getAssetUrl, selectModerationContextItems };
|
package/esm/app.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { D as CALMLENS_ERROR_CODES, O as CalmLensError, c as DEFAULT_CDN_BASE_URL, i as SDK_VERSION, n as MODERATION_CONTEXT_USED_ITEMS, r as selectModerationContextItems, t as MODERATION_CONTEXT_USED_CHARACTERS, u as getAssetUrl } from "./ModerationContextLimits-BaX2QnU8.js";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DuFas_dW.js";
|
|
4
|
+
export { CALMLENS_ERROR_CODES, CalmLensAppClient, CalmLensError, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, getAssetUrl, selectModerationContextItems };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
|
|
2
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BT091eOB.js";
|
|
3
|
+
/** The `detail` of each event the elements dispatch. */
|
|
4
|
+
export interface CalmLensElementEvents {
|
|
5
|
+
"calmlens-uploaded": CalmLensUpload;
|
|
6
|
+
"calmlens-rejected": UploadItem;
|
|
7
|
+
"calmlens-failed": UploadItem;
|
|
8
|
+
"calmlens-removed": UploadItem;
|
|
9
|
+
"calmlens-change": UploadSnapshot;
|
|
10
|
+
"calmlens-reveal": undefined;
|
|
11
|
+
}
|
|
12
|
+
declare const BaseElement: typeof HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* `<calmlens-uploader upload-preset-id="…" token-url="/api/upload-token">` uploads through an
|
|
15
|
+
* upload preset and dispatches `calmlens-uploaded` with `{ assetId, status, file }` for each
|
|
16
|
+
* finished upload. Attributes: `upload-preset-id`, `token-url`, `accept`, `max-file-size`
|
|
17
|
+
* (bytes), `no-auto-upload`, `multiple`, `max-files`, `disabled`, `capture` and `base-url`. Set
|
|
18
|
+
* the `token`, `upload`, `checkStatus`, `messages` and `controller` properties from script for
|
|
19
|
+
* anything an attribute can't hold.
|
|
20
|
+
*/
|
|
21
|
+
export declare class CalmLensUploaderElement extends BaseElement {
|
|
22
|
+
#private;
|
|
23
|
+
static observedAttributes: string[];
|
|
24
|
+
/** The upload token, or a function returning one per file, instead of `token-url`. */
|
|
25
|
+
get token(): UploadControllerOptions["token"];
|
|
26
|
+
set token(value: UploadControllerOptions["token"]);
|
|
27
|
+
/** Uploads each file your own way instead of through `upload-preset-id`. */
|
|
28
|
+
get upload(): UploadControllerOptions["upload"];
|
|
29
|
+
set upload(value: UploadControllerOptions["upload"]);
|
|
30
|
+
/** Checks a pending upload made with `upload`. */
|
|
31
|
+
get checkStatus(): UploadControllerOptions["checkStatus"];
|
|
32
|
+
set checkStatus(value: UploadControllerOptions["checkStatus"]);
|
|
33
|
+
/** Creates the client for each upload, for example a `MockCalmLensAppClient` in tests. */
|
|
34
|
+
get createClient(): UploadControllerOptions["createClient"];
|
|
35
|
+
set createClient(value: UploadControllerOptions["createClient"]);
|
|
36
|
+
get messages(): Partial<CalmLensMessages> | undefined;
|
|
37
|
+
set messages(value: Partial<CalmLensMessages> | undefined);
|
|
38
|
+
/**
|
|
39
|
+
* The upload queue, for reading items or calling `start`, `retry`, `remove` and `clear`. Set it
|
|
40
|
+
* to show a queue your script created; its own options then apply instead of the attributes.
|
|
41
|
+
*/
|
|
42
|
+
get controller(): UploadController<File>;
|
|
43
|
+
set controller(value: UploadController<File>);
|
|
44
|
+
connectedCallback(): void;
|
|
45
|
+
disconnectedCallback(): void;
|
|
46
|
+
attributeChangedCallback(): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `<calmlens-media project-id="…" asset-id="…" status="allowed" alt="…">` shows an asset from the
|
|
50
|
+
* CalmLens CDN with a blurred placeholder while it loads. Age-restricted assets show the
|
|
51
|
+
* placeholder and a reveal button, which dispatches `calmlens-reveal`, until `age-confirmed` is set.
|
|
52
|
+
* Attributes: `project-id`, `asset-id`, `status`, `age-confirmed`, `type`, `resource`, `lens`,
|
|
53
|
+
* `transform`, `widths` (comma-separated), `url`, `no-placeholder`, `placeholder-hash`,
|
|
54
|
+
* `placeholder-url`, `average-color`, `cdn-base-url`, `alt`, `aspect-ratio`, `width`, `height`,
|
|
55
|
+
* `sizes`, `fit`, `position`, `eager`, `fetch-priority` and `no-controls`. Set the
|
|
56
|
+
* `asset` property to an API asset instead of `project-id` and `asset-id`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class CalmLensMediaElement extends BaseElement {
|
|
59
|
+
#private;
|
|
60
|
+
static observedAttributes: string[];
|
|
61
|
+
get messages(): Partial<CalmLensMessages> | undefined;
|
|
62
|
+
set messages(value: Partial<CalmLensMessages> | undefined);
|
|
63
|
+
/**
|
|
64
|
+
* An asset from the API, in place of `project-id` and `asset-id`. It supplies the status, type
|
|
65
|
+
* and preview too; attributes you set win over it.
|
|
66
|
+
*/
|
|
67
|
+
get asset(): MediaAsset | undefined;
|
|
68
|
+
set asset(value: MediaAsset | undefined);
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
attributeChangedCallback(): void;
|
|
71
|
+
}
|
|
72
|
+
/** Defines `<calmlens-uploader>` and `<calmlens-media>`, if they aren't defined yet. */
|
|
73
|
+
export declare const defineCalmLensElements: () => void;
|
|
74
|
+
declare global {
|
|
75
|
+
interface HTMLElementTagNameMap {
|
|
76
|
+
"calmlens-uploader": CalmLensUploaderElement;
|
|
77
|
+
"calmlens-media": CalmLensMediaElement;
|
|
78
|
+
}
|
|
79
|
+
interface HTMLElementEventMap {
|
|
80
|
+
"calmlens-uploaded": CustomEvent<CalmLensUpload>;
|
|
81
|
+
"calmlens-rejected": CustomEvent<UploadItem>;
|
|
82
|
+
"calmlens-failed": CustomEvent<UploadItem>;
|
|
83
|
+
"calmlens-removed": CustomEvent<UploadItem>;
|
|
84
|
+
"calmlens-change": CustomEvent<UploadSnapshot>;
|
|
85
|
+
"calmlens-reveal": CustomEvent<undefined>;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
|