autumn-js 1.1.7 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/adapters/express.js +122 -6
- package/dist/backend/adapters/express.mjs +9 -9
- package/dist/backend/adapters/fetch.js +122 -6
- package/dist/backend/adapters/fetch.mjs +9 -9
- package/dist/backend/adapters/hono.js +122 -6
- package/dist/backend/adapters/hono.mjs +9 -9
- package/dist/backend/adapters/index.js +122 -6
- package/dist/backend/adapters/index.mjs +12 -12
- package/dist/backend/adapters/next.js +122 -6
- package/dist/backend/adapters/next.mjs +9 -9
- package/dist/backend/{chunk-PP6UQYJS.mjs → chunk-3N5JKLZU.mjs} +1 -1
- package/dist/backend/{chunk-JUZDG66W.mjs → chunk-CS4R7BU4.mjs} +5 -5
- package/dist/backend/{chunk-X2ZQ7KI7.mjs → chunk-HG52KOLU.mjs} +1 -1
- package/dist/backend/{chunk-BNTQ4ECE.mjs → chunk-NKLPJAWS.mjs} +1 -1
- package/dist/backend/{chunk-VDKSZFDB.mjs → chunk-NSXJQETG.mjs} +4 -2
- package/dist/backend/{chunk-ZPZ7FFHT.mjs → chunk-RGUUMXFG.mjs} +118 -4
- package/dist/backend/{chunk-PX3QACWR.mjs → chunk-SBTEC637.mjs} +1 -1
- package/dist/backend/{chunk-NYHWQDP6.mjs → chunk-TC6BT3QN.mjs} +7 -7
- package/dist/backend/core/handlers/coreHandler.d.mts +1 -1
- package/dist/backend/core/handlers/coreHandler.d.ts +1 -1
- package/dist/backend/core/handlers/coreHandler.js +122 -6
- package/dist/backend/core/handlers/coreHandler.mjs +7 -7
- package/dist/backend/core/handlers/executeRoute.d.mts +1 -1
- package/dist/backend/core/handlers/executeRoute.d.ts +1 -1
- package/dist/backend/core/handlers/executeRoute.mjs +4 -4
- package/dist/backend/core/handlers/handleRouteByName.js +122 -6
- package/dist/backend/core/handlers/handleRouteByName.mjs +7 -7
- package/dist/backend/core/handlers/index.d.mts +1 -1
- package/dist/backend/core/handlers/index.d.ts +1 -1
- package/dist/backend/core/handlers/index.js +122 -6
- package/dist/backend/core/handlers/index.mjs +10 -10
- package/dist/backend/core/index.d.mts +1 -1
- package/dist/backend/core/index.d.ts +1 -1
- package/dist/backend/core/index.js +122 -6
- package/dist/backend/core/index.mjs +10 -10
- package/dist/backend/core/routes/index.d.mts +1 -1
- package/dist/backend/core/routes/index.d.ts +1 -1
- package/dist/backend/core/routes/index.js +4 -2
- package/dist/backend/core/routes/index.mjs +2 -2
- package/dist/backend/core/routes/routeBuilder.d.mts +1 -1
- package/dist/backend/core/routes/routeBuilder.d.ts +1 -1
- package/dist/backend/core/routes/routeConfigs.d.mts +1 -1
- package/dist/backend/core/routes/routeConfigs.d.ts +1 -1
- package/dist/backend/core/routes/routeConfigs.js +4 -2
- package/dist/backend/core/routes/routeConfigs.mjs +2 -2
- package/dist/backend/core/types/handlerTypes.d.mts +1 -1
- package/dist/backend/core/types/handlerTypes.d.ts +1 -1
- package/dist/backend/core/types/index.d.mts +1 -1
- package/dist/backend/core/types/index.d.ts +1 -1
- package/dist/backend/core/types/routeTypes.d.mts +1 -1
- package/dist/backend/core/types/routeTypes.d.ts +1 -1
- package/dist/backend/core/utils/index.mjs +3 -3
- package/dist/backend/index.d.mts +2 -2
- package/dist/backend/index.d.ts +2 -2
- package/dist/backend/index.js +122 -6
- package/dist/backend/index.mjs +10 -10
- package/dist/backend/{routeTypes-COJtRKM-.d.ts → routeTypes-CpYmkN-b.d.ts} +4 -0
- package/dist/backend/{routeTypes-BTLwfLzU.d.mts → routeTypes-mZBR-uVw.d.mts} +4 -0
- package/dist/better-auth/{chunk-GVZ475U2.mjs → chunk-6YDKA7Z5.mjs} +1 -1
- package/dist/better-auth/{chunk-KVCXG6IW.mjs → chunk-AHCYYKBC.mjs} +4 -2
- package/dist/better-auth/{chunk-WVO7XICO.mjs → chunk-SASLAUVA.mjs} +119 -5
- package/dist/better-auth/index.js +122 -6
- package/dist/better-auth/index.mjs +3 -3
- package/dist/better-auth/utils/createAutumnEndpoint.js +4 -2
- package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
- package/dist/better-auth/utils/handleBetterAuthRoute.js +122 -6
- package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
- package/dist/better-auth/utils/index.js +122 -6
- package/dist/better-auth/utils/index.mjs +3 -3
- package/dist/react/AutumnContext.d.mts +1 -1
- package/dist/react/AutumnContext.d.ts +1 -1
- package/dist/react/client/AutumnClient.d.mts +1 -1
- package/dist/react/client/AutumnClient.d.ts +1 -1
- package/dist/react/client/IAutumnClient.d.mts +1 -1
- package/dist/react/client/IAutumnClient.d.ts +1 -1
- package/dist/react/client/index.d.mts +1 -1
- package/dist/react/client/index.d.ts +1 -1
- package/dist/react/hooks/index.d.mts +1 -1
- package/dist/react/hooks/index.d.ts +1 -1
- package/dist/react/hooks/index.mjs +9 -9
- package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +1 -1
- package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +1 -1
- package/dist/react/hooks/internal/useCustomerActions.d.mts +1 -1
- package/dist/react/hooks/internal/useCustomerActions.d.ts +1 -1
- package/dist/react/hooks/useAggregateEvents.d.mts +1 -1
- package/dist/react/hooks/useAggregateEvents.d.ts +1 -1
- package/dist/react/hooks/useCustomer.d.mts +1 -1
- package/dist/react/hooks/useCustomer.d.ts +1 -1
- package/dist/react/hooks/useEntity.d.mts +1 -1
- package/dist/react/hooks/useEntity.d.ts +1 -1
- package/dist/react/hooks/useListEvents.d.mts +1 -1
- package/dist/react/hooks/useListEvents.d.ts +1 -1
- package/dist/react/hooks/useListPlans.d.mts +1 -1
- package/dist/react/hooks/useListPlans.d.ts +1 -1
- package/dist/react/hooks/useReferrals.d.mts +1 -1
- package/dist/react/hooks/useReferrals.d.ts +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.mjs +10 -10
- package/dist/react/{params-CULG2g_G.d.ts → params-BJe02wWl.d.ts} +4 -0
- package/dist/react/{params-D0knGGE_.d.mts → params-DQdWUztN.d.mts} +4 -0
- package/dist/sdk/index.d.mts +7 -2
- package/dist/sdk/index.d.ts +7 -2
- package/dist/sdk/index.js +120 -4
- package/dist/sdk/index.mjs +120 -4
- package/package.json +142 -142
- package/dist/backend/{chunk-55C2WWXQ.mjs → chunk-S5HPMJ4U.mjs} +3 -3
|
@@ -78,8 +78,8 @@ var SDK_METADATA = {
|
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "2.2.0",
|
|
80
80
|
sdkVersion: "0.10.17",
|
|
81
|
-
genVersion: "2.869.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.
|
|
81
|
+
genVersion: "2.869.25",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.25 2.2.0 @useautumn/sdk"
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// ../sdk/src/lib/http.ts
|
|
@@ -1336,7 +1336,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1336
1336
|
binSize: z8._default(BinSize$outboundSchema, "day"),
|
|
1337
1337
|
customRange: z8.optional(
|
|
1338
1338
|
z8.lazy(() => AggregateEventsCustomRange$outboundSchema)
|
|
1339
|
-
)
|
|
1339
|
+
),
|
|
1340
|
+
maxGroups: z8.optional(z8.int())
|
|
1340
1341
|
}),
|
|
1341
1342
|
z8.transform((v) => {
|
|
1342
1343
|
return remap(v, {
|
|
@@ -1345,7 +1346,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1345
1346
|
featureId: "feature_id",
|
|
1346
1347
|
groupBy: "group_by",
|
|
1347
1348
|
binSize: "bin_size",
|
|
1348
|
-
customRange: "custom_range"
|
|
1349
|
+
customRange: "custom_range",
|
|
1350
|
+
maxGroups: "max_groups"
|
|
1349
1351
|
});
|
|
1350
1352
|
})
|
|
1351
1353
|
);
|
|
@@ -9724,6 +9726,117 @@ async function $do2(client, request, options) {
|
|
|
9724
9726
|
return [result, { status: "complete", request: req, response }];
|
|
9725
9727
|
}
|
|
9726
9728
|
|
|
9729
|
+
// ../sdk/src/hooks/failOpenHook.ts
|
|
9730
|
+
var FAIL_OPEN_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
9731
|
+
"check",
|
|
9732
|
+
"track",
|
|
9733
|
+
"getOrCreateCustomer"
|
|
9734
|
+
]);
|
|
9735
|
+
var FAIL_OPEN_LOG_MESSAGE = "[Autumn] Request failed \u2014 failing open. Learn more: https://docs.useautumn.com/documentation/fail-open";
|
|
9736
|
+
var FAIL_OPEN_BODIES = {
|
|
9737
|
+
check: {
|
|
9738
|
+
allowed: true,
|
|
9739
|
+
customer_id: null,
|
|
9740
|
+
balance: null,
|
|
9741
|
+
flag: null
|
|
9742
|
+
},
|
|
9743
|
+
track: {
|
|
9744
|
+
customer_id: null,
|
|
9745
|
+
value: 0,
|
|
9746
|
+
balance: null
|
|
9747
|
+
},
|
|
9748
|
+
getOrCreateCustomer: {
|
|
9749
|
+
id: null,
|
|
9750
|
+
name: null,
|
|
9751
|
+
email: null,
|
|
9752
|
+
created_at: 0,
|
|
9753
|
+
fingerprint: null,
|
|
9754
|
+
stripe_id: null,
|
|
9755
|
+
env: "live",
|
|
9756
|
+
metadata: {},
|
|
9757
|
+
send_email_receipts: false,
|
|
9758
|
+
billing_controls: {},
|
|
9759
|
+
subscriptions: [],
|
|
9760
|
+
purchases: [],
|
|
9761
|
+
balances: {},
|
|
9762
|
+
flags: {}
|
|
9763
|
+
}
|
|
9764
|
+
};
|
|
9765
|
+
var FailOpenHook = class {
|
|
9766
|
+
enabled = true;
|
|
9767
|
+
sdkInit(opts) {
|
|
9768
|
+
if (opts.failOpen === false) {
|
|
9769
|
+
this.enabled = false;
|
|
9770
|
+
return opts;
|
|
9771
|
+
}
|
|
9772
|
+
this.enabled = true;
|
|
9773
|
+
opts.httpClient = new HTTPClient({
|
|
9774
|
+
fetcher: async (input, init) => {
|
|
9775
|
+
try {
|
|
9776
|
+
return init == null ? await fetch(input) : await fetch(input, init);
|
|
9777
|
+
} catch {
|
|
9778
|
+
return new Response(null, {
|
|
9779
|
+
status: 503,
|
|
9780
|
+
statusText: "Autumn Unreachable"
|
|
9781
|
+
});
|
|
9782
|
+
}
|
|
9783
|
+
}
|
|
9784
|
+
});
|
|
9785
|
+
return opts;
|
|
9786
|
+
}
|
|
9787
|
+
afterError(hookCtx, response, error) {
|
|
9788
|
+
if (!this.enabled) {
|
|
9789
|
+
return { response, error };
|
|
9790
|
+
}
|
|
9791
|
+
if (!response || response.status < 500) {
|
|
9792
|
+
return { response, error };
|
|
9793
|
+
}
|
|
9794
|
+
if (!FAIL_OPEN_OPERATION_IDS.has(hookCtx.operationID)) {
|
|
9795
|
+
return { response, error };
|
|
9796
|
+
}
|
|
9797
|
+
const body = FAIL_OPEN_BODIES[hookCtx.operationID];
|
|
9798
|
+
if (!body) {
|
|
9799
|
+
return { response, error };
|
|
9800
|
+
}
|
|
9801
|
+
console.error(FAIL_OPEN_LOG_MESSAGE);
|
|
9802
|
+
console.error(
|
|
9803
|
+
` Operation: ${hookCtx.operationID} | Status: ${response.status} | Error: ${error ?? "Server error"}`
|
|
9804
|
+
);
|
|
9805
|
+
return {
|
|
9806
|
+
response: new Response(JSON.stringify(body), {
|
|
9807
|
+
status: 200,
|
|
9808
|
+
headers: { "Content-Type": "application/json" }
|
|
9809
|
+
}),
|
|
9810
|
+
error: null
|
|
9811
|
+
};
|
|
9812
|
+
}
|
|
9813
|
+
};
|
|
9814
|
+
|
|
9815
|
+
// ../sdk/src/hooks/timeoutFixHook.ts
|
|
9816
|
+
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
9817
|
+
var AUTO_TIMEOUT_OPERATION_IDS = /* @__PURE__ */ new Set(["check", "track"]);
|
|
9818
|
+
var TimeoutFixHook = class {
|
|
9819
|
+
beforeRequest(hookCtx, request) {
|
|
9820
|
+
let timeoutMs = hookCtx.options.timeoutMs;
|
|
9821
|
+
if ((!timeoutMs || timeoutMs <= 0) && AUTO_TIMEOUT_OPERATION_IDS.has(hookCtx.operationID))
|
|
9822
|
+
timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
9823
|
+
if (!timeoutMs || timeoutMs <= 0) return request;
|
|
9824
|
+
const signal = typeof AbortSignal.any === "function" ? AbortSignal.any([request.signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
|
|
9825
|
+
return new Request(request, {
|
|
9826
|
+
signal
|
|
9827
|
+
});
|
|
9828
|
+
}
|
|
9829
|
+
};
|
|
9830
|
+
|
|
9831
|
+
// ../sdk/src/hooks/registration.ts
|
|
9832
|
+
function initHooks(hooks) {
|
|
9833
|
+
const failOpenHook = new FailOpenHook();
|
|
9834
|
+
const timeoutFixHook = new TimeoutFixHook();
|
|
9835
|
+
hooks.registerSDKInitHook(failOpenHook);
|
|
9836
|
+
hooks.registerBeforeRequestHook(timeoutFixHook);
|
|
9837
|
+
hooks.registerAfterErrorHook(failOpenHook);
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9727
9840
|
// ../sdk/src/hooks/hooks.ts
|
|
9728
9841
|
var SDKHooks = class {
|
|
9729
9842
|
sdkInitHooks = [];
|
|
@@ -9732,6 +9845,7 @@ var SDKHooks = class {
|
|
|
9732
9845
|
afterSuccessHooks = [];
|
|
9733
9846
|
afterErrorHooks = [];
|
|
9734
9847
|
constructor() {
|
|
9848
|
+
initHooks(this);
|
|
9735
9849
|
const presetHooks = [];
|
|
9736
9850
|
for (const hook of presetHooks) {
|
|
9737
9851
|
if ("sdkInit" in hook) {
|
|
@@ -13920,7 +14034,8 @@ var eventsAggregateParamsOutboundSchema = import_v4.z.object({
|
|
|
13920
14034
|
group_by: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13921
14035
|
range: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13922
14036
|
bin_size: import_v4.z.string(),
|
|
13923
|
-
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional()
|
|
14037
|
+
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional(),
|
|
14038
|
+
max_groups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13924
14039
|
});
|
|
13925
14040
|
var closedEnumSchema = import_v4.z.any();
|
|
13926
14041
|
var rangeSchema = closedEnumSchema;
|
|
@@ -13932,7 +14047,8 @@ var eventsAggregateParamsSchema = import_v4.z.object({
|
|
|
13932
14047
|
groupBy: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13933
14048
|
range: import_v4.z.union([rangeSchema, import_v4.z.undefined()]).optional(),
|
|
13934
14049
|
binSize: import_v4.z.union([binSizeSchema, import_v4.z.undefined()]).optional(),
|
|
13935
|
-
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional()
|
|
14050
|
+
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional(),
|
|
14051
|
+
maxGroups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13936
14052
|
});
|
|
13937
14053
|
|
|
13938
14054
|
// src/generated/attachSchemas.ts
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autumnHandler
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-HG52KOLU.mjs";
|
|
4
4
|
import "../chunk-WYDGEDEU.mjs";
|
|
5
5
|
import "../chunk-VXND2UDT.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-ZPZ7FFHT.mjs";
|
|
9
|
-
import "../chunk-55C2WWXQ.mjs";
|
|
10
|
-
import "../chunk-TBQ27LIK.mjs";
|
|
11
|
-
import "../chunk-J44WR3QZ.mjs";
|
|
6
|
+
import "../chunk-CS4R7BU4.mjs";
|
|
7
|
+
import "../chunk-TC6BT3QN.mjs";
|
|
12
8
|
import "../chunk-TSF4YCUO.mjs";
|
|
13
9
|
import "../chunk-UAR3TMWI.mjs";
|
|
14
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-RGUUMXFG.mjs";
|
|
11
|
+
import "../chunk-NSXJQETG.mjs";
|
|
12
|
+
import "../chunk-S5HPMJ4U.mjs";
|
|
15
13
|
import "../chunk-OTXV5FY7.mjs";
|
|
16
|
-
import "../chunk-VZIMT7AO.mjs";
|
|
17
14
|
import "../chunk-Z6QP3YEA.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
|
|
@@ -78,8 +78,8 @@ var SDK_METADATA = {
|
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "2.2.0",
|
|
80
80
|
sdkVersion: "0.10.17",
|
|
81
|
-
genVersion: "2.869.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.
|
|
81
|
+
genVersion: "2.869.25",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.25 2.2.0 @useautumn/sdk"
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// ../sdk/src/lib/http.ts
|
|
@@ -1336,7 +1336,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1336
1336
|
binSize: z8._default(BinSize$outboundSchema, "day"),
|
|
1337
1337
|
customRange: z8.optional(
|
|
1338
1338
|
z8.lazy(() => AggregateEventsCustomRange$outboundSchema)
|
|
1339
|
-
)
|
|
1339
|
+
),
|
|
1340
|
+
maxGroups: z8.optional(z8.int())
|
|
1340
1341
|
}),
|
|
1341
1342
|
z8.transform((v) => {
|
|
1342
1343
|
return remap(v, {
|
|
@@ -1345,7 +1346,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1345
1346
|
featureId: "feature_id",
|
|
1346
1347
|
groupBy: "group_by",
|
|
1347
1348
|
binSize: "bin_size",
|
|
1348
|
-
customRange: "custom_range"
|
|
1349
|
+
customRange: "custom_range",
|
|
1350
|
+
maxGroups: "max_groups"
|
|
1349
1351
|
});
|
|
1350
1352
|
})
|
|
1351
1353
|
);
|
|
@@ -9724,6 +9726,117 @@ async function $do2(client, request, options) {
|
|
|
9724
9726
|
return [result, { status: "complete", request: req, response }];
|
|
9725
9727
|
}
|
|
9726
9728
|
|
|
9729
|
+
// ../sdk/src/hooks/failOpenHook.ts
|
|
9730
|
+
var FAIL_OPEN_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
9731
|
+
"check",
|
|
9732
|
+
"track",
|
|
9733
|
+
"getOrCreateCustomer"
|
|
9734
|
+
]);
|
|
9735
|
+
var FAIL_OPEN_LOG_MESSAGE = "[Autumn] Request failed \u2014 failing open. Learn more: https://docs.useautumn.com/documentation/fail-open";
|
|
9736
|
+
var FAIL_OPEN_BODIES = {
|
|
9737
|
+
check: {
|
|
9738
|
+
allowed: true,
|
|
9739
|
+
customer_id: null,
|
|
9740
|
+
balance: null,
|
|
9741
|
+
flag: null
|
|
9742
|
+
},
|
|
9743
|
+
track: {
|
|
9744
|
+
customer_id: null,
|
|
9745
|
+
value: 0,
|
|
9746
|
+
balance: null
|
|
9747
|
+
},
|
|
9748
|
+
getOrCreateCustomer: {
|
|
9749
|
+
id: null,
|
|
9750
|
+
name: null,
|
|
9751
|
+
email: null,
|
|
9752
|
+
created_at: 0,
|
|
9753
|
+
fingerprint: null,
|
|
9754
|
+
stripe_id: null,
|
|
9755
|
+
env: "live",
|
|
9756
|
+
metadata: {},
|
|
9757
|
+
send_email_receipts: false,
|
|
9758
|
+
billing_controls: {},
|
|
9759
|
+
subscriptions: [],
|
|
9760
|
+
purchases: [],
|
|
9761
|
+
balances: {},
|
|
9762
|
+
flags: {}
|
|
9763
|
+
}
|
|
9764
|
+
};
|
|
9765
|
+
var FailOpenHook = class {
|
|
9766
|
+
enabled = true;
|
|
9767
|
+
sdkInit(opts) {
|
|
9768
|
+
if (opts.failOpen === false) {
|
|
9769
|
+
this.enabled = false;
|
|
9770
|
+
return opts;
|
|
9771
|
+
}
|
|
9772
|
+
this.enabled = true;
|
|
9773
|
+
opts.httpClient = new HTTPClient({
|
|
9774
|
+
fetcher: async (input, init) => {
|
|
9775
|
+
try {
|
|
9776
|
+
return init == null ? await fetch(input) : await fetch(input, init);
|
|
9777
|
+
} catch {
|
|
9778
|
+
return new Response(null, {
|
|
9779
|
+
status: 503,
|
|
9780
|
+
statusText: "Autumn Unreachable"
|
|
9781
|
+
});
|
|
9782
|
+
}
|
|
9783
|
+
}
|
|
9784
|
+
});
|
|
9785
|
+
return opts;
|
|
9786
|
+
}
|
|
9787
|
+
afterError(hookCtx, response, error) {
|
|
9788
|
+
if (!this.enabled) {
|
|
9789
|
+
return { response, error };
|
|
9790
|
+
}
|
|
9791
|
+
if (!response || response.status < 500) {
|
|
9792
|
+
return { response, error };
|
|
9793
|
+
}
|
|
9794
|
+
if (!FAIL_OPEN_OPERATION_IDS.has(hookCtx.operationID)) {
|
|
9795
|
+
return { response, error };
|
|
9796
|
+
}
|
|
9797
|
+
const body = FAIL_OPEN_BODIES[hookCtx.operationID];
|
|
9798
|
+
if (!body) {
|
|
9799
|
+
return { response, error };
|
|
9800
|
+
}
|
|
9801
|
+
console.error(FAIL_OPEN_LOG_MESSAGE);
|
|
9802
|
+
console.error(
|
|
9803
|
+
` Operation: ${hookCtx.operationID} | Status: ${response.status} | Error: ${error ?? "Server error"}`
|
|
9804
|
+
);
|
|
9805
|
+
return {
|
|
9806
|
+
response: new Response(JSON.stringify(body), {
|
|
9807
|
+
status: 200,
|
|
9808
|
+
headers: { "Content-Type": "application/json" }
|
|
9809
|
+
}),
|
|
9810
|
+
error: null
|
|
9811
|
+
};
|
|
9812
|
+
}
|
|
9813
|
+
};
|
|
9814
|
+
|
|
9815
|
+
// ../sdk/src/hooks/timeoutFixHook.ts
|
|
9816
|
+
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
9817
|
+
var AUTO_TIMEOUT_OPERATION_IDS = /* @__PURE__ */ new Set(["check", "track"]);
|
|
9818
|
+
var TimeoutFixHook = class {
|
|
9819
|
+
beforeRequest(hookCtx, request) {
|
|
9820
|
+
let timeoutMs = hookCtx.options.timeoutMs;
|
|
9821
|
+
if ((!timeoutMs || timeoutMs <= 0) && AUTO_TIMEOUT_OPERATION_IDS.has(hookCtx.operationID))
|
|
9822
|
+
timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
9823
|
+
if (!timeoutMs || timeoutMs <= 0) return request;
|
|
9824
|
+
const signal = typeof AbortSignal.any === "function" ? AbortSignal.any([request.signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
|
|
9825
|
+
return new Request(request, {
|
|
9826
|
+
signal
|
|
9827
|
+
});
|
|
9828
|
+
}
|
|
9829
|
+
};
|
|
9830
|
+
|
|
9831
|
+
// ../sdk/src/hooks/registration.ts
|
|
9832
|
+
function initHooks(hooks) {
|
|
9833
|
+
const failOpenHook = new FailOpenHook();
|
|
9834
|
+
const timeoutFixHook = new TimeoutFixHook();
|
|
9835
|
+
hooks.registerSDKInitHook(failOpenHook);
|
|
9836
|
+
hooks.registerBeforeRequestHook(timeoutFixHook);
|
|
9837
|
+
hooks.registerAfterErrorHook(failOpenHook);
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9727
9840
|
// ../sdk/src/hooks/hooks.ts
|
|
9728
9841
|
var SDKHooks = class {
|
|
9729
9842
|
sdkInitHooks = [];
|
|
@@ -9732,6 +9845,7 @@ var SDKHooks = class {
|
|
|
9732
9845
|
afterSuccessHooks = [];
|
|
9733
9846
|
afterErrorHooks = [];
|
|
9734
9847
|
constructor() {
|
|
9848
|
+
initHooks(this);
|
|
9735
9849
|
const presetHooks = [];
|
|
9736
9850
|
for (const hook of presetHooks) {
|
|
9737
9851
|
if ("sdkInit" in hook) {
|
|
@@ -13920,7 +14034,8 @@ var eventsAggregateParamsOutboundSchema = import_v4.z.object({
|
|
|
13920
14034
|
group_by: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13921
14035
|
range: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13922
14036
|
bin_size: import_v4.z.string(),
|
|
13923
|
-
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional()
|
|
14037
|
+
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional(),
|
|
14038
|
+
max_groups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13924
14039
|
});
|
|
13925
14040
|
var closedEnumSchema = import_v4.z.any();
|
|
13926
14041
|
var rangeSchema = closedEnumSchema;
|
|
@@ -13932,7 +14047,8 @@ var eventsAggregateParamsSchema = import_v4.z.object({
|
|
|
13932
14047
|
groupBy: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13933
14048
|
range: import_v4.z.union([rangeSchema, import_v4.z.undefined()]).optional(),
|
|
13934
14049
|
binSize: import_v4.z.union([binSizeSchema, import_v4.z.undefined()]).optional(),
|
|
13935
|
-
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional()
|
|
14050
|
+
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional(),
|
|
14051
|
+
maxGroups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13936
14052
|
});
|
|
13937
14053
|
|
|
13938
14054
|
// src/generated/attachSchemas.ts
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autumnHandler
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-3N5JKLZU.mjs";
|
|
4
4
|
import "../chunk-WYDGEDEU.mjs";
|
|
5
5
|
import "../chunk-VXND2UDT.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-ZPZ7FFHT.mjs";
|
|
9
|
-
import "../chunk-55C2WWXQ.mjs";
|
|
10
|
-
import "../chunk-TBQ27LIK.mjs";
|
|
11
|
-
import "../chunk-J44WR3QZ.mjs";
|
|
6
|
+
import "../chunk-CS4R7BU4.mjs";
|
|
7
|
+
import "../chunk-TC6BT3QN.mjs";
|
|
12
8
|
import "../chunk-TSF4YCUO.mjs";
|
|
13
9
|
import "../chunk-UAR3TMWI.mjs";
|
|
14
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-RGUUMXFG.mjs";
|
|
11
|
+
import "../chunk-NSXJQETG.mjs";
|
|
12
|
+
import "../chunk-S5HPMJ4U.mjs";
|
|
15
13
|
import "../chunk-OTXV5FY7.mjs";
|
|
16
|
-
import "../chunk-VZIMT7AO.mjs";
|
|
17
14
|
import "../chunk-Z6QP3YEA.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
|
|
@@ -78,8 +78,8 @@ var SDK_METADATA = {
|
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "2.2.0",
|
|
80
80
|
sdkVersion: "0.10.17",
|
|
81
|
-
genVersion: "2.869.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.
|
|
81
|
+
genVersion: "2.869.25",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 0.10.17 2.869.25 2.2.0 @useautumn/sdk"
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// ../sdk/src/lib/http.ts
|
|
@@ -1336,7 +1336,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1336
1336
|
binSize: z8._default(BinSize$outboundSchema, "day"),
|
|
1337
1337
|
customRange: z8.optional(
|
|
1338
1338
|
z8.lazy(() => AggregateEventsCustomRange$outboundSchema)
|
|
1339
|
-
)
|
|
1339
|
+
),
|
|
1340
|
+
maxGroups: z8.optional(z8.int())
|
|
1340
1341
|
}),
|
|
1341
1342
|
z8.transform((v) => {
|
|
1342
1343
|
return remap(v, {
|
|
@@ -1345,7 +1346,8 @@ var EventsAggregateParams$outboundSchema = z8.pipe(
|
|
|
1345
1346
|
featureId: "feature_id",
|
|
1346
1347
|
groupBy: "group_by",
|
|
1347
1348
|
binSize: "bin_size",
|
|
1348
|
-
customRange: "custom_range"
|
|
1349
|
+
customRange: "custom_range",
|
|
1350
|
+
maxGroups: "max_groups"
|
|
1349
1351
|
});
|
|
1350
1352
|
})
|
|
1351
1353
|
);
|
|
@@ -9724,6 +9726,117 @@ async function $do2(client, request, options) {
|
|
|
9724
9726
|
return [result, { status: "complete", request: req, response }];
|
|
9725
9727
|
}
|
|
9726
9728
|
|
|
9729
|
+
// ../sdk/src/hooks/failOpenHook.ts
|
|
9730
|
+
var FAIL_OPEN_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
9731
|
+
"check",
|
|
9732
|
+
"track",
|
|
9733
|
+
"getOrCreateCustomer"
|
|
9734
|
+
]);
|
|
9735
|
+
var FAIL_OPEN_LOG_MESSAGE = "[Autumn] Request failed \u2014 failing open. Learn more: https://docs.useautumn.com/documentation/fail-open";
|
|
9736
|
+
var FAIL_OPEN_BODIES = {
|
|
9737
|
+
check: {
|
|
9738
|
+
allowed: true,
|
|
9739
|
+
customer_id: null,
|
|
9740
|
+
balance: null,
|
|
9741
|
+
flag: null
|
|
9742
|
+
},
|
|
9743
|
+
track: {
|
|
9744
|
+
customer_id: null,
|
|
9745
|
+
value: 0,
|
|
9746
|
+
balance: null
|
|
9747
|
+
},
|
|
9748
|
+
getOrCreateCustomer: {
|
|
9749
|
+
id: null,
|
|
9750
|
+
name: null,
|
|
9751
|
+
email: null,
|
|
9752
|
+
created_at: 0,
|
|
9753
|
+
fingerprint: null,
|
|
9754
|
+
stripe_id: null,
|
|
9755
|
+
env: "live",
|
|
9756
|
+
metadata: {},
|
|
9757
|
+
send_email_receipts: false,
|
|
9758
|
+
billing_controls: {},
|
|
9759
|
+
subscriptions: [],
|
|
9760
|
+
purchases: [],
|
|
9761
|
+
balances: {},
|
|
9762
|
+
flags: {}
|
|
9763
|
+
}
|
|
9764
|
+
};
|
|
9765
|
+
var FailOpenHook = class {
|
|
9766
|
+
enabled = true;
|
|
9767
|
+
sdkInit(opts) {
|
|
9768
|
+
if (opts.failOpen === false) {
|
|
9769
|
+
this.enabled = false;
|
|
9770
|
+
return opts;
|
|
9771
|
+
}
|
|
9772
|
+
this.enabled = true;
|
|
9773
|
+
opts.httpClient = new HTTPClient({
|
|
9774
|
+
fetcher: async (input, init) => {
|
|
9775
|
+
try {
|
|
9776
|
+
return init == null ? await fetch(input) : await fetch(input, init);
|
|
9777
|
+
} catch {
|
|
9778
|
+
return new Response(null, {
|
|
9779
|
+
status: 503,
|
|
9780
|
+
statusText: "Autumn Unreachable"
|
|
9781
|
+
});
|
|
9782
|
+
}
|
|
9783
|
+
}
|
|
9784
|
+
});
|
|
9785
|
+
return opts;
|
|
9786
|
+
}
|
|
9787
|
+
afterError(hookCtx, response, error) {
|
|
9788
|
+
if (!this.enabled) {
|
|
9789
|
+
return { response, error };
|
|
9790
|
+
}
|
|
9791
|
+
if (!response || response.status < 500) {
|
|
9792
|
+
return { response, error };
|
|
9793
|
+
}
|
|
9794
|
+
if (!FAIL_OPEN_OPERATION_IDS.has(hookCtx.operationID)) {
|
|
9795
|
+
return { response, error };
|
|
9796
|
+
}
|
|
9797
|
+
const body = FAIL_OPEN_BODIES[hookCtx.operationID];
|
|
9798
|
+
if (!body) {
|
|
9799
|
+
return { response, error };
|
|
9800
|
+
}
|
|
9801
|
+
console.error(FAIL_OPEN_LOG_MESSAGE);
|
|
9802
|
+
console.error(
|
|
9803
|
+
` Operation: ${hookCtx.operationID} | Status: ${response.status} | Error: ${error ?? "Server error"}`
|
|
9804
|
+
);
|
|
9805
|
+
return {
|
|
9806
|
+
response: new Response(JSON.stringify(body), {
|
|
9807
|
+
status: 200,
|
|
9808
|
+
headers: { "Content-Type": "application/json" }
|
|
9809
|
+
}),
|
|
9810
|
+
error: null
|
|
9811
|
+
};
|
|
9812
|
+
}
|
|
9813
|
+
};
|
|
9814
|
+
|
|
9815
|
+
// ../sdk/src/hooks/timeoutFixHook.ts
|
|
9816
|
+
var DEFAULT_TIMEOUT_MS = 5e3;
|
|
9817
|
+
var AUTO_TIMEOUT_OPERATION_IDS = /* @__PURE__ */ new Set(["check", "track"]);
|
|
9818
|
+
var TimeoutFixHook = class {
|
|
9819
|
+
beforeRequest(hookCtx, request) {
|
|
9820
|
+
let timeoutMs = hookCtx.options.timeoutMs;
|
|
9821
|
+
if ((!timeoutMs || timeoutMs <= 0) && AUTO_TIMEOUT_OPERATION_IDS.has(hookCtx.operationID))
|
|
9822
|
+
timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
9823
|
+
if (!timeoutMs || timeoutMs <= 0) return request;
|
|
9824
|
+
const signal = typeof AbortSignal.any === "function" ? AbortSignal.any([request.signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
|
|
9825
|
+
return new Request(request, {
|
|
9826
|
+
signal
|
|
9827
|
+
});
|
|
9828
|
+
}
|
|
9829
|
+
};
|
|
9830
|
+
|
|
9831
|
+
// ../sdk/src/hooks/registration.ts
|
|
9832
|
+
function initHooks(hooks) {
|
|
9833
|
+
const failOpenHook = new FailOpenHook();
|
|
9834
|
+
const timeoutFixHook = new TimeoutFixHook();
|
|
9835
|
+
hooks.registerSDKInitHook(failOpenHook);
|
|
9836
|
+
hooks.registerBeforeRequestHook(timeoutFixHook);
|
|
9837
|
+
hooks.registerAfterErrorHook(failOpenHook);
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9727
9840
|
// ../sdk/src/hooks/hooks.ts
|
|
9728
9841
|
var SDKHooks = class {
|
|
9729
9842
|
sdkInitHooks = [];
|
|
@@ -9732,6 +9845,7 @@ var SDKHooks = class {
|
|
|
9732
9845
|
afterSuccessHooks = [];
|
|
9733
9846
|
afterErrorHooks = [];
|
|
9734
9847
|
constructor() {
|
|
9848
|
+
initHooks(this);
|
|
9735
9849
|
const presetHooks = [];
|
|
9736
9850
|
for (const hook of presetHooks) {
|
|
9737
9851
|
if ("sdkInit" in hook) {
|
|
@@ -13920,7 +14034,8 @@ var eventsAggregateParamsOutboundSchema = import_v4.z.object({
|
|
|
13920
14034
|
group_by: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13921
14035
|
range: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13922
14036
|
bin_size: import_v4.z.string(),
|
|
13923
|
-
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional()
|
|
14037
|
+
custom_range: import_v4.z.union([aggregateEventsCustomRangeOutboundSchema, import_v4.z.undefined()]).optional(),
|
|
14038
|
+
max_groups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13924
14039
|
});
|
|
13925
14040
|
var closedEnumSchema = import_v4.z.any();
|
|
13926
14041
|
var rangeSchema = closedEnumSchema;
|
|
@@ -13932,7 +14047,8 @@ var eventsAggregateParamsSchema = import_v4.z.object({
|
|
|
13932
14047
|
groupBy: import_v4.z.union([import_v4.z.string(), import_v4.z.undefined()]).optional(),
|
|
13933
14048
|
range: import_v4.z.union([rangeSchema, import_v4.z.undefined()]).optional(),
|
|
13934
14049
|
binSize: import_v4.z.union([binSizeSchema, import_v4.z.undefined()]).optional(),
|
|
13935
|
-
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional()
|
|
14050
|
+
customRange: import_v4.z.union([aggregateEventsCustomRangeSchema, import_v4.z.undefined()]).optional(),
|
|
14051
|
+
maxGroups: import_v4.z.union([import_v4.z.number(), import_v4.z.undefined()]).optional()
|
|
13936
14052
|
});
|
|
13937
14053
|
|
|
13938
14054
|
// src/generated/attachSchemas.ts
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autumnHandler
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-NKLPJAWS.mjs";
|
|
4
4
|
import "../chunk-WYDGEDEU.mjs";
|
|
5
5
|
import "../chunk-VXND2UDT.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-ZPZ7FFHT.mjs";
|
|
9
|
-
import "../chunk-55C2WWXQ.mjs";
|
|
10
|
-
import "../chunk-TBQ27LIK.mjs";
|
|
11
|
-
import "../chunk-J44WR3QZ.mjs";
|
|
6
|
+
import "../chunk-CS4R7BU4.mjs";
|
|
7
|
+
import "../chunk-TC6BT3QN.mjs";
|
|
12
8
|
import "../chunk-TSF4YCUO.mjs";
|
|
13
9
|
import "../chunk-UAR3TMWI.mjs";
|
|
14
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-RGUUMXFG.mjs";
|
|
11
|
+
import "../chunk-NSXJQETG.mjs";
|
|
12
|
+
import "../chunk-S5HPMJ4U.mjs";
|
|
15
13
|
import "../chunk-OTXV5FY7.mjs";
|
|
16
|
-
import "../chunk-VZIMT7AO.mjs";
|
|
17
14
|
import "../chunk-Z6QP3YEA.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
|