calmlens 0.25.0 → 0.26.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.
Files changed (84) hide show
  1. package/README.md +14 -14
  2. package/bin/calmlens.js +2202 -521
  3. package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-DdkcoZLH.js} +1 -1
  4. package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-zYWKtFSs.d.ts} +2 -2
  5. package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-Gu9mU_66.js} +22 -15
  6. package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
  7. package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-BCITGsr9.js} +138 -90
  8. package/cjs/CalmLensServerClient-D5-njsNk.d.ts +357 -0
  9. package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-DHmAPT1u.js} +283 -303
  10. package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
  11. package/cjs/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
  12. package/cjs/{Core-Cw4IxFUq.js → Core-DAf9lqe2.js} +30 -12
  13. package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-D4iwqoN_.js} +858 -28
  14. package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BNIbpxIH.js} +38 -2
  15. package/cjs/ReactUpload-D4htIz8X.d.ts +27 -0
  16. package/cjs/{UploadController-ObdgTaBl.js → UploadController-B_lKxvpM.js} +16 -3
  17. package/cjs/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
  18. package/cjs/app.d.ts +5 -5
  19. package/cjs/app.js +20 -2
  20. package/cjs/elements.d.ts +5 -5
  21. package/cjs/elements.js +102 -67
  22. package/cjs/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
  23. package/cjs/index.d.ts +4 -4
  24. package/cjs/index.js +19 -1
  25. package/cjs/react-native.d.ts +3 -3
  26. package/cjs/react-native.js +6 -4
  27. package/cjs/react.d.ts +5 -4
  28. package/cjs/react.js +10 -14
  29. package/cjs/server.d.ts +5 -5
  30. package/cjs/server.js +20 -2
  31. package/cjs/testing.d.ts +11 -9
  32. package/cjs/testing.js +72 -41
  33. package/cjs/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
  34. package/cjs/{ui-CA16jyfZ.js → ui-CvlJmRYM.js} +6 -4
  35. package/cjs/ui.d.ts +3 -3
  36. package/cjs/ui.js +4 -3
  37. package/cjs/vue.d.ts +15 -8
  38. package/cjs/vue.js +29 -16
  39. package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-BAWYEBd7.js} +1 -1
  40. package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-zYWKtFSs.d.ts} +2 -2
  41. package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-DNkIZb6x.js} +22 -15
  42. package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
  43. package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CYHJo3nV.js} +133 -91
  44. package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-B1AiR4nv.js} +283 -303
  45. package/esm/CalmLensServerClient-D5-njsNk.d.ts +357 -0
  46. package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
  47. package/esm/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
  48. package/esm/{Core-CtbYmeXG.js → Core-xNBQxZWH.js} +30 -12
  49. package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-DxuPP4uM.js} +475 -285
  50. package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-BWifQdLv.js} +34 -4
  51. package/esm/ReactUpload-D4htIz8X.d.ts +27 -0
  52. package/esm/{UploadController-C7fL3Iz9.js → UploadController-jlJdddyI.js} +11 -4
  53. package/esm/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
  54. package/esm/app.d.ts +5 -5
  55. package/esm/app.js +3 -3
  56. package/esm/elements.d.ts +5 -5
  57. package/esm/elements.js +102 -68
  58. package/esm/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
  59. package/esm/index.d.ts +4 -4
  60. package/esm/index.js +1 -1
  61. package/esm/react-native.d.ts +3 -3
  62. package/esm/react-native.js +5 -5
  63. package/esm/react.d.ts +5 -4
  64. package/esm/react.js +9 -15
  65. package/esm/server.d.ts +5 -5
  66. package/esm/server.js +3 -3
  67. package/esm/styles.css +28 -10
  68. package/esm/svelte/CalmLensUploader.svelte +17 -17
  69. package/esm/svelte/context.js +21 -0
  70. package/esm/svelte/index.d.ts +12 -0
  71. package/esm/svelte/index.js +1 -0
  72. package/esm/testing.d.ts +11 -9
  73. package/esm/testing.js +72 -41
  74. package/esm/{ui-B98AucZA.js → ui-BXzzqh7M.js} +6 -4
  75. package/esm/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
  76. package/esm/ui.d.ts +3 -3
  77. package/esm/ui.js +4 -4
  78. package/esm/vue.d.ts +15 -8
  79. package/esm/vue.js +29 -18
  80. package/package.json +16 -6
  81. package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  82. package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
  83. package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  84. package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
@@ -636,6 +636,69 @@ const CALMLENS_ERROR_CODES = {
636
636
  ...API_ERROR_CODES,
637
637
  ...SDK_ERROR_CODES
638
638
  };
639
+ const KIND_PARENTS = {
640
+ error: null,
641
+ api: "error",
642
+ "bad-request": "api",
643
+ authentication: "api",
644
+ "permission-denied": "api",
645
+ "not-found": "api",
646
+ conflict: "api",
647
+ "payload-too-large": "api",
648
+ "unprocessable-entity": "api",
649
+ "rate-limit": "api",
650
+ server: "api",
651
+ connection: "error",
652
+ timeout: "error",
653
+ cancelled: "error",
654
+ "invalid-argument": "error",
655
+ configuration: "invalid-argument",
656
+ "invalid-response": "error",
657
+ "webhook-verification": "error"
658
+ };
659
+ const STATUS_KINDS = {
660
+ 400: "bad-request",
661
+ 401: "authentication",
662
+ 403: "permission-denied",
663
+ 404: "not-found",
664
+ 409: "conflict",
665
+ 413: "payload-too-large",
666
+ 422: "unprocessable-entity",
667
+ 429: "rate-limit"
668
+ };
669
+ /** The kinds of the SDK's own codes, whatever the status. */
670
+ const CODE_KINDS = {
671
+ "sdk/transport-error": "connection",
672
+ "sdk/timeout": "timeout",
673
+ "sdk/cancelled": "cancelled",
674
+ "sdk/invalid-response": "invalid-response",
675
+ "sdk/response-too-large": "invalid-response",
676
+ "sdk/invalid-argument": "invalid-argument",
677
+ "sdk/invalid-config": "configuration",
678
+ "sdk/no-fetch": "configuration",
679
+ "sdk/invalid-webhook-signature": "webhook-verification",
680
+ "sdk/invalid-webhook-payload": "webhook-verification"
681
+ };
682
+ /**
683
+ * The kind of an error with `code` and `status`: the SDK's own codes by code; any other error by
684
+ * its HTTP status when the API answered (`api` for a status without a kind of its own, or a
685
+ * hidden one); and an error the SDK raised before sending, such as `upload/unsupported-type`, as
686
+ * `invalid-argument`.
687
+ */
688
+ const errorKindOf = (code, status) => {
689
+ const byCode = CODE_KINDS[code];
690
+ if (byCode) return byCode;
691
+ if (status === void 0) return code === "sdk/http-error" ? "api" : "invalid-argument";
692
+ if (status >= 500) return "server";
693
+ return STATUS_KINDS[status] ?? "api";
694
+ };
695
+ /** Whether `kind` is `ancestor` or one of its descendants. */
696
+ const isErrorKind = (kind, ancestor) => {
697
+ for (let current = kind; current; current = KIND_PARENTS[current]) if (current === ancestor) return true;
698
+ return false;
699
+ };
700
+ /** The longest API error body an error keeps. */
701
+ const MAX_ERROR_BODY_LENGTH = 4096;
639
702
  const BRAND = Symbol.for("calmlens.sdk.CalmLensError");
