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,252 @@
|
|
|
1
|
+
import "./ModerationContext-9lGm-Mna-CcmbRnOy.js";
|
|
2
|
+
import { W as GetAssetUrlOptions } from "./CalmLensTypes-9Vt16pc7.js";
|
|
3
|
+
import "./WebhookPayload-2aL31v0J.js";
|
|
4
|
+
import "./Classification-94kSYWZw-CMnQKW13.js";
|
|
5
|
+
import * as zod from "zod";
|
|
6
|
+
declare const DEFAULT_CDN_BASE_URL = "https://cdn.calmlens.com/v1";
|
|
7
|
+
/**
|
|
8
|
+
* Builds an asset's CDN URL without a client: no API key and no request, so it works in browsers.
|
|
9
|
+
* `CalmLensServerClient`'s `cdn.getAssetUrl` uses it too.
|
|
10
|
+
*
|
|
11
|
+
* `resource` is `rendered` (default), `original` or `placeholder`. Only `rendered` takes a lens or
|
|
12
|
+
* transform, and it serves images in the best format the browser accepts. A
|
|
13
|
+
* placeholder is a small blurred PNG that the CDN serves publicly for every asset whatever its
|
|
14
|
+
* visibility or moderation status, without requiring age confirmation.
|
|
15
|
+
*/
|
|
16
|
+
declare const getAssetUrl: ({ projectId, assetIdentifier, cdnBaseUrl, resource, ...options }: GetAssetUrlOptions) => string;
|
|
17
|
+
/** This SDK's version, from its package.json. */
|
|
18
|
+
declare const SDK_VERSION: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional analyses a request can turn on with `processingOptions.features.<id>`. The catalog is
|
|
21
|
+
* the single source for the request and result schemas, cache keys and metering. Features are
|
|
22
|
+
* chosen per request only; there is no project-level default.
|
|
23
|
+
*/
|
|
24
|
+
/** How mature a feature is. Beta results may change shape. */
|
|
25
|
+
declare const PROCESSING_FEATURE_STAGES: readonly ["beta", "ga"];
|
|
26
|
+
type ProcessingFeatureStage = (typeof PROCESSING_FEATURE_STAGES)[number];
|
|
27
|
+
declare const PROCESSING_FEATURE_IDS: readonly ["ocr", "personDetection", "faceDetection", "linkDetection", "aiGeneratedDetection"];
|
|
28
|
+
type ProcessingFeatureId = (typeof PROCESSING_FEATURE_IDS)[number];
|
|
29
|
+
declare const PROCESSING_FEATURES_SCHEMA: zod.ZodObject<{
|
|
30
|
+
ocr: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
31
|
+
enabled: zod.ZodBoolean;
|
|
32
|
+
}, zod.core.$strict>>>;
|
|
33
|
+
personDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
34
|
+
enabled: zod.ZodBoolean;
|
|
35
|
+
}, zod.core.$strict>>>;
|
|
36
|
+
faceDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
37
|
+
enabled: zod.ZodBoolean;
|
|
38
|
+
ageEstimation: zod.ZodOptional<zod.ZodBoolean>;
|
|
39
|
+
}, zod.core.$strict>>>;
|
|
40
|
+
linkDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
41
|
+
enabled: zod.ZodBoolean;
|
|
42
|
+
}, zod.core.$strict>>>;
|
|
43
|
+
aiGeneratedDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
44
|
+
enabled: zod.ZodBoolean;
|
|
45
|
+
}, zod.core.$strict>>>;
|
|
46
|
+
}, zod.core.$strict>;
|
|
47
|
+
type ProcessingFeatures = zod.infer<typeof PROCESSING_FEATURES_SCHEMA>;
|
|
48
|
+
/** Position and size as fractions of the image width and height, from 0 to 1. */
|
|
49
|
+
declare const BOUNDING_BOX_SCHEMA: zod.ZodObject<{
|
|
50
|
+
left: zod.ZodNumber;
|
|
51
|
+
top: zod.ZodNumber;
|
|
52
|
+
width: zod.ZodNumber;
|
|
53
|
+
height: zod.ZodNumber;
|
|
54
|
+
}, zod.core.$strict>;
|
|
55
|
+
type BoundingBox = zod.infer<typeof BOUNDING_BOX_SCHEMA>;
|
|
56
|
+
declare const AGE_RANGE_SCHEMA: zod.ZodObject<{
|
|
57
|
+
low: zod.ZodNumber;
|
|
58
|
+
high: zod.ZodNumber;
|
|
59
|
+
}, zod.core.$strict>;
|
|
60
|
+
type AgeRange = zod.infer<typeof AGE_RANGE_SCHEMA>;
|
|
61
|
+
declare const DETECTED_PERSON_SCHEMA: zod.ZodObject<{
|
|
62
|
+
box: zod.ZodObject<{
|
|
63
|
+
left: zod.ZodNumber;
|
|
64
|
+
top: zod.ZodNumber;
|
|
65
|
+
width: zod.ZodNumber;
|
|
66
|
+
height: zod.ZodNumber;
|
|
67
|
+
}, zod.core.$strict>;
|
|
68
|
+
confidence: zod.ZodNumber;
|
|
69
|
+
}, zod.core.$strict>;
|
|
70
|
+
type DetectedPerson = zod.infer<typeof DETECTED_PERSON_SCHEMA>;
|
|
71
|
+
declare const DETECTED_FACE_SCHEMA: zod.ZodObject<{
|
|
72
|
+
box: zod.ZodObject<{
|
|
73
|
+
left: zod.ZodNumber;
|
|
74
|
+
top: zod.ZodNumber;
|
|
75
|
+
width: zod.ZodNumber;
|
|
76
|
+
height: zod.ZodNumber;
|
|
77
|
+
}, zod.core.$strict>;
|
|
78
|
+
confidence: zod.ZodNumber;
|
|
79
|
+
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
80
|
+
low: zod.ZodNumber;
|
|
81
|
+
high: zod.ZodNumber;
|
|
82
|
+
}, zod.core.$strict>>;
|
|
83
|
+
}, zod.core.$strict>;
|
|
84
|
+
type DetectedFace = zod.infer<typeof DETECTED_FACE_SCHEMA>;
|
|
85
|
+
declare const PROCESSING_FEATURE_RESULTS_SCHEMA: zod.ZodObject<{
|
|
86
|
+
personDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
87
|
+
status: zod.ZodLiteral<"evaluated">;
|
|
88
|
+
stage: zod.ZodEnum<{
|
|
89
|
+
beta: "beta";
|
|
90
|
+
ga: "ga";
|
|
91
|
+
}>;
|
|
92
|
+
people: zod.ZodArray<zod.ZodObject<{
|
|
93
|
+
box: zod.ZodObject<{
|
|
94
|
+
left: zod.ZodNumber;
|
|
95
|
+
top: zod.ZodNumber;
|
|
96
|
+
width: zod.ZodNumber;
|
|
97
|
+
height: zod.ZodNumber;
|
|
98
|
+
}, zod.core.$strict>;
|
|
99
|
+
confidence: zod.ZodNumber;
|
|
100
|
+
}, zod.core.$strict>>;
|
|
101
|
+
}, zod.core.$strict>, zod.ZodObject<{
|
|
102
|
+
status: zod.ZodLiteral<"not-evaluated">;
|
|
103
|
+
stage: zod.ZodEnum<{
|
|
104
|
+
beta: "beta";
|
|
105
|
+
ga: "ga";
|
|
106
|
+
}>;
|
|
107
|
+
reason: zod.ZodEnum<{
|
|
108
|
+
"not-supported": "not-supported";
|
|
109
|
+
unavailable: "unavailable";
|
|
110
|
+
}>;
|
|
111
|
+
}, zod.core.$strict>], "status">>;
|
|
112
|
+
faceDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
113
|
+
status: zod.ZodLiteral<"evaluated">;
|
|
114
|
+
stage: zod.ZodEnum<{
|
|
115
|
+
beta: "beta";
|
|
116
|
+
ga: "ga";
|
|
117
|
+
}>;
|
|
118
|
+
faces: zod.ZodArray<zod.ZodObject<{
|
|
119
|
+
box: zod.ZodObject<{
|
|
120
|
+
left: zod.ZodNumber;
|
|
121
|
+
top: zod.ZodNumber;
|
|
122
|
+
width: zod.ZodNumber;
|
|
123
|
+
height: zod.ZodNumber;
|
|
124
|
+
}, zod.core.$strict>;
|
|
125
|
+
confidence: zod.ZodNumber;
|
|
126
|
+
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
127
|
+
low: zod.ZodNumber;
|
|
128
|
+
high: zod.ZodNumber;
|
|
129
|
+
}, zod.core.$strict>>;
|
|
130
|
+
}, zod.core.$strict>>;
|
|
131
|
+
}, zod.core.$strict>, zod.ZodObject<{
|
|
132
|
+
status: zod.ZodLiteral<"not-evaluated">;
|
|
133
|
+
stage: zod.ZodEnum<{
|
|
134
|
+
beta: "beta";
|
|
135
|
+
ga: "ga";
|
|
136
|
+
}>;
|
|
137
|
+
reason: zod.ZodEnum<{
|
|
138
|
+
"not-supported": "not-supported";
|
|
139
|
+
unavailable: "unavailable";
|
|
140
|
+
}>;
|
|
141
|
+
}, zod.core.$strict>], "status">>;
|
|
142
|
+
linkDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
143
|
+
status: zod.ZodLiteral<"evaluated">;
|
|
144
|
+
stage: zod.ZodEnum<{
|
|
145
|
+
beta: "beta";
|
|
146
|
+
ga: "ga";
|
|
147
|
+
}>;
|
|
148
|
+
qrCodes: zod.ZodArray<zod.ZodObject<{
|
|
149
|
+
value: zod.ZodString;
|
|
150
|
+
box: zod.ZodObject<{
|
|
151
|
+
left: zod.ZodNumber;
|
|
152
|
+
top: zod.ZodNumber;
|
|
153
|
+
width: zod.ZodNumber;
|
|
154
|
+
height: zod.ZodNumber;
|
|
155
|
+
}, zod.core.$strict>;
|
|
156
|
+
}, zod.core.$strict>>;
|
|
157
|
+
links: zod.ZodArray<zod.ZodObject<{
|
|
158
|
+
url: zod.ZodString;
|
|
159
|
+
source: zod.ZodEnum<{
|
|
160
|
+
"qr-code": "qr-code";
|
|
161
|
+
text: "text";
|
|
162
|
+
}>;
|
|
163
|
+
}, zod.core.$strict>>;
|
|
164
|
+
}, zod.core.$strict>, zod.ZodObject<{
|
|
165
|
+
status: zod.ZodLiteral<"not-evaluated">;
|
|
166
|
+
stage: zod.ZodEnum<{
|
|
167
|
+
beta: "beta";
|
|
168
|
+
ga: "ga";
|
|
169
|
+
}>;
|
|
170
|
+
reason: zod.ZodEnum<{
|
|
171
|
+
"not-supported": "not-supported";
|
|
172
|
+
unavailable: "unavailable";
|
|
173
|
+
}>;
|
|
174
|
+
}, zod.core.$strict>], "status">>;
|
|
175
|
+
linkSafety: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
176
|
+
status: zod.ZodLiteral<"evaluated">;
|
|
177
|
+
stage: zod.ZodEnum<{
|
|
178
|
+
beta: "beta";
|
|
179
|
+
ga: "ga";
|
|
180
|
+
}>;
|
|
181
|
+
links: zod.ZodArray<zod.ZodObject<{
|
|
182
|
+
url: zod.ZodString;
|
|
183
|
+
finalUrl: zod.ZodNullable<zod.ZodString>;
|
|
184
|
+
redirects: zod.ZodNumber;
|
|
185
|
+
source: zod.ZodEnum<{
|
|
186
|
+
"qr-code": "qr-code";
|
|
187
|
+
text: "text";
|
|
188
|
+
}>;
|
|
189
|
+
verdict: zod.ZodEnum<{
|
|
190
|
+
adult: "adult";
|
|
191
|
+
gambling: "gambling";
|
|
192
|
+
malware: "malware";
|
|
193
|
+
phishing: "phishing";
|
|
194
|
+
safe: "safe";
|
|
195
|
+
unresolved: "unresolved";
|
|
196
|
+
}>;
|
|
197
|
+
evidence: zod.ZodArray<zod.ZodObject<{
|
|
198
|
+
check: zod.ZodEnum<{
|
|
199
|
+
"domain-categories": "domain-categories";
|
|
200
|
+
"threat-lists": "threat-lists";
|
|
201
|
+
}>;
|
|
202
|
+
status: zod.ZodEnum<{
|
|
203
|
+
checked: "checked";
|
|
204
|
+
failed: "failed";
|
|
205
|
+
}>;
|
|
206
|
+
labels: zod.ZodArray<zod.ZodString>;
|
|
207
|
+
}, zod.core.$strict>>;
|
|
208
|
+
}, zod.core.$strict>>;
|
|
209
|
+
}, zod.core.$strict>, zod.ZodObject<{
|
|
210
|
+
status: zod.ZodLiteral<"not-evaluated">;
|
|
211
|
+
stage: zod.ZodEnum<{
|
|
212
|
+
beta: "beta";
|
|
213
|
+
ga: "ga";
|
|
214
|
+
}>;
|
|
215
|
+
reason: zod.ZodEnum<{
|
|
216
|
+
"not-supported": "not-supported";
|
|
217
|
+
unavailable: "unavailable";
|
|
218
|
+
}>;
|
|
219
|
+
}, zod.core.$strict>], "status">>;
|
|
220
|
+
aiGeneratedDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
221
|
+
status: zod.ZodLiteral<"evaluated">;
|
|
222
|
+
stage: zod.ZodEnum<{
|
|
223
|
+
beta: "beta";
|
|
224
|
+
ga: "ga";
|
|
225
|
+
}>;
|
|
226
|
+
provenance: zod.ZodEnum<{
|
|
227
|
+
"ai-edited": "ai-edited";
|
|
228
|
+
"ai-generated": "ai-generated";
|
|
229
|
+
unknown: "unknown";
|
|
230
|
+
}>;
|
|
231
|
+
signals: zod.ZodArray<zod.ZodObject<{
|
|
232
|
+
kind: zod.ZodEnum<{
|
|
233
|
+
c2pa: "c2pa";
|
|
234
|
+
"generator-metadata": "generator-metadata";
|
|
235
|
+
"iptc-digital-source-type": "iptc-digital-source-type";
|
|
236
|
+
}>;
|
|
237
|
+
value: zod.ZodString;
|
|
238
|
+
}, zod.core.$strict>>;
|
|
239
|
+
}, zod.core.$strict>, zod.ZodObject<{
|
|
240
|
+
status: zod.ZodLiteral<"not-evaluated">;
|
|
241
|
+
stage: zod.ZodEnum<{
|
|
242
|
+
beta: "beta";
|
|
243
|
+
ga: "ga";
|
|
244
|
+
}>;
|
|
245
|
+
reason: zod.ZodEnum<{
|
|
246
|
+
"not-supported": "not-supported";
|
|
247
|
+
unavailable: "unavailable";
|
|
248
|
+
}>;
|
|
249
|
+
}, zod.core.$strict>], "status">>;
|
|
250
|
+
}, zod.core.$strict>;
|
|
251
|
+
type ProcessingFeatureResults = zod.infer<typeof PROCESSING_FEATURE_RESULTS_SCHEMA>;
|
|
252
|
+
export { ProcessingFeatureId as a, ProcessingFeatures as c, getAssetUrl as d, DetectedPerson as i, SDK_VERSION as l, BoundingBox as n, ProcessingFeatureResults as o, DetectedFace as r, ProcessingFeatureStage as s, AgeRange as t, DEFAULT_CDN_BASE_URL as u };
|
package/esm/index.d.ts
CHANGED
|
@@ -1,163 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private readonly ensuredLenses;
|
|
8
|
-
private readonly pendingEnsureLenses;
|
|
9
|
-
private readonly multipartImageUploadSizes;
|
|
10
|
-
private readonly multipartUploadQueues;
|
|
11
|
-
/**
|
|
12
|
-
* Validates a webhook signature to ensure the webhook payload is authentic.
|
|
13
|
-
*
|
|
14
|
-
* @param payload - The webhook payload (string or object)
|
|
15
|
-
* @param signatureHex - The signature from the 'x-calmlens-signature' header
|
|
16
|
-
* @param secret - The webhook secret used to sign the payload
|
|
17
|
-
* @returns Promise<boolean> - True if the signature is valid, false otherwise
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```javascript
|
|
21
|
-
* // In your webhook handler
|
|
22
|
-
* const signature = req.headers['x-calmlens-signature'];
|
|
23
|
-
* const payload = req.body;
|
|
24
|
-
* const isValid = await CalmLensClient.verifyWebhookSignature({
|
|
25
|
-
* payload,
|
|
26
|
-
* signatureHex: signature,
|
|
27
|
-
* secret: WEBHOOK_SECRET,
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* if (!isValid) {
|
|
31
|
-
* return res.status(401).send('Unauthorized');
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
static verifyWebhookSignature(options: VerifyWebhookSignatureOptions): Promise<boolean>;
|
|
36
|
-
constructor(options: CalmLensClientOptions);
|
|
37
|
-
private getUploadFetch;
|
|
38
|
-
private submitRawAssetUpload;
|
|
39
|
-
private submitRawAssetPart;
|
|
40
|
-
private parseRawUploadResponse;
|
|
41
|
-
get cdn(): {
|
|
42
|
-
/**
|
|
43
|
-
* Create a CDN URL for asset content or previews.
|
|
44
|
-
* Private assets require an authenticated request or signed URL.
|
|
45
|
-
*/
|
|
46
|
-
getAssetUrl: ({ assetIdentifier, ...options }: CdnAssetUrlOptions) => string;
|
|
47
|
-
/**
|
|
48
|
-
* Fetch asset content or previews from the CDN.
|
|
49
|
-
* Private assets are authenticated with the client's API key.
|
|
50
|
-
*/
|
|
51
|
-
serve: ({ assetIdentifier, init, ...urlOptions }: CdnServeOptions) => Promise<Response>;
|
|
52
|
-
};
|
|
53
|
-
get text(): {
|
|
54
|
-
/**
|
|
55
|
-
* Moderate a short piece of text, such as a comment, caption or bio, and wait for the
|
|
56
|
-
* decision. Check `status` (`"approved"` or `"rejected"`) and `report.flagged`.
|
|
57
|
-
* The text is not retained after classification unless `processingOptions` says so.
|
|
58
|
-
*/
|
|
59
|
-
moderate: (options: ModerateTextOptions) => Promise<Asset>;
|
|
60
|
-
};
|
|
61
|
-
get assets(): {
|
|
62
|
-
/**
|
|
63
|
-
* List all assets for a project
|
|
64
|
-
* @param options - Pagination and filtering options
|
|
65
|
-
* @returns Promise with paginated assets
|
|
66
|
-
*/
|
|
67
|
-
list: (options: ListAssetsOptions) => Promise<GetAssetsPageResponse>;
|
|
68
|
-
/**
|
|
69
|
-
* Retrieve a specific asset by ID
|
|
70
|
-
* @param assetId - The asset ID
|
|
71
|
-
* @returns Promise with asset data
|
|
72
|
-
*/
|
|
73
|
-
retrieve: ({ assetId }: RetrieveAssetOptions) => Promise<GetAssetResponse>;
|
|
74
|
-
update: ({ assetId, ...body }: UpdateAssetOptions) => Promise<Asset>;
|
|
75
|
-
/**
|
|
76
|
-
* Get child assets of a parent asset
|
|
77
|
-
* @param assetId - The parent asset ID
|
|
78
|
-
* @param options - Pagination options
|
|
79
|
-
* @returns Promise with paginated child assets
|
|
80
|
-
*/
|
|
81
|
-
listChildren: ({ assetId, ...options }: ListAssetChildrenOptions) => Promise<GetAssetChildrenResponse>;
|
|
82
|
-
/**
|
|
83
|
-
* Submit a new asset for processing (queued asynchronously)
|
|
84
|
-
* The asset will be queued for classification and returned immediately.
|
|
85
|
-
* @param options - Asset submission options
|
|
86
|
-
* @returns Promise with created asset
|
|
87
|
-
*/
|
|
88
|
-
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
89
|
-
/**
|
|
90
|
-
* Submit a new asset and analyze it synchronously
|
|
91
|
-
* The asset will be classified immediately before the response is returned.
|
|
92
|
-
* This may take longer but ensures the asset is fully processed.
|
|
93
|
-
* @param options - Asset submission options
|
|
94
|
-
* @returns Promise with created and analyzed asset
|
|
95
|
-
*/
|
|
96
|
-
analyze: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
97
|
-
/**
|
|
98
|
-
* Upload a part for a multipart upload
|
|
99
|
-
* @param assetId - The asset ID
|
|
100
|
-
* @param part - The part to upload
|
|
101
|
-
* @returns Promise with asset data
|
|
102
|
-
*/
|
|
103
|
-
uploadPart: ({ assetId, part }: UploadAssetPartOptions) => Promise<Asset>;
|
|
104
|
-
/**
|
|
105
|
-
* Create a short-lived signed CDN URL for an asset.
|
|
106
|
-
* This is useful for private assets where clients should not send app
|
|
107
|
-
* auth cookies or API keys to the CDN on every media request.
|
|
108
|
-
*/
|
|
109
|
-
createSignedUrl: ({ assetId, ...options }: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
|
|
110
|
-
move: ({ assetId, folderId }: MoveAssetOptions) => Promise<Asset>;
|
|
111
|
-
/**
|
|
112
|
-
* Processes an asset that failed (status `error`) again. It returns to `pending` and is
|
|
113
|
-
* moderated like a new upload; its content must still be stored.
|
|
114
|
-
*/
|
|
115
|
-
retry: ({ assetId }: RetryAssetOptions) => Promise<Asset>;
|
|
116
|
-
};
|
|
117
|
-
get events(): {
|
|
118
|
-
/**
|
|
119
|
-
* List project events after a cursor, oldest first. Call without `after` to get a cursor
|
|
120
|
-
* for "now", then poll with the returned `cursor`. Event bodies match webhook deliveries.
|
|
121
|
-
*/
|
|
122
|
-
list: (options?: ListEventsOptions) => Promise<GetEventsResponse>;
|
|
123
|
-
};
|
|
124
|
-
get folders(): {
|
|
125
|
-
list: () => Promise<Folder[]>;
|
|
126
|
-
retrieve: ({ folderId }: FolderIdOptions) => Promise<Folder>;
|
|
127
|
-
create: (options: CreateFolderOptions) => Promise<Folder>;
|
|
128
|
-
update: ({ folderId, ...body }: UpdateFolderOptions) => Promise<Folder>;
|
|
129
|
-
delete: ({ folderId }: FolderIdOptions) => Promise<void>;
|
|
130
|
-
move: ({ folderId, parentId }: MoveFolderOptions) => Promise<Folder>;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Create a named lens at any positive version, or update it with a greater version.
|
|
134
|
-
* Supplying the same definition and version is idempotent.
|
|
135
|
-
*/
|
|
136
|
-
ensureLens(options: EnsureLensOptions): Promise<Lens>;
|
|
137
|
-
/**
|
|
138
|
-
* Create or update several named lenses in one API request.
|
|
139
|
-
* Each lens follows the same versioning and idempotency rules as ensureLens().
|
|
140
|
-
*/
|
|
141
|
-
ensureLenses({ lenses }: EnsureLensesOptions): Promise<Lens[]>;
|
|
142
|
-
private submitEnsureLenses;
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/client/CalmLensError.d.ts
|
|
146
|
-
type CalmLensErrorDetails = Record<string, unknown>;
|
|
147
|
-
type CalmLensErrorCodeInput = RequestErrorCode | {
|
|
148
|
-
id: string;
|
|
149
|
-
defaultMessage?: string;
|
|
150
|
-
};
|
|
151
|
-
export declare class CalmLensError extends Error {
|
|
152
|
-
code: string;
|
|
153
|
-
details?: CalmLensErrorDetails;
|
|
154
|
-
constructor(errorCode: CalmLensErrorCodeInput, options?: {
|
|
155
|
-
message?: string;
|
|
156
|
-
details?: CalmLensErrorDetails;
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/client/CalmLensUtils.d.ts
|
|
161
|
-
export declare function verifyWebhookSignature({ payload, signatureHex, secret }: VerifyWebhookSignatureOptions): Promise<boolean>;
|
|
162
|
-
//#endregion
|
|
163
|
-
export { CalmLensClient, type CalmLensClientOptions, type CalmLensErrorDetails, type CdnAssetUrlOptions, type CdnServeOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type EnsureLensOptions, type EnsureLensesOptions, type FolderIdOptions, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type ModerateTextOptions, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type RetrieveAssetOptions, type RetryAssetOptions, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type VerifyWebhookSignatureOptions };
|
|
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 { 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";
|
|
4
|
+
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";
|
|
5
|
+
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";
|
|
6
|
+
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, 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 };
|