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.
Files changed (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +673 -130
  3. package/bin/calmlens.js +15994 -1164
  4. package/bin/package.json +1 -0
  5. package/cjs/BrowserUpload-BT091eOB.d.ts +11 -0
  6. package/cjs/BrowserUpload-CQwXEGFv.js +10 -0
  7. package/cjs/CalmLensAppClient-CHQGu-Do.js +89 -0
  8. package/cjs/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  9. package/cjs/CalmLensConnection-B8Bu2j3y.js +659 -0
  10. package/cjs/CalmLensServerClient-C5o2A8MW.js +645 -0
  11. package/cjs/CalmLensServerClient-JtP687a3.d.ts +235 -0
  12. package/cjs/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  13. package/cjs/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  14. package/cjs/CryptoUtils-B_x8lMIx-YBW1-bvL.js +42 -0
  15. package/cjs/FileIcons-Ob003MdS.js +175 -0
  16. package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +91 -0
  17. package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  18. package/cjs/ModerationContextLimits-DelWfmiJ.js +1311 -0
  19. package/cjs/ReactUpload-CAyCsyG6.d.ts +17 -0
  20. package/cjs/ReactUpload-Cfg5JYUq.js +54 -0
  21. package/cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  22. package/cjs/TestTriggers-DTc_iMJF-BjMPq4_3.js +1327 -0
  23. package/cjs/UploadController-BGO1eyzb.js +618 -0
  24. package/cjs/WebhookPayload-2aL31v0J.d.ts +352 -0
  25. package/cjs/app.d.ts +7 -0
  26. package/cjs/app.js +13 -0
  27. package/cjs/elements.d.ts +88 -0
  28. package/cjs/elements.js +555 -0
  29. package/cjs/file-icons.d.ts +67 -0
  30. package/cjs/file-icons.js +10 -0
  31. package/cjs/index-CI4BzN4W.d.ts +252 -0
  32. package/cjs/index.d.ts +6 -163
  33. package/cjs/index.js +9 -796
  34. package/cjs/react-native.d.ts +56 -0
  35. package/cjs/react-native.js +495 -0
  36. package/cjs/react.d.ts +30 -0
  37. package/cjs/react.js +370 -0
  38. package/cjs/server.d.ts +33 -0
  39. package/cjs/server.js +20 -0
  40. package/cjs/test-inputs.d.ts +2 -0
  41. package/cjs/test-inputs.js +10 -0
  42. package/cjs/testing.d.ts +309 -80
  43. package/cjs/testing.js +10453 -689
  44. package/cjs/ui-CC1GOoMg.js +583 -0
  45. package/cjs/ui-wIiMfqMB.d.ts +526 -0
  46. package/cjs/ui.d.ts +2 -0
  47. package/cjs/ui.js +27 -0
  48. package/cjs/vue.d.ts +490 -0
  49. package/cjs/vue.js +419 -0
  50. package/esm/BrowserUpload-BT091eOB.d.ts +11 -0
  51. package/esm/BrowserUpload-D2xBWqhm.js +5 -0
  52. package/esm/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  53. package/esm/CalmLensAppClient-DuFas_dW.js +84 -0
  54. package/esm/CalmLensConnection-MxwwLXdl.js +582 -0
  55. package/esm/CalmLensServerClient-D80_mKpW.js +586 -0
  56. package/esm/CalmLensServerClient-JtP687a3.d.ts +235 -0
  57. package/esm/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  58. package/esm/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  59. package/esm/CryptoUtils-B_x8lMIx-DhuWGzqn.js +25 -0
  60. package/esm/FileIcons-M6dzjFxd.js +128 -0
  61. package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +46 -0
  62. package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  63. package/esm/ModerationContextLimits-BaX2QnU8.js +1114 -0
  64. package/esm/ReactUpload-CAyCsyG6.d.ts +17 -0
  65. package/esm/ReactUpload-CL2XC8WS.js +37 -0
  66. package/esm/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  67. package/esm/TestTriggers-DTc_iMJF-HfB533Gx.js +1267 -0
  68. package/esm/UploadController-qjoYGCwx.js +589 -0
  69. package/esm/WebhookPayload-2aL31v0J.d.ts +352 -0
  70. package/esm/app.d.ts +7 -0
  71. package/esm/app.js +4 -0
  72. package/esm/elements.d.ts +88 -0
  73. package/esm/elements.js +528 -0
  74. package/esm/file-icons.d.ts +67 -0
  75. package/esm/file-icons.js +1 -0
  76. package/esm/index-CI4BzN4W.d.ts +252 -0
  77. package/esm/index.d.ts +6 -163
  78. package/esm/index.js +1 -794
  79. package/esm/react-native.d.ts +56 -0
  80. package/esm/react-native.js +467 -0
  81. package/esm/react.d.ts +30 -0
  82. package/esm/react.js +343 -0
  83. package/esm/server.d.ts +33 -0
  84. package/esm/server.js +4 -0
  85. package/esm/styles.css +147 -0
  86. package/esm/svelte/CalmLensMedia.svelte +134 -0
  87. package/esm/svelte/CalmLensUploader.svelte +175 -0
  88. package/esm/svelte/Icon.svelte +7 -0
  89. package/esm/svelte/index.d.ts +37 -0
  90. package/esm/svelte/index.js +6 -0
  91. package/esm/test-inputs.d.ts +2 -0
  92. package/esm/test-inputs.js +1 -0
  93. package/esm/testing.d.ts +309 -80
  94. package/esm/testing.js +10432 -656
  95. package/esm/ui-CCY3yXFn.js +458 -0
  96. package/esm/ui-wIiMfqMB.d.ts +526 -0
  97. package/esm/ui.d.ts +2 -0
  98. package/esm/ui.js +3 -0
  99. package/esm/vue.d.ts +490 -0
  100. package/esm/vue.js +392 -0
  101. package/package.json +173 -34
  102. package/cjs/CalmLensTypes-DkqoKBwF.d.ts +0 -1761
  103. package/cjs/CalmLensUtils-CjdO9v--.js +0 -549
  104. package/esm/CalmLensTypes-DkqoKBwF.d.ts +0 -1761
  105. package/esm/CalmLensUtils-B3Eiz2Ro.js +0 -430
package/esm/vue.js ADDED
@@ -0,0 +1,392 @@
1
+ import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CCY3yXFn.js";
2
+ import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-qjoYGCwx.js";
3
+ import { t as createUploadController } from "./BrowserUpload-D2xBWqhm.js";
4
+ import { computed, defineComponent, h, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
5
+ // src/vue.ts
6
+ const icon = (name) => h("svg", ICON_ATTRIBUTES, [h("path", { d: ICONS[name] })]);
7
+ /** Keeps a ref to a controller's snapshot, following the controller if it changes. */
8
+ const subscribeSnapshot = (controller) => {
9
+ const snapshot = shallowRef(toValue(controller).getSnapshot());
10
+ watch(() => toValue(controller), (current, _previous, onCleanup) => {
11
+ onCleanup(current.subscribe((next) => {
12
+ snapshot.value = next;
13
+ }));
14
+ }, { immediate: true });
15
+ return snapshot;
16
+ };
17
+ /**
18
+ * Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
19
+ * is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
20
+ * still running when the component unmounts are cancelled.
21
+ */
22
+ const useCalmLensUpload = (options) => {
23
+ const controller = createUploadController$1(toValue(options));
24
+ watchEffect(() => controller.setOptions(toValue(options)));
25
+ const snapshot = subscribeSnapshot(controller);
26
+ onScopeDispose(() => controller.clear());
27
+ return {
28
+ snapshot,
29
+ controller,
30
+ addFiles: (files) => controller.addFiles(files),
31
+ retry: (key) => controller.retry(key),
32
+ cancel: (key) => controller.cancel(key),
33
+ remove: (key) => controller.remove(key),
34
+ clear: () => controller.clear(),
35
+ start: () => controller.start()
36
+ };
37
+ };
38
+ const optional = (type) => ({
39
+ type,
40
+ default: void 0
41
+ });
42
+ const messagesProp = optional(Object);
43
+ /**
44
+ * A drop zone and file list that uploads through an upload preset, shows each file's progress
45
+ * and moderation decision, and emits `uploaded` for finished uploads.
46
+ */
47
+ const CalmLensUploader = defineComponent({
48
+ name: "CalmLensUploader",
49
+ props: {
50
+ uploadPresetId: optional(String),
51
+ upload: optional(Function),
52
+ checkStatus: optional(Function),
53
+ createClient: optional(Function),
54
+ token: optional([String, Function]),
55
+ tokenUrl: optional(String),
56
+ accept: optional(String),
57
+ maxFileSize: optional(Number),
58
+ autoUpload: {
59
+ type: Boolean,
60
+ default: true
61
+ },
62
+ multiple: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ maxFiles: optional(Number),
67
+ concurrency: optional(Number),
68
+ decisionTimeoutMs: optional(Number),
69
+ baseUrl: optional(String),
70
+ disabled: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ capture: optional(String),
75
+ messages: messagesProp,
76
+ controller: optional(Object)
77
+ },
78
+ emits: {
79
+ uploaded: (_upload) => true,
80
+ rejected: (_item) => true,
81
+ failed: (_item) => true,
82
+ removed: (_item) => true
83
+ },
84
+ setup(props, { emit }) {
85
+ const own = useCalmLensUpload(() => ({
86
+ uploadPresetId: props.uploadPresetId,
87
+ upload: props.upload,
88
+ checkStatus: props.checkStatus,
89
+ createClient: props.createClient,
90
+ token: props.token,
91
+ tokenUrl: props.tokenUrl,
92
+ accept: props.accept,
93
+ maxFileSize: props.maxFileSize,
94
+ autoUpload: props.autoUpload,
95
+ multiple: props.multiple,
96
+ maxFiles: props.maxFiles,
97
+ concurrency: props.concurrency,
98
+ decisionTimeoutMs: props.decisionTimeoutMs,
99
+ baseUrl: props.baseUrl,
100
+ onUploaded: (value) => emit("uploaded", value),
101
+ onRejected: (item) => emit("rejected", item),
102
+ onFailed: (item) => emit("failed", item),
103
+ onRemoved: (item) => emit("removed", item)
104
+ }));
105
+ const controller = computed(() => props.controller ?? own.controller);
106
+ const snapshot = subscribeSnapshot(controller);
107
+ const messages = computed(() => resolveMessages(props.messages));
108
+ const dragging = ref(false);
109
+ const input = ref();
110
+ const openPicker = () => {
111
+ if (!props.disabled) input.value?.click();
112
+ };
113
+ const onDragOver = (event) => {
114
+ event.preventDefault();
115
+ if (!props.disabled) dragging.value = true;
116
+ };
117
+ return () => {
118
+ const text = messages.value;
119
+ const queue = controller.value;
120
+ const { accept, multiple } = queue.options;
121
+ const items = snapshot.value.items;
122
+ const view = describeUploader(snapshot.value, queue.options, text);
123
+ return h("div", { class: "calmlens-uploader" }, [
124
+ view.showDropzone && h("div", {
125
+ class: "calmlens-dropzone",
126
+ "data-dragging": dragging.value || void 0,
127
+ "data-disabled": props.disabled || void 0,
128
+ onClick: openPicker,
129
+ onDragover: onDragOver,
130
+ onDragenter: onDragOver,
131
+ onDragleave: (event) => {
132
+ if (!event.currentTarget.contains(event.relatedTarget)) dragging.value = false;
133
+ },
134
+ onDrop: (event) => {
135
+ event.preventDefault();
136
+ dragging.value = false;
137
+ if (!props.disabled && event.dataTransfer) queue.addFiles(event.dataTransfer.files);
138
+ },
139
+ onPaste: (event) => {
140
+ const files = event.clipboardData?.files;
141
+ if (!props.disabled && files?.length) queue.addFiles(files);
142
+ }
143
+ }, [
144
+ h("span", { class: "calmlens-dropzone__icon" }, [icon("upload")]),
145
+ h("div", { class: "calmlens-dropzone__text" }, [h("p", { class: "calmlens-dropzone__title" }, dragging.value ? text.dropzoneTitleDragging : text.dropzoneTitle), view.hint && h("p", { class: "calmlens-dropzone__hint" }, view.hint)]),
146
+ h("button", {
147
+ type: "button",
148
+ class: "calmlens-button",
149
+ "data-variant": "outline",
150
+ disabled: props.disabled,
151
+ onClick: (event) => {
152
+ event.stopPropagation();
153
+ openPicker();
154
+ }
155
+ }, view.chooseLabel)
156
+ ]),
157
+ h("input", {
158
+ ref: input,
159
+ type: "file",
160
+ hidden: true,
161
+ accept,
162
+ multiple,
163
+ capture: props.capture,
164
+ disabled: props.disabled,
165
+ onChange: (event) => {
166
+ const target = event.target;
167
+ if (target.files) queue.addFiles(target.files);
168
+ target.value = "";
169
+ }
170
+ }),
171
+ items.length > 0 && h("ul", { class: "calmlens-uploads" }, items.map((item) => {
172
+ const itemView = describeUploadItem(item, text);
173
+ return h("li", {
174
+ key: item.key,
175
+ class: "calmlens-upload",
176
+ "data-stage": item.stage,
177
+ "data-outcome": itemView.outcome
178
+ }, [
179
+ item.previewUrl ? h("img", {
180
+ class: "calmlens-upload__thumb",
181
+ src: item.previewUrl,
182
+ alt: ""
183
+ }) : h("span", {
184
+ class: "calmlens-upload__thumb",
185
+ "data-kind": "file",
186
+ "aria-hidden": "true",
187
+ innerHTML: itemView.fileIcon
188
+ }),
189
+ h("div", { class: "calmlens-upload__body" }, [
190
+ h("span", { class: "calmlens-upload__name" }, item.file.name),
191
+ h("span", { class: "calmlens-upload__size" }, itemView.size),
192
+ itemView.busy && h("div", {
193
+ class: "calmlens-progress",
194
+ role: "progressbar",
195
+ "aria-label": itemView.message,
196
+ "aria-valuemin": 0,
197
+ "aria-valuemax": 100,
198
+ "aria-valuenow": itemView.progressPercent
199
+ }, [h("div", {
200
+ class: "calmlens-progress__bar",
201
+ style: itemView.progressPercent === void 0 ? void 0 : { width: `${itemView.progressPercent}%` }
202
+ })]),
203
+ itemView.message && h("p", {
204
+ class: "calmlens-upload__message",
205
+ role: "status"
206
+ }, itemView.message)
207
+ ]),
208
+ h("div", { class: "calmlens-upload__actions" }, [
209
+ !view.showDropzone && h("button", {
210
+ type: "button",
211
+ class: "calmlens-button",
212
+ "data-variant": "outline",
213
+ "data-size": "small",
214
+ disabled: props.disabled,
215
+ onClick: openPicker
216
+ }, text.chooseAnother),
217
+ itemView.canRetry && h("button", {
218
+ type: "button",
219
+ class: "calmlens-icon-button",
220
+ "aria-label": text.retry,
221
+ title: text.retry,
222
+ onClick: () => queue.retry(item.key)
223
+ }, [icon("retry")]),
224
+ h("button", {
225
+ type: "button",
226
+ class: "calmlens-icon-button",
227
+ "aria-label": itemView.removeLabel,
228
+ title: itemView.removeLabel,
229
+ onClick: () => queue.remove(item.key)
230
+ }, [icon("remove")])
231
+ ])
232
+ ]);
233
+ }))
234
+ ]);
235
+ };
236
+ }
237
+ });
238
+ /**
239
+ * Shows an asset from the CalmLens CDN with responsive widths and a blurred placeholder while
240
+ * it loads. Age-restricted assets stay behind the placeholder and a reveal button until
241
+ * `ageConfirmed` is set; blocked and purged assets show an unavailable notice.
242
+ */
243
+ const CalmLensMedia = defineComponent({
244
+ name: "CalmLensMedia",
245
+ props: {
246
+ /** An asset from the API, which supplies the project, ID, status, type and preview. */
247
+ asset: optional(Object),
248
+ /** Required without `asset`. */
249
+ projectId: optional(String),
250
+ /** Required without `asset`. */
251
+ assetId: optional(String),
252
+ status: optional(String),
253
+ contentRemoved: optional(Boolean),
254
+ type: optional(String),
255
+ resource: optional(String),
256
+ lens: optional(String),
257
+ transform: optional([
258
+ String,
259
+ Object,
260
+ Array
261
+ ]),
262
+ widths: optional(Array),
263
+ url: optional(String),
264
+ placeholder: {
265
+ type: Boolean,
266
+ default: true
267
+ },
268
+ placeholderHash: optional(String),
269
+ placeholderUrl: optional(String),
270
+ averageColor: optional(String),
271
+ cdnBaseUrl: optional(String),
272
+ viewerClaims: optional(Object),
273
+ alt: {
274
+ type: String,
275
+ default: ""
276
+ },
277
+ aspectRatio: optional(Number),
278
+ width: optional(Number),
279
+ height: optional(Number),
280
+ sizes: optional(String),
281
+ fit: optional(String),
282
+ position: optional(String),
283
+ lazy: {
284
+ type: Boolean,
285
+ default: true
286
+ },
287
+ fetchPriority: optional(String),
288
+ controls: {
289
+ type: Boolean,
290
+ default: true
291
+ },
292
+ messages: messagesProp,
293
+ /** Bound by `@reveal`; declared as a prop so the button shows only when something listens. */
294
+ onReveal: optional(Function)
295
+ },
296
+ setup(props) {
297
+ const messages = computed(() => resolveMessages(props.messages));
298
+ const resolved = computed(() => resolveMediaProps(props));
299
+ const state = computed(() => getMediaState(resolved.value));
300
+ const loadKey = computed(() => getMediaLoadKey(state.value));
301
+ const load = ref("loading");
302
+ const image = ref();
303
+ watch(loadKey, () => {
304
+ load.value = "loading";
305
+ });
306
+ onMounted(() => {
307
+ if (image.value?.complete && image.value.naturalWidth > 0) load.value = "loaded";
308
+ });
309
+ const onError = () => {
310
+ load.value = "error";
311
+ };
312
+ return () => {
313
+ const current = state.value;
314
+ const text = messages.value;
315
+ const view = resolved.value;
316
+ const ratio = getMediaAspectRatio(view);
317
+ const failed = load.value === "error";
318
+ const placeholderUrl = current.kind === "audio" || current.kind === "unavailable" ? void 0 : current.placeholderUrl;
319
+ const showPlaceholder = placeholderUrl && (current.kind === "gated" || current.kind === "image" && load.value !== "loaded");
320
+ const notice = (children) => h("figcaption", { class: "calmlens-media__notice" }, children);
321
+ return h("figure", {
322
+ class: "calmlens-media",
323
+ "data-kind": current.kind,
324
+ "data-state": load.value,
325
+ "data-sized": ratio ? "" : void 0,
326
+ style: {
327
+ aspectRatio: ratio,
328
+ backgroundColor: view.averageColor,
329
+ "--calmlens-fit": props.fit,
330
+ "--calmlens-position": props.position
331
+ }
332
+ }, [
333
+ showPlaceholder && h("img", {
334
+ class: "calmlens-media__placeholder",
335
+ src: placeholderUrl,
336
+ alt: "",
337
+ "aria-hidden": "true"
338
+ }),
339
+ current.kind === "image" && !failed && h("img", {
340
+ key: loadKey.value,
341
+ ref: image,
342
+ class: "calmlens-media__content",
343
+ src: current.src,
344
+ srcset: current.srcSet,
345
+ sizes: props.sizes,
346
+ alt: props.alt,
347
+ width: view.width,
348
+ height: view.height,
349
+ loading: props.lazy ? "lazy" : void 0,
350
+ decoding: "async",
351
+ fetchpriority: props.fetchPriority,
352
+ onLoad: () => {
353
+ load.value = "loaded";
354
+ },
355
+ onError
356
+ }),
357
+ current.kind === "video" && !failed && h("video", {
358
+ class: "calmlens-media__content",
359
+ src: current.src,
360
+ controls: props.controls,
361
+ playsinline: true,
362
+ preload: "metadata",
363
+ "aria-label": props.alt || void 0,
364
+ onError: () => {
365
+ load.value = "error";
366
+ }
367
+ }),
368
+ current.kind === "audio" && !failed && h("audio", {
369
+ class: "calmlens-media__content",
370
+ src: current.src,
371
+ controls: props.controls,
372
+ preload: "metadata",
373
+ "aria-label": props.alt || void 0,
374
+ onError: () => {
375
+ load.value = "error";
376
+ }
377
+ }),
378
+ current.kind === "gated" && notice([
379
+ h("strong", text.sensitiveTitle),
380
+ h("p", text.sensitiveBody),
381
+ props.onReveal && h("button", {
382
+ type: "button",
383
+ class: "calmlens-button",
384
+ onClick: props.onReveal
385
+ }, text.reveal)
386
+ ]),
387
+ (current.kind === "unavailable" || failed) && notice([h("p", [icon("unavailable"), h("span", { class: "calmlens-media__label" }, getMediaUnavailableMessage(current, text))])])
388
+ ]);
389
+ };
390
+ }
391
+ });
392
+ export { CALMLENS_STYLES, CALMLENS_THEME, CalmLensMedia, CalmLensUploader, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme, useCalmLensUpload };
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "calmlens",
3
- "version": "0.4.0",
3
+ "version": "0.18.0",
4
+ "description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
5
+ "license": "MIT",
6
+ "homepage": "https://calmlens.com/docs/sdk/javascript",
4
7
  "repository": {
5
8
  "type": "git",
6
- "url": "https://github.com/Censkh/CalmLens.git",
7
- "directory": "packages/js-sdk"
9
+ "url": "git+https://github.com/CalmLens/sdks.git",
10
+ "directory": "javascript"
8
11
  },
9
12
  "publishConfig": {
10
13
  "access": "public",
@@ -13,34 +16,38 @@
13
16
  "main": "cjs/index.js",
14
17
  "types": "cjs/index.d.ts",
15
18
  "module": "esm/index.js",
16
- "sideEffects": false,
19
+ "sideEffects": [
20
+ "./esm/elements.js",
21
+ "./cjs/elements.js"
22
+ ],
23
+ "engines": {
24
+ "node": ">=22"
25
+ },
17
26
  "bin": {
18
27
  "calmlens": "bin/calmlens.js"
19
28
  },
20
29
  "scripts": {
21
- "generate:fixtures": "bun scripts/generateFixtures.ts",
22
30
  "prepublishOnly": "npm run check && npm run test && npm run build",
23
- "test": "bun test --parallel=4 tests",
24
- "example:start": "cd example && npm run start",
31
+ "test": "bun test --parallel=4 ./tests/",
25
32
  "check:fix": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check --write",
26
33
  "check": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check",
27
34
  "cleanup": "rimraf esm && rimraf cjs && rimraf bin",
28
- "build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run verify:package",
29
- "verify:package": "node scripts/verify-package.mjs",
30
- "website:dev": "cd website && npm run start",
31
- "website:deploy": "cd website && npm run deploy"
35
+ "build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run build:cli && npm run verify:package",
36
+ "build:cli": "bun scripts/build-cli.ts",
37
+ "build:cli:binary": "bun scripts/build-cli.ts --binary",
38
+ "verify:package": "node scripts/verify-package.mjs"
32
39
  },
33
40
  "keywords": [
34
- "typescript",
35
- "javascript",
36
- "node",
37
- "web",
38
- "api",
39
- "typed",
40
- "cache",
41
- "fetch",
42
- "retry",
43
- "middleware"
41
+ "calmlens",
42
+ "content-moderation",
43
+ "moderation",
44
+ "image-moderation",
45
+ "text-moderation",
46
+ "trust-and-safety",
47
+ "webhooks",
48
+ "cdn",
49
+ "sdk",
50
+ "typescript"
44
51
  ],
45
52
  "files": [
46
53
  "LICENSE",
@@ -50,20 +57,22 @@
50
57
  "bin/"
51
58
  ],
52
59
  "devDependencies": {
53
- "@biomejs/biome": "^2.5.13",
54
- "@oxc-project/runtime": "0.148.0",
55
- "@types/bun": "^1.3.13",
56
- "@types/node": "22.20.2",
60
+ "@biomejs/biome": "^2.6.3",
61
+ "@oxc-project/runtime": "0.155.0",
62
+ "@types/bun": "^1.4.4",
63
+ "@types/node": "26.6.5",
64
+ "@types/react": "19.3.0",
65
+ "react-native": "0.86.3",
57
66
  "rimraf": "6.1.3",
58
- "rolldown": "1.2.7",
59
- "rolldown-plugin-dts": "0.28.6",
60
- "typescript": "catalog:"
67
+ "rolldown": "1.2.15",
68
+ "rolldown-plugin-dts": "0.28.8",
69
+ "svelte": "5.57.2",
70
+ "typescript": "7.0.2",
71
+ "vue": "3.5.44"
61
72
  },
62
73
  "dependencies": {
63
- "api-def": "^0.17.1",
64
74
  "json-schema-to-ts": "^3.1.1",
65
- "sendable-error": "^0.11.4",
66
- "zod": "^4.6.5"
75
+ "zod": "^4.6.7"
67
76
  },
68
77
  "exports": {
69
78
  ".": {
@@ -74,8 +83,103 @@
74
83
  "require": {
75
84
  "types": "./cjs/index.d.ts",
76
85
  "default": "./cjs/index.js"
77
- }
86
+ },
87
+ "default": "./esm/index.js"
88
+ },
89
+ "./server": {
90
+ "import": {
91
+ "types": "./esm/server.d.ts",
92
+ "default": "./esm/server.js"
93
+ },
94
+ "require": {
95
+ "types": "./cjs/server.d.ts",
96
+ "default": "./cjs/server.js"
97
+ },
98
+ "default": "./esm/server.js"
99
+ },
100
+ "./app": {
101
+ "import": {
102
+ "types": "./esm/app.d.ts",
103
+ "default": "./esm/app.js"
104
+ },
105
+ "require": {
106
+ "types": "./cjs/app.d.ts",
107
+ "default": "./cjs/app.js"
108
+ },
109
+ "default": "./esm/app.js"
110
+ },
111
+ "./ui": {
112
+ "import": {
113
+ "types": "./esm/ui.d.ts",
114
+ "default": "./esm/ui.js"
115
+ },
116
+ "require": {
117
+ "types": "./cjs/ui.d.ts",
118
+ "default": "./cjs/ui.js"
119
+ },
120
+ "default": "./esm/ui.js"
121
+ },
122
+ "./file-icons": {
123
+ "import": {
124
+ "types": "./esm/file-icons.d.ts",
125
+ "default": "./esm/file-icons.js"
126
+ },
127
+ "require": {
128
+ "types": "./cjs/file-icons.d.ts",
129
+ "default": "./cjs/file-icons.js"
130
+ },
131
+ "default": "./esm/file-icons.js"
132
+ },
133
+ "./react": {
134
+ "import": {
135
+ "types": "./esm/react.d.ts",
136
+ "default": "./esm/react.js"
137
+ },
138
+ "require": {
139
+ "types": "./cjs/react.d.ts",
140
+ "default": "./cjs/react.js"
141
+ },
142
+ "default": "./esm/react.js"
78
143
  },
144
+ "./react-native": {
145
+ "import": {
146
+ "types": "./esm/react-native.d.ts",
147
+ "default": "./esm/react-native.js"
148
+ },
149
+ "require": {
150
+ "types": "./cjs/react-native.d.ts",
151
+ "default": "./cjs/react-native.js"
152
+ },
153
+ "default": "./esm/react-native.js"
154
+ },
155
+ "./vue": {
156
+ "import": {
157
+ "types": "./esm/vue.d.ts",
158
+ "default": "./esm/vue.js"
159
+ },
160
+ "require": {
161
+ "types": "./cjs/vue.d.ts",
162
+ "default": "./cjs/vue.js"
163
+ },
164
+ "default": "./esm/vue.js"
165
+ },
166
+ "./svelte": {
167
+ "types": "./esm/svelte/index.d.ts",
168
+ "svelte": "./esm/svelte/index.js",
169
+ "default": "./esm/svelte/index.js"
170
+ },
171
+ "./elements": {
172
+ "import": {
173
+ "types": "./esm/elements.d.ts",
174
+ "default": "./esm/elements.js"
175
+ },
176
+ "require": {
177
+ "types": "./cjs/elements.d.ts",
178
+ "default": "./cjs/elements.js"
179
+ },
180
+ "default": "./esm/elements.js"
181
+ },
182
+ "./styles.css": "./esm/styles.css",
79
183
  "./testing": {
80
184
  "import": {
81
185
  "types": "./esm/testing.d.ts",
@@ -84,8 +188,43 @@
84
188
  "require": {
85
189
  "types": "./cjs/testing.d.ts",
86
190
  "default": "./cjs/testing.js"
87
- }
191
+ },
192
+ "default": "./esm/testing.js"
193
+ },
194
+ "./package.json": "./package.json",
195
+ "./test-inputs": {
196
+ "import": {
197
+ "types": "./esm/test-inputs.d.ts",
198
+ "default": "./esm/test-inputs.js"
199
+ },
200
+ "require": {
201
+ "types": "./cjs/test-inputs.d.ts",
202
+ "default": "./cjs/test-inputs.js"
203
+ },
204
+ "default": "./esm/test-inputs.js"
88
205
  }
89
206
  },
90
- "description": "CalmLens SDK Also published as @calmlens/js-sdk."
207
+ "bugs": {
208
+ "url": "https://github.com/CalmLens/sdks/issues"
209
+ },
210
+ "peerDependencies": {
211
+ "react": ">=19",
212
+ "react-native": ">=0.79",
213
+ "svelte": ">=5",
214
+ "vue": ">=3.3"
215
+ },
216
+ "peerDependenciesMeta": {
217
+ "react": {
218
+ "optional": true
219
+ },
220
+ "react-native": {
221
+ "optional": true
222
+ },
223
+ "svelte": {
224
+ "optional": true
225
+ },
226
+ "vue": {
227
+ "optional": true
228
+ }
229
+ }
91
230
  }