640
703
  const RETRYABLE_STATUSES$1 = /* @__PURE__ */ new Set([
641
704
  429,
@@ -658,11 +721,21 @@ const RETRYABLE_CODES = /* @__PURE__ */ new Set([
658
721
  * from any copy of the SDK, so they work when ESM and CommonJS builds are loaded side by side.
659
722
  */
660
723
  var CalmLensError = class CalmLensError extends Error {
724
+ static {
725
+ this.kind = "error";
726
+ }
661
727
  constructor(code, options = {}) {
662
728
  const id = typeof code === "string" ? code : code.id;
663
729
  const defaultMessage = typeof code === "string" ? void 0 : code.defaultMessage;
664
730
  super(`[calmlens] ${options.message ?? defaultMessage ?? id}`, { cause: options.cause });
665
- this.name = "CalmLensError";
731
+ const kind = errorKindOf(id, options.status);
732
+ if (new.target === CalmLensError) {
733
+ const KindClass = ERROR_CLASSES[kind];
734
+ if (KindClass !== CalmLensError) return new KindClass(code, options);
735
+ }
736
+ this.name = new.target.name;
737
+ this.kind = kind;
738
+ this.body = options.body?.slice(0, MAX_ERROR_BODY_LENGTH);
666
739
  this.code = id;
667
740
  this.status = options.status;
668
741
  this.details = options.details;
@@ -675,8 +748,20 @@ var CalmLensError = class CalmLensError extends Error {
675
748
  static isCalmLensError(value) {
676
749
  return typeof value === "object" && value !== null && value[BRAND] === true;
677
750
  }
751
+ /**
752
+ * `error instanceof CalmLensNotFoundError` (or any kind's class) is true for errors of that kind
753
+ * and its descendants, from any copy of the SDK.
754
+ */
678
755
  static [Symbol.hasInstance](value) {
679
- return CalmLensError.isCalmLensError(value);
756
+ if (!CalmLensError.isCalmLensError(value)) return false;
757
+ const expected = this.kind;
758
+ if (expected === "error") return true;
759
+ const { kind } = value;
760
+ return kind in KIND_PARENTS && isErrorKind(kind, expected);
761
+ }
762
+ /** Whether this error is of `kind` or a kind beneath it, such as `api` for a `not-found` error. */
763
+ isKind(kind) {
764
+ return isErrorKind(this.kind, kind);
680
765
  }
681
766
  /**
682
767
  * Whether the SDK raised this error itself, with no HTTP response: before sending (an invalid
@@ -706,9 +791,283 @@ const invalidArgument = (message, details) => new CalmLensError(SDK_ERROR_CODES.
706
791
  details
707
792
  });
708
793
  const invalidConfig = (message) => new CalmLensError(SDK_ERROR_CODES.INVALID_CONFIG, { message });
794
+ /** The API, or a proxy in front of it, answered with a non-2xx status. */
795
+ var CalmLensApiError = class extends CalmLensError {
796
+ static {
797
+ this.kind = "api";
798
+ }
799
+ };
800
+ /** HTTP 400: the request was invalid. */
801
+ var CalmLensBadRequestError = class extends CalmLensApiError {
802
+ static {
803
+ this.kind = "bad-request";
804
+ }
805
+ };
806
+ /** HTTP 401: the API key is missing or invalid. */
807
+ var CalmLensAuthenticationError = class extends CalmLensApiError {
808
+ static {
809
+ this.kind = "authentication";
810
+ }
811
+ };
812
+ /** HTTP 403: the API key lacks a grant, or the viewer can't see the asset. */
813
+ var CalmLensPermissionDeniedError = class extends CalmLensApiError {
814
+ static {
815
+ this.kind = "permission-denied";
816
+ }
817
+ };
818
+ /** HTTP 404: the resource doesn't exist or isn't visible to the API key. */
819
+ var CalmLensNotFoundError = class extends CalmLensApiError {
820
+ static {
821
+ this.kind = "not-found";
822
+ }
823
+ };
824
+ /** HTTP 409: the request conflicts with the resource's state, such as a changed revision. */
825
+ var CalmLensConflictError = class extends CalmLensApiError {
826
+ static {
827
+ this.kind = "conflict";
828
+ }
829
+ };
830
+ /** HTTP 413: the content is over a size limit. */
831
+ var CalmLensPayloadTooLargeError = class extends CalmLensApiError {
832
+ static {
833
+ this.kind = "payload-too-large";
834
+ }
835
+ };
836
+ /** HTTP 422: the content can't be processed. */
837
+ var CalmLensUnprocessableEntityError = class extends CalmLensApiError {
838
+ static {
839
+ this.kind = "unprocessable-entity";
840
+ }
841
+ };
842
+ /** HTTP 429: too many requests; `retryAfter` says how long to wait. */
843
+ var CalmLensRateLimitError = class extends CalmLensApiError {
844
+ static {
845
+ this.kind = "rate-limit";
846
+ }
847
+ };
848
+ /** HTTP 500 or above: the API failed. */
849
+ var CalmLensServerError = class extends CalmLensApiError {
850
+ static {
851
+ this.kind = "server";
852
+ }
853
+ };
854
+ /** No complete response: the connection failed or was cut (`sdk/transport-error`). */
855
+ var CalmLensConnectionError = class extends CalmLensError {
856
+ static {
857
+ this.kind = "connection";
858
+ }
859
+ };
860
+ /** A request took longer than its timeout, or a wait reached its deadline (`sdk/timeout`). */
861
+ var CalmLensTimeoutError = class extends CalmLensError {
862
+ static {
863
+ this.kind = "timeout";
864
+ }
865
+ };
866
+ /** The caller cancelled the call through a signal (`sdk/cancelled`). */
867
+ var CalmLensCancelledError = class extends CalmLensError {
868
+ static {
869
+ this.kind = "cancelled";
870
+ }
871
+ };
872
+ /** The SDK refused the call before sending anything. */
873
+ var CalmLensInvalidArgumentError = class extends CalmLensError {
874
+ static {
875
+ this.kind = "invalid-argument";
876
+ }
877
+ };
878
+ /** The client's configuration is invalid (`sdk/invalid-config`, `sdk/no-fetch`). */
879
+ var CalmLensConfigurationError = class extends CalmLensInvalidArgumentError {
880
+ static {
881
+ this.kind = "configuration";
882
+ }
883
+ };
884
+ /** A response wasn't what the operation returns (`sdk/invalid-response`, `sdk/response-too-large`). */
885
+ var CalmLensInvalidResponseError = class extends CalmLensError {
886
+ static {
887
+ this.kind = "invalid-response";
888
+ }
889
+ };
890
+ /** A webhook delivery couldn't be verified or parsed. */
891
+ var CalmLensWebhookVerificationError = class extends CalmLensError {
892
+ static {
893
+ this.kind = "webhook-verification";
894
+ }
895
+ };
896
+ /** Each kind's class. */
897
+ const ERROR_CLASSES = {
898
+ error: CalmLensError,
899
+ api: CalmLensApiError,
900
+ "bad-request": CalmLensBadRequestError,
901
+ authentication: CalmLensAuthenticationError,
902
+ "permission-denied": CalmLensPermissionDeniedError,
903
+ "not-found": CalmLensNotFoundError,
904
+ conflict: CalmLensConflictError,
905
+ "payload-too-large": CalmLensPayloadTooLargeError,
906
+ "unprocessable-entity": CalmLensUnprocessableEntityError,
907
+ "rate-limit": CalmLensRateLimitError,
908
+ server: CalmLensServerError,
909
+ connection: CalmLensConnectionError,
910
+ timeout: CalmLensTimeoutError,
911
+ cancelled: CalmLensCancelledError,
912
+ "invalid-argument": CalmLensInvalidArgumentError,
913
+ configuration: CalmLensConfigurationError,
914
+ "invalid-response": CalmLensInvalidResponseError,
915
+ "webhook-verification": CalmLensWebhookVerificationError
916
+ };
917
+ // src/client/CalmLensLogging.ts
918
+ const LOG_LEVELS = [
919
+ "off",
920
+ "info",
921
+ "debug"
922
+ ];
923
+ /**
924
+ * An environment variable, in runtimes that have an environment: Node.js, Bun and Deno (with
925
+ * `--allow-env`). Cloudflare Workers and browsers have none, so it is `undefined` there.
926
+ */
927
+ const readEnv = (name) => {
928
+ const runtime = globalThis;
929
+ try {
930
+ const value = runtime.process?.env?.[name] ?? runtime.Deno?.env?.get(name);
931
+ return value === void 0 || value.trim() === "" ? void 0 : value.trim();
932
+ } catch {
933
+ return;
934
+ }
935
+ };
936
+ /** The log level: the option, else `CALMLENS_LOG` from the environment, else `off`. */
937
+ const resolveLogLevel = (option, fromEnv) => {
938
+ if (option !== void 0) {
939
+ if (!LOG_LEVELS.includes(option)) throw invalidConfig(`logLevel must be one of ${LOG_LEVELS.join(", ")}`);
940
+ return option;
941
+ }
942
+ const env = fromEnv ? readEnv("CALMLENS_LOG")?.toLowerCase() : void 0;
943
+ return LOG_LEVELS.includes(env) ? env : "off";
944
+ };
945
+ /**
946
+ * One line about an attempt: what was sent where, how it ended and what happens next. It holds no
947
+ * API key, upload token, query (which can hold viewer claims), signed URL or body.
948
+ */
949
+ const describeAttempt = (attempt) => {
950
+ const outcome = attempt.status !== null ? `HTTP ${attempt.status}` : attempt.errorCode !== null ? attempt.errorCode : "no response";
951
+ const parts = [
952
+ `[calmlens] ${attempt.operation ?? "request"} ${attempt.method} ${attempt.path}`,
953
+ `attempt ${attempt.attempt}`,
954
+ outcome,
955
+ `${attempt.durationMs}ms`
956
+ ];
957
+ if (attempt.requestId) parts.push(`request ${attempt.requestId}`);
958
+ if (attempt.delayMs !== null) parts.push(`retrying in ${attempt.delayMs}ms`);
959
+ return parts.join(" · ");
960
+ };
961
+ // src/client/CalmLensPagination.ts
962
+ /** Attaches `lastResponse` to a parsed JSON result; other values are returned unchanged. */
963
+ const withLastResponse = (value, lastResponse) => {
964
+ if (value && typeof value === "object" && !Object.isFrozen(value)) Object.defineProperty(value, "lastResponse", {
965
+ value: lastResponse,
966
+ enumerable: false,
967
+ writable: false,
968
+ configurable: true
969
+ });
970
+ return value;
971
+ };
972
+ /** `value` with `from`'s `lastResponse`, for results the SDK builds from a response. */
973
+ const copyLastResponse = (value, from) => {
974
+ const lastResponse = from?.lastResponse;
975
+ return lastResponse ? withLastResponse(value, lastResponse) : value;
976
+ };
977
+ /** The most items `autoPagingToArray` collects; iterate with `for await` for more. */
978
+ const AUTO_PAGING_TO_ARRAY_MAX = 1e4;
979
+ /**
980
+ * Iterators stop rather than loop: a page that says more follow must not hand back a cursor this
981
+ * iteration has already sent, which would repeat the same pages forever.
982
+ */
983
+ const assertNewCursor = (sent, cursor) => {
984
+ if (sent.has(cursor)) throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, {
985
+ message: "The API returned a cursor it had already returned, with more pages to follow",
986
+ details: { cursor }
987
+ });
988
+ sent.add(cursor);
989
+ };
990
+ /** The cursor each page was requested with, for iteration's repeated-cursor check. */
991
+ const requestCursors = /* @__PURE__ */ new WeakMap();
992
+ const autoPaging = (first) => {
993
+ async function* items() {
994
+ let page = await first;
995
+ const start = requestCursors.get(page);
996
+ const sent = new Set(start === void 0 ? [] : [start]);
997
+ for (;;) {
998
+ const more = page.hasNextPage();
999
+ if (more) assertNewCursor(sent, page.nextCursor);
1000
+ yield* page.items;
1001
+ if (!more) return;
1002
+ page = await page.getNextPage();
1003
+ }
1004
+ }
1005
+ return {
1006
+ [Symbol.asyncIterator]: () => items(),
1007
+ async autoPagingToArray(options) {
1008
+ const limit = options?.limit;
1009
+ if (!Number.isInteger(limit) || limit < 1 || limit > 1e4) throw invalidArgument(`autoPagingToArray needs a limit from 1 to ${AUTO_PAGING_TO_ARRAY_MAX}; iterate with for await for more`);
1010
+ const collected = [];
1011
+ for await (const item of items()) {
1012
+ collected.push(item);
1013
+ if (collected.length >= limit) break;
1014
+ }
1015
+ return collected;
1016
+ }
1017
+ };
1018
+ };
1019
+ const toListPage = (data, source, cursor) => {
1020
+ if (!data || typeof data !== "object" || !Array.isArray(data.items)) throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, { message: "The API returned a list without items" });
1021
+ const hasNextPage = () => data.hasMore === true && typeof data.nextCursor === "string" && data.nextCursor !== "" && (source.feed || data.items.length > 0);
1022
+ const page = data;
1023
+ if (cursor !== void 0) requestCursors.set(page, cursor);
1024
+ const self = Promise.resolve(page);
1025
+ const { [Symbol.asyncIterator]: iterate, autoPagingToArray } = autoPaging(self);
1026
+ Object.defineProperties(page, {
1027
+ hasNextPage: {
1028
+ value: hasNextPage,
1029
+ configurable: true
1030
+ },
1031
+ getNextPage: {
1032
+ value: () => {
1033
+ const next = data.nextCursor ?? void 0;
1034
+ return list(async () => {
1035
+ if (!hasNextPage()) throw invalidArgument("There is no next page; check hasNextPage() first");
1036
+ if (next !== void 0 && next === cursor) assertNewCursor(/* @__PURE__ */ new Set([next]), next);
1037
+ return toListPage(await source.fetchPage(next), source, next);
1038
+ });
1039
+ },
1040
+ configurable: true
1041
+ },
1042
+ autoPagingToArray: {
1043
+ value: autoPagingToArray,
1044
+ configurable: true
1045
+ },
1046
+ [Symbol.asyncIterator]: {
1047
+ value: iterate,
1048
+ configurable: true
1049
+ }
1050
+ });
1051
+ return page;
1052
+ };
1053
+ const list = (load) => {
1054
+ const first = (async () => load())();
1055
+ return Object.assign(first, autoPaging(first));
1056
+ };
1057
+ /**
1058
+ * A list call: `fetchPage` requests the page at a cursor, the first page at `cursor` (which may
1059
+ * be `undefined`). Failures, including invalid options, reject the promise.
1060
+ */
1061
+ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
1062
+ const source = {
1063
+ fetchPage,
1064
+ feed
1065
+ };
1066
+ return list(async () => toListPage(await fetchPage(cursor), source, cursor));
1067
+ };
709
1068
  // src/client/CalmLensVersion.ts
710
1069
  /** This SDK's version, from its package.json. */
711
- const SDK_VERSION = "0.25.0";
1070
+ const SDK_VERSION = "0.26.1";
712
1071
  const runtimeName = () => {
713
1072
  const runtime = globalThis;
714
1073
  if (isReactNativeRuntime()) return "react-native";
@@ -718,8 +1077,15 @@ const runtimeName = () => {
718
1077
  if (runtime.process?.versions?.node) return `node/${runtime.process.versions.node}`;
719
1078
  return "unknown";
720
1079
  };
721
- /** The `User-Agent` the SDK sends from server runtimes, e.g. `calmlens-js/0.10.0 (node/22.12.0)`. */
722
- const getUserAgent = () => `calmlens-js/${SDK_VERSION} (${runtimeName()})`;
1080
+ /**
1081
+ * The `User-Agent` the SDK sends from server runtimes, e.g. `calmlens-js/0.10.0 (node/22.12.0)`,
1082
+ * followed by the app's `name/version (url)` when `appInfo` names it.
1083
+ */
1084
+ const getUserAgent = (appInfo) => {
1085
+ const sdk = `calmlens-js/${SDK_VERSION} (${runtimeName()})`;
1086
+ if (!appInfo) return sdk;
1087
+ return `${sdk} ${appInfo.version ? `${appInfo.name}/${appInfo.version}` : appInfo.name}${appInfo.url ? ` (${appInfo.url})` : ""}`;
1088
+ };
723
1089
  /** True in a web page, where API keys would be visible to every visitor. */
724
1090
  const isBrowserRuntime = () => typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined";
725
1091
  /** True in a React Native app, where an API key ships inside the app for anyone to extract. */
@@ -871,6 +1237,7 @@ const responseInfo = (response) => ({
871
1237
  });
872
1238
  /** The `CalmLensError` for a non-2xx response whose body has been read. */
873
1239
  const toHttpError = (response, bytes) => {
1240
+ const body = new TextDecoder().decode(bytes.subarray(0, MAX_ERROR_BODY_LENGTH * 4)).slice(0, MAX_ERROR_BODY_LENGTH);
874
1241
  let data;
875
1242
  try {
876
1243
  data = JSON.parse(new TextDecoder().decode(bytes));
@@ -882,14 +1249,24 @@ const toHttpError = (response, bytes) => {
882
1249
  message: message ?? code,
883
1250
  ...info,
884
1251
  requestId: info.requestId ?? (typeof requestId === "string" ? requestId : void 0),
885
- details
1252
+ details,
1253
+ body
886
1254
  });
887
1255
  }
888
1256
  return new CalmLensError(SDK_ERROR_CODES.HTTP_ERROR, {
889
1257
  message: `HTTP ${response.status}`,
890
- ...responseInfo(response)
1258
+ ...responseInfo(response),
1259
+ body
891
1260
  });
892
1261
  };
1262
+ /** A URL's path without its query, which can hold viewer claims, for hooks and logs. */
1263
+ const pathOf = (url) => {
1264
+ try {
1265
+ return new URL(url).pathname;
1266
+ } catch {
1267
+ return url.split(/[?#]/)[0] ?? "";
1268
+ }
1269
+ };
893
1270
  /** Sends requests with the client's credentials, deadlines, retries and response limits. */
894
1271
  var CalmLensTransport = class {
895
1272
  constructor(settings) {
@@ -901,12 +1278,42 @@ var CalmLensTransport = class {
901
1278
  for (const [name, value] of Object.entries(request.headers ?? {})) headers.set(name, value);
902
1279
  if (!headers.has("accept") && request.deadline === "body") headers.set("accept", "application/json");
903
1280
  if (this.settings.apiKey) headers.set("x-api-key", this.settings.apiKey);
904
- if (!isBrowserRuntime()) headers.set("user-agent", getUserAgent());
1281
+ if (!isBrowserRuntime()) headers.set("user-agent", getUserAgent(this.settings.appInfo));
905
1282
  if (request.idempotencyKey) headers.set("idempotency-key", request.idempotencyKey);
906
1283
  return Object.fromEntries(headers.entries());
907
1284
  }
1285
+ /** Waits before a retry. Either the client's or the request's signal cancels the wait. */
1286
+ async backoff(ms, request) {
1287
+ const callers = createAttemptSignal(this.signalsFor(request), void 0);
1288
+ try {
1289
+ await this.sleep(ms, callers.signal);
1290
+ } finally {
1291
+ callers.release();
1292
+ }
1293
+ }
1294
+ signalsFor(request) {
1295
+ return [
1296
+ this.settings.signal,
1297
+ request.signal,
1298
+ request.init?.signal ?? void 0
1299
+ ];
1300
+ }
1301
+ maxRetriesFor(request) {
1302
+ return request.maxRetries ?? this.settings.maxRetries;
1303
+ }
1304
+ /** Tells the hook and the logger how an attempt went. Neither ever sees a key or a body. */
1305
+ report(attempt) {
1306
+ const { onAttempt, logger, logLevel } = this.settings;
1307
+ try {
1308
+ onAttempt?.(attempt);
1309
+ } catch {}
1310
+ if (!logger || !logLevel || logLevel === "off") return;
1311
+ const failed = attempt.status === null || attempt.status >= 400;
1312
+ if (logLevel === "debug") logger.debug(describeAttempt(attempt));
1313
+ else if (attempt.delayMs !== null || failed) logger.info(describeAttempt(attempt));
1314
+ }
908
1315
  canRetry(request) {
909
- return this.settings.maxRetries > 0 && (request.method === "GET" || request.method === "HEAD" || !!request.idempotencyKey) && isReplayableBody(request.body);
1316
+ return this.maxRetriesFor(request) > 0 && (request.method === "GET" || request.method === "HEAD" || !!request.idempotencyKey) && isReplayableBody(request.body);
910
1317
  }
911
1318
  /**
912
1319
  * Sends a request and returns the response, retrying transport failures, timeouts, 429, 500, 502–504 and
@@ -917,9 +1324,23 @@ var CalmLensTransport = class {
917
1324
  const fetchImpl = request.fetch ?? this.settings.fetch;
918
1325
  const retryable = this.canRetry(request);
919
1326
  const headers = this.headersFor(request);
1327
+ const now = this.settings.now ?? Date.now;
1328
+ const path = pathOf(request.url);
920
1329
  for (let attemptNumber = 0;; attemptNumber++) {
921
- const canRetryAgain = retryable && attemptNumber < this.settings.maxRetries;
922
- const attempt = createAttemptSignal([this.settings.signal, request.init?.signal ?? void 0], request.timeoutMs);
1330
+ const canRetryAgain = retryable && attemptNumber < this.maxRetriesFor(request);
1331
+ const attempt = createAttemptSignal(this.signalsFor(request), request.timeoutMs);
1332
+ const started = now();
1333
+ const report = (outcome, delayMs) => this.report({
1334
+ operation: request.operation ?? null,
1335
+ method: request.method,
1336
+ path,
1337
+ attempt: attemptNumber + 1,
1338
+ delayMs,
1339
+ status: outcome.response?.status ?? outcome.error?.status ?? null,
1340
+ requestId: outcome.response?.headers.get("x-request-id") ?? outcome.error?.requestId ?? null,
1341
+ durationMs: Math.max(0, now() - started),
1342
+ errorCode: outcome.error?.code ?? null
1343
+ });
923
1344
  let response;
924
1345
  try {
925
1346
  if (attempt.signal.aborted) throw attempt.signal.reason;
@@ -944,26 +1365,36 @@ var CalmLensTransport = class {
944
1365
  attempt.release();
945
1366
  const failure = toFailure(cause, attempt);
946
1367
  if (canRetryAgain && failure.isRetryable()) {
947
- await this.sleep(getRetryDelayMs(attemptNumber), this.settings.signal);
1368
+ const delayMs = getRetryDelayMs(attemptNumber);
1369
+ report({ error: failure }, delayMs);
1370
+ await this.backoff(delayMs, request);
948
1371
  continue;
949
1372
  }
1373
+ report({ error: failure }, null);
950
1374
  throw failure;
951
1375
  }
952
1376
  if (request.deadline === "headers") attempt.clearDeadline();
953
- if (response.ok) return {
954
- response,
955
- attempt
956
- };
957
- if (allowHttpErrors) {
958
- const retryAfter = parseRetryAfter(response.headers.get("retry-after"));
959
- const delayMs = retryAfter !== void 0 ? retryAfter * 1e3 : getRetryDelayMs(attemptNumber);
960
- if (!canRetryAgain || !RETRYABLE_STATUSES.has(response.status) || delayMs > 6e4) return {
1377
+ if (response.ok) {
1378
+ report({ response }, null);
1379
+ return {
961
1380
  response,
962
1381
  attempt
963
1382
  };
1383
+ }
1384
+ if (allowHttpErrors) {
1385
+ const retryAfter = parseRetryAfter(response.headers.get("retry-after"));
1386
+ const delayMs = retryAfter !== void 0 ? retryAfter * 1e3 : getRetryDelayMs(attemptNumber);
1387
+ if (!canRetryAgain || !RETRYABLE_STATUSES.has(response.status) || delayMs > 6e4) {
1388
+ report({ response }, null);
1389
+ return {
1390
+ response,
1391
+ attempt
1392
+ };
1393
+ }
1394
+ report({ response }, delayMs);
964
1395
  attempt.release();
965
1396
  await response.body?.cancel().catch(() => {});
966
- await this.sleep(delayMs, this.settings.signal);
1397
+ await this.backoff(delayMs, request);
967
1398
  continue;
968
1399
  }
969
1400
  let error;
@@ -976,20 +1407,26 @@ var CalmLensTransport = class {
976
1407
  }
977
1408
  const retryDelayMs = error.retryAfter !== void 0 ? error.retryAfter * 1e3 : getRetryDelayMs(attemptNumber);
978
1409
  if (canRetryAgain && retryDelayMs <= 6e4 && error.isRetryable()) {
979
- await this.sleep(retryDelayMs, this.settings.signal);
1410
+ report({ error }, retryDelayMs);
1411
+ await this.backoff(retryDelayMs, request);
980
1412
  continue;
981
1413
  }
1414
+ report({ error }, null);
982
1415
  throw error;
983
1416
  }
984
1417
  }
985
- /** Sends a request and parses its JSON response body. */
1418
+ /**
1419
+ * Sends a request and parses its JSON response body. An object or array result carries the
1420
+ * response's status, request ID and headers as its non-enumerable `lastResponse`.
1421
+ */
986
1422
  async json(request) {
987
1423
  const { response, attempt } = await this.send(request);
988
1424
  try {
989
1425
  const bytes = await readBody(response, this.settings.maxResponseBytes);
990
1426
  if (bytes.byteLength === 0 && (response.status === 204 || request.method === "DELETE")) return;
1427
+ let data;
991
1428
  try {
992
- return JSON.parse(new TextDecoder().decode(bytes));
1429
+ data = JSON.parse(new TextDecoder().decode(bytes));
993
1430
  } catch (cause) {
994
1431
  throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, {
995
1432
  message: `Invalid JSON response (HTTP ${response.status})`,
@@ -997,6 +1434,12 @@ var CalmLensTransport = class {
997
1434
  cause
998
1435
  });
999
1436
  }
1437
+ return withLastResponse(data, {
1438
+ status: response.status,
1439
+ requestId: response.headers.get("x-request-id") ?? void 0,
1440
+ headers: response.headers,
1441
+ idempotencyKey: request.idempotencyKey
1442
+ });
1000
1443
  } catch (cause) {
1001
1444
  throw toFailure(cause, attempt);
1002
1445
  } finally {
@@ -1411,6 +1854,10 @@ const validateConnectionOptions = (options) => {
1411
1854
  if (partSizeBytes !== void 0 && (!Number.isSafeInteger(partSizeBytes) || partSizeBytes < 5242880 || partSizeBytes > 67108864)) throw invalidConfig("partSizeBytes must be an integer from 5 MiB (5242880) to 64 MiB (67108864)");
1412
1855
  for (const name of ["fetch", "uploadFetch"]) if (options[name] !== void 0 && typeof options[name] !== "function") throw invalidConfig(`${name} must be a function`);
1413
1856
  assertHttpUrl("baseUrl", options.baseUrl);
1857
+ const { appInfo, onAttempt, logger } = options;
1858
+ if (appInfo !== void 0 && (!appInfo || typeof appInfo.name !== "string" || !/^[\x21-\x7e]+$/.test(appInfo.name) || appInfo.version !== void 0 && !/^[\x21-\x7e]+$/.test(String(appInfo.version)) || appInfo.url !== void 0 && !/^[\x20-\x7e]+$/.test(String(appInfo.url)))) throw invalidConfig("appInfo needs a name, and a version, without spaces, and a url, in printable ASCII");
1859
+ if (onAttempt !== void 0 && typeof onAttempt !== "function") throw invalidConfig("onAttempt must be a function");
1860
+ if (logger !== void 0 && (!logger || typeof logger.debug !== "function" || typeof logger.info !== "function")) throw invalidConfig("logger must have debug and info methods, as console does");
1414
1861
  };
1415
1862
  /**
1416
1863
  * Checks server client options before the client sets anything up. `CalmLensServerClient` and
@@ -1437,7 +1884,7 @@ const validateAppClientOptions = (options) => {
1437
1884
  if (options.token !== void 0 && typeof options.token !== "string" && typeof options.token !== "function") throw invalidConfig("token must be a string or a function that returns one");
1438
1885
  validateConnectionOptions(options);
1439
1886
  };
1440
- /** Checks the options `withRequestOptions` accepts. */
1887
+ /** Checks a client's request defaults. */
1441
1888
  const validateRequestOptions = (options) => {
1442
1889
  assertInteger("timeoutMs", options.timeoutMs, 1);
1443
1890
  assertInteger("uploadTimeoutMs", options.uploadTimeoutMs, 1);
@@ -1735,11 +2182,11 @@ const pollForDecision = async (retrieve, { timeoutMs = DEFAULT_DECISION_TIMEOUT_
1735
2182
  if (isAssetDecided(asset)) return asset;
1736
2183
  const remaining = deadline - now();
1737
2184
  if (remaining <= 0) throw new CalmLensError(SDK_ERROR_CODES.TIMEOUT, {
1738
- message: `Asset ${asset.id} had no moderation decision after ${timeoutMs}ms (classification status: ${asset.classification.status}, moderation status: ${asset.classification.moderation.status})`,
2185
+ message: `Asset ${asset.id} had no moderation decision after ${timeoutMs}ms (classification status: ${asset.classification.status}, moderation decision: ${asset.classification.moderation.decision})`,
1739
2186
  details: {
1740
2187
  assetId: asset.id,
1741
2188
  classificationStatus: asset.classification.status,
1742
- moderationStatus: asset.classification.moderation.status
2189
+ moderationDecision: asset.classification.moderation.decision
1743
2190
  }
1744
2191
  });
1745
2192
  await sleep(Math.min(delay, remaining), signal);
@@ -1949,4 +2396,387 @@ const selectModerationContextItems = (items) => {
1949
2396
  }
1950
2397
  return selected;
1951
2398
  };
1952
- export { getRejectedUploadMimeTypeError as A, invalidArgument as B, validateBatchAssetsOptions as C, MAX_DIRECT_IMAGE_UPLOAD_BYTES as D, DOMAIN as E, isBrowserRuntime as F, API_ERROR_CODES as H, isReactNativeRuntime as I, CALMLENS_ERROR_CODES as L, CalmLensTransport as M, sleep as N, MAX_IMAGE_UPLOAD_BYTES as O, SDK_VERSION as P, CalmLensError as R, validateAppClientOptions as S, validateServerClientOptions as T, API_ERROR_DEFINITIONS as U, invalidConfig as V, randomUuid as _, appendAssetLocation as a, toTextAssetOptions as b, toUrlViewerClaims as c, checkOptionKeys as d, checkTransformOptions as f, pollForDecision as g, parseTransformSelector as h, CDN_RESOURCES as i, normalizeUploadMimeType as j, MAX_NON_IMAGE_UPLOAD_BYTES as k, validateSignAssetUrlOptions as l, isAcceptedUploadMimeType as m, MODERATION_CONTEXT_USED_ITEMS as n, buildAssetUrl as o, encodePathSegment as p, selectModerationContextItems as r, getAssetInfo as s, MODERATION_CONTEXT_USED_CHARACTERS as t, DEFAULT_CDN_BASE_URL as u, serializeTransform as v, validateRequestOptions as w, transformSelector as x, stringifyQuery as y, SDK_ERROR_CODES as z };
2399
+ Object.defineProperty(exports, "API_ERROR_CODES", {
2400
+ enumerable: true,
2401
+ get: function() {
2402
+ return API_ERROR_CODES;
2403
+ }
2404
+ });
2405
+ Object.defineProperty(exports, "API_ERROR_DEFINITIONS", {
2406
+ enumerable: true,
2407
+ get: function() {
2408
+ return API_ERROR_DEFINITIONS;
2409
+ }
2410
+ });
2411
+ Object.defineProperty(exports, "AUTO_PAGING_TO_ARRAY_MAX", {
2412
+ enumerable: true,
2413
+ get: function() {
2414
+ return AUTO_PAGING_TO_ARRAY_MAX;
2415
+ }
2416
+ });
2417
+ Object.defineProperty(exports, "CALMLENS_ERROR_CODES", {
2418
+ enumerable: true,
2419
+ get: function() {
2420
+ return CALMLENS_ERROR_CODES;
2421
+ }
2422
+ });
2423
+ Object.defineProperty(exports, "CDN_RESOURCES", {
2424
+ enumerable: true,
2425
+ get: function() {
2426
+ return CDN_RESOURCES;
2427
+ }
2428
+ });
2429
+ Object.defineProperty(exports, "CalmLensApiError", {
2430
+ enumerable: true,
2431
+ get: function() {
2432
+ return CalmLensApiError;
2433
+ }
2434
+ });
2435
+ Object.defineProperty(exports, "CalmLensAuthenticationError", {
2436
+ enumerable: true,
2437
+ get: function() {
2438
+ return CalmLensAuthenticationError;
2439
+ }
2440
+ });
2441
+ Object.defineProperty(exports, "CalmLensBadRequestError", {
2442
+ enumerable: true,
2443
+ get: function() {
2444
+ return CalmLensBadRequestError;
2445
+ }
2446
+ });
2447
+ Object.defineProperty(exports, "CalmLensCancelledError", {
2448
+ enumerable: true,
2449
+ get: function() {
2450
+ return CalmLensCancelledError;
2451
+ }
2452
+ });
2453
+ Object.defineProperty(exports, "CalmLensConfigurationError", {
2454
+ enumerable: true,
2455
+ get: function() {
2456
+ return CalmLensConfigurationError;
2457
+ }
2458
+ });
2459
+ Object.defineProperty(exports, "CalmLensConflictError", {
2460
+ enumerable: true,
2461
+ get: function() {
2462
+ return CalmLensConflictError;
2463
+ }
2464
+ });
2465
+ Object.defineProperty(exports, "CalmLensConnectionError", {
2466
+ enumerable: true,
2467
+ get: function() {
2468
+ return CalmLensConnectionError;
2469
+ }
2470
+ });
2471
+ Object.defineProperty(exports, "CalmLensError", {
2472
+ enumerable: true,
2473
+ get: function() {
2474
+ return CalmLensError;
2475
+ }
2476
+ });
2477
+ Object.defineProperty(exports, "CalmLensInvalidArgumentError", {
2478
+ enumerable: true,
2479
+ get: function() {
2480
+ return CalmLensInvalidArgumentError;
2481
+ }
2482
+ });
2483
+ Object.defineProperty(exports, "CalmLensInvalidResponseError", {
2484
+ enumerable: true,
2485
+ get: function() {
2486
+ return CalmLensInvalidResponseError;
2487
+ }
2488
+ });
2489
+ Object.defineProperty(exports, "CalmLensNotFoundError", {
2490
+ enumerable: true,
2491
+ get: function() {
2492
+ return CalmLensNotFoundError;
2493
+ }
2494
+ });
2495
+ Object.defineProperty(exports, "CalmLensPayloadTooLargeError", {
2496
+ enumerable: true,
2497
+ get: function() {
2498
+ return CalmLensPayloadTooLargeError;
2499
+ }
2500
+ });
2501
+ Object.defineProperty(exports, "CalmLensPermissionDeniedError", {
2502
+ enumerable: true,
2503
+ get: function() {
2504
+ return CalmLensPermissionDeniedError;
2505
+ }
2506
+ });
2507
+ Object.defineProperty(exports, "CalmLensRateLimitError", {
2508
+ enumerable: true,
2509
+ get: function() {
2510
+ return CalmLensRateLimitError;
2511
+ }
2512
+ });
2513
+ Object.defineProperty(exports, "CalmLensServerError", {
2514
+ enumerable: true,
2515
+ get: function() {
2516
+ return CalmLensServerError;
2517
+ }
2518
+ });
2519
+ Object.defineProperty(exports, "CalmLensTimeoutError", {
2520
+ enumerable: true,
2521
+ get: function() {
2522
+ return CalmLensTimeoutError;
2523
+ }
2524
+ });
2525
+ Object.defineProperty(exports, "CalmLensTransport", {
2526
+ enumerable: true,
2527
+ get: function() {
2528
+ return CalmLensTransport;
2529
+ }
2530
+ });
2531
+ Object.defineProperty(exports, "CalmLensUnprocessableEntityError", {
2532
+ enumerable: true,
2533
+ get: function() {
2534
+ return CalmLensUnprocessableEntityError;
2535
+ }
2536
+ });
2537
+ Object.defineProperty(exports, "CalmLensWebhookVerificationError", {
2538
+ enumerable: true,
2539
+ get: function() {
2540
+ return CalmLensWebhookVerificationError;
2541
+ }
2542
+ });
2543
+ Object.defineProperty(exports, "DEFAULT_CDN_BASE_URL", {
2544
+ enumerable: true,
2545
+ get: function() {
2546
+ return DEFAULT_CDN_BASE_URL;
2547
+ }
2548
+ });
2549
+ Object.defineProperty(exports, "DOMAIN", {
2550
+ enumerable: true,
2551
+ get: function() {
2552
+ return DOMAIN;
2553
+ }
2554
+ });
2555
+ Object.defineProperty(exports, "MAX_DIRECT_IMAGE_UPLOAD_BYTES", {
2556
+ enumerable: true,
2557
+ get: function() {
2558
+ return MAX_DIRECT_IMAGE_UPLOAD_BYTES;
2559
+ }
2560
+ });
2561
+ Object.defineProperty(exports, "MAX_IMAGE_UPLOAD_BYTES", {
2562
+ enumerable: true,
2563
+ get: function() {
2564
+ return MAX_IMAGE_UPLOAD_BYTES;
2565
+ }
2566
+ });
2567
+ Object.defineProperty(exports, "MAX_NON_IMAGE_UPLOAD_BYTES", {
2568
+ enumerable: true,
2569
+ get: function() {
2570
+ return MAX_NON_IMAGE_UPLOAD_BYTES;
2571
+ }
2572
+ });
2573
+ Object.defineProperty(exports, "MODERATION_CONTEXT_USED_CHARACTERS", {
2574
+ enumerable: true,
2575
+ get: function() {
2576
+ return MODERATION_CONTEXT_USED_CHARACTERS;
2577
+ }
2578
+ });
2579
+ Object.defineProperty(exports, "MODERATION_CONTEXT_USED_ITEMS", {
2580
+ enumerable: true,
2581
+ get: function() {
2582
+ return MODERATION_CONTEXT_USED_ITEMS;
2583
+ }
2584
+ });
2585
+ Object.defineProperty(exports, "SDK_ERROR_CODES", {
2586
+ enumerable: true,
2587
+ get: function() {
2588
+ return SDK_ERROR_CODES;
2589
+ }
2590
+ });
2591
+ Object.defineProperty(exports, "SDK_VERSION", {
2592
+ enumerable: true,
2593
+ get: function() {
2594
+ return SDK_VERSION;
2595
+ }
2596
+ });
2597
+ Object.defineProperty(exports, "appendAssetLocation", {
2598
+ enumerable: true,
2599
+ get: function() {
2600
+ return appendAssetLocation;
2601
+ }
2602
+ });
2603
+ Object.defineProperty(exports, "buildAssetUrl", {
2604
+ enumerable: true,
2605
+ get: function() {
2606
+ return buildAssetUrl;
2607
+ }
2608
+ });
2609
+ Object.defineProperty(exports, "checkOptionKeys", {
2610
+ enumerable: true,
2611
+ get: function() {
2612
+ return checkOptionKeys;
2613
+ }
2614
+ });
2615
+ Object.defineProperty(exports, "checkTransformOptions", {
2616
+ enumerable: true,
2617
+ get: function() {
2618
+ return checkTransformOptions;
2619
+ }
2620
+ });
2621
+ Object.defineProperty(exports, "copyLastResponse", {
2622
+ enumerable: true,
2623
+ get: function() {
2624
+ return copyLastResponse;
2625
+ }
2626
+ });
2627
+ Object.defineProperty(exports, "encodePathSegment", {
2628
+ enumerable: true,
2629
+ get: function() {
2630
+ return encodePathSegment;
2631
+ }
2632
+ });
2633
+ Object.defineProperty(exports, "getAssetInfo", {
2634
+ enumerable: true,
2635
+ get: function() {
2636
+ return getAssetInfo;
2637
+ }
2638
+ });
2639
+ Object.defineProperty(exports, "getRejectedUploadMimeTypeError", {
2640
+ enumerable: true,
2641
+ get: function() {
2642
+ return getRejectedUploadMimeTypeError;
2643
+ }
2644
+ });
2645
+ Object.defineProperty(exports, "invalidArgument", {
2646
+ enumerable: true,
2647
+ get: function() {
2648
+ return invalidArgument;
2649
+ }
2650
+ });
2651
+ Object.defineProperty(exports, "invalidConfig", {
2652
+ enumerable: true,
2653
+ get: function() {
2654
+ return invalidConfig;
2655
+ }
2656
+ });
2657
+ Object.defineProperty(exports, "isAcceptedUploadMimeType", {
2658
+ enumerable: true,
2659
+ get: function() {
2660
+ return isAcceptedUploadMimeType;
2661
+ }
2662
+ });
2663
+ Object.defineProperty(exports, "isBrowserRuntime", {
2664
+ enumerable: true,
2665
+ get: function() {
2666
+ return isBrowserRuntime;
2667
+ }
2668
+ });
2669
+ Object.defineProperty(exports, "isReactNativeRuntime", {
2670
+ enumerable: true,
2671
+ get: function() {
2672
+ return isReactNativeRuntime;
2673
+ }
2674
+ });
2675
+ Object.defineProperty(exports, "listPages", {
2676
+ enumerable: true,
2677
+ get: function() {
2678
+ return listPages;
2679
+ }
2680
+ });
2681
+ Object.defineProperty(exports, "normalizeUploadMimeType", {
2682
+ enumerable: true,
2683
+ get: function() {
2684
+ return normalizeUploadMimeType;
2685
+ }
2686
+ });
2687
+ Object.defineProperty(exports, "parseTransformSelector", {
2688
+ enumerable: true,
2689
+ get: function() {
2690
+ return parseTransformSelector;
2691
+ }
2692
+ });
2693
+ Object.defineProperty(exports, "pollForDecision", {
2694
+ enumerable: true,
2695
+ get: function() {
2696
+ return pollForDecision;
2697
+ }
2698
+ });
2699
+ Object.defineProperty(exports, "randomUuid", {
2700
+ enumerable: true,
2701
+ get: function() {
2702
+ return randomUuid;
2703
+ }
2704
+ });
2705
+ Object.defineProperty(exports, "readEnv", {
2706
+ enumerable: true,
2707
+ get: function() {
2708
+ return readEnv;
2709
+ }
2710
+ });
2711
+ Object.defineProperty(exports, "resolveLogLevel", {
2712
+ enumerable: true,
2713
+ get: function() {
2714
+ return resolveLogLevel;
2715
+ }
2716
+ });
2717
+ Object.defineProperty(exports, "selectModerationContextItems", {
2718
+ enumerable: true,
2719
+ get: function() {
2720
+ return selectModerationContextItems;
2721
+ }
2722
+ });
2723
+ Object.defineProperty(exports, "serializeTransform", {
2724
+ enumerable: true,
2725
+ get: function() {
2726
+ return serializeTransform;
2727
+ }
2728
+ });
2729
+ Object.defineProperty(exports, "sleep", {
2730
+ enumerable: true,
2731
+ get: function() {
2732
+ return sleep;
2733
+ }
2734
+ });
2735
+ Object.defineProperty(exports, "stringifyQuery", {
2736
+ enumerable: true,
2737
+ get: function() {
2738
+ return stringifyQuery;
2739
+ }
2740
+ });
2741
+ Object.defineProperty(exports, "toTextAssetOptions", {
2742
+ enumerable: true,
2743
+ get: function() {
2744
+ return toTextAssetOptions;
2745
+ }
2746
+ });
2747
+ Object.defineProperty(exports, "toUrlViewerClaims", {
2748
+ enumerable: true,
2749
+ get: function() {
2750
+ return toUrlViewerClaims;
2751
+ }
2752
+ });
2753
+ Object.defineProperty(exports, "transformSelector", {
2754
+ enumerable: true,
2755
+ get: function() {
2756
+ return transformSelector;
2757
+ }
2758
+ });
2759
+ Object.defineProperty(exports, "validateAppClientOptions", {
2760
+ enumerable: true,
2761
+ get: function() {
2762
+ return validateAppClientOptions;
2763
+ }
2764
+ });
2765
+ Object.defineProperty(exports, "validateBatchAssetsOptions", {
2766
+ enumerable: true,
2767
+ get: function() {
2768
+ return validateBatchAssetsOptions;
2769
+ }
2770
+ });
2771
+ Object.defineProperty(exports, "validateServerClientOptions", {
2772
+ enumerable: true,
2773
+ get: function() {
2774
+ return validateServerClientOptions;
2775
+ }
2776
+ });
2777
+ Object.defineProperty(exports, "validateSignAssetUrlOptions", {
2778
+ enumerable: true,
2779
+ get: function() {
2780
+ return validateSignAssetUrlOptions;
2781
+ }
2782
+ });