@calmlens/sdk 0.16.2 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +399 -162
- package/cjs/BrowserUpload-DZ0Vbmxi.js +10 -0
- package/cjs/BrowserUpload-uZjVFGfP.d.ts +11 -0
- package/cjs/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
- package/cjs/CalmLensAppClient-DBGmaDlG.js +89 -0
- package/cjs/CalmLensConnection-K1TAD1Z-.js +659 -0
- package/cjs/CalmLensServerClient-C-pxiz0C.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-Dj1YAl3G.js +1311 -0
- package/cjs/ReactUpload-DxtFMr06.js +54 -0
- package/cjs/ReactUpload-nZahpmyg.d.ts +17 -0
- package/cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
- package/cjs/TestTriggers-DcArt0Nu-CvoaONUB.js +1326 -0
- package/cjs/UploadController-BBkN4Ni6.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-CgZpgpNo.d.ts +526 -0
- package/cjs/ui-KceuoVCM.js +583 -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-D7-zNmc0.js +5 -0
- package/esm/BrowserUpload-uZjVFGfP.d.ts +11 -0
- package/esm/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
- package/esm/CalmLensAppClient-FVMwrHlH.js +84 -0
- package/esm/CalmLensConnection-iyNQHA8L.js +582 -0
- package/esm/CalmLensServerClient-JtP687a3.d.ts +235 -0
- package/esm/CalmLensServerClient-fQEYKLw4.js +586 -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-D1x_WAtP.js +1114 -0
- package/esm/ReactUpload-D6yBCkcw.js +37 -0
- package/esm/ReactUpload-nZahpmyg.d.ts +17 -0
- package/esm/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
- package/esm/TestTriggers-DcArt0Nu-s0AQZuWE.js +1266 -0
- package/esm/UploadController-txp5NuzH.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-Ca_SpJXf.js +458 -0
- package/esm/ui-CgZpgpNo.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 +110 -11
- package/cjs/CalmLensConnection-5Hj3trGr.js +0 -234
- package/cjs/CalmLensUtils-BeIl1N6N.js +0 -699
- package/cjs/CalmLensVersion-BGpB9t4-.js +0 -480
- package/cjs/CalmLensWebhooks-CogUYk8-.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-BAJdoZHy.js +0 -193
- package/esm/CalmLensUtils-DqniTKJ8.js +0 -574
- package/esm/CalmLensVersion-l_khh4nS.js +0 -415
- package/esm/CalmLensWebhooks-BtrKKLvg.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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-type icons for files without an image preview: a file outline in the family's colour with
|
|
3
|
+
* the family's symbol and an extension label, drawn the same way by every framework. The symbols are
|
|
4
|
+
* Tabler icons (MIT) as 24×24 stroke paths.
|
|
5
|
+
*/
|
|
6
|
+
type FileIconFamily = "documents" | "spreadsheets" | "presentations" | "images" | "audio" | "video" | "archives" | "code" | "data" | "design" | "applications" | "fonts" | "maps" | "games" | "system" | "security" | "unknown";
|
|
7
|
+
/** The families `getFileIcon` finds from a file's name and MIME type. */
|
|
8
|
+
type UploadFileIconFamily = Exclude<FileIconFamily, "applications" | "maps" | "games" | "system" | "security" | "unknown">;
|
|
9
|
+
/** The file outline every family's icon is drawn on. */
|
|
10
|
+
export declare const FILE_ICON_OUTLINE = "M14 3v4a1 1 0 0 0 1 1h4 M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2";
|
|
11
|
+
/** The symbols of the families `getFileIcon` finds, which the upload widget draws. */
|
|
12
|
+
export declare const FILE_ICON_SYMBOLS: Record<UploadFileIconFamily, string>;
|
|
13
|
+
/**
|
|
14
|
+
* The symbols of the families only an app's own file detection finds, kept apart so the upload
|
|
15
|
+
* widget doesn't bundle them.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MORE_FILE_ICON_SYMBOLS: Record<Exclude<FileIconFamily, UploadFileIconFamily | "unknown">, string>;
|
|
18
|
+
export declare const FILE_ICON_COLORS: Record<FileIconFamily, string>;
|
|
19
|
+
/** A file's icon family and the extension its label shows, such as `pdf`. */
|
|
20
|
+
export declare const getFileIcon: (file: {
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
23
|
+
}) => {
|
|
24
|
+
family: UploadFileIconFamily;
|
|
25
|
+
extension: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Where each part of the icon goes in its 24×24 box: the symbol inside the outline, above a band
|
|
29
|
+
* holding the extension. Icons 32 pixels or smaller leave the band out and centre the symbol.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getFileIconLayout: (size: number) => {
|
|
32
|
+
compact: boolean;
|
|
33
|
+
symbol: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
39
|
+
outlineStroke: number;
|
|
40
|
+
/** The band and its label, in a half-scale group: `transform="scale(0.5)"`. */
|
|
41
|
+
band: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
rx: number;
|
|
47
|
+
};
|
|
48
|
+
label: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/** The label's font size, and a squeezed width for long extensions. */
|
|
54
|
+
export declare const getFileIconLabel: (extension: string) => {
|
|
55
|
+
text: string;
|
|
56
|
+
fontSize: number;
|
|
57
|
+
textLength: number | undefined;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The icon as SVG markup, for the components to insert as it is. `extension` must come from
|
|
61
|
+
* `getFileIcon`, which keeps only letters and digits.
|
|
62
|
+
*/
|
|
63
|
+
export declare const renderFileIconSvg: ({ family, extension }: {
|
|
64
|
+
family: UploadFileIconFamily | "unknown";
|
|
65
|
+
extension: string;
|
|
66
|
+
}, size: number) => string;
|
|
67
|
+
export type { FileIconFamily, UploadFileIconFamily };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
3
|
+
exports.FILE_ICON_COLORS = require_FileIcons.FILE_ICON_COLORS;
|
|
4
|
+
exports.FILE_ICON_OUTLINE = require_FileIcons.FILE_ICON_OUTLINE;
|
|
5
|
+
exports.FILE_ICON_SYMBOLS = require_FileIcons.FILE_ICON_SYMBOLS;
|
|
6
|
+
exports.MORE_FILE_ICON_SYMBOLS = require_FileIcons.MORE_FILE_ICON_SYMBOLS;
|
|
7
|
+
exports.getFileIcon = require_FileIcons.getFileIcon;
|
|
8
|
+
exports.getFileIconLabel = require_FileIcons.getFileIconLabel;
|
|
9
|
+
exports.getFileIconLayout = require_FileIcons.getFileIconLayout;
|
|
10
|
+
exports.renderFileIconSvg = require_FileIcons.renderFileIconSvg;
|
|
@@ -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/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
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 };
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
exports.CALMLENS_ERROR_CODES =
|
|
4
|
-
exports.CalmLensError =
|
|
5
|
-
exports.
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-Dj1YAl3G.js");
|
|
3
|
+
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
4
|
+
exports.CalmLensError = require_ModerationContextLimits.CalmLensError;
|
|
5
|
+
exports.DEFAULT_CDN_BASE_URL = require_ModerationContextLimits.DEFAULT_CDN_BASE_URL;
|
|
6
|
+
exports.MODERATION_CONTEXT_USED_CHARACTERS = require_ModerationContextLimits.MODERATION_CONTEXT_USED_CHARACTERS;
|
|
7
|
+
exports.MODERATION_CONTEXT_USED_ITEMS = require_ModerationContextLimits.MODERATION_CONTEXT_USED_ITEMS;
|
|
8
|
+
exports.SDK_VERSION = require_ModerationContextLimits.SDK_VERSION;
|
|
9
|
+
exports.getAssetUrl = require_ModerationContextLimits.getAssetUrl;
|
|
10
|
+
exports.selectModerationContextItems = require_ModerationContextLimits.selectModerationContextItems;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-CgZpgpNo.js";
|
|
2
|
+
import { n as useCalmLensUpload, t as UseCalmLensUploadResult } from "./ReactUpload-nZahpmyg.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
5
|
+
/** What the uploader asks your picker for. */
|
|
6
|
+
export interface PickRequest {
|
|
7
|
+
/** Whether the uploader takes more than one file. */
|
|
8
|
+
multiple: boolean;
|
|
9
|
+
/** The uploader's `accept` list, such as `image/*`, to limit the picker to those types. */
|
|
10
|
+
accept?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Opens your app's picker and resolves with the picked files: `File`s from `expo-file-system`,
|
|
14
|
+
* or anything with a name, MIME type, size, `uri` and `arrayBuffer()`. Resolve with none when the
|
|
15
|
+
* person cancels.
|
|
16
|
+
*/
|
|
17
|
+
export type PickFiles<F extends UploadFile = UploadFile> = (request: PickRequest) => Promise<readonly F[] | null | undefined>;
|
|
18
|
+
type ThemeOptions = {
|
|
19
|
+
/** Colours and corner radius; anything left out keeps the default. */
|
|
20
|
+
theme?: Partial<CalmLensTheme>;
|
|
21
|
+
};
|
|
22
|
+
export type CalmLensUploaderProps<F extends UploadFile = UploadFile> = Omit<UploaderProps<F>, "capture"> & ThemeOptions & {
|
|
23
|
+
pick: PickFiles<F>;
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
};
|
|
26
|
+
/** The `testID` of the uploader's pick buttons, for end-to-end tests such as Detox or Maestro. */
|
|
27
|
+
export declare const CHOOSE_TEST_ID = "calmlens-choose";
|
|
28
|
+
/**
|
|
29
|
+
* A pick button and file list that uploads through an upload preset, shows each file's progress
|
|
30
|
+
* and moderation decision, and reports finished uploads to `onUploaded`. `pick` opens your app's
|
|
31
|
+
* picker, such as `expo-image-picker`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function CalmLensUploader<F extends UploadFile = UploadFile>({ pick, disabled, messages: overrides, controller: external, theme: themeOverrides, style, ...options }: CalmLensUploaderProps<F>): import("react").JSX.Element;
|
|
34
|
+
/** A video or audio file for your app's player to play. */
|
|
35
|
+
export interface MediaPlayerSource {
|
|
36
|
+
kind: "video" | "audio";
|
|
37
|
+
/** The asset's original file. */
|
|
38
|
+
src: string;
|
|
39
|
+
/** Describes the media, from the component's `alt`. */
|
|
40
|
+
alt: string;
|
|
41
|
+
}
|
|
42
|
+
export type CalmLensMediaProps = MediaOptions & Omit<MediaDisplayOptions, "sizes" | "lazy" | "fetchPriority" | "position" | "controls"> & ThemeOptions & {
|
|
43
|
+
/**
|
|
44
|
+
* Renders video and audio, which React Native has no built-in player for, such as `expo-video`.
|
|
45
|
+
* Without it, video and audio assets show their placeholder.
|
|
46
|
+
*/
|
|
47
|
+
renderPlayer?: (source: MediaPlayerSource) => ReactNode;
|
|
48
|
+
style?: StyleProp<ViewStyle>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Shows an asset from the CalmLens CDN, at the width in `widths` that covers its measured size,
|
|
52
|
+
* with a blurred placeholder while it loads. Age-restricted assets stay behind the placeholder and
|
|
53
|
+
* a reveal button until `ageConfirmed` is set; blocked and purged assets show an unavailable notice.
|
|
54
|
+
*/
|
|
55
|
+
export declare function CalmLensMedia(input: CalmLensMediaProps): import("react").JSX.Element;
|
|
56
|
+
export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, type UseCalmLensUploadResult, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme, useCalmLensUpload };
|