@calmlens/sdk 0.16.3 → 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/README.md +425 -181
- package/bin/calmlens.js +16016 -0
- 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/{esm/index-C9Xw1aid.d.ts → cjs/WebhookPayload-2aL31v0J.d.ts} +131 -155
- package/cjs/app.d.ts +7 -44
- package/cjs/app.js +11 -89
- 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 -4
- package/cjs/index.js +9 -4
- 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 +12 -191
- package/cjs/server.js +18 -378
- package/cjs/test-inputs.d.ts +2 -2
- package/cjs/test-inputs.js +9 -264
- package/cjs/testing.d.ts +285 -190
- package/cjs/testing.js +2393 -1203
- 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/{cjs/index-C9Xw1aid.d.ts → esm/WebhookPayload-2aL31v0J.d.ts} +131 -155
- package/esm/app.d.ts +7 -44
- package/esm/app.js +3 -86
- 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 -4
- package/esm/index.js +1 -1
- 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 +12 -191
- package/esm/server.js +3 -369
- 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 -2
- package/esm/test-inputs.js +1 -256
- package/esm/testing.d.ts +285 -190
- package/esm/testing.js +2329 -1122
- 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 +118 -13
- package/cjs/CalmLensConnection-BNUHp_AQ.js +0 -234
- package/cjs/CalmLensUtils-o171ownK.js +0 -699
- package/cjs/CalmLensVersion-DwhgxQK5.js +0 -480
- package/cjs/CalmLensWebhooks-BKrq30Yp.js +0 -201
- package/cjs/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
- package/cjs/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
- package/cjs/WebhookPayload-CJoIkGBD.d.ts +0 -11753
- package/esm/CalmLensConnection-XTqmlwzG.js +0 -193
- package/esm/CalmLensUtils-DsF8Aa_x.js +0 -574
- package/esm/CalmLensVersion-DcifRKsx.js +0 -415
- package/esm/CalmLensWebhooks-BvGyk5d3.js +0 -148
- package/esm/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
- package/esm/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
- package/esm/WebhookPayload-CJoIkGBD.d.ts +0 -11753
|
@@ -1,23 +1,45 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./Classification-BNhgwGEm-DmA9VEuE.js";
|
|
1
|
+
import { Ft as TypedEvent, Pt as EventAsset } from "./CalmLensTypes-9Vt16pc7.js";
|
|
3
2
|
import * as zod from "zod";
|
|
4
|
-
//#region src/client/CalmLensErrorCodes.d.ts
|
|
5
3
|
/** Error codes the CalmLens API documents, by name. */
|
|
6
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";
|
|
7
30
|
readonly INVALID_CURSOR: "validation/invalid-cursor";
|
|
8
31
|
readonly MISSING_TOKEN: "auth/missing-token";
|
|
9
32
|
readonly INVALID_API_KEY: "auth/invalid-api-key";
|
|
10
33
|
readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
|
|
11
34
|
readonly API_KEY_NOT_ACCEPTED: "auth/api-key-not-accepted";
|
|
35
|
+
readonly PERMISSION_DENIED: "auth/permission-denied";
|
|
12
36
|
readonly FILE_TOO_LARGE: "upload/file-too-large";
|
|
13
|
-
readonly IMAGE_REQUIRES_MULTIPART_UPLOAD: "upload/image-requires-multipart-upload";
|
|
14
37
|
readonly MULTIPART_IMAGE_TOO_SMALL: "upload/multipart-image-too-small";
|
|
15
38
|
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
16
39
|
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
17
40
|
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
18
41
|
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
19
42
|
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
20
|
-
readonly INVALID_EVENT_CURSOR: "events/invalid-cursor";
|
|
21
43
|
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
|
22
44
|
readonly USE_UPLOAD_PART: "upload/use-upload-part";
|
|
23
45
|
readonly UPLOAD_NOT_OPEN: "upload/not-open";
|
|
@@ -29,10 +51,19 @@ declare const API_ERROR_CODES: {
|
|
|
29
51
|
readonly IDEMPOTENT_REQUEST_IN_PROGRESS: "idempotency/request-in-progress";
|
|
30
52
|
readonly ASSET_NOT_FOUND: "asset/not-found";
|
|
31
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";
|
|
32
56
|
readonly ASSET_UPDATE_FAILED: "asset/update-failed";
|
|
33
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";
|
|
34
61
|
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
35
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";
|
|
36
67
|
readonly SUPPORT_TICKET_NOT_FOUND: "support/ticket-not-found";
|
|
37
68
|
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
38
69
|
readonly FOLDER_NOT_FOUND: "folder/not-found";
|
|
@@ -40,6 +71,12 @@ declare const API_ERROR_CODES: {
|
|
|
40
71
|
readonly FOLDER_NOT_EMPTY: "folder/not-empty";
|
|
41
72
|
readonly FOLDER_PARENT_CYCLE: "folder/parent-cycle";
|
|
42
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";
|
|
43
80
|
readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
|
|
44
81
|
readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
|
|
45
82
|
readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
|
|
@@ -66,8 +103,6 @@ declare const API_ERROR_CODES: {
|
|
|
66
103
|
readonly APPEAL_CONTENT_UNAVAILABLE: "appeal/content-unavailable";
|
|
67
104
|
};
|
|
68
105
|
type ApiErrorCode = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES];
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/client/CalmLensError.d.ts
|
|
71
106
|
type CalmLensErrorDetails = Record<string, unknown>;
|
|
72
107
|
/** Codes for failures the SDK detects itself, before or instead of an API error response. */
|
|
73
108
|
declare const SDK_ERROR_CODES: {
|
|
@@ -79,7 +114,7 @@ declare const SDK_ERROR_CODES: {
|
|
|
79
114
|
readonly CANCELLED: "sdk/cancelled";
|
|
80
115
|
/** A successful response whose body is not the JSON the operation returns. */
|
|
81
116
|
readonly INVALID_RESPONSE: "sdk/invalid-response";
|
|
82
|
-
/** An HTTP failure without a CalmLens error body, for example from a proxy. */
|
|
117
|
+
/** An HTTP failure without a CalmLens error body, for example from a proxy, or a redirect. */
|
|
83
118
|
readonly HTTP_ERROR: "sdk/http-error";
|
|
84
119
|
/** A response body larger than `maxResponseBytes`. */
|
|
85
120
|
readonly RESPONSE_TOO_LARGE: "sdk/response-too-large";
|
|
@@ -97,20 +132,44 @@ declare const SDK_ERROR_CODES: {
|
|
|
97
132
|
type SdkErrorCode = (typeof SDK_ERROR_CODES)[keyof typeof SDK_ERROR_CODES];
|
|
98
133
|
/** Every error code the SDK can throw: the documented API codes and the SDK's own `sdk/*` codes. */
|
|
99
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";
|
|
100
160
|
readonly INVALID_CURSOR: "validation/invalid-cursor";
|
|
101
161
|
readonly MISSING_TOKEN: "auth/missing-token";
|
|
102
162
|
readonly INVALID_API_KEY: "auth/invalid-api-key";
|
|
103
163
|
readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
|
|
104
164
|
readonly API_KEY_NOT_ACCEPTED: "auth/api-key-not-accepted";
|
|
165
|
+
readonly PERMISSION_DENIED: "auth/permission-denied";
|
|
105
166
|
readonly FILE_TOO_LARGE: "upload/file-too-large";
|
|
106
|
-
readonly IMAGE_REQUIRES_MULTIPART_UPLOAD: "upload/image-requires-multipart-upload";
|
|
107
167
|
readonly MULTIPART_IMAGE_TOO_SMALL: "upload/multipart-image-too-small";
|
|
108
168
|
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
109
169
|
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
110
170
|
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
111
171
|
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
112
172
|
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
113
|
-
readonly INVALID_EVENT_CURSOR: "events/invalid-cursor";
|
|
114
173
|
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
|
115
174
|
readonly USE_UPLOAD_PART: "upload/use-upload-part";
|
|
116
175
|
readonly UPLOAD_NOT_OPEN: "upload/not-open";
|
|
@@ -122,10 +181,19 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
122
181
|
readonly IDEMPOTENT_REQUEST_IN_PROGRESS: "idempotency/request-in-progress";
|
|
123
182
|
readonly ASSET_NOT_FOUND: "asset/not-found";
|
|
124
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";
|
|
125
186
|
readonly ASSET_UPDATE_FAILED: "asset/update-failed";
|
|
126
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";
|
|
127
191
|
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
128
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";
|
|
129
197
|
readonly SUPPORT_TICKET_NOT_FOUND: "support/ticket-not-found";
|
|
130
198
|
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
131
199
|
readonly FOLDER_NOT_FOUND: "folder/not-found";
|
|
@@ -133,6 +201,12 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
133
201
|
readonly FOLDER_NOT_EMPTY: "folder/not-empty";
|
|
134
202
|
readonly FOLDER_PARENT_CYCLE: "folder/parent-cycle";
|
|
135
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";
|
|
136
210
|
readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
|
|
137
211
|
readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
|
|
138
212
|
readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
|
|
@@ -165,7 +239,7 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
165
239
|
readonly CANCELLED: "sdk/cancelled";
|
|
166
240
|
/** A successful response whose body is not the JSON the operation returns. */
|
|
167
241
|
readonly INVALID_RESPONSE: "sdk/invalid-response";
|
|
168
|
-
/** An HTTP failure without a CalmLens error body, for example from a proxy. */
|
|
242
|
+
/** An HTTP failure without a CalmLens error body, for example from a proxy, or a redirect. */
|
|
169
243
|
readonly HTTP_ERROR: "sdk/http-error";
|
|
170
244
|
/** A response body larger than `maxResponseBytes`. */
|
|
171
245
|
readonly RESPONSE_TOO_LARGE: "sdk/response-too-large";
|
|
@@ -181,8 +255,8 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
181
255
|
readonly INVALID_WEBHOOK_PAYLOAD: "sdk/invalid-webhook-payload";
|
|
182
256
|
};
|
|
183
257
|
/**
|
|
184
|
-
* A known error code. API
|
|
185
|
-
*
|
|
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.
|
|
186
260
|
*/
|
|
187
261
|
type CalmLensErrorCode = ApiErrorCode | SdkErrorCode;
|
|
188
262
|
interface CalmLensErrorOptions {
|
|
@@ -210,7 +284,7 @@ declare class CalmLensError extends Error {
|
|
|
210
284
|
readonly code: CalmLensErrorCode | (string & {});
|
|
211
285
|
/** The HTTP status, when the API responded. */
|
|
212
286
|
readonly status?: number;
|
|
213
|
-
/** Structured diagnostics from the API, such as validation issues
|
|
287
|
+
/** Structured diagnostics from the API, such as validation issues. */
|
|
214
288
|
readonly details?: CalmLensErrorDetails;
|
|
215
289
|
/** The `X-Request-Id` response header. Include it when you contact support. */
|
|
216
290
|
readonly requestId?: string;
|
|
@@ -228,149 +302,51 @@ declare class CalmLensError extends Error {
|
|
|
228
302
|
/** The resource does not exist or is not visible to this API key. */
|
|
229
303
|
isNotFound(): boolean;
|
|
230
304
|
/**
|
|
231
|
-
* Whether repeating the same request may succeed: transport failures,
|
|
232
|
-
* gateway errors (502, 503, 504)
|
|
233
|
-
* create or upload with the same
|
|
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`.
|
|
234
309
|
*/
|
|
235
310
|
isRetryable(): boolean;
|
|
236
311
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
declare const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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"];
|
|
244
334
|
/**
|
|
245
|
-
*
|
|
246
|
-
* the
|
|
247
|
-
*
|
|
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.
|
|
248
338
|
*/
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
type
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
ageEstimation: zod.ZodOptional<zod.ZodBoolean>;
|
|
264
|
-
}, zod.core.$strict>>>;
|
|
265
|
-
}, zod.core.$strict>;
|
|
266
|
-
type ProcessingFeatures = zod.infer<typeof PROCESSING_FEATURES_SCHEMA>;
|
|
267
|
-
/** Position and size as fractions of the image width and height, from 0 to 1. */
|
|
268
|
-
declare const BOUNDING_BOX_SCHEMA: zod.ZodObject<{
|
|
269
|
-
left: zod.ZodNumber;
|
|
270
|
-
top: zod.ZodNumber;
|
|
271
|
-
width: zod.ZodNumber;
|
|
272
|
-
height: zod.ZodNumber;
|
|
273
|
-
}, zod.core.$strict>;
|
|
274
|
-
type BoundingBox = zod.infer<typeof BOUNDING_BOX_SCHEMA>;
|
|
275
|
-
declare const AGE_RANGE_SCHEMA: zod.ZodObject<{
|
|
276
|
-
low: zod.ZodNumber;
|
|
277
|
-
high: zod.ZodNumber;
|
|
278
|
-
}, zod.core.$strict>;
|
|
279
|
-
type AgeRange = zod.infer<typeof AGE_RANGE_SCHEMA>;
|
|
280
|
-
declare const DETECTED_PERSON_SCHEMA: zod.ZodObject<{
|
|
281
|
-
box: zod.ZodObject<{
|
|
282
|
-
left: zod.ZodNumber;
|
|
283
|
-
top: zod.ZodNumber;
|
|
284
|
-
width: zod.ZodNumber;
|
|
285
|
-
height: zod.ZodNumber;
|
|
286
|
-
}, zod.core.$strict>;
|
|
287
|
-
confidence: zod.ZodNumber;
|
|
288
|
-
}, zod.core.$strict>;
|
|
289
|
-
type DetectedPerson = zod.infer<typeof DETECTED_PERSON_SCHEMA>;
|
|
290
|
-
declare const DETECTED_FACE_SCHEMA: zod.ZodObject<{
|
|
291
|
-
box: zod.ZodObject<{
|
|
292
|
-
left: zod.ZodNumber;
|
|
293
|
-
top: zod.ZodNumber;
|
|
294
|
-
width: zod.ZodNumber;
|
|
295
|
-
height: zod.ZodNumber;
|
|
296
|
-
}, zod.core.$strict>;
|
|
297
|
-
confidence: zod.ZodNumber;
|
|
298
|
-
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
299
|
-
low: zod.ZodNumber;
|
|
300
|
-
high: zod.ZodNumber;
|
|
301
|
-
}, zod.core.$strict>>;
|
|
302
|
-
}, zod.core.$strict>;
|
|
303
|
-
type DetectedFace = zod.infer<typeof DETECTED_FACE_SCHEMA>;
|
|
304
|
-
declare const PROCESSING_FEATURE_RESULTS_SCHEMA: zod.ZodObject<{
|
|
305
|
-
personDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
306
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
307
|
-
stage: zod.ZodEnum<{
|
|
308
|
-
beta: "beta";
|
|
309
|
-
ga: "ga";
|
|
310
|
-
}>;
|
|
311
|
-
people: zod.ZodArray<zod.ZodObject<{
|
|
312
|
-
box: zod.ZodObject<{
|
|
313
|
-
left: zod.ZodNumber;
|
|
314
|
-
top: zod.ZodNumber;
|
|
315
|
-
width: zod.ZodNumber;
|
|
316
|
-
height: zod.ZodNumber;
|
|
317
|
-
}, zod.core.$strict>;
|
|
318
|
-
confidence: zod.ZodNumber;
|
|
319
|
-
}, zod.core.$strict>>;
|
|
320
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
321
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
322
|
-
stage: zod.ZodEnum<{
|
|
323
|
-
beta: "beta";
|
|
324
|
-
ga: "ga";
|
|
325
|
-
}>;
|
|
326
|
-
reason: zod.ZodEnum<{
|
|
327
|
-
"not-supported": "not-supported";
|
|
328
|
-
unavailable: "unavailable";
|
|
329
|
-
}>;
|
|
330
|
-
}, zod.core.$strict>], "status">>;
|
|
331
|
-
faceDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
332
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
333
|
-
stage: zod.ZodEnum<{
|
|
334
|
-
beta: "beta";
|
|
335
|
-
ga: "ga";
|
|
336
|
-
}>;
|
|
337
|
-
faces: zod.ZodArray<zod.ZodObject<{
|
|
338
|
-
box: zod.ZodObject<{
|
|
339
|
-
left: zod.ZodNumber;
|
|
340
|
-
top: zod.ZodNumber;
|
|
341
|
-
width: zod.ZodNumber;
|
|
342
|
-
height: zod.ZodNumber;
|
|
343
|
-
}, zod.core.$strict>;
|
|
344
|
-
confidence: zod.ZodNumber;
|
|
345
|
-
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
346
|
-
low: zod.ZodNumber;
|
|
347
|
-
high: zod.ZodNumber;
|
|
348
|
-
}, zod.core.$strict>>;
|
|
349
|
-
}, zod.core.$strict>>;
|
|
350
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
351
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
352
|
-
stage: zod.ZodEnum<{
|
|
353
|
-
beta: "beta";
|
|
354
|
-
ga: "ga";
|
|
355
|
-
}>;
|
|
356
|
-
reason: zod.ZodEnum<{
|
|
357
|
-
"not-supported": "not-supported";
|
|
358
|
-
unavailable: "unavailable";
|
|
359
|
-
}>;
|
|
360
|
-
}, zod.core.$strict>], "status">>;
|
|
361
|
-
}, zod.core.$strict>;
|
|
362
|
-
type ProcessingFeatureResults = zod.infer<typeof PROCESSING_FEATURE_RESULTS_SCHEMA>;
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/contract/Project.d.ts
|
|
365
|
-
//#region packages/shared/src/Project.d.ts
|
|
366
|
-
declare const FLAGGED_CONTENT_POLICY_SCHEMA: zod.ZodObject<{
|
|
367
|
-
action: zod.ZodEnum<{
|
|
368
|
-
alert: "alert";
|
|
369
|
-
hide: "hide";
|
|
370
|
-
ignore: "ignore";
|
|
371
|
-
purge: "purge";
|
|
372
|
-
}>;
|
|
373
|
-
}, zod.core.$strip>;
|
|
374
|
-
type FlaggedContentPolicy = zod.infer<typeof FLAGGED_CONTENT_POLICY_SCHEMA>;
|
|
375
|
-
//#endregion
|
|
376
|
-
export { ApiErrorCode as _, DetectedPerson as a, ProcessingFeatureStage as c, CALMLENS_ERROR_CODES as d, CalmLensError as f, SdkErrorCode as g, CalmLensErrorOptions as h, DetectedFace as i, ProcessingFeatures as l, CalmLensErrorDetails as m, AgeRange as n, ProcessingFeatureId as o, CalmLensErrorCode as p, BoundingBox as r, ProcessingFeatureResults as s, FlaggedContentPolicy as t, SDK_VERSION as u };
|
|
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/cjs/app.d.ts
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* with an upload token from your server when the preset requires one, and never holds an API
|
|
9
|
-
* key. It can upload (`assets.create`, `assets.moderate`, `assets.uploadPart`) and check its own
|
|
10
|
-
* uploads (`assets.retrieve`). Every method throws `CalmLensError` on failure.
|
|
11
|
-
*/
|
|
12
|
-
declare class CalmLensAppClient {
|
|
13
|
-
#private;
|
|
14
|
-
constructor(options: CalmLensAppClientOptions);
|
|
15
|
-
/** Keeps tokens out of `console.log`, `util.inspect` and `JSON.stringify`. */
|
|
16
|
-
[inspectSymbol](): string;
|
|
17
|
-
toJSON(): {
|
|
18
|
-
uploadPresetId: string;
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
};
|
|
21
|
-
private get uploadsPath();
|
|
22
|
-
/** A fresh token for a new upload, when the client has one. */
|
|
23
|
-
private newUploadToken;
|
|
24
|
-
/** The `Authorization` header for an upload this client started. */
|
|
25
|
-
private authHeaders;
|
|
26
|
-
/** Uploads with a new token, kept for the upload's parts and status checks. */
|
|
27
|
-
private submit;
|
|
28
|
-
/** Uploads through the client's upload preset and checks those uploads. */
|
|
29
|
-
get assets(): {
|
|
30
|
-
/** Uploads a file and queues it for moderation. */
|
|
31
|
-
create: (options: UploadPresetSubmitAssetOptions) => Promise<UploadedAsset>;
|
|
32
|
-
/** Uploads a file and waits for its moderation decision. */
|
|
33
|
-
moderate: (options: UploadPresetSubmitAssetOptions) => Promise<UploadedAsset>;
|
|
34
|
-
/**
|
|
35
|
-
* Uploads the next part of a multipart upload this client started. The upload's queue
|
|
36
|
-
* mode, chosen when it started, applies when the final part arrives.
|
|
37
|
-
*/
|
|
38
|
-
uploadPart: ({ assetId, ...options }: UploadAssetPartOptions) => Promise<UploadedAsset>;
|
|
39
|
-
/** Checks an upload this client made. `status` is present when the preset shows decisions. */
|
|
40
|
-
retrieve: ({ assetId }: RetrieveAssetOptions) => Promise<UploadedAsset>;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetModeration, type AssetModerationAction, type AssetModerationStatus, type AssetPage, type AssetProcessing, type AssetProcessingStatus, type AssetReviewerAction, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, CalmLensAppClient, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type CursorPage, 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 ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type PreviewImage, 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 UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WaitForAssetDecisionOptions, type ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
|
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/cjs/app.js
CHANGED
|
@@ -1,91 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-DelWfmiJ.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var CalmLensAppClient = class {
|
|
15
|
-
#uploadPresetId;
|
|
16
|
-
#token;
|
|
17
|
-
/** The token each upload started with, for its parts and status checks. */
|
|
18
|
-
#uploadTokens = /* @__PURE__ */ new Map();
|
|
19
|
-
#connection;
|
|
20
|
-
constructor(options) {
|
|
21
|
-
require_CalmLensUtils.validateAppClientOptions(options);
|
|
22
|
-
const { token, uploadPresetId, ...rest } = options;
|
|
23
|
-
this.#uploadPresetId = uploadPresetId;
|
|
24
|
-
this.#token = token;
|
|
25
|
-
this.#connection = new require_CalmLensConnection.CalmLensConnection(require_CalmLensConnection.resolveConnectionOptions(rest));
|
|
26
|
-
}
|
|
27
|
-
/** Keeps tokens out of `console.log`, `util.inspect` and `JSON.stringify`. */
|
|
28
|
-
[inspectSymbol]() {
|
|
29
|
-
return `CalmLensAppClient { uploadPresetId: ${JSON.stringify(this.#uploadPresetId)}, baseUrl: ${JSON.stringify(this.#connection.options.baseUrl)} }`;
|
|
30
|
-
}
|
|
31
|
-
toJSON() {
|
|
32
|
-
return {
|
|
33
|
-
uploadPresetId: this.#uploadPresetId,
|
|
34
|
-
baseUrl: this.#connection.options.baseUrl
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
get uploadsPath() {
|
|
38
|
-
return `/upload-presets/${encodeURIComponent(this.#uploadPresetId)}/assets`;
|
|
39
|
-
}
|
|
40
|
-
/** A fresh token for a new upload, when the client has one. */
|
|
41
|
-
async newUploadToken() {
|
|
42
|
-
const token = typeof this.#token === "function" ? await this.#token() : this.#token;
|
|
43
|
-
if (token !== void 0 && (typeof token !== "string" || !token)) throw require_CalmLensVersion.invalidConfig("token must return a non-empty string");
|
|
44
|
-
return token;
|
|
45
|
-
}
|
|
46
|
-
/** The `Authorization` header for an upload this client started. */
|
|
47
|
-
authHeaders(assetId) {
|
|
48
|
-
const token = this.#uploadTokens.get(assetId);
|
|
49
|
-
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
50
|
-
}
|
|
51
|
-
/** Uploads with a new token, kept for the upload's parts and status checks. */
|
|
52
|
-
async submit(options, queue) {
|
|
53
|
-
if (!options || typeof options !== "object") throw require_CalmLensVersion.invalidArgument("Upload options are required");
|
|
54
|
-
if (!("content" in options) && !("part" in options)) throw require_CalmLensVersion.invalidArgument("Uploads through an upload preset need content or a part");
|
|
55
|
-
require_CalmLensConnection.prepareSubmitAssetOptions(options);
|
|
56
|
-
const token = await this.newUploadToken();
|
|
57
|
-
const data = await this.#connection.submitRawUpload(this.uploadsPath, options, queue, token ? { Authorization: `Bearer ${token}` } : {});
|
|
58
|
-
const uploaded = require_CalmLensConnection.expectUploadedAsset(data);
|
|
59
|
-
if (token) this.#uploadTokens.set(uploaded.id, token);
|
|
60
|
-
return uploaded;
|
|
61
|
-
}
|
|
62
|
-
/** Uploads through the client's upload preset and checks those uploads. */
|
|
63
|
-
get assets() {
|
|
64
|
-
return {
|
|
65
|
-
/** Uploads a file and queues it for moderation. */
|
|
66
|
-
create: (options) => this.submit(options, true),
|
|
67
|
-
/** Uploads a file and waits for its moderation decision. */
|
|
68
|
-
moderate: (options) => this.submit(options, false),
|
|
69
|
-
/**
|
|
70
|
-
* Uploads the next part of a multipart upload this client started. The upload's queue
|
|
71
|
-
* mode, chosen when it started, applies when the final part arrives.
|
|
72
|
-
*/
|
|
73
|
-
uploadPart: async ({ assetId, ...options }) => {
|
|
74
|
-
const encodedAssetId = require_CalmLensUtils.encodePathSegment(assetId, "Asset ID");
|
|
75
|
-
const data = await this.#connection.uploadPart(`${this.uploadsPath}/${encodedAssetId}/part`, options, this.authHeaders(assetId));
|
|
76
|
-
return require_CalmLensConnection.expectUploadedAsset(data);
|
|
77
|
-
},
|
|
78
|
-
/** Checks an upload this client made. `status` is present when the preset shows decisions. */
|
|
79
|
-
retrieve: async ({ assetId }) => {
|
|
80
|
-
const encodedAssetId = require_CalmLensUtils.encodePathSegment(assetId, "Asset ID");
|
|
81
|
-
const data = await this.#connection.json("GET", `${this.uploadsPath}/${encodedAssetId}`, { headers: this.authHeaders(assetId) });
|
|
82
|
-
return require_CalmLensConnection.expectUploadedAsset(data);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
//#endregion
|
|
88
|
-
exports.CALMLENS_ERROR_CODES = require_CalmLensVersion.CALMLENS_ERROR_CODES;
|
|
89
|
-
exports.CalmLensAppClient = CalmLensAppClient;
|
|
90
|
-
exports.CalmLensError = require_CalmLensVersion.CalmLensError;
|
|
91
|
-
exports.SDK_VERSION = require_CalmLensVersion.SDK_VERSION;
|
|
4
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-CHQGu-Do.js");
|
|
5
|
+
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
6
|
+
exports.CalmLensAppClient = require_CalmLensAppClient.CalmLensAppClient;
|
|
7
|
+
exports.CalmLensError = require_ModerationContextLimits.CalmLensError;
|
|
8
|
+
exports.DEFAULT_CDN_BASE_URL = require_ModerationContextLimits.DEFAULT_CDN_BASE_URL;
|
|
9
|
+
exports.MODERATION_CONTEXT_USED_CHARACTERS = require_ModerationContextLimits.MODERATION_CONTEXT_USED_CHARACTERS;
|
|
10
|
+
exports.MODERATION_CONTEXT_USED_ITEMS = require_ModerationContextLimits.MODERATION_CONTEXT_USED_ITEMS;
|
|
11
|
+
exports.SDK_VERSION = require_ModerationContextLimits.SDK_VERSION;
|
|
12
|
+
exports.getAssetUrl = require_ModerationContextLimits.getAssetUrl;
|
|
13
|
+
exports.selectModerationContextItems = require_ModerationContextLimits.selectModerationContextItems;
|