autumn-js 1.4.55 → 1.5.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 (44) hide show
  1. package/dist/backend/adapters/express.js +38 -34
  2. package/dist/backend/adapters/express.mjs +8 -8
  3. package/dist/backend/adapters/fetch.js +38 -34
  4. package/dist/backend/adapters/fetch.mjs +8 -8
  5. package/dist/backend/adapters/hono.js +38 -34
  6. package/dist/backend/adapters/hono.mjs +8 -8
  7. package/dist/backend/adapters/index.js +38 -34
  8. package/dist/backend/adapters/index.mjs +11 -11
  9. package/dist/backend/adapters/next.js +38 -34
  10. package/dist/backend/adapters/next.mjs +8 -8
  11. package/dist/backend/{chunk-N2SCUJPL.mjs → chunk-CWKKSAVY.mjs} +4 -4
  12. package/dist/backend/{chunk-6X4JZECX.mjs → chunk-HIP3ARPK.mjs} +1 -1
  13. package/dist/backend/{chunk-EVPPOVX5.mjs → chunk-HMBEOO4M.mjs} +6 -6
  14. package/dist/backend/{chunk-XIBFK5EL.mjs → chunk-ISGN4ETP.mjs} +1 -1
  15. package/dist/backend/{chunk-EUR3CZTF.mjs → chunk-KIHR5PMZ.mjs} +1 -1
  16. package/dist/backend/{chunk-QPDWSMZ5.mjs → chunk-R42SWVEA.mjs} +1 -1
  17. package/dist/backend/{chunk-L4HKBZCC.mjs → chunk-SB3DRXHF.mjs} +38 -34
  18. package/dist/backend/core/handlers/coreHandler.js +38 -34
  19. package/dist/backend/core/handlers/coreHandler.mjs +6 -6
  20. package/dist/backend/core/handlers/executeRoute.mjs +4 -4
  21. package/dist/backend/core/handlers/handleRouteByName.js +38 -34
  22. package/dist/backend/core/handlers/handleRouteByName.mjs +6 -6
  23. package/dist/backend/core/handlers/index.js +38 -34
  24. package/dist/backend/core/handlers/index.mjs +10 -10
  25. package/dist/backend/core/index.js +38 -34
  26. package/dist/backend/core/index.mjs +9 -9
  27. package/dist/backend/core/routes/index.mjs +1 -1
  28. package/dist/backend/core/routes/routeConfigs.mjs +1 -1
  29. package/dist/backend/core/utils/index.mjs +3 -3
  30. package/dist/backend/index.js +38 -34
  31. package/dist/backend/index.mjs +9 -9
  32. package/dist/better-auth/{chunk-44MLRR2L.mjs → chunk-TWKUSKM4.mjs} +38 -34
  33. package/dist/better-auth/index.js +38 -34
  34. package/dist/better-auth/index.mjs +1 -1
  35. package/dist/better-auth/utils/handleBetterAuthRoute.js +38 -34
  36. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +1 -1
  37. package/dist/better-auth/utils/index.js +38 -34
  38. package/dist/better-auth/utils/index.mjs +1 -1
  39. package/dist/sdk/index.d.mts +2 -2
  40. package/dist/sdk/index.d.ts +2 -2
  41. package/dist/sdk/index.js +38 -34
  42. package/dist/sdk/index.mjs +38 -34
  43. package/package.json +2 -2
  44. package/dist/backend/{chunk-MOHYGUMA.mjs → chunk-IXUCY7AU.mjs} +3 -3
@@ -77,10 +77,10 @@ function serverURLFromOptions(options) {
77
77
  }
78
78
  var SDK_METADATA = {
79
79
  language: "typescript",
80
- openapiDocVersion: "2.5.0",
80
+ openapiDocVersion: "2.6.0",
81
81
  sdkVersion: "0.10.18",
82
82
  genVersion: "2.884.13",
83
- userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.5.0 @useautumn/sdk"
83
+ userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.6.0 @useautumn/sdk"
84
84
  };
85
85
 
86
86
  // ../sdk/src/lib/http.ts
