@calmlens/sdk 0.5.0 → 0.7.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.
@@ -1245,6 +1245,7 @@ declare const ASSET_SCHEMA: zod.ZodObject<{
1245
1245
  audioTranscribed: zod.ZodBoolean;
1246
1246
  segments: zod.ZodArray<zod.ZodObject<{
1247
1247
  source: zod.ZodEnum<{
1248
+ clip: "clip";
1248
1249
  frame: "frame";
1249
1250
  "frame-text": "frame-text";
1250
1251
  speech: "speech";
@@ -3518,4 +3519,4 @@ interface ModerateTextOptions extends Omit<SubmitAssetCommonOptions, "name" | "v
3518
3519
  name?: string;
3519
3520
  }
3520
3521
  //#endregion
3521
- export { GetEventsResponse as A, EventFacts as B, UpdateAssetOptions as C, GetAssetChildrenResponse as D, VerifyWebhookSignatureOptions as E, Folder as F, AssetType as G, EventType as H, TypedEvent as I, ProcessingOptions as J, AssetVisibility as K, EventCategory as L, RequestErrorCode as M, AssetBinaryPayloadInput as N, GetAssetResponse as O, Lens as P, EventFact as R, SubmitAssetOptions as S, UploadAssetPartOptions as T, Asset as U, EventSeverity as V, AssetStatus as W, MultipartUploadOptions as _, CreateAssetSignedUrlOptions as a, RetrieveAssetOptions as b, EnsureLensOptions as c, ListAssetChildrenOptions as d, ListAssetsOptions as f, MoveFolderOptions as g, MoveAssetOptions as h, CdnServeOptions as i, PostAssetSignedUrlResponse as j, GetAssetsPageResponse as k, EnsureLensesOptions as l, ModerateTextOptions as m, CalmLensClientOptions as n, CreateFolderOptions as o, ListEventsOptions as p, MetadataItem as q, CdnAssetUrlOptions as r, CreateMultipartUploadPartOptions as s, AssetContentOptions as t, FolderIdOptions as u, MultipartUploadPartOptions as v, UpdateFolderOptions as w, RetryAssetOptions as x, RequestOptions as y, EventFactValues as z };
3522
+ export { GetEventsResponse as A, EventFactValues as B, UpdateAssetOptions as C, GetAssetChildrenResponse as D, VerifyWebhookSignatureOptions as E, Folder as F, AssetStatus as G, EventSeverity as H, Event as I, MetadataItem as J, AssetType as K, TypedEvent as L, RequestErrorCode as M, AssetBinaryPayloadInput as N, GetAssetResponse as O, Lens as P, EventCategory as R, SubmitAssetOptions as S, UploadAssetPartOptions as T, EventType as U, EventFacts as V, Asset as W, ProcessingOptions as Y, MultipartUploadOptions as _, CreateAssetSignedUrlOptions as a, RetrieveAssetOptions as b, EnsureLensOptions as c, ListAssetChildrenOptions as d, ListAssetsOptions as f, MoveFolderOptions as g, MoveAssetOptions as h, CdnServeOptions as i, PostAssetSignedUrlResponse as j, GetAssetsPageResponse as k, EnsureLensesOptions as l, ModerateTextOptions as m, CalmLensClientOptions as n, CreateFolderOptions as o, ListEventsOptions as p, AssetVisibility as q, CdnAssetUrlOptions as r, CreateMultipartUploadPartOptions as s, AssetContentOptions as t, FolderIdOptions as u, MultipartUploadPartOptions as v, UpdateFolderOptions as w, RetryAssetOptions as x, RequestOptions as y, EventFact as z };
@@ -1,5 +1,5 @@
1
1
  import { ErrorCode } from "sendable-error";
2
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
2
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
3
3
  function _typeof(o) {
4
4
  "@babel/helpers - typeof";
5
5
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9,7 +9,7 @@ function _typeof(o) {
9
9
  }, _typeof(o);
10
10
  }
11
11
  //#endregion
12
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
12
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
13
13
  function toPrimitive(t, r) {
14
14
  if ("object" != _typeof(t) || !t) return t;
15
15
  var e = t[Symbol.toPrimitive];
@@ -21,13 +21,13 @@ function toPrimitive(t, r) {
21
21
  return ("string" === r ? String : Number)(t);
22
22
  }
23
23
  //#endregion
24
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
24
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
25
25
  function toPropertyKey(t) {
26
26
  var i = toPrimitive(t, "string");
27
27
  return "symbol" == _typeof(i) ? i : i + "";
28
28
  }
29
29
  //#endregion
30
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
30
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
31
31
  function _defineProperty(e, r, t) {
32
32
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
33
  value: t,
@@ -37,7 +37,7 @@ function _defineProperty(e, r, t) {
37
37
  }) : e[r] = t, e;
38
38
  }
39
39
  //#endregion
40
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/objectSpread2.js
40
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectSpread2.js
41
41
  function ownKeys(e, r) {
42
42
  var t = Object.keys(e);
43
43
  if (Object.getOwnPropertySymbols) {
@@ -60,7 +60,7 @@ function _objectSpread2(e) {
60
60
  return e;
61
61
  }
62
62
  //#endregion
63
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/asyncToGenerator.js
63
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/asyncToGenerator.js
64
64
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
65
65
  try {
66
66
  var i = n[a](c), u = i.value;
@@ -371,7 +371,7 @@ var CalmLensError = class extends Error {
371
371
  };
372
372
  const calmLensError = (errorCode, options) => new CalmLensError(errorCode, options);
373
373
  //#endregion
374
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/objectWithoutPropertiesLoose.js
374
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutPropertiesLoose.js
375
375
  function _objectWithoutPropertiesLoose(r, e) {
376
376
  if (null == r) return {};
377
377
  var t = {};
@@ -382,7 +382,7 @@ function _objectWithoutPropertiesLoose(r, e) {
382
382
  return t;
383
383
  }
384
384
  //#endregion
385
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/objectWithoutProperties.js
385
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutProperties.js
386
386
  function _objectWithoutProperties(e, t) {
387
387
  if (null == e) return {};
388
388
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
@@ -395,6 +395,27 @@ function _objectWithoutProperties(e, t) {
395
395
  //#endregion
396
396
  //#region src/client/CalmLensUtils.ts
397
397
  const _excluded = ["text", "name"];
398
+ const invalidOptions = (message) => calmLensError({ id: "upload/invalid-payload" }, { message });
399
+ const assertHttpUrl = (name, value) => {
400
+ if (value === void 0) return;
401
+ let url;
402
+ try {
403
+ url = new URL(value);
404
+ } catch (_unused) {}
405
+ if (!url || url.protocol !== "https:" && url.protocol !== "http:") throw invalidOptions(`${name} must be an absolute http(s) URL`);
406
+ };
407
+ /**
408
+ * Checks client options before the client sets anything up. `CalmLensClient` and
409
+ * `MockCalmLensClient` share it so both reject the same configuration.
410
+ */
411
+ const validateClientOptions = (options) => {
412
+ if (!options || typeof options !== "object") throw invalidOptions("Client options are required");
413
+ if (!options.apiKey) throw invalidOptions("API key is required");
414
+ if (!options.projectId) throw invalidOptions("Project ID is required");
415
+ if (options.timeoutMs !== void 0 && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs <= 0)) throw invalidOptions("timeoutMs must be a positive integer");
416
+ assertHttpUrl("baseUrl", options.baseUrl);
417
+ assertHttpUrl("cdnBaseUrl", options.cdnBaseUrl);
418
+ };
398
419
  const toTextAssetOptions = (_ref) => {
399
420
  let { text, name } = _ref, options = _objectWithoutProperties(_ref, _excluded);
400
421
  if (typeof text !== "string" || !text.trim()) throw calmLensError(PUBLIC_ERROR_CODES.INVALID_UPLOAD_PAYLOAD, { message: "Text to moderate must be a non-empty string" });
@@ -407,4 +428,4 @@ const toTextAssetOptions = (_ref) => {
407
428
  });
408
429
  };
409
430
  //#endregion
410
- export { validateAssetPayload as _, calmLensError as a, MIN_MULTIPART_IMAGE_UPLOAD_BYTES as c, PUBLIC_ERROR_CODES as d, stringifyJsonCanonical as f, getRawBase64 as g, getAssetPayloadByteLength as h, SDK_ERRORS as i, getRejectedUploadMimeTypeError as l, assetToData as m, _objectWithoutProperties as n, DOMAIN as o, assetDataToUint8Array as p, CalmLensError as r, MAX_IMAGE_UPLOAD_BYTES as s, toTextAssetOptions as t, isRejectedUploadMimeType as u, _asyncToGenerator as v, _objectSpread2 as y };
431
+ export { getRawBase64 as _, SDK_ERRORS as a, _objectSpread2 as b, MAX_IMAGE_UPLOAD_BYTES as c, isRejectedUploadMimeType as d, PUBLIC_ERROR_CODES as f, getAssetPayloadByteLength as g, assetToData as h, CalmLensError as i, MIN_MULTIPART_IMAGE_UPLOAD_BYTES as l, assetDataToUint8Array as m, validateClientOptions as n, calmLensError as o, stringifyJsonCanonical as p, _objectWithoutProperties as r, DOMAIN as s, toTextAssetOptions as t, getRejectedUploadMimeTypeError as u, validateAssetPayload as v, _asyncToGenerator as y };