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
@@ -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,20 +1,20 @@
1
1
  import {
2
2
  autumnHandler
3
- } from "../chunk-QPDWSMZ5.mjs";
3
+ } from "../chunk-R42SWVEA.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
@@ -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,20 +1,20 @@
1
1
  import {
2
2
  autumnHandler
3
- } from "../chunk-EUR3CZTF.mjs";
3
+ } from "../chunk-KIHR5PMZ.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
@@ -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,20 +1,20 @@
1
1
  import {
2
2
  autumnHandler
3
- } from "../chunk-6X4JZECX.mjs";
3
+ } from "../chunk-HIP3ARPK.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
@@ -79,10 +79,10 @@ function serverURLFromOptions(options) {
79
79
  }
80
80
  var SDK_METADATA = {
81
81
  language: "typescript",
82
- openapiDocVersion: "2.5.0",
82
+ openapiDocVersion: "2.6.0",
83
83
  sdkVersion: "0.10.18",
84
84
  genVersion: "2.884.13",
85
- userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.5.0 @useautumn/sdk"
85
+ userAgent: "speakeasy-sdk/typescript 0.10.18 2.884.13 2.6.0 @useautumn/sdk"
86
86
  };
87
87
 
88
88
  // ../sdk/src/lib/http.ts
@@ -852,7 +852,7 @@ function dlv(obj, key, def, p, undef) {
852
852
  // ../sdk/src/lib/env.ts
853
853
  var envSchema = z5.object({
854
854
  AUTUMN_SECRET_KEY: z5.optional(z5.string()),
855
- AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.5.0"),
855
+ AUTUMN_X_API_VERSION: z5._default(z5.string(), "2.6.0"),
856
856
  AUTUMN_FAIL_OPEN: z5.pipe(
857
857
  z5._default(z5.enum(["true", "false"]), "true"),
858
858
  z5.transform((v) => v === "true")
@@ -59964,30 +59964,8 @@ var edgeHTTPClientOf = ({
59964
59964
  return edgeClient;
59965
59965
  };
59966
59966
 
59967
- // ../sdk/src/hooks/edge/edgeOperations.ts
59968
- var EDGE_OPERATIONS = {
59969
- check: {
59970
- isWrite: (body) => body.send_event === true || body.lock !== void 0
59971
- }
59972
- };
59973
- var parseBody = (body) => {
59974
- if (typeof body !== "string") return {};
59975
- try {
59976
- return JSON.parse(body);
59977
- } catch {
59978
- return {};
59979
- }
59980
- };
59981
- var isEdgeOperation = ({
59982
- operationID,
59983
- body
59984
- }) => {
59985
- const operation = EDGE_OPERATIONS[operationID];
59986
- if (!operation) return false;
59987
- return !operation.isWrite?.(parseBody(body));
59988
- };
59989
-
59990
59967
  // ../sdk/src/hooks/edge/edgeHook.ts
59968
+ var EDGE_OPERATION_IDS = /* @__PURE__ */ new Set(["check"]);
59991
59969
  var EdgeHook = class {
59992
59970
  sdkInit(opts) {
59993
59971
  const bases = edgeBasesOf({ options: opts });
@@ -59999,11 +59977,7 @@ var EdgeHook = class {
59999
59977
  const options = hookCtx.options;
60000
59978
  const bases = edgeBasesOf({ options });
60001
59979
  if (!options.useEdge || !bases) return input;
60002
- if (!isEdgeOperation({
60003
- operationID: hookCtx.operationID,
60004
- body: input.options?.body
60005
- }))
60006
- return input;
59980
+ if (!EDGE_OPERATION_IDS.has(hookCtx.operationID)) return input;
60007
59981
  const edgeURL = rebaseURL({
60008
59982
  url: input.url,
60009
59983
  from: bases.autumn,
@@ -60083,6 +60057,36 @@ var FailOpenHook = class {
60083
60057
  }
60084
60058
  };
60085
60059
 
60060
+ // ../sdk/src/hooks/idempotencyKeyHook.ts
60061
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
60062
+ var isWriteCheck = ({
60063
+ operationID,
60064
+ body
60065
+ }) => {
60066
+ if (operationID !== "check" || typeof body !== "string") return false;
60067
+ try {
60068
+ const sent = JSON.parse(body);
60069
+ return sent.send_event === true || sent.lock !== void 0;
60070
+ } catch {
60071
+ return false;
60072
+ }
60073
+ };
60074
+ var IdempotencyKeyHook = class {
60075
+ beforeCreateRequest(hookCtx, input) {
60076
+ const options = hookCtx.options;
60077
+ if (!options.useEdge) return input;
60078
+ if (!isWriteCheck({
60079
+ operationID: hookCtx.operationID,
60080
+ body: input.options?.body
60081
+ }))
60082
+ return input;
60083
+ const headers = new Headers(input.options?.headers);
60084
+ if (headers.has(IDEMPOTENCY_KEY_HEADER)) return input;
60085
+ headers.set(IDEMPOTENCY_KEY_HEADER, crypto.randomUUID());
60086
+ return { ...input, options: { ...input.options, headers } };
60087
+ }
60088
+ };
60089
+
60086
60090
  // ../sdk/src/hooks/redactDebugLogHook.ts
60087
60091
  var AUTHORIZATION_LINE = /^(authorization:\s*).+$/i;
60088
60092
  var redactAuthorization = (value) => typeof value === "string" ? value.replace(AUTHORIZATION_LINE, "$1[REDACTED]") : value;
@@ -60120,13 +60124,13 @@ var TimeoutFixHook = class {
60120
60124
  // ../sdk/src/hooks/registration.ts
60121
60125
  function initHooks(hooks) {
60122
60126
  const failOpenHook = new FailOpenHook();
60123
- const timeoutFixHook = new TimeoutFixHook();
60127
+ const edgeHook = new EdgeHook();
60124
60128
  hooks.registerSDKInitHook(failOpenHook);
60125
60129
  hooks.registerSDKInitHook(new RedactDebugLogHook());
60126
- const edgeHook = new EdgeHook();
60127
60130
  hooks.registerSDKInitHook(edgeHook);
60131
+ hooks.registerBeforeCreateRequestHook(new IdempotencyKeyHook());
60128
60132
  hooks.registerBeforeCreateRequestHook(edgeHook);
60129
- hooks.registerBeforeCreateRequestHook(timeoutFixHook);
60133
+ hooks.registerBeforeCreateRequestHook(new TimeoutFixHook());
60130
60134
  hooks.registerAfterSuccessHook(new BufferLoggedResponseHook());
60131
60135
  hooks.registerAfterErrorHook(failOpenHook);
60132
60136
  }
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  autumnHandler
3
- } from "../chunk-QPDWSMZ5.mjs";
3
+ } from "../chunk-R42SWVEA.mjs";
4
4
  import {
5
5
  autumnHandler as autumnHandler2
6
- } from "../chunk-EUR3CZTF.mjs";
6
+ } from "../chunk-KIHR5PMZ.mjs";
7
7
  import {
8
8
  autumnHandler as autumnHandler3
9
- } from "../chunk-6X4JZECX.mjs";
9
+ } from "../chunk-HIP3ARPK.mjs";
10
10
  import {
11
11
  autumnHandler as autumnHandler4
12
- } from "../chunk-XIBFK5EL.mjs";
12
+ } from "../chunk-ISGN4ETP.mjs";
13
13
  import "../chunk-WYDGEDEU.mjs";
14
14
  import "../chunk-VXND2UDT.mjs";
15
- import "../chunk-N2SCUJPL.mjs";
16
- import "../chunk-EVPPOVX5.mjs";
17
- import "../chunk-L4HKBZCC.mjs";
18
- import "../chunk-MOHYGUMA.mjs";
19
- import "../chunk-TBQ27LIK.mjs";
20
- import "../chunk-J44WR3QZ.mjs";
15
+ import "../chunk-CWKKSAVY.mjs";
16
+ import "../chunk-HMBEOO4M.mjs";
21
17
  import "../chunk-TSF4YCUO.mjs";
22
18
  import "../chunk-UAR3TMWI.mjs";
19
+ import "../chunk-SB3DRXHF.mjs";
23
20
  import "../chunk-4J2TOGWE.mjs";
21
+ import "../chunk-IXUCY7AU.mjs";
24
22
  import "../chunk-OTXV5FY7.mjs";
25
- import "../chunk-VZIMT7AO.mjs";
26
23
  import "../chunk-I7CD6EB6.mjs";
24
+ import "../chunk-VZIMT7AO.mjs";
25
+ import "../chunk-TBQ27LIK.mjs";
26
+ import "../chunk-J44WR3QZ.mjs";
27
27
  import "../chunk-N7NFYY54.mjs";
28
28
  export {
29
29
  autumnHandler as expressAutumnHandler,