@@ -850,7 +850,7 @@ function dlv(obj, key, def, p, undef) {
850
850
  // ../sdk/src/lib/env.ts
851
851
  var envSchema = z5.object({
852
852
  AUTUMN_SECRET_KEY: z5.optional(z5.string()),
853
- AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.5.0"),
853
+ AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.6.0"),
854
854
  AUTUMN_FAIL_OPEN: z5.pipe(
855
855
  z5._default(z5.enum(["true", "false"]), "true"),
856
856
  z5.transform((v) => v === "true")
@@ -59962,30 +59962,8 @@ var edgeHTTPClientOf = ({
59962
59962
  return edgeClient;
59963
59963
  };
59964
59964
 
59965
- // ../sdk/src/hooks/edge/edgeOperations.ts
59966
- var EDGE_OPERATIONS = {
59967
- check: {
59968
- isWrite: (body) => body.send_event === true || body.lock !== void 0
59969
- }
59970
- };
59971
- var parseBody = (body) => {
59972
- if (typeof body !== "string") return {};
59973
- try {
59974
- return JSON.parse(body);
59975
- } catch {
59976
- return {};
59977
- }
59978
- };
59979
- var isEdgeOperation = ({
59980
- operationID,
59981
- body
59982
- }) => {
59983
- const operation = EDGE_OPERATIONS[operationID];
59984
- if (!operation) return false;
59985
- return !operation.isWrite?.(parseBody(body));
59986
- };
59987
-
59988
59965
  // ../sdk/src/hooks/edge/edgeHook.ts
59966
+ var EDGE_OPERATION_IDS = /* @__PURE__ */ new Set(["check"]);
59989
59967
  var EdgeHook = class {
59990
59968
  sdkInit(opts) {
59991
59969
  const bases = edgeBasesOf({ options: opts });
@@ -59997,11 +59975,7 @@ var EdgeHook = class {
59997
59975
  const options = hookCtx.options;
59998
59976
  const bases = edgeBasesOf({ options });
59999
59977
  if (!options.useEdge || !bases) return input;
60000
- if (!isEdgeOperation({
60001
- operationID: hookCtx.operationID,
60002
- body: input.options?.body
60003
- }))
60004
- return input;
59978
+ if (!EDGE_OPERATION_IDS.has(hookCtx.operationID)) return input;
60005
59979
  const edgeURL = rebaseURL({
60006
59980
  url: input.url,
60007
59981
  from: bases.autumn,
@@ -60081,6 +60055,36 @@ var FailOpenHook = class {
60081
60055
  }
60082
60056
  };
60083
60057
 
60058
+ // ../sdk/src/hooks/idempotencyKeyHook.ts
60059
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
60060
+ var isWriteCheck = ({
60061
+ operationID,
60062
+ body
60063
+ }) => {
60064
+ if (operationID !== "check" || typeof body !== "string") return false;
60065
+ try {
60066
+ const sent = JSON.parse(body);
60067
+ return sent.send_event === true || sent.lock !== void 0;
60068
+ } catch {
60069
+ return false;
60070
+ }
60071
+ };
60072
+ var IdempotencyKeyHook = class {
60073
+ beforeCreateRequest(hookCtx, input) {
60074
+ const options = hookCtx.options;
60075
+ if (!options.useEdge) return input;
60076
+ if (!isWriteCheck({
60077
+ operationID: hookCtx.operationID,
60078
+ body: input.options?.body
60079
+ }))
60080
+ return input;
60081
+ const headers = new Headers(input.options?.headers);
60082
+ if (headers.has(IDEMPOTENCY_KEY_HEADER)) return input;
60083
+ headers.set(IDEMPOTENCY_KEY_HEADER, crypto.randomUUID());
60084
+ return { ...input, options: { ...input.options, headers } };
60085
+ }
60086
+ };
60087
+
60084
60088
  // ../sdk/src/hooks/redactDebugLogHook.ts
60085
60089
  var AUTHORIZATION_LINE = /^(authorization:\s*).+$/i;
60086
60090
  var redactAuthorization = (value) => typeof value === "string" ? value.replace(AUTHORIZATION_LINE, "$1[REDACTED]") : value;
@@ -60118,13 +60122,13 @@ var TimeoutFixHook = class {
60118
60122
  // ../sdk/src/hooks/registration.ts
60119
60123
  function initHooks(hooks) {
60120
60124
  const failOpenHook = new FailOpenHook();
60121
- const timeoutFixHook = new TimeoutFixHook();
60125
+ const edgeHook = new EdgeHook();
60122
60126
  hooks.registerSDKInitHook(failOpenHook);
60123
60127
  hooks.registerSDKInitHook(new RedactDebugLogHook());
60124
- const edgeHook = new EdgeHook();
60125
60128
  hooks.registerSDKInitHook(edgeHook);
60129
+ hooks.registerBeforeCreateRequestHook(new IdempotencyKeyHook());
60126
60130
  hooks.registerBeforeCreateRequestHook(edgeHook);
60127
- hooks.registerBeforeCreateRequestHook(timeoutFixHook);
60131
+ hooks.registerBeforeCreateRequestHook(new TimeoutFixHook());
60128
60132
  hooks.registerAfterSuccessHook(new BufferLoggedResponseHook());
60129
60133
  hooks.registerAfterErrorHook(failOpenHook);
60130
60134
  }
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  autumnHandler
3
- } from "../chunk-XIBFK5EL.mjs";
3
+ } from "../chunk-ISGN4ETP.mjs";
4
4
  import "../chunk-WYDGEDEU.mjs";
5
5
  import "../chunk-VXND2UDT.mjs";
6
- import "../chunk-N2SCUJPL.mjs";
7
- import "../chunk-EVPPOVX5.mjs";
8
- import "../chunk-L4HKBZCC.mjs";
9
- import "../chunk-MOHYGUMA.mjs";
10
- import "../chunk-TBQ27LIK.mjs";
11
- import "../chunk-J44WR3QZ.mjs";
6
+ import "../chunk-CWKKSAVY.mjs";
7
+ import "../chunk-HMBEOO4M.mjs";
12
8
  import "../chunk-TSF4YCUO.mjs";
13
9
  import "../chunk-UAR3TMWI.mjs";
10
+ import "../chunk-SB3DRXHF.mjs";
14
11
  import "../chunk-4J2TOGWE.mjs";
12
+ import "../chunk-IXUCY7AU.mjs";
15
13
  import "../chunk-OTXV5FY7.mjs";
16
- import "../chunk-VZIMT7AO.mjs";
17
14
  import "../chunk-I7CD6EB6.mjs";
15
+ import "../chunk-VZIMT7AO.mjs";
16
+ import "../chunk-TBQ27LIK.mjs";
17
+ import "../chunk-J44WR3QZ.mjs";
18
18
  import "../chunk-N7NFYY54.mjs";
19
19
  export {
20
20
  autumnHandler
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Autumn
3
- } from "./chunk-L4HKBZCC.mjs";
4
- import {
5
- executeRoute
6
- } from "./chunk-MOHYGUMA.mjs";
3
+ } from "./chunk-SB3DRXHF.mjs";
7
4
  import {
8
5
  routeConfigs
9
6
  } from "./chunk-4J2TOGWE.mjs";
7
+ import {
8
+ executeRoute
9
+ } from "./chunk-IXUCY7AU.mjs";
10
10
  import {
11
11
  secretKeyCheck
12
12
  } from "./chunk-VZIMT7AO.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCoreHandler
3
- } from "./chunk-EVPPOVX5.mjs";
3
+ } from "./chunk-HMBEOO4M.mjs";
4
4
 
5
5
  // src/backend/adapters/hono.ts
6
6
  function autumnHandler(options) {
@@ -1,15 +1,15 @@
1
- import {
2
- Autumn
3
- } from "./chunk-L4HKBZCC.mjs";
4
- import {
5
- executeRoute
6
- } from "./chunk-MOHYGUMA.mjs";
7
1
  import {
8
2
  buildRouter
9
3
  } from "./chunk-UAR3TMWI.mjs";
4
+ import {
5
+ Autumn
6
+ } from "./chunk-SB3DRXHF.mjs";
10
7
  import {
11
8
  routeConfigs
12
9
  } from "./chunk-4J2TOGWE.mjs";
10
+ import {
11
+ executeRoute
12
+ } from "./chunk-IXUCY7AU.mjs";
13
13
  import {
14
14
  secretKeyCheck
15
15
  } from "./chunk-VZIMT7AO.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCoreHandler
3
- } from "./chunk-EVPPOVX5.mjs";
3
+ } from "./chunk-HMBEOO4M.mjs";
4
4
 
5
5
  // src/backend/adapters/next.ts
6
6
  import { NextResponse } from "next/server";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCoreHandler
3
- } from "./chunk-EVPPOVX5.mjs";
3
+ } from "./chunk-HMBEOO4M.mjs";
4
4
 
5
5
  // src/backend/adapters/fetch.ts
6
6
  function autumnHandler(options) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCoreHandler
3
- } from "./chunk-EVPPOVX5.mjs";
3
+ } from "./chunk-HMBEOO4M.mjs";
4
4
 
