@calmlens/sdk 0.10.0 → 0.10.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/cjs/{CalmLensTypes-BfweJTMS.d.ts → CalmLensTypes-DjYFaTyh.d.ts} +24 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +11 -2
- package/cjs/testing.d.ts +1 -1
- package/esm/{CalmLensTypes-BfweJTMS.d.ts → CalmLensTypes-DjYFaTyh.d.ts} +24 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +11 -2
- package/esm/testing.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4997,6 +4997,8 @@ interface EventFieldInfo {
|
|
|
4997
4997
|
display: EventFieldDisplay;
|
|
4998
4998
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
4999
4999
|
hidden?: boolean;
|
|
5000
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5001
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5000
5002
|
}
|
|
5001
5003
|
interface EventFieldDefinition<TSchema extends zod.ZodType = zod.ZodType> extends EventFieldInfo {
|
|
5002
5004
|
schema: TSchema;
|
|
@@ -5036,6 +5038,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5036
5038
|
display: EventFieldDisplay;
|
|
5037
5039
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5038
5040
|
hidden?: boolean;
|
|
5041
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5042
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5039
5043
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5040
5044
|
key: string;
|
|
5041
5045
|
}[];
|
|
@@ -5099,6 +5103,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5099
5103
|
display: EventFieldDisplay;
|
|
5100
5104
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5101
5105
|
hidden?: boolean;
|
|
5106
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5107
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5102
5108
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5103
5109
|
key: string;
|
|
5104
5110
|
}[];
|
|
@@ -5168,6 +5174,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5168
5174
|
display: EventFieldDisplay;
|
|
5169
5175
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5170
5176
|
hidden?: boolean;
|
|
5177
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5178
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5171
5179
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5172
5180
|
key: string;
|
|
5173
5181
|
}[];
|
|
@@ -5228,6 +5236,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5228
5236
|
display: EventFieldDisplay;
|
|
5229
5237
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5230
5238
|
hidden?: boolean;
|
|
5239
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5240
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5231
5241
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5232
5242
|
key: string;
|
|
5233
5243
|
}[];
|
|
@@ -5284,6 +5294,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5284
5294
|
display: EventFieldDisplay;
|
|
5285
5295
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5286
5296
|
hidden?: boolean;
|
|
5297
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5298
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5287
5299
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5288
5300
|
key: string;
|
|
5289
5301
|
}[];
|
|
@@ -5342,6 +5354,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5342
5354
|
display: EventFieldDisplay;
|
|
5343
5355
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5344
5356
|
hidden?: boolean;
|
|
5357
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5358
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5345
5359
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5346
5360
|
key: string;
|
|
5347
5361
|
}[];
|
|
@@ -5390,6 +5404,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5390
5404
|
display: EventFieldDisplay;
|
|
5391
5405
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5392
5406
|
hidden?: boolean;
|
|
5407
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5408
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5393
5409
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5394
5410
|
key: string;
|
|
5395
5411
|
}[];
|
|
@@ -5431,6 +5447,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5431
5447
|
display: EventFieldDisplay;
|
|
5432
5448
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5433
5449
|
hidden?: boolean;
|
|
5450
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5451
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5434
5452
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5435
5453
|
key: string;
|
|
5436
5454
|
}[];
|
|
@@ -5475,6 +5493,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5475
5493
|
display: EventFieldDisplay;
|
|
5476
5494
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5477
5495
|
hidden?: boolean;
|
|
5496
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5497
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5478
5498
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5479
5499
|
key: string;
|
|
5480
5500
|
}[];
|
|
@@ -5516,6 +5536,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5516
5536
|
display: EventFieldDisplay;
|
|
5517
5537
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5518
5538
|
hidden?: boolean;
|
|
5539
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5540
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5519
5541
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5520
5542
|
key: string;
|
|
5521
5543
|
}[];
|
|
@@ -5569,6 +5591,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5569
5591
|
display: EventFieldDisplay;
|
|
5570
5592
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5571
5593
|
hidden?: boolean;
|
|
5594
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5595
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5572
5596
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5573
5597
|
key: string;
|
|
5574
5598
|
}[];
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as EventCategory, A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, E as LensTransform, F as RequestOptions, G as AssetSearchQuery, H as VerifyWebhookSignatureOptions, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, N as MultipartUploadOptions, O as ListAssetsOptions, P as MultipartUploadPartOptions, Q as TypedEvent, R as SubmitAssetOptions, S as ImageTransformOptions, T as Lens, U as WebhookHeadersInput, V as UploadAssetPartOptions, W as WebhookPayloadInput, X as Folder, _ as DeleteAssetOptions, a as AssetSearchResponse, b as FolderIdOptions, c as AssetType, ct as MetadataItem, d as CdnAssetUrlOptions, et as EventFact, f as CdnServeOptions, g as DeleteAssetContentOptions, h as CreateMultipartUploadPartOptions, i as AssetPage, it as EventType, j as MoveAssetOptions, k as ListEventsOptions, l as AssetVisibility, lt as ProcessingOptions, m as CreateFolderOptions, n as AssetChildrenPage, nt as EventFacts, o as AssetSearchResult, ot as ClassificationCategoryReport, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, r as AssetContentOptions, rt as EventSeverity, s as AssetStatus, st as ClassificationReport, t as Asset, tt as EventFactValues, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, x as IdempotencyOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-
|
|
1
|
+
import { $ as EventCategory, A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, E as LensTransform, F as RequestOptions, G as AssetSearchQuery, H as VerifyWebhookSignatureOptions, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, N as MultipartUploadOptions, O as ListAssetsOptions, P as MultipartUploadPartOptions, Q as TypedEvent, R as SubmitAssetOptions, S as ImageTransformOptions, T as Lens, U as WebhookHeadersInput, V as UploadAssetPartOptions, W as WebhookPayloadInput, X as Folder, _ as DeleteAssetOptions, a as AssetSearchResponse, b as FolderIdOptions, c as AssetType, ct as MetadataItem, d as CdnAssetUrlOptions, et as EventFact, f as CdnServeOptions, g as DeleteAssetContentOptions, h as CreateMultipartUploadPartOptions, i as AssetPage, it as EventType, j as MoveAssetOptions, k as ListEventsOptions, l as AssetVisibility, lt as ProcessingOptions, m as CreateFolderOptions, n as AssetChildrenPage, nt as EventFacts, o as AssetSearchResult, ot as ClassificationCategoryReport, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, r as AssetContentOptions, rt as EventSeverity, s as AssetStatus, st as ClassificationReport, t as Asset, tt as EventFactValues, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, x as IdempotencyOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-DjYFaTyh.js";
|
|
2
2
|
//#region src/client/CalmLensClient.d.ts
|
|
3
3
|
interface ClientState {
|
|
4
4
|
readonly options: Omit<CalmLensClientOptions, "apiKey"> & {
|
package/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ const require_CalmLensWebhooks = require("./CalmLensWebhooks-DJnaLpRy.js");
|
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region src/client/CalmLensVersion.ts
|
|
5
5
|
/** This SDK's version, from its package.json. */
|
|
6
|
-
const SDK_VERSION = "0.10.
|
|
6
|
+
const SDK_VERSION = "0.10.1";
|
|
7
7
|
const runtimeName = () => {
|
|
8
8
|
const runtime = globalThis;
|
|
9
9
|
if (runtime.Bun?.version) return `bun/${runtime.Bun.version}`;
|
|
@@ -72,6 +72,11 @@ const createAttemptSignal = (signals, timeoutMs) => {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* A redirect the SDK must not follow: it would send the API key to another origin. Browsers report
|
|
77
|
+
* a manual redirect as an opaque response; other runtimes return the 3xx with its Location.
|
|
78
|
+
*/
|
|
79
|
+
const isRedirect = (response) => response.type === "opaqueredirect" || response.status >= 300 && response.status < 400 && response.headers.has("location");
|
|
75
80
|
/** Turns anything thrown while sending or reading a request into a `CalmLensError`. */
|
|
76
81
|
const toFailure = (cause, attempt) => {
|
|
77
82
|
if (require_CalmLensWebhooks.CalmLensError.isCalmLensError(cause)) return cause;
|
|
@@ -220,10 +225,14 @@ var CalmLensTransport = class {
|
|
|
220
225
|
method: request.method,
|
|
221
226
|
headers,
|
|
222
227
|
body: request.body,
|
|
223
|
-
redirect: "
|
|
228
|
+
redirect: "manual",
|
|
224
229
|
signal: attempt.signal,
|
|
225
230
|
duplex: "half"
|
|
226
231
|
});
|
|
232
|
+
if (isRedirect(response)) {
|
|
233
|
+
await response.body?.cancel().catch(() => {});
|
|
234
|
+
throw new require_CalmLensWebhooks.CalmLensError(require_CalmLensWebhooks.SDK_ERROR_CODES.TRANSPORT_ERROR, { message: `Unexpected redirect (HTTP ${response.status})` });
|
|
235
|
+
}
|
|
227
236
|
} catch (cause) {
|
|
228
237
|
attempt.release();
|
|
229
238
|
const failure = toFailure(cause, attempt);
|
package/cjs/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, G as AssetSearchQuery, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, O as ListAssetsOptions, Q as TypedEvent, R as SubmitAssetOptions, T as Lens, V as UploadAssetPartOptions, X as Folder, Y as AssetBinaryPayloadInput, Z as Event, _ as DeleteAssetOptions, a as AssetSearchResponse, at as ClassificationCategory, b as FolderIdOptions, d as CdnAssetUrlOptions, f as CdnServeOptions, g as DeleteAssetContentOptions, i as AssetPage, j as MoveAssetOptions, k as ListEventsOptions, m as CreateFolderOptions, n as AssetChildrenPage, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, s as AssetStatus, t as Asset, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-
|
|
1
|
+
import { A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, G as AssetSearchQuery, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, O as ListAssetsOptions, Q as TypedEvent, R as SubmitAssetOptions, T as Lens, V as UploadAssetPartOptions, X as Folder, Y as AssetBinaryPayloadInput, Z as Event, _ as DeleteAssetOptions, a as AssetSearchResponse, at as ClassificationCategory, b as FolderIdOptions, d as CdnAssetUrlOptions, f as CdnServeOptions, g as DeleteAssetContentOptions, i as AssetPage, j as MoveAssetOptions, k as ListEventsOptions, m as CreateFolderOptions, n as AssetChildrenPage, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, s as AssetStatus, t as Asset, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-DjYFaTyh.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/TestTriggers.d.ts
|
|
4
4
|
type ClassificationTestSignal = ClassificationCategory | "sexual.involving-minors" | "violence.graphic";
|
|
@@ -4997,6 +4997,8 @@ interface EventFieldInfo {
|
|
|
4997
4997
|
display: EventFieldDisplay;
|
|
4998
4998
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
4999
4999
|
hidden?: boolean;
|
|
5000
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5001
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5000
5002
|
}
|
|
5001
5003
|
interface EventFieldDefinition<TSchema extends zod.ZodType = zod.ZodType> extends EventFieldInfo {
|
|
5002
5004
|
schema: TSchema;
|
|
@@ -5036,6 +5038,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5036
5038
|
display: EventFieldDisplay;
|
|
5037
5039
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5038
5040
|
hidden?: boolean;
|
|
5041
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5042
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5039
5043
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5040
5044
|
key: string;
|
|
5041
5045
|
}[];
|
|
@@ -5099,6 +5103,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5099
5103
|
display: EventFieldDisplay;
|
|
5100
5104
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5101
5105
|
hidden?: boolean;
|
|
5106
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5107
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5102
5108
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5103
5109
|
key: string;
|
|
5104
5110
|
}[];
|
|
@@ -5168,6 +5174,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5168
5174
|
display: EventFieldDisplay;
|
|
5169
5175
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5170
5176
|
hidden?: boolean;
|
|
5177
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5178
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5171
5179
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5172
5180
|
key: string;
|
|
5173
5181
|
}[];
|
|
@@ -5228,6 +5236,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5228
5236
|
display: EventFieldDisplay;
|
|
5229
5237
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5230
5238
|
hidden?: boolean;
|
|
5239
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5240
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5231
5241
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5232
5242
|
key: string;
|
|
5233
5243
|
}[];
|
|
@@ -5284,6 +5294,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5284
5294
|
display: EventFieldDisplay;
|
|
5285
5295
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5286
5296
|
hidden?: boolean;
|
|
5297
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5298
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5287
5299
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5288
5300
|
key: string;
|
|
5289
5301
|
}[];
|
|
@@ -5342,6 +5354,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5342
5354
|
display: EventFieldDisplay;
|
|
5343
5355
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5344
5356
|
hidden?: boolean;
|
|
5357
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5358
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5345
5359
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5346
5360
|
key: string;
|
|
5347
5361
|
}[];
|
|
@@ -5390,6 +5404,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5390
5404
|
display: EventFieldDisplay;
|
|
5391
5405
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5392
5406
|
hidden?: boolean;
|
|
5407
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5408
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5393
5409
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5394
5410
|
key: string;
|
|
5395
5411
|
}[];
|
|
@@ -5431,6 +5447,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5431
5447
|
display: EventFieldDisplay;
|
|
5432
5448
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5433
5449
|
hidden?: boolean;
|
|
5450
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5451
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5434
5452
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5435
5453
|
key: string;
|
|
5436
5454
|
}[];
|
|
@@ -5475,6 +5493,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5475
5493
|
display: EventFieldDisplay;
|
|
5476
5494
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5477
5495
|
hidden?: boolean;
|
|
5496
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5497
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5478
5498
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5479
5499
|
key: string;
|
|
5480
5500
|
}[];
|
|
@@ -5516,6 +5536,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5516
5536
|
display: EventFieldDisplay;
|
|
5517
5537
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5518
5538
|
hidden?: boolean;
|
|
5539
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5540
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5519
5541
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5520
5542
|
key: string;
|
|
5521
5543
|
}[];
|
|
@@ -5569,6 +5591,8 @@ declare const EVENT_TYPE_INFO: {
|
|
|
5569
5591
|
display: EventFieldDisplay;
|
|
5570
5592
|
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
5571
5593
|
hidden?: boolean;
|
|
5594
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
5595
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
5572
5596
|
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
5573
5597
|
key: string;
|
|
5574
5598
|
}[];
|
package/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as EventCategory, A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, E as LensTransform, F as RequestOptions, G as AssetSearchQuery, H as VerifyWebhookSignatureOptions, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, N as MultipartUploadOptions, O as ListAssetsOptions, P as MultipartUploadPartOptions, Q as TypedEvent, R as SubmitAssetOptions, S as ImageTransformOptions, T as Lens, U as WebhookHeadersInput, V as UploadAssetPartOptions, W as WebhookPayloadInput, X as Folder, _ as DeleteAssetOptions, a as AssetSearchResponse, b as FolderIdOptions, c as AssetType, ct as MetadataItem, d as CdnAssetUrlOptions, et as EventFact, f as CdnServeOptions, g as DeleteAssetContentOptions, h as CreateMultipartUploadPartOptions, i as AssetPage, it as EventType, j as MoveAssetOptions, k as ListEventsOptions, l as AssetVisibility, lt as ProcessingOptions, m as CreateFolderOptions, n as AssetChildrenPage, nt as EventFacts, o as AssetSearchResult, ot as ClassificationCategoryReport, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, r as AssetContentOptions, rt as EventSeverity, s as AssetStatus, st as ClassificationReport, t as Asset, tt as EventFactValues, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, x as IdempotencyOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-
|
|
1
|
+
import { $ as EventCategory, A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, E as LensTransform, F as RequestOptions, G as AssetSearchQuery, H as VerifyWebhookSignatureOptions, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, N as MultipartUploadOptions, O as ListAssetsOptions, P as MultipartUploadPartOptions, Q as TypedEvent, R as SubmitAssetOptions, S as ImageTransformOptions, T as Lens, U as WebhookHeadersInput, V as UploadAssetPartOptions, W as WebhookPayloadInput, X as Folder, _ as DeleteAssetOptions, a as AssetSearchResponse, b as FolderIdOptions, c as AssetType, ct as MetadataItem, d as CdnAssetUrlOptions, et as EventFact, f as CdnServeOptions, g as DeleteAssetContentOptions, h as CreateMultipartUploadPartOptions, i as AssetPage, it as EventType, j as MoveAssetOptions, k as ListEventsOptions, l as AssetVisibility, lt as ProcessingOptions, m as CreateFolderOptions, n as AssetChildrenPage, nt as EventFacts, o as AssetSearchResult, ot as ClassificationCategoryReport, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, r as AssetContentOptions, rt as EventSeverity, s as AssetStatus, st as ClassificationReport, t as Asset, tt as EventFactValues, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, x as IdempotencyOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-DjYFaTyh.js";
|
|
2
2
|
//#region src/client/CalmLensClient.d.ts
|
|
3
3
|
interface ClientState {
|
|
4
4
|
readonly options: Omit<CalmLensClientOptions, "apiKey"> & {
|
package/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { A as getRawBase64, C as MIN_MULTIPART_IMAGE_UPLOAD_BYTES, E as stringif
|
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src/client/CalmLensVersion.ts
|
|
4
4
|
/** This SDK's version, from its package.json. */
|
|
5
|
-
const SDK_VERSION = "0.10.
|
|
5
|
+
const SDK_VERSION = "0.10.1";
|
|
6
6
|
const runtimeName = () => {
|
|
7
7
|
const runtime = globalThis;
|
|
8
8
|
if (runtime.Bun?.version) return `bun/${runtime.Bun.version}`;
|
|
@@ -71,6 +71,11 @@ const createAttemptSignal = (signals, timeoutMs) => {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* A redirect the SDK must not follow: it would send the API key to another origin. Browsers report
|
|
76
|
+
* a manual redirect as an opaque response; other runtimes return the 3xx with its Location.
|
|
77
|
+
*/
|
|
78
|
+
const isRedirect = (response) => response.type === "opaqueredirect" || response.status >= 300 && response.status < 400 && response.headers.has("location");
|
|
74
79
|
/** Turns anything thrown while sending or reading a request into a `CalmLensError`. */
|
|
75
80
|
const toFailure = (cause, attempt) => {
|
|
76
81
|
if (CalmLensError.isCalmLensError(cause)) return cause;
|
|
@@ -219,10 +224,14 @@ var CalmLensTransport = class {
|
|
|
219
224
|
method: request.method,
|
|
220
225
|
headers,
|
|
221
226
|
body: request.body,
|
|
222
|
-
redirect: "
|
|
227
|
+
redirect: "manual",
|
|
223
228
|
signal: attempt.signal,
|
|
224
229
|
duplex: "half"
|
|
225
230
|
});
|
|
231
|
+
if (isRedirect(response)) {
|
|
232
|
+
await response.body?.cancel().catch(() => {});
|
|
233
|
+
throw new CalmLensError(SDK_ERROR_CODES.TRANSPORT_ERROR, { message: `Unexpected redirect (HTTP ${response.status})` });
|
|
234
|
+
}
|
|
226
235
|
} catch (cause) {
|
|
227
236
|
attempt.release();
|
|
228
237
|
const failure = toFailure(cause, attempt);
|
package/esm/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, G as AssetSearchQuery, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, O as ListAssetsOptions, Q as TypedEvent, R as SubmitAssetOptions, T as Lens, V as UploadAssetPartOptions, X as Folder, Y as AssetBinaryPayloadInput, Z as Event, _ as DeleteAssetOptions, a as AssetSearchResponse, at as ClassificationCategory, b as FolderIdOptions, d as CdnAssetUrlOptions, f as CdnServeOptions, g as DeleteAssetContentOptions, i as AssetPage, j as MoveAssetOptions, k as ListEventsOptions, m as CreateFolderOptions, n as AssetChildrenPage, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, s as AssetStatus, t as Asset, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-
|
|
1
|
+
import { A as ModerateTextOptions, B as UpdateFolderOptions, C as IterateAssetChildrenOptions, D as ListAssetChildrenOptions, G as AssetSearchQuery, I as RetrieveAssetOptions, J as PostAssetSignedUrlResponse, K as WebhookEventPayload, L as RetryAssetOptions, M as MoveFolderOptions, O as ListAssetsOptions, Q as TypedEvent, R as SubmitAssetOptions, T as Lens, V as UploadAssetPartOptions, X as Folder, Y as AssetBinaryPayloadInput, Z as Event, _ as DeleteAssetOptions, a as AssetSearchResponse, at as ClassificationCategory, b as FolderIdOptions, d as CdnAssetUrlOptions, f as CdnServeOptions, g as DeleteAssetContentOptions, i as AssetPage, j as MoveAssetOptions, k as ListEventsOptions, m as CreateFolderOptions, n as AssetChildrenPage, p as CreateAssetSignedUrlOptions, q as GetEventsResponse, s as AssetStatus, t as Asset, u as CalmLensClientOptions, v as EnsureLensOptions, w as IterateAssetsOptions, y as EnsureLensesOptions, z as UpdateAssetOptions } from "./CalmLensTypes-DjYFaTyh.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/TestTriggers.d.ts
|
|
4
4
|
type ClassificationTestSignal = ClassificationCategory | "sexual.involving-minors" | "violence.graphic";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calmlens/sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://calmlens.com/docs/sdk/javascript",
|