calmlens 0.37.1 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calmlens.js +87 -17
- package/cjs/{BrowserUpload-84KQWr1Q.js → BrowserUpload-DS0lxg5C.js} +1 -1
- package/{esm/BrowserUpload-CuG3tWSo.d.ts → cjs/BrowserUpload-_iMX_nq0.d.ts} +2 -2
- package/{esm/CalmLensAppClient-QqtovWE-.d.ts → cjs/CalmLensAppClient-CQpnc4JZ.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-D4tRb_P2.js → CalmLensAppClient-Diu1QtBz.js} +3 -3
- package/cjs/{CalmLensCdn-CdYY_XtK.js → CalmLensCdn-DCj0AfoS.js} +2 -2
- package/cjs/{CalmLensConnection-GkR2cKn5.js → CalmLensConnection-BpBq0nQR.js} +14 -4
- package/cjs/{CalmLensError-ifj5rLmk.js → CalmLensError-C9g7GXfU.js} +7 -2
- package/{esm/CalmLensServerClient-csSQqHBt.d.ts → cjs/CalmLensServerClient-CeTsE5Jx.d.ts} +5 -5
- package/cjs/{CalmLensServerClient-cgPOG4Sv.js → CalmLensServerClient-vdHfH0Nf.js} +15 -6
- package/cjs/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-jond9q6a.d.ts} +28 -9
- package/cjs/{Core-BlnBBJKb.js → Core-BHQSo7rY.js} +3 -3
- package/{esm/Core-4iFxKJnY.d.ts → cjs/Core-C6_Q5ZME.d.ts} +2 -2
- package/cjs/{ReactUpload-D3AYIZBh.js → ReactUpload-bbHMmEUQ.js} +1 -1
- package/cjs/{ReactUpload-4qd2xACg.d.ts → ReactUpload-fy6zhY8M.d.ts} +1 -1
- package/cjs/{UploadController-BYuHuZ7K.js → UploadController-C1tiTTRR.js} +2 -2
- package/{esm/WebhookPayload-BJtggTLd.d.ts → cjs/WebhookPayload-DdpKjQGw.d.ts} +5 -3
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +3 -3
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-IEA75nev.d.ts → index-CgAztQdX.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +2 -2
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +3 -3
- package/cjs/{CalmLensTestInputArguments-C6S09FVQ.js → test-inputs-DJnupsBH.js} +231 -22
- package/{esm/TestTriggers-CjDhhz78.d.ts → cjs/test-inputs-fugEK0py.d.ts} +36 -142
- package/cjs/test-inputs.d.ts +2 -18
- package/cjs/test-inputs.js +17 -126
- package/cjs/testing.d.ts +11 -14
- package/cjs/testing.js +38 -68
- package/cjs/{ui-Cy8MWXOw.js → ui-2jJvTcCP.js} +2 -2
- package/cjs/{ui-BMQW3Hse.d.ts → ui-Cp18fGXG.d.ts} +2 -2
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/esm/{BrowserUpload-C429CcUi.js → BrowserUpload-C4YF17a3.js} +1 -1
- package/{cjs/BrowserUpload-CuG3tWSo.d.ts → esm/BrowserUpload-_iMX_nq0.d.ts} +2 -2
- package/esm/{CalmLensAppClient-Brvc-GXt.js → CalmLensAppClient-B2H7x_SJ.js} +3 -3
- package/{cjs/CalmLensAppClient-QqtovWE-.d.ts → esm/CalmLensAppClient-CQpnc4JZ.d.ts} +1 -1
- package/esm/{CalmLensCdn-cmxtF_dw.js → CalmLensCdn-Dh546rXe.js} +2 -2
- package/esm/{CalmLensConnection-DEfpIugc.js → CalmLensConnection-BbFlVAdl.js} +14 -4
- package/esm/{CalmLensError-C15tWu8W.js → CalmLensError-DjkibkdI.js} +7 -2
- package/{cjs/CalmLensServerClient-csSQqHBt.d.ts → esm/CalmLensServerClient-CeTsE5Jx.d.ts} +5 -5
- package/esm/{CalmLensServerClient-BpsCXVeO.js → CalmLensServerClient-CqH-tqcC.js} +15 -6
- package/esm/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-jond9q6a.d.ts} +28 -9
- package/{cjs/Core-4iFxKJnY.d.ts → esm/Core-C6_Q5ZME.d.ts} +2 -2
- package/esm/{Core-C_f1o9RQ.js → Core-VNBTpvrG.js} +3 -3
- package/esm/{ReactUpload-Ch5qY7PS.js → ReactUpload-CRH6rSaX.js} +1 -1
- package/esm/{ReactUpload-4qd2xACg.d.ts → ReactUpload-fy6zhY8M.d.ts} +1 -1
- package/esm/{UploadController-9fkYFVZM.js → UploadController-BYxiONcw.js} +2 -2
- package/{cjs/WebhookPayload-BJtggTLd.d.ts → esm/WebhookPayload-DdpKjQGw.d.ts} +5 -3
- package/esm/app.d.ts +4 -4
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-IEA75nev.d.ts → index-CgAztQdX.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +2 -2
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +3 -3
- package/esm/{CalmLensTestInputArguments-DS_3mt1C.js → test-inputs-BLlkOmNC.js} +212 -15
- package/{cjs/TestTriggers-CjDhhz78.d.ts → esm/test-inputs-fugEK0py.d.ts} +36 -142
- package/esm/test-inputs.d.ts +2 -18
- package/esm/test-inputs.js +1 -115
- package/esm/testing.d.ts +11 -14
- package/esm/testing.js +27 -57
- package/esm/{ui-BMQW3Hse.d.ts → ui-Cp18fGXG.d.ts} +2 -2
- package/esm/{ui-HK74e42L.js → ui-siBYiNJZ.js} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ClassificationCategory } from "./Classification-C3pkrGYS-B7EygpJn.js";
|
|
1
|
+
import { n as ClassificationCategory, s as ModerationQualifier } from "./Classification-C3pkrGYS-B7EygpJn.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
interface RgbaImage {
|
|
4
4
|
width: number;
|
|
@@ -46,6 +46,20 @@ declare const TEST_DETECTIONS_SCHEMA: z.ZodObject<{
|
|
|
46
46
|
}, z.core.$strict>>, z.ZodLiteral<"unavailable">]>>;
|
|
47
47
|
}, z.core.$strict>;
|
|
48
48
|
type TestDetections = z.infer<typeof TEST_DETECTIONS_SCHEMA>;
|
|
49
|
+
/**
|
|
50
|
+
* Why a test input's qualifier is refused: each zod issue's `params` carry the `category`,
|
|
51
|
+
* `qualifier` and `reason`, and `allowed` (the category's qualifiers) for an unknown one.
|
|
52
|
+
*/
|
|
53
|
+
declare const TEST_INPUT_QUALIFIER_ERRORS: {
|
|
54
|
+
/** Not a qualifier of the instance's category. */
|
|
55
|
+
readonly unknown: "unknown-qualifier";
|
|
56
|
+
/** A qualifier the input type sets, such as `sexual-text`. */
|
|
57
|
+
readonly automatic: "input-type-qualifier";
|
|
58
|
+
/** Given more than once in one instance. */
|
|
59
|
+
readonly repeated: "repeated-qualifier";
|
|
60
|
+
};
|
|
61
|
+
/** The qualifiers a test input may give for `category`: its own, less those the input type sets. */
|
|
62
|
+
declare const getTestInputQualifiers: (category: string) => ModerationQualifier[];
|
|
49
63
|
/** Each row is one qualifying instance. Unselected qualifiers are explicitly absent. */
|
|
50
64
|
declare const TEST_INPUT_SCHEMA: z.ZodObject<{
|
|
51
65
|
regionalActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -91,146 +105,7 @@ declare const TEST_INPUT_SCHEMA: z.ZodObject<{
|
|
|
91
105
|
block: "block";
|
|
92
106
|
limit: "limit";
|
|
93
107
|
}>>;
|
|
94
|
-
qualifiers: z.ZodArray<z.
|
|
95
|
-
"criminal-activity-alcohol": "criminal-activity-alcohol";
|
|
96
|
-
"criminal-activity-coded-incitement": "criminal-activity-coded-incitement";
|
|
97
|
-
"criminal-activity-csam": "criminal-activity-csam";
|
|
98
|
-
"criminal-activity-demonstration": "criminal-activity-demonstration";
|
|
99
|
-
"criminal-activity-discussion": "criminal-activity-discussion";
|
|
100
|
-
"criminal-activity-documentary": "criminal-activity-documentary";
|
|
101
|
-
"criminal-activity-educational": "criminal-activity-educational";
|
|
102
|
-
"criminal-activity-fictional": "criminal-activity-fictional";
|
|
103
|
-
"criminal-activity-fraud": "criminal-activity-fraud";
|
|
104
|
-
"criminal-activity-gambling": "criminal-activity-gambling";
|
|
105
|
-
"criminal-activity-graffiti": "criminal-activity-graffiti";
|
|
106
|
-
"criminal-activity-grooming": "criminal-activity-grooming";
|
|
107
|
-
"criminal-activity-historical": "criminal-activity-historical";
|
|
108
|
-
"criminal-activity-instructions": "criminal-activity-instructions";
|
|
109
|
-
"criminal-activity-preparation": "criminal-activity-preparation";
|
|
110
|
-
"criminal-activity-promotion": "criminal-activity-promotion";
|
|
111
|
-
"criminal-activity-request": "criminal-activity-request";
|
|
112
|
-
"criminal-activity-sexual-solicitation": "criminal-activity-sexual-solicitation";
|
|
113
|
-
"criminal-activity-substances": "criminal-activity-substances";
|
|
114
|
-
"criminal-activity-support-prevention": "criminal-activity-support-prevention";
|
|
115
|
-
"criminal-activity-tobacco": "criminal-activity-tobacco";
|
|
116
|
-
"harassment-abuse": "harassment-abuse";
|
|
117
|
-
"harassment-bullying": "harassment-bullying";
|
|
118
|
-
"harassment-documentary": "harassment-documentary";
|
|
119
|
-
"harassment-educational": "harassment-educational";
|
|
120
|
-
"harassment-encouragement": "harassment-encouragement";
|
|
121
|
-
"harassment-fictional": "harassment-fictional";
|
|
122
|
-
"harassment-historical": "harassment-historical";
|
|
123
|
-
"harassment-mild": "harassment-mild";
|
|
124
|
-
"harassment-public-target": "harassment-public-target";
|
|
125
|
-
"harassment-sexual": "harassment-sexual";
|
|
126
|
-
"harassment-support-prevention": "harassment-support-prevention";
|
|
127
|
-
"harassment-threat": "harassment-threat";
|
|
128
|
-
"hate-abuse": "hate-abuse";
|
|
129
|
-
"hate-adjudicated-nazi-crimes-denial": "hate-adjudicated-nazi-crimes-denial";
|
|
130
|
-
"hate-counterspeech": "hate-counterspeech";
|
|
131
|
-
"hate-dehumanization": "hate-dehumanization";
|
|
132
|
-
"hate-documentary": "hate-documentary";
|
|
133
|
-
"hate-educational": "hate-educational";
|
|
134
|
-
"hate-exclusion": "hate-exclusion";
|
|
135
|
-
"hate-fictional": "hate-fictional";
|
|
136
|
-
"hate-historical": "hate-historical";
|
|
137
|
-
"hate-hostility": "hate-hostility";
|
|
138
|
-
"hate-inferiority": "hate-inferiority";
|
|
139
|
-
"hate-nazi-genocide-denial-or-approval": "hate-nazi-genocide-denial-or-approval";
|
|
140
|
-
"hate-nazi-genocide-public-peace": "hate-nazi-genocide-public-peace";
|
|
141
|
-
"hate-nazi-insignia-public-display": "hate-nazi-insignia-public-display";
|
|
142
|
-
"hate-nazi-symbols-public-display": "hate-nazi-symbols-public-display";
|
|
143
|
-
"hate-personal": "hate-personal";
|
|
144
|
-
"hate-slurs": "hate-slurs";
|
|
145
|
-
"hate-support-prevention": "hate-support-prevention";
|
|
146
|
-
"hate-symbol": "hate-symbol";
|
|
147
|
-
"hate-threat": "hate-threat";
|
|
148
|
-
"personal-information-contact": "personal-information-contact";
|
|
149
|
-
"personal-information-credentials": "personal-information-credentials";
|
|
150
|
-
"personal-information-documentary": "personal-information-documentary";
|
|
151
|
-
"personal-information-educational": "personal-information-educational";
|
|
152
|
-
"personal-information-email": "personal-information-email";
|
|
153
|
-
"personal-information-fictional": "personal-information-fictional";
|
|
154
|
-
"personal-information-financial": "personal-information-financial";
|
|
155
|
-
"personal-information-government-id": "personal-information-government-id";
|
|
156
|
-
"personal-information-historical": "personal-information-historical";
|
|
157
|
-
"personal-information-identifiers": "personal-information-identifiers";
|
|
158
|
-
"personal-information-location": "personal-information-location";
|
|
159
|
-
"personal-information-phone": "personal-information-phone";
|
|
160
|
-
"personal-information-request": "personal-information-request";
|
|
161
|
-
"personal-information-self-disclosure": "personal-information-self-disclosure";
|
|
162
|
-
"personal-information-support-prevention": "personal-information-support-prevention";
|
|
163
|
-
"personal-information-third-party": "personal-information-third-party";
|
|
164
|
-
"profanity-documentary": "profanity-documentary";
|
|
165
|
-
"profanity-educational": "profanity-educational";
|
|
166
|
-
"profanity-fictional": "profanity-fictional";
|
|
167
|
-
"profanity-historical": "profanity-historical";
|
|
168
|
-
"profanity-mild": "profanity-mild";
|
|
169
|
-
"profanity-obfuscated": "profanity-obfuscated";
|
|
170
|
-
"profanity-slurs": "profanity-slurs";
|
|
171
|
-
"profanity-strong": "profanity-strong";
|
|
172
|
-
"profanity-support-prevention": "profanity-support-prevention";
|
|
173
|
-
"self-harm-act": "self-harm-act";
|
|
174
|
-
"self-harm-age-restricted": "self-harm-age-restricted";
|
|
175
|
-
"self-harm-documentary": "self-harm-documentary";
|
|
176
|
-
"self-harm-educational": "self-harm-educational";
|
|
177
|
-
"self-harm-encouragement": "self-harm-encouragement";
|
|
178
|
-
"self-harm-fictional": "self-harm-fictional";
|
|
179
|
-
"self-harm-historical": "self-harm-historical";
|
|
180
|
-
"self-harm-methods": "self-harm-methods";
|
|
181
|
-
"self-harm-preparation": "self-harm-preparation";
|
|
182
|
-
"self-harm-support-prevention": "self-harm-support-prevention";
|
|
183
|
-
"self-harm-thoughts": "self-harm-thoughts";
|
|
184
|
-
"sexual-activity": "sexual-activity";
|
|
185
|
-
"sexual-adult-promotion": "sexual-adult-promotion";
|
|
186
|
-
"sexual-artistic": "sexual-artistic";
|
|
187
|
-
"sexual-assault-media": "sexual-assault-media";
|
|
188
|
-
"sexual-discussion": "sexual-discussion";
|
|
189
|
-
"sexual-documentary": "sexual-documentary";
|
|
190
|
-
"sexual-educational": "sexual-educational";
|
|
191
|
-
"sexual-explicit-language": "sexual-explicit-language";
|
|
192
|
-
"sexual-extreme": "sexual-extreme";
|
|
193
|
-
"sexual-fictional": "sexual-fictional";
|
|
194
|
-
"sexual-historical": "sexual-historical";
|
|
195
|
-
"sexual-incest": "sexual-incest";
|
|
196
|
-
"sexual-intimate-image-abuse": "sexual-intimate-image-abuse";
|
|
197
|
-
"sexual-minors": "sexual-minors";
|
|
198
|
-
"sexual-non-consensual": "sexual-non-consensual";
|
|
199
|
-
"sexual-non-erotic-nudity": "sexual-non-erotic-nudity";
|
|
200
|
-
"sexual-nudity": "sexual-nudity";
|
|
201
|
-
"sexual-paid": "sexual-paid";
|
|
202
|
-
"sexual-pornographic-media": "sexual-pornographic-media";
|
|
203
|
-
"sexual-revealing-clothing": "sexual-revealing-clothing";
|
|
204
|
-
"sexual-solicitation": "sexual-solicitation";
|
|
205
|
-
"sexual-strangulation": "sexual-strangulation";
|
|
206
|
-
"sexual-suggestive": "sexual-suggestive";
|
|
207
|
-
"sexual-support-prevention": "sexual-support-prevention";
|
|
208
|
-
"sexual-text": "sexual-text";
|
|
209
|
-
"violence-attack": "violence-attack";
|
|
210
|
-
"violence-coded-incitement": "violence-coded-incitement";
|
|
211
|
-
"violence-decapitation-act": "violence-decapitation-act";
|
|
212
|
-
"violence-discussion": "violence-discussion";
|
|
213
|
-
"violence-documentary": "violence-documentary";
|
|
214
|
-
"violence-educational": "violence-educational";
|
|
215
|
-
"violence-encouragement": "violence-encouragement";
|
|
216
|
-
"violence-extremism": "violence-extremism";
|
|
217
|
-
"violence-fantasy": "violence-fantasy";
|
|
218
|
-
"violence-fictional": "violence-fictional";
|
|
219
|
-
"violence-gore": "violence-gore";
|
|
220
|
-
"violence-graphic": "violence-graphic";
|
|
221
|
-
"violence-high-impact": "violence-high-impact";
|
|
222
|
-
"violence-historical": "violence-historical";
|
|
223
|
-
"violence-injury": "violence-injury";
|
|
224
|
-
"violence-natural-death": "violence-natural-death";
|
|
225
|
-
"violence-preparation": "violence-preparation";
|
|
226
|
-
"violence-sport": "violence-sport";
|
|
227
|
-
"violence-support-prevention": "violence-support-prevention";
|
|
228
|
-
"violence-text": "violence-text";
|
|
229
|
-
"violence-threat": "violence-threat";
|
|
230
|
-
"violence-violent-death": "violence-violent-death";
|
|
231
|
-
"violence-weapon": "violence-weapon";
|
|
232
|
-
"violence-wish": "violence-wish";
|
|
233
|
-
}>>;
|
|
108
|
+
qualifiers: z.ZodArray<z.ZodCustom<"criminal-activity-alcohol" | "criminal-activity-coded-incitement" | "criminal-activity-csam" | "criminal-activity-demonstration" | "criminal-activity-discussion" | "criminal-activity-documentary" | "criminal-activity-educational" | "criminal-activity-fictional" | "criminal-activity-fraud" | "criminal-activity-gambling" | "criminal-activity-graffiti" | "criminal-activity-grooming" | "criminal-activity-historical" | "criminal-activity-instructions" | "criminal-activity-preparation" | "criminal-activity-promotion" | "criminal-activity-request" | "criminal-activity-sexual-solicitation" | "criminal-activity-substances" | "criminal-activity-support-prevention" | "criminal-activity-tobacco" | "harassment-abuse" | "harassment-bullying" | "harassment-documentary" | "harassment-educational" | "harassment-encouragement" | "harassment-fictional" | "harassment-historical" | "harassment-mild" | "harassment-public-target" | "harassment-sexual" | "harassment-support-prevention" | "harassment-threat" | "hate-abuse" | "hate-adjudicated-nazi-crimes-denial" | "hate-counterspeech" | "hate-dehumanization" | "hate-documentary" | "hate-educational" | "hate-exclusion" | "hate-fictional" | "hate-historical" | "hate-hostility" | "hate-inferiority" | "hate-nazi-genocide-denial-or-approval" | "hate-nazi-genocide-public-peace" | "hate-nazi-insignia-public-display" | "hate-nazi-symbols-public-display" | "hate-personal" | "hate-slurs" | "hate-support-prevention" | "hate-symbol" | "hate-threat" | "personal-information-contact" | "personal-information-credentials" | "personal-information-documentary" | "personal-information-educational" | "personal-information-email" | "personal-information-fictional" | "personal-information-financial" | "personal-information-government-id" | "personal-information-historical" | "personal-information-identifiers" | "personal-information-location" | "personal-information-phone" | "personal-information-request" | "personal-information-self-disclosure" | "personal-information-support-prevention" | "personal-information-third-party" | "profanity-documentary" | "profanity-educational" | "profanity-fictional" | "profanity-historical" | "profanity-mild" | "profanity-obfuscated" | "profanity-slurs" | "profanity-strong" | "profanity-support-prevention" | "self-harm-act" | "self-harm-age-restricted" | "self-harm-documentary" | "self-harm-educational" | "self-harm-encouragement" | "self-harm-fictional" | "self-harm-historical" | "self-harm-methods" | "self-harm-preparation" | "self-harm-support-prevention" | "self-harm-thoughts" | "sexual-activity" | "sexual-adult-promotion" | "sexual-artistic" | "sexual-assault-media" | "sexual-discussion" | "sexual-documentary" | "sexual-educational" | "sexual-explicit-language" | "sexual-extreme" | "sexual-fictional" | "sexual-historical" | "sexual-incest" | "sexual-intimate-image-abuse" | "sexual-minors" | "sexual-non-consensual" | "sexual-non-erotic-nudity" | "sexual-nudity" | "sexual-paid" | "sexual-pornographic-media" | "sexual-revealing-clothing" | "sexual-solicitation" | "sexual-strangulation" | "sexual-suggestive" | "sexual-support-prevention" | "sexual-text" | "violence-attack" | "violence-coded-incitement" | "violence-decapitation-act" | "violence-discussion" | "violence-documentary" | "violence-educational" | "violence-encouragement" | "violence-extremism" | "violence-fantasy" | "violence-fictional" | "violence-gore" | "violence-graphic" | "violence-high-impact" | "violence-historical" | "violence-injury" | "violence-natural-death" | "violence-preparation" | "violence-sport" | "violence-support-prevention" | "violence-text" | "violence-threat" | "violence-violent-death" | "violence-weapon" | "violence-wish", "criminal-activity-alcohol" | "criminal-activity-coded-incitement" | "criminal-activity-csam" | "criminal-activity-demonstration" | "criminal-activity-discussion" | "criminal-activity-documentary" | "criminal-activity-educational" | "criminal-activity-fictional" | "criminal-activity-fraud" | "criminal-activity-gambling" | "criminal-activity-graffiti" | "criminal-activity-grooming" | "criminal-activity-historical" | "criminal-activity-instructions" | "criminal-activity-preparation" | "criminal-activity-promotion" | "criminal-activity-request" | "criminal-activity-sexual-solicitation" | "criminal-activity-substances" | "criminal-activity-support-prevention" | "criminal-activity-tobacco" | "harassment-abuse" | "harassment-bullying" | "harassment-documentary" | "harassment-educational" | "harassment-encouragement" | "harassment-fictional" | "harassment-historical" | "harassment-mild" | "harassment-public-target" | "harassment-sexual" | "harassment-support-prevention" | "harassment-threat" | "hate-abuse" | "hate-adjudicated-nazi-crimes-denial" | "hate-counterspeech" | "hate-dehumanization" | "hate-documentary" | "hate-educational" | "hate-exclusion" | "hate-fictional" | "hate-historical" | "hate-hostility" | "hate-inferiority" | "hate-nazi-genocide-denial-or-approval" | "hate-nazi-genocide-public-peace" | "hate-nazi-insignia-public-display" | "hate-nazi-symbols-public-display" | "hate-personal" | "hate-slurs" | "hate-support-prevention" | "hate-symbol" | "hate-threat" | "personal-information-contact" | "personal-information-credentials" | "personal-information-documentary" | "personal-information-educational" | "personal-information-email" | "personal-information-fictional" | "personal-information-financial" | "personal-information-government-id" | "personal-information-historical" | "personal-information-identifiers" | "personal-information-location" | "personal-information-phone" | "personal-information-request" | "personal-information-self-disclosure" | "personal-information-support-prevention" | "personal-information-third-party" | "profanity-documentary" | "profanity-educational" | "profanity-fictional" | "profanity-historical" | "profanity-mild" | "profanity-obfuscated" | "profanity-slurs" | "profanity-strong" | "profanity-support-prevention" | "self-harm-act" | "self-harm-age-restricted" | "self-harm-documentary" | "self-harm-educational" | "self-harm-encouragement" | "self-harm-fictional" | "self-harm-historical" | "self-harm-methods" | "self-harm-preparation" | "self-harm-support-prevention" | "self-harm-thoughts" | "sexual-activity" | "sexual-adult-promotion" | "sexual-artistic" | "sexual-assault-media" | "sexual-discussion" | "sexual-documentary" | "sexual-educational" | "sexual-explicit-language" | "sexual-extreme" | "sexual-fictional" | "sexual-historical" | "sexual-incest" | "sexual-intimate-image-abuse" | "sexual-minors" | "sexual-non-consensual" | "sexual-non-erotic-nudity" | "sexual-nudity" | "sexual-paid" | "sexual-pornographic-media" | "sexual-revealing-clothing" | "sexual-solicitation" | "sexual-strangulation" | "sexual-suggestive" | "sexual-support-prevention" | "sexual-text" | "violence-attack" | "violence-coded-incitement" | "violence-decapitation-act" | "violence-discussion" | "violence-documentary" | "violence-educational" | "violence-encouragement" | "violence-extremism" | "violence-fantasy" | "violence-fictional" | "violence-gore" | "violence-graphic" | "violence-high-impact" | "violence-historical" | "violence-injury" | "violence-natural-death" | "violence-preparation" | "violence-sport" | "violence-support-prevention" | "violence-text" | "violence-threat" | "violence-violent-death" | "violence-weapon" | "violence-wish">>;
|
|
234
109
|
}, z.core.$strict>>;
|
|
235
110
|
detections: z.ZodOptional<z.ZodObject<{
|
|
236
111
|
people: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
@@ -402,4 +277,23 @@ declare function detectTestImage(image: RgbaImage, key: string,
|
|
|
402
277
|
}[] | undefined;
|
|
403
278
|
} | undefined;
|
|
404
279
|
} | undefined>;
|
|
405
|
-
|
|
280
|
+
declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "personal-information", "profanity", "violence.graphic"];
|
|
281
|
+
/** A spoken media test phrase for `signal`, signed with the project's test input key. */
|
|
282
|
+
declare const generateMediaTestCode: (signal: ClassificationTestSignal, key: string) => Promise<string>;
|
|
283
|
+
/** A text code for `scenario`, signed with the project's test input key. */
|
|
284
|
+
declare const generateTestTextCode: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<string>;
|
|
285
|
+
/** A painted test image: its RGBA pixels, row by row, and the same image as PNG bytes. */
|
|
286
|
+
interface TestImage {
|
|
287
|
+
width: number;
|
|
288
|
+
height: number;
|
|
289
|
+
rgba: Uint8Array;
|
|
290
|
+
/** The image as a PNG, to upload as it is. */
|
|
291
|
+
png: Uint8Array;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
295
|
+
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
296
|
+
* image, optionally on a plain single-colour border.
|
|
297
|
+
*/
|
|
298
|
+
declare const paintTestImage: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<TestImage>;
|
|
299
|
+
export { detectTestTrigger as _, MEDIA_TEST_SIGNALS as a, testInputForSignal as b, TEST_DETECTION_BOX_MAX as c, TEST_INPUT_KEY_PATTERN as d, TEST_INPUT_PRESETS as f, detectTestImage as g, TestInput as h, paintTestImage as i, TEST_FACE_AGE_MAX as l, TestDetections as m, generateMediaTestCode as n, ClassificationTestSignal as o, TEST_INPUT_QUALIFIER_ERRORS as p, generateTestTextCode as r, TEST_DETECTIONS_MAX as s, TestImage as t, TEST_FACE_AGE_PRESETS as u, getImageTestCategories as v, getTestInputQualifiers as y };
|
package/cjs/test-inputs.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
export declare const generateTestTextCode: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<string>;
|
|
4
|
-
/** A painted test image: its RGBA pixels, row by row, and the same image as PNG bytes. */
|
|
5
|
-
export interface TestImage {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
rgba: Uint8Array;
|
|
9
|
-
/** The image as a PNG, to upload as it is. */
|
|
10
|
-
png: Uint8Array;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
14
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
15
|
-
* image, optionally on a plain single-colour border.
|
|
16
|
-
*/
|
|
17
|
-
export declare const paintTestImage: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<TestImage>;
|
|
18
|
-
export { type ClassificationTestSignal, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestDetections, type TestInput, detectTestImage, detectTestTrigger, getImageTestCategories, testInputForSignal };
|
|
1
|
+
import { _ as detectTestTrigger, a as MEDIA_TEST_SIGNALS, b as testInputForSignal, c as TEST_DETECTION_BOX_MAX, d as TEST_INPUT_KEY_PATTERN, f as TEST_INPUT_PRESETS, g as detectTestImage, h as TestInput, i as paintTestImage, l as TEST_FACE_AGE_MAX, m as TestDetections, n as generateMediaTestCode, o as ClassificationTestSignal, p as TEST_INPUT_QUALIFIER_ERRORS, r as generateTestTextCode, s as TEST_DETECTIONS_MAX, t as TestImage, u as TEST_FACE_AGE_PRESETS, v as getImageTestCategories, y as getTestInputQualifiers } from "./test-inputs-fugEK0py.js";
|
|
2
|
+
export { type ClassificationTestSignal, MEDIA_TEST_SIGNALS, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, TEST_INPUT_QUALIFIER_ERRORS, type TestDetections, TestImage, type TestInput, detectTestImage, detectTestTrigger, generateMediaTestCode, generateTestTextCode, getImageTestCategories, getTestInputQualifiers, paintTestImage, testInputForSignal };
|
package/cjs/test-inputs.js
CHANGED
|
@@ -1,127 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const length = block.length;
|
|
20
|
-
stream.set([
|
|
21
|
-
offset + length >= raw.length ? 1 : 0,
|
|
22
|
-
length & 255,
|
|
23
|
-
length >> 8,
|
|
24
|
-
~length & 255,
|
|
25
|
-
~length >> 8 & 255
|
|
26
|
-
], position);
|
|
27
|
-
stream.set(block, position + 5);
|
|
28
|
-
position += 5 + length;
|
|
29
|
-
}
|
|
30
|
-
writeUint32(stream, position, adler32(raw));
|
|
31
|
-
const header = /* @__PURE__ */ new Uint8Array(13);
|
|
32
|
-
writeUint32(header, 0, width);
|
|
33
|
-
writeUint32(header, 4, height);
|
|
34
|
-
header.set([
|
|
35
|
-
8,
|
|
36
|
-
6,
|
|
37
|
-
0,
|
|
38
|
-
0,
|
|
39
|
-
0
|
|
40
|
-
], 8);
|
|
41
|
-
return concat([
|
|
42
|
-
Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10),
|
|
43
|
-
chunk("IHDR", header),
|
|
44
|
-
chunk("IDAT", stream),
|
|
45
|
-
chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
|
|
46
|
-
]);
|
|
47
|
-
}
|
|
48
|
-
function chunk(kind, body) {
|
|
49
|
-
const typed = new Uint8Array(4 + body.length);
|
|
50
|
-
for (let i = 0; i < 4; i++) typed[i] = kind.charCodeAt(i);
|
|
51
|
-
typed.set(body, 4);
|
|
52
|
-
const out = new Uint8Array(12 + body.length);
|
|
53
|
-
writeUint32(out, 0, body.length);
|
|
54
|
-
out.set(typed, 4);
|
|
55
|
-
writeUint32(out, 8 + body.length, crc32(typed));
|
|
56
|
-
return out;
|
|
57
|
-
}
|
|
58
|
-
function writeUint32(target, offset, value) {
|
|
59
|
-
target[offset] = value >>> 24;
|
|
60
|
-
target[offset + 1] = value >>> 16 & 255;
|
|
61
|
-
target[offset + 2] = value >>> 8 & 255;
|
|
62
|
-
target[offset + 3] = value & 255;
|
|
63
|
-
}
|
|
64
|
-
function concat(parts) {
|
|
65
|
-
const out = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
66
|
-
let offset = 0;
|
|
67
|
-
for (const part of parts) {
|
|
68
|
-
out.set(part, offset);
|
|
69
|
-
offset += part.length;
|
|
70
|
-
}
|
|
71
|
-
return out;
|
|
72
|
-
}
|
|
73
|
-
let crcTable;
|
|
74
|
-
function crc32(bytes) {
|
|
75
|
-
if (!crcTable) {
|
|
76
|
-
crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
77
|
-
for (let n = 0; n < 256; n++) {
|
|
78
|
-
let c = n;
|
|
79
|
-
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
80
|
-
crcTable[n] = c >>> 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
let crc = 4294967295;
|
|
84
|
-
for (const byte of bytes) crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
85
|
-
return (crc ^ 4294967295) >>> 0;
|
|
86
|
-
}
|
|
87
|
-
function adler32(bytes) {
|
|
88
|
-
let a = 1;
|
|
89
|
-
let b = 0;
|
|
90
|
-
for (const byte of bytes) {
|
|
91
|
-
a = (a + byte) % 65521;
|
|
92
|
-
b = (b + a) % 65521;
|
|
93
|
-
}
|
|
94
|
-
return (b << 16 | a) >>> 0;
|
|
95
|
-
}
|
|
96
|
-
// src/test-inputs.ts
|
|
97
|
-
/**
|
|
98
|
-
* Portable test inputs: presets and custom instances share one authenticated format. CalmLens
|
|
99
|
-
* recognises a code only as the whole text and a test image only as the whole
|
|
100
|
-
* upload, signed with the project's own key.
|
|
101
|
-
*/
|
|
102
|
-
/** A text code for `scenario`, signed with the project's test input key. */
|
|
103
|
-
const generateTestTextCode = (scenario, key) => require_CalmLensTestInputArguments.withValidTestInputArguments(key, () => require_CalmLensTestInputArguments.generateTestTextCode(scenario, key));
|
|
104
|
-
/**
|
|
105
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
106
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
107
|
-
* image, optionally on a plain single-colour border.
|
|
108
|
-
*/
|
|
109
|
-
const paintTestImage = async (scenario, key) => {
|
|
110
|
-
const image = await require_CalmLensTestInputArguments.withValidTestInputArguments(key, () => require_CalmLensTestInputArguments.paintTestImage(scenario, key));
|
|
111
|
-
return {
|
|
112
|
-
...image,
|
|
113
|
-
png: encodeTestImagePng(image.width, image.height, image.rgba)
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
exports.TEST_DETECTIONS_MAX = require_CalmLensTestInputArguments.TEST_DETECTIONS_MAX;
|
|
117
|
-
exports.TEST_DETECTION_BOX_MAX = require_CalmLensTestInputArguments.TEST_DETECTION_BOX_MAX;
|
|
118
|
-
exports.TEST_FACE_AGE_MAX = require_CalmLensTestInputArguments.TEST_FACE_AGE_MAX;
|
|
119
|
-
exports.TEST_FACE_AGE_PRESETS = require_CalmLensTestInputArguments.TEST_FACE_AGE_PRESETS;
|
|
120
|
-
exports.TEST_INPUT_KEY_PATTERN = require_CalmLensTestInputArguments.TEST_INPUT_KEY_PATTERN;
|
|
121
|
-
exports.TEST_INPUT_PRESETS = require_CalmLensTestInputArguments.TEST_INPUT_PRESETS;
|
|
122
|
-
exports.detectTestImage = require_CalmLensTestInputArguments.detectTestImage;
|
|
123
|
-
exports.detectTestTrigger = require_CalmLensTestInputArguments.detectTestTrigger;
|
|
124
|
-
exports.generateTestTextCode = generateTestTextCode;
|
|
125
|
-
exports.getImageTestCategories = require_CalmLensTestInputArguments.getImageTestCategories;
|
|
126
|
-
exports.paintTestImage = paintTestImage;
|
|
127
|
-
exports.testInputForSignal = require_CalmLensTestInputArguments.testInputForSignal;
|
|
2
|
+
const require_test_inputs = require("./test-inputs-DJnupsBH.js");
|
|
3
|
+
exports.MEDIA_TEST_SIGNALS = require_test_inputs.MEDIA_TEST_SIGNALS;
|
|
4
|
+
exports.TEST_DETECTIONS_MAX = require_test_inputs.TEST_DETECTIONS_MAX;
|
|
5
|
+
exports.TEST_DETECTION_BOX_MAX = require_test_inputs.TEST_DETECTION_BOX_MAX;
|
|
6
|
+
exports.TEST_FACE_AGE_MAX = require_test_inputs.TEST_FACE_AGE_MAX;
|
|
7
|
+
exports.TEST_FACE_AGE_PRESETS = require_test_inputs.TEST_FACE_AGE_PRESETS;
|
|
8
|
+
exports.TEST_INPUT_KEY_PATTERN = require_test_inputs.TEST_INPUT_KEY_PATTERN;
|
|
9
|
+
exports.TEST_INPUT_PRESETS = require_test_inputs.TEST_INPUT_PRESETS;
|
|
10
|
+
exports.TEST_INPUT_QUALIFIER_ERRORS = require_test_inputs.TEST_INPUT_QUALIFIER_ERRORS;
|
|
11
|
+
exports.detectTestImage = require_test_inputs.detectTestImage;
|
|
12
|
+
exports.detectTestTrigger = require_test_inputs.detectTestTrigger;
|
|
13
|
+
exports.generateMediaTestCode = require_test_inputs.generateMediaTestCode;
|
|
14
|
+
exports.generateTestTextCode = require_test_inputs.generateTestTextCode;
|
|
15
|
+
exports.getImageTestCategories = require_test_inputs.getImageTestCategories;
|
|
16
|
+
exports.getTestInputQualifiers = require_test_inputs.getTestInputQualifiers;
|
|
17
|
+
exports.paintTestImage = require_test_inputs.paintTestImage;
|
|
18
|
+
exports.testInputForSignal = require_test_inputs.testInputForSignal;
|
package/cjs/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, r as Asset } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
5
|
-
import {
|
|
1
|
+
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, r as Asset } from "./CalmLensTypes-jond9q6a.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-CQpnc4JZ.js";
|
|
3
|
+
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-DdpKjQGw.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-CeTsE5Jx.js";
|
|
5
|
+
import { a as MEDIA_TEST_SIGNALS, n as generateMediaTestCode } from "./test-inputs-fugEK0py.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -14,7 +14,6 @@ declare const signUploadTokenWithApiKey: (apiKey: string, options: SignUploadTok
|
|
|
14
14
|
now?: number;
|
|
15
15
|
nonce?: string;
|
|
16
16
|
}) => Promise<SignedUploadToken>;
|
|
17
|
-
export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "personal-information", "profanity", "violence.graphic"];
|
|
18
17
|
export declare const MOCK_API_KEY_PREFIX = "sk_test_";
|
|
19
18
|
/**
|
|
20
19
|
* Creates a mock API key holding `grants`. Throws `sdk/invalid-argument`, naming the grant, for
|
|
@@ -234,11 +233,11 @@ interface MockDatabaseStorage {
|
|
|
234
233
|
getAsset(assetId: string): Promise<Asset | undefined>;
|
|
235
234
|
listAssets(projectId: string): Promise<Asset[]>;
|
|
236
235
|
deleteAsset(assetId: string): Promise<void>;
|
|
237
|
-
createFolder
|
|
238
|
-
updateFolder
|
|
239
|
-
getFolder
|
|
240
|
-
listFolders
|
|
241
|
-
deleteFolder
|
|
236
|
+
createFolder(folder: Folder): Promise<Folder>;
|
|
237
|
+
updateFolder(folder: Folder): Promise<Folder>;
|
|
238
|
+
getFolder(folderId: string): Promise<Folder | undefined>;
|
|
239
|
+
listFolders(projectId: string): Promise<Folder[]>;
|
|
240
|
+
deleteFolder(folderId: string): Promise<void>;
|
|
242
241
|
}
|
|
243
242
|
export declare class InMemoryMockDatabaseStorage implements MockDatabaseStorage {
|
|
244
243
|
private readonly assets;
|
|
@@ -505,6 +504,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
505
504
|
deliveryId: string;
|
|
506
505
|
timestampSeconds?: number;
|
|
507
506
|
}) => Promise<Record<string, string>>;
|
|
508
|
-
|
|
509
|
-
export declare const generateMediaTestCode: (signal: ClassificationTestSignal, key: string) => Promise<string>;
|
|
510
|
-
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
|
507
|
+
export { MEDIA_TEST_SIGNALS, type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, generateMediaTestCode, signUploadTokenWithApiKey as signUploadToken };
|