5
5
  // src/backend/adapters/express.ts
6
6
  function autumnHandler(options) {
@@ -746,7 +746,7 @@ function dlv(obj, key, def, p, undef) {
746
746
  // ../sdk/src/lib/env.ts
747
747
  var envSchema = z5.object({
748
748
  AUTUMN_SECRET_KEY: z5.optional(z5.string()),
749
- AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.5.0"),
749
+ AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.6.0"),
750
750
  AUTUMN_FAIL_OPEN: z5.pipe(
751
751
  z5._default(z5.enum(["true", "false"]), "true"),
752
752
  z5.transform((v) => v === "true")
@@ -59816,10 +59816,10 @@ function serverURLFromOptions(options) {
59816
59816
  }
59817
59817
  var SDK_METADATA = {
59818
59818
  language: "typescript",
59819
- openapiDocVersion: "2.5.0",
59819
+ openapiDocVersion: "2.6.0",
59820
59820
  sdkVersion: "0.10.18",
59821
59821
  genVersion: "2.884.13",
59822
- userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.5.0 @useautumn/sdk"
59822
+ userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.6.0 @useautumn/sdk"
59823
59823
  };
59824
59824
 
59825
59825
  // ../sdk/src/hooks/edge/edgeURLs.ts
@@ -59906,30 +59906,8 @@ var edgeHTTPClientOf = ({
59906
59906
  return edgeClient;
59907
59907
  };
59908
59908
 
59909
- // ../sdk/src/hooks/edge/edgeOperations.ts
59910
- var EDGE_OPERATIONS = {
59911
- check: {
59912
- isWrite: (body) => body.send_event === true || body.lock !== void 0
59913
- }
59914
- };
59915
- var parseBody = (body) => {
59916
- if (typeof body !== "string") return {};
59917
- try {
59918
- return JSON.parse(body);
59919
- } catch {
59920
- return {};
59921
- }
59922
- };
59923
- var isEdgeOperation = ({
59924
- operationID,
59925
- body
59926
- }) => {
59927
- const operation = EDGE_OPERATIONS[operationID];
59928
- if (!operation) return false;
59929
- return !operation.isWrite?.(parseBody(body));
59930
- };
59931
-
59932
59909
  // ../sdk/src/hooks/edge/edgeHook.ts
59910
+ var EDGE_OPERATION_IDS = /* @__PURE__ */ new Set(["check"]);
59933
59911
  var EdgeHook = class {
59934
59912
  sdkInit(opts) {
59935
59913
  const bases = edgeBasesOf({ options: opts });
@@ -59941,11 +59919,7 @@ var EdgeHook = class {
59941
59919
  const options = hookCtx.options;
59942
59920
  const bases = edgeBasesOf({ options });
59943
59921
  if (!options.useEdge || !bases) return input;
59944
- if (!isEdgeOperation({
59945
- operationID: hookCtx.operationID,
59946
- body: input.options?.body
59947
- }))
59948
- return input;
59922
+ if (!EDGE_OPERATION_IDS.has(hookCtx.operationID)) return input;
59949
59923
  const edgeURL = rebaseURL({
59950
59924
  url: input.url,
59951
59925
  from: bases.autumn,
@@ -60025,6 +59999,36 @@ var FailOpenHook = class {
60025
59999
  }
60026
60000
  };
60027
60001
 
60002
+ // ../sdk/src/hooks/idempotencyKeyHook.ts
60003
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
60004
+ var isWriteCheck = ({
60005
+ operationID,
60006
+ body
60007
+ }) => {
60008
+ if (operationID !== "check" || typeof body !== "string") return false;
60009
+ try {
60010
+ const sent = JSON.parse(body);
60011
+ return sent.send_event === true || sent.lock !== void 0;
60012
+ } catch {
60013
+ return false;
60014
+ }
60015
+ };
60016
+ var IdempotencyKeyHook = class {
60017
+ beforeCreateRequest(hookCtx, input) {
60018
+ const options = hookCtx.options;
60019
+ if (!options.useEdge) return input;
60020
+ if (!isWriteCheck({
60021
+ operationID: hookCtx.operationID,
60022
+ body: input.options?.body
60023
+ }))
60024
+ return input;
60025
+ const headers = new Headers(input.options?.headers);
60026
+ if (headers.has(IDEMPOTENCY_KEY_HEADER)) return input;
60027
+ headers.set(IDEMPOTENCY_KEY_HEADER, crypto.randomUUID());
60028
+ return { ...input, options: { ...input.options, headers } };
60029
+ }
60030
+ };
60031
+
60028
60032
  // ../sdk/src/hooks/redactDebugLogHook.ts
60029
60033
  var AUTHORIZATION_LINE = /^(authorization:\s*).+$/i;
60030
60034
  var redactAuthorization = (value) => typeof value === "string" ? value.replace(AUTHORIZATION_LINE, "$1[REDACTED]") : value;
@@ -60062,13 +60066,13 @@ var TimeoutFixHook = class {
60062
60066
  // ../sdk/src/hooks/registration.ts
60063
60067
  function initHooks(hooks) {
60064
60068
  const failOpenHook = new FailOpenHook();
60065
- const timeoutFixHook = new TimeoutFixHook();
60069
+ const edgeHook = new EdgeHook();
60066
60070
  hooks.registerSDKInitHook(failOpenHook);
60067
60071
  hooks.registerSDKInitHook(new RedactDebugLogHook());
60068
- const edgeHook = new EdgeHook();
60069
60072
  hooks.registerSDKInitHook(edgeHook);
60073
+ hooks.registerBeforeCreateRequestHook(new IdempotencyKeyHook());
60070
60074
  hooks.registerBeforeCreateRequestHook(edgeHook);
60071
- hooks.registerBeforeCreateRequestHook(timeoutFixHook);
60075
+ hooks.registerBeforeCreateRequestHook(new TimeoutFixHook());
60072
60076
  hooks.registerAfterSuccessHook(new BufferLoggedResponseHook());
60073
60077
  hooks.registerAfterErrorHook(failOpenHook);
60074
60078
  }
@@ -76,10 +76,10 @@ function serverURLFromOptions(options) {
76
76
  }
77
77
  var SDK_METADATA = {
78
78
  language: "typescript",
79
- openapiDocVersion: "2.5.0",
79
+ openapiDocVersion: "2.6.0",
80
80
  sdkVersion: "0.10.18",
81
81
  genVersion: "2.884.13",
82
- userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.5.0 @useautumn/sdk"
82
+ userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.6.0 @useautumn/sdk"
83
83
  };
84
84
 
85
85
  // ../sdk/src/lib/http.ts
@@ -849,7 +849,7 @@ function dlv(obj, key, def, p, undef) {
849
849
  // ../sdk/src/lib/env.ts
850
850
  var envSchema = z5.object({
851
851
  AUTUMN_SECRET_KEY: z5.optional(z5.string()),
852
- AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.5.0"),
852
+ AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.6.0"),
853
853
  AUTUMN_FAIL_OPEN: z5.pipe(
854
854
  z5._default(z5.enum(["true", "false"]), "true"),
855
855
  z5.transform((v) => v === "true")
@@ -59961,30 +59961,8 @@ var edgeHTTPClientOf = ({
59961
59961
  return edgeClient;
59962
59962
  };
59963
59963
 
59964
- // ../sdk/src/hooks/edge/edgeOperations.ts
59965
- var EDGE_OPERATIONS = {
59966
- check: {
59967
- isWrite: (body) => body.send_event === true || body.lock !== void 0
59968
- }
59969
- };
59970
- var parseBody = (body) => {
59971
- if (typeof body !== "string") return {};
59972
- try {
59973
- return JSON.parse(body);
59974
- } catch {
59975
- return {};
59976
- }
59977
- };
59978
- var isEdgeOperation = ({
59979
- operationID,
59980
- body
59981
- }) => {
59982
- const operation = EDGE_OPERATIONS[operationID];
59983
- if (!operation) return false;
59984
- return !operation.isWrite?.(parseBody(body));
59985
- };
59986
-
59987
59964
  // ../sdk/src/hooks/edge/edgeHook.ts
59965
+ var EDGE_OPERATION_IDS = /* @__PURE__ */ new Set(["check"]);
59988
59966
  var EdgeHook = class {
59989
59967
  sdkInit(opts) {
59990
59968
  const bases = edgeBasesOf({ options: opts });
@@ -59996,11 +59974,7 @@ var EdgeHook = class {
59996
59974
  const options = hookCtx.options;
59997
59975
  const bases = edgeBasesOf({ options });
59998
59976
  if (!options.useEdge || !bases) return input;
59999
- if (!isEdgeOperation({
60000
- operationID: hookCtx.operationID,
60001
- body: input.options?.body
60002
- }))
60003
- return input;
59977
+ if (!EDGE_OPERATION_IDS.has(hookCtx.operationID)) return input;
60004
59978
  const edgeURL = rebaseURL({
60005
59979
  url: input.url,
60006
59980
  from: bases.autumn,
@@ -60080,6 +60054,36 @@ var FailOpenHook = class {
60080
60054
  }
60081
60055
  };
60082
60056
 
60057
+ // ../sdk/src/hooks/idempotencyKeyHook.ts
60058
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
60059
+ var isWriteCheck = ({
60060
+ operationID,
60061
+ body
60062
+ }) => {
60063
+ if (operationID !== "check" || typeof body !== "string") return false;
60064
+ try {
60065
+ const sent = JSON.parse(body);
60066
+ return sent.send_event === true || sent.lock !== void 0;
60067
+ } catch {
60068
+ return false;
60069
+ }
60070
+ };
60071
+ var IdempotencyKeyHook = class {
60072
+ beforeCreateRequest(hookCtx, input) {
60073
+ const options = hookCtx.options;
60074
+ if (!options.useEdge) return input;
60075
+ if (!isWriteCheck({
60076
+ operationID: hookCtx.operationID,
60077
+ body: input.options?.body
60078
+ }))
60079
+ return input;
60080
+ const headers = new Headers(input.options?.headers);
60081
+ if (headers.has(IDEMPOTENCY_KEY_HEADER)) return input;
60082
+ headers.set(IDEMPOTENCY_KEY_HEADER, crypto.randomUUID());
60083
+ return { ...input, options: { ...input.options, headers } };
60084
+ }
60085
+ };
60086
+
60083
60087
  // ../sdk/src/hooks/redactDebugLogHook.ts
60084
60088
  var AUTHORIZATION_LINE = /^(authorization:\s*).+$/i;
60085
60089
  var redactAuthorization = (value) => typeof value === "string" ? value.replace(AUTHORIZATION_LINE, "$1[REDACTED]") : value;
@@ -60117,13 +60121,13 @@ var TimeoutFixHook = class {
60117
60121
  // ../sdk/src/hooks/registration.ts
60118
60122
  function initHooks(hooks) {
60119
60123
  const failOpenHook = new FailOpenHook();
60120
- const timeoutFixHook = new TimeoutFixHook();
60124
+ const edgeHook = new EdgeHook();
60121
60125
  hooks.registerSDKInitHook(failOpenHook);
60122
60126
  hooks.registerSDKInitHook(new RedactDebugLogHook());
60123
- const edgeHook = new EdgeHook();
60124
60127
  hooks.registerSDKInitHook(edgeHook);
60128
+ hooks.registerBeforeCreateRequestHook(new IdempotencyKeyHook());
60125
60129
  hooks.registerBeforeCreateRequestHook(edgeHook);
60126
- hooks.registerBeforeCreateRequestHook(timeoutFixHook);
60130
+ hooks.registerBeforeCreateRequestHook(new TimeoutFixHook());
60127
60131
  hooks.registerAfterSuccessHook(new BufferLoggedResponseHook());
60128
60132
  hooks.registerAfterErrorHook(failOpenHook);
60129
60133
  }
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createCoreHandler
3
- } from "../../chunk-EVPPOVX5.mjs";
4
- import "../../chunk-L4HKBZCC.mjs";
5
- import "../../chunk-MOHYGUMA.mjs";
6
- import "../../chunk-TBQ27LIK.mjs";
7
- import "../../chunk-J44WR3QZ.mjs";
3
+ } from "../../chunk-HMBEOO4M.mjs";
8
4
  import "../../chunk-TSF4YCUO.mjs";
9
5
  import "../../chunk-UAR3TMWI.mjs";
6
+ import "../../chunk-SB3DRXHF.mjs";
10
7
  import "../../chunk-4J2TOGWE.mjs";
8
+ import "../../chunk-IXUCY7AU.mjs";
11
9
  import "../../chunk-OTXV5FY7.mjs";
12
- import "../../chunk-VZIMT7AO.mjs";
13
10
  import "../../chunk-I7CD6EB6.mjs";
11
+ import "../../chunk-VZIMT7AO.mjs";
12
+ import "../../chunk-TBQ27LIK.mjs";
13
+ import "../../chunk-J44WR3QZ.mjs";
14
14
  import "../../chunk-N7NFYY54.mjs";
15
15
  export {
16
16
  createCoreHandler
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  executeRoute
3
- } from "../../chunk-MOHYGUMA.mjs";
4
- import "../../chunk-TBQ27LIK.mjs";
5
- import "../../chunk-J44WR3QZ.mjs";
3
+ } from "../../chunk-IXUCY7AU.mjs";
6
4
  import "../../chunk-OTXV5FY7.mjs";
7
- import "../../chunk-VZIMT7AO.mjs";
8
5
  import "../../chunk-I7CD6EB6.mjs";
6
+ import "../../chunk-VZIMT7AO.mjs";
7
+ import "../../chunk-TBQ27LIK.mjs";
8
+ import "../../chunk-J44WR3QZ.mjs";
9
9
  import "../../chunk-N7NFYY54.mjs";
10
10
  export {
11
11
  executeRoute
@@ -76,10 +76,10 @@ function serverURLFromOptions(options) {
76
76
  }
77
77
  var SDK_METADATA = {
78
78
  language: "typescript",
79
- openapiDocVersion: "2.5.0",
79
+ openapiDocVersion: "2.6.0",
80
80
  sdkVersion: "0.10.18",
81
81
  genVersion: "2.884.13",
82
- userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.5.0 @useautumn/sdk"
82
+ userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.6.0 @useautumn/sdk"
83
83
  };
84
84
 
85
85
  // ../sdk/src/lib/http.ts
@@ -849,7 +849,7 @@ function dlv(obj, key, def, p, undef) {
849
849
  // ../sdk/src/lib/env.ts
850
850
  var envSchema = z5.object({
851
851
  AUTUMN_SECRET_KEY: z5.optional(z5.string()),
852
- AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.5.0"),
852
+ AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.6.0"),
853
853
  AUTUMN_FAIL_OPEN: z5.pipe(
854
854
  z5._default(z5.enum(["true", "false"]), "true"),
855
855
  z5.transform((v) => v === "true")
@@ -59961,30 +59961,8 @@ var edgeHTTPClientOf = ({
59961
59961
  return edgeClient;
59962
59962
  };
59963
59963
 
59964
- // ../sdk/src/hooks/edge/edgeOperations.ts
59965
- var EDGE_OPERATIONS = {
59966
- check: {
59967
- isWrite: (body) => body.send_event === true || body.lock !== void 0
59968
- }
59969
- };
59970
- var parseBody = (body) => {
59971
- if (typeof body !== "string") return {};
59972
- try {
59973
- return JSON.parse(body);
59974
- } catch {
59975
- return {};
59976
- }
59977
- };
59978
- var isEdgeOperation = ({
59979
- operationID,
59980
- body
59981
- }) => {
59982
- const operation = EDGE_OPERATIONS[operationID];
59983
- if (!operation) return false;
59984
- return !operation.isWrite?.(parseBody(body));
59985
- };
59986
-
59987
59964
  // ../sdk/src/hooks/edge/edgeHook.ts
59965
+ var EDGE_OPERATION_IDS = /* @__PURE__ */ new Set(["check"]);
59988
59966
  var EdgeHook = class {
59989
59967
  sdkInit(opts) {
59990
59968
  const bases = edgeBasesOf({ options: opts });
@@ -59996,11 +59974,7 @@ var EdgeHook = class {
59996
59974
  const options = hookCtx.options;
59997
59975
  const bases = edgeBasesOf({ options });
59998
59976
  if (!options.useEdge || !bases) return input;
59999
- if (!isEdgeOperation({
60000
- operationID: hookCtx.operationID,
60001
- body: input.options?.body
60002
- }))
60003
- return input;
59977
+ if (!EDGE_OPERATION_IDS.has(hookCtx.operationID)) return input;
60004
59978
  const edgeURL = rebaseURL({
60005
59979
  url: input.url,
60006
59980
  from: bases.autumn,
@@ -60080,6 +60054,36 @@ var FailOpenHook = class {
60080
60054
  }
60081
60055
  };
60082
60056
 
60057
+ // ../sdk/src/hooks/idempotencyKeyHook.ts
60058
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
60059
+ var isWriteCheck = ({
60060
+ operationID,
60061
+ body
60062
+ }) => {
60063
+ if (operationID !== "check" || typeof body !== "string") return false;
60064
+ try {
60065
+ const sent = JSON.parse(body);
60066
+ return sent.send_event === true || sent.lock !== void 0;
60067
+ } catch {
60068
+ return false;
60069
+ }
60070
+ };
60071
+ var IdempotencyKeyHook = class {
60072
+ beforeCreateRequest(hookCtx, input) {
60073
+ const options = hookCtx.options;
60074
+ if (!options.useEdge) return input;
60075
+ if (!isWriteCheck({
60076
+ operationID: hookCtx.operationID,
60077
+ body: input.options?.body
60078
+ }))
60079
+ return input;
60080
+ const headers = new Headers(input.options?.headers);
60081
+ if (headers.has(IDEMPOTENCY_KEY_HEADER)) return input;
60082
+ headers.set(IDEMPOTENCY_KEY_HEADER, crypto.randomUUID());
60083
+ return { ...input, options: { ...input.options, headers } };
60084
+ }
60085
+ };
60086
+
60083
60087
  // ../sdk/src/hooks/redactDebugLogHook.ts
60084
60088
  var AUTHORIZATION_LINE = /^(authorization:\s*).+$/i;
60085
60089
  var redactAuthorization = (value) => typeof value === "string" ? value.replace(AUTHORIZATION_LINE, "$1[REDACTED]") : value;
@@ -60117,13 +60121,13 @@ var TimeoutFixHook = class {
60117
60121
  // ../sdk/src/hooks/registration.ts
60118
60122
  function initHooks(hooks) {
60119
60123
  const failOpenHook = new FailOpenHook();
60120
- const timeoutFixHook = new TimeoutFixHook();
60124
+ const edgeHook = new EdgeHook();
60121
60125
  hooks.registerSDKInitHook(failOpenHook);
60122
60126
  hooks.registerSDKInitHook(new RedactDebugLogHook());
60123
- const edgeHook = new EdgeHook();
60124
60127
  hooks.registerSDKInitHook(edgeHook);
60128
+ hooks.registerBeforeCreateRequestHook(new IdempotencyKeyHook());
60125
60129
  hooks.registerBeforeCreateRequestHook(edgeHook);
60126
- hooks.registerBeforeCreateRequestHook(timeoutFixHook);
60130
+ hooks.registerBeforeCreateRequestHook(new TimeoutFixHook());
60127
60131
  hooks.registerAfterSuccessHook(new BufferLoggedResponseHook());
60128
60132
  hooks.registerAfterErrorHook(failOpenHook);
60129
60133
  }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  handleRouteByName
3
- } from "../../chunk-N2SCUJPL.mjs";
4
- import "../../chunk-L4HKBZCC.mjs";
5
- import "../../chunk-MOHYGUMA.mjs";
6
- import "../../chunk-TBQ27LIK.mjs";
7
- import "../../chunk-J44WR3QZ.mjs";
3
+ } from "../../chunk-CWKKSAVY.mjs";
4
+ import "../../chunk-SB3DRXHF.mjs";
8
5
  import "../../chunk-4J2TOGWE.mjs";
6
+ import "../../chunk-IXUCY7AU.mjs";
9
7
  import "../../chunk-OTXV5FY7.mjs";
10
- import "../../chunk-VZIMT7AO.mjs";
11
8
  import "../../chunk-I7CD6EB6.mjs";
9
+ import "../../chunk-VZIMT7AO.mjs";
10
+ import "../../chunk-TBQ27LIK.mjs";
11
+ import "../../chunk-J44WR3QZ.mjs";
12
12
  import "../../chunk-N7NFYY54.mjs";
13
13
  export {
14
14
  handleRouteByName