autumn-js 0.0.62 → 0.0.65
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/libraries/backend/{chunk-3OKYXLTN.mjs → chunk-C2YFOJYP.mjs} +1 -1
- package/dist/libraries/backend/{chunk-EJQ2IWD7.mjs → chunk-FRL4IWBU.mjs} +6 -6
- package/dist/libraries/backend/{chunk-I45FNCR5.mjs → chunk-NDN25XDG.mjs} +3 -2
- package/dist/libraries/backend/{chunk-ONFOZVN3.mjs → chunk-NDS3EHT3.mjs} +1 -1
- package/dist/libraries/backend/{chunk-EWE7GADM.mjs → chunk-QXJ7YDTB.mjs} +1 -1
- package/dist/libraries/backend/{chunk-YQVUFNOA.mjs → chunk-W63TY2DI.mjs} +13 -8
- package/dist/libraries/backend/express.d.mts +1 -1
- package/dist/libraries/backend/express.d.ts +1 -1
- package/dist/libraries/backend/express.js +22 -19
- package/dist/libraries/backend/express.mjs +12 -15
- package/dist/libraries/backend/fastify.js +17 -13
- package/dist/libraries/backend/fastify.mjs +7 -9
- package/dist/libraries/backend/hono.js +17 -13
- package/dist/libraries/backend/hono.mjs +7 -9
- package/dist/libraries/backend/next.d.mts +2 -1
- package/dist/libraries/backend/next.d.ts +2 -1
- package/dist/libraries/backend/next.js +18 -14
- package/dist/libraries/backend/next.mjs +8 -10
- package/dist/libraries/backend/react-router.js +17 -13
- package/dist/libraries/backend/react-router.mjs +7 -9
- package/dist/libraries/backend/{referralTypes-CGt7XaEI.d.ts → referralTypes-CJPslVLJ.d.ts} +4 -0
- package/dist/libraries/backend/{referralTypes-B7FSGa5b.d.mts → referralTypes-DmqKXhXe.d.mts} +4 -0
- package/dist/libraries/backend/remix_dep.js +17 -13
- package/dist/libraries/backend/remix_dep.mjs +7 -9
- package/dist/libraries/backend/routes/backendRouter.d.mts +1 -5
- package/dist/libraries/backend/routes/backendRouter.d.ts +1 -5
- package/dist/libraries/backend/routes/backendRouter.js +16 -10
- package/dist/libraries/backend/routes/backendRouter.mjs +6 -6
- package/dist/libraries/backend/routes/entityRoutes.js +13 -8
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +15 -9
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/referralRoutes.js +13 -8
- package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
- package/dist/libraries/backend/supabase.js +17 -13
- package/dist/libraries/backend/supabase.mjs +7 -9
- package/dist/libraries/backend/tanstack.js +17 -13
- package/dist/libraries/backend/tanstack.mjs +7 -9
- package/dist/libraries/backend/utils/backendRes.js +13 -8
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
- package/dist/libraries/backend/utils/withAuth.js +13 -8
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +4 -4
- package/dist/libraries/react/AutumnContext.d.ts +4 -4
- package/dist/libraries/react/AutumnContext.js +13 -8
- package/dist/libraries/react/AutumnContext.mjs +3 -3
- package/dist/libraries/react/BaseAutumnProvider.d.mts +4 -4
- package/dist/libraries/react/BaseAutumnProvider.d.ts +4 -4
- package/dist/libraries/react/BaseAutumnProvider.js +13 -8
- package/dist/libraries/react/BaseAutumnProvider.mjs +6 -6
- package/dist/libraries/react/{ReactAutumnClient-DoXXU_vr.d.mts → ReactAutumnClient-BQtmw21U.d.mts} +3 -3
- package/dist/libraries/react/{ReactAutumnClient-BgrRcTEM.d.ts → ReactAutumnClient-DNcV0gAT.d.ts} +3 -3
- package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.js +13 -8
- package/dist/libraries/react/ReactAutumnProvider.mjs +7 -7
- package/dist/libraries/react/{chunk-BG33A3TN.mjs → chunk-4TTWSWW7.mjs} +3 -3
- package/dist/libraries/react/{chunk-6FF2Q2VD.mjs → chunk-5CBWPVSP.mjs} +1 -1
- package/dist/libraries/react/{chunk-GKHSPJB6.mjs → chunk-CZAUMPWK.mjs} +2 -2
- package/dist/libraries/react/{chunk-MRIPC6HX.mjs → chunk-DFXUEQ6D.mjs} +1 -1
- package/dist/libraries/react/{chunk-VIXAYSBW.mjs → chunk-OCZFV7OX.mjs} +13 -8
- package/dist/libraries/react/{chunk-LRYO52RU.mjs → chunk-Q5SSQSDP.mjs} +1 -1
- package/dist/libraries/react/{chunk-7PEQTAP7.mjs → chunk-RIXRUJDK.mjs} +1 -1
- package/dist/libraries/react/{chunk-PC4OCHJB.mjs → chunk-URAFNMTH.mjs} +1 -1
- package/dist/libraries/react/{chunk-E6UE2PPO.mjs → chunk-WPXLFYWT.mjs} +3 -9
- package/dist/libraries/react/{chunk-GVWF4C3N.mjs → chunk-XTEUMENO.mjs} +1 -1
- package/dist/libraries/react/{chunk-3BJR6YBL.mjs → chunk-XXOQMNM6.mjs} +1 -1
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -4
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -4
- package/dist/libraries/react/client/ReactAutumnClient.js +13 -8
- package/dist/libraries/react/client/ReactAutumnClient.mjs +2 -2
- package/dist/libraries/react/client/clientCompMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientCompMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientCusMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientCusMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientGenMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientGenMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -4
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +1 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +1 -0
- package/dist/libraries/react/{cusTypes-BTcZvjbB.d.ts → cusTypes-Cf-s9PYP.d.mts} +2 -0
- package/dist/libraries/react/{cusTypes-BTcZvjbB.d.mts → cusTypes-Cf-s9PYP.d.ts} +2 -0
- package/dist/libraries/react/{entTypes-CIjIxPas.d.ts → entTypes-BbIk0Toa.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-_9_C-00R.d.mts → entTypes-CV-165S-.d.mts} +1 -1
- package/dist/libraries/react/hooks/useAutumn.d.mts +4 -7
- package/dist/libraries/react/hooks/useAutumn.d.ts +4 -7
- package/dist/libraries/react/hooks/useAutumn.js +15 -16
- package/dist/libraries/react/hooks/useAutumn.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.mts +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.ts +4 -4
- package/dist/libraries/react/hooks/useCustomer.js +13 -8
- package/dist/libraries/react/hooks/useCustomer.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomerProvider.d.mts +4 -4
- package/dist/libraries/react/hooks/useCustomerProvider.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntity.d.mts +2 -2
- package/dist/libraries/react/hooks/useEntity.d.ts +2 -2
- package/dist/libraries/react/hooks/useEntity.js +13 -8
- package/dist/libraries/react/hooks/useEntity.mjs +4 -4
- package/dist/libraries/react/hooks/useEntityProvider.d.mts +4 -4
- package/dist/libraries/react/hooks/useEntityProvider.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntityProvider.js +13 -8
- package/dist/libraries/react/hooks/useEntityProvider.mjs +2 -2
- package/dist/libraries/react/hooks/usePricingTable.js +13 -8
- package/dist/libraries/react/hooks/usePricingTable.mjs +4 -4
- package/dist/libraries/react/hooks/usePricingTableProvider.d.mts +4 -4
- package/dist/libraries/react/hooks/usePricingTableProvider.d.ts +4 -4
- package/dist/libraries/react/hooks/usePricingTableProvider.js +13 -8
- package/dist/libraries/react/hooks/usePricingTableProvider.mjs +2 -2
- package/dist/libraries/react/index.d.mts +4 -4
- package/dist/libraries/react/index.d.ts +4 -4
- package/dist/libraries/react/index.js +15 -16
- package/dist/libraries/react/index.mjs +11 -11
- package/dist/libraries/react/{response-CuJBOgCX.d.ts → response-B1KyqUB9.d.ts} +1 -1
- package/dist/libraries/react/{response-BqFGIMug.d.mts → response-B5dHU3I9.d.mts} +1 -1
- package/dist/next/client/AutumnContext.d.mts +2 -2
- package/dist/next/client/AutumnContext.d.ts +2 -2
- package/dist/next/client/AutumnProvider.d.mts +1 -1
- package/dist/next/client/AutumnProvider.d.ts +1 -1
- package/dist/next/client/clientUtils.d.mts +2 -2
- package/dist/next/client/clientUtils.d.ts +2 -2
- package/dist/next/client/{cusTypes-BGfMicAw.d.ts → cusTypes-sh5_cN7N.d.mts} +2 -0
- package/dist/next/client/{cusTypes-BGfMicAw.d.mts → cusTypes-sh5_cN7N.d.ts} +2 -0
- package/dist/next/client/{entTypes-C81tVu3a.d.ts → entTypes-BDqnMLZ4.d.ts} +1 -1
- package/dist/next/client/{entTypes-Dmm2Us0w.d.mts → entTypes-C9TNWMk6.d.mts} +1 -1
- package/dist/next/client/hooks/useAutumn.d.mts +6 -4
- package/dist/next/client/hooks/useAutumn.d.ts +6 -4
- package/dist/next/client/hooks/useAutumn.js +2 -6
- package/dist/next/client/hooks/useAutumn.mjs +2 -6
- package/dist/next/client/hooks/useCustomer.d.mts +2 -2
- package/dist/next/client/hooks/useCustomer.d.ts +2 -2
- package/dist/next/client/hooks/useEntity.d.mts +2 -2
- package/dist/next/client/hooks/useEntity.d.ts +2 -2
- package/dist/next/client/hooks/usePricingTable.d.mts +2 -2
- package/dist/next/client/hooks/usePricingTable.d.ts +2 -2
- package/dist/next/client/types.d.mts +2 -2
- package/dist/next/client/types.d.ts +2 -2
- package/dist/next/index.d.mts +10 -5
- package/dist/next/index.d.ts +10 -5
- package/dist/next/server/auth/withAuth.d.mts +1 -1
- package/dist/next/server/auth/withAuth.d.ts +1 -1
- package/dist/next/server/{clientEntTypes-DX4iApM4.d.ts → clientEntTypes-CPVfO1bd.d.mts} +2 -1
- package/dist/next/server/{clientEntTypes-DCLnLdr2.d.mts → clientEntTypes-JLwH7X3l.d.ts} +2 -1
- package/dist/next/server/componentActions.d.mts +1 -1
- package/dist/next/server/componentActions.d.ts +1 -1
- package/dist/next/server/cusActions.d.mts +3 -2
- package/dist/next/server/cusActions.d.ts +3 -2
- package/dist/next/server/{cusTypes-VlsM-bzW.d.mts → cusTypes-BD42O-7Z.d.mts} +2 -0
- package/dist/next/server/{cusTypes-VlsM-bzW.d.ts → cusTypes-BD42O-7Z.d.ts} +2 -0
- package/dist/next/server/genActions.d.mts +9 -5
- package/dist/next/server/genActions.d.ts +9 -5
- package/dist/next/server/genActions.js +3 -10
- package/dist/next/server/genActions.mjs +3 -10
- package/dist/sdk/{cusTypes-D6sQTXPy.d.ts → cusTypes-BTV6ui4e.d.ts} +2 -0
- package/dist/sdk/{cusTypes-T1IdN-ez.d.mts → cusTypes-wBxbodEe.d.mts} +2 -0
- package/dist/sdk/customers.d.mts +1 -1
- package/dist/sdk/customers.d.ts +1 -1
- package/dist/sdk/{entTypes-BCt_cXXf.d.ts → entTypes-BwLV9Jn4.d.ts} +1 -1
- package/dist/sdk/{entTypes-BDv4ErLm.d.mts → entTypes-CJjjWn54.d.mts} +1 -1
- package/dist/sdk/entities.d.mts +2 -2
- package/dist/sdk/entities.d.ts +2 -2
- package/dist/sdk/general.d.mts +3 -2
- package/dist/sdk/general.d.ts +3 -2
- package/dist/sdk/index.d.mts +5 -4
- package/dist/sdk/index.d.ts +5 -4
- package/dist/sdk/index.js +13 -8
- package/dist/sdk/index.mjs +13 -8
- package/dist/utils/encryptUtils.js +13 -8
- package/dist/utils/encryptUtils.mjs +13 -8
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
|
-
import { G as GetEntityParams } from '../entTypes-
|
|
3
|
-
import '../cusTypes-
|
|
2
|
+
import { G as GetEntityParams } from '../entTypes-BDqnMLZ4.js';
|
|
3
|
+
import '../cusTypes-sh5_cN7N.js';
|
|
4
4
|
|
|
5
5
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
6
6
|
entity: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PricingTableProduct } from '../types.mjs';
|
|
2
|
-
import '../cusTypes-
|
|
3
|
-
import '../entTypes-
|
|
2
|
+
import '../cusTypes-sh5_cN7N.mjs';
|
|
3
|
+
import '../entTypes-C9TNWMk6.mjs';
|
|
4
4
|
|
|
5
5
|
declare const usePricingTable: (options?: {
|
|
6
6
|
productDetails: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CustomerData, b as Customer } from './cusTypes-
|
|
2
|
-
import { E as Entity } from './entTypes-
|
|
1
|
+
import { C as CustomerData, b as Customer } from './cusTypes-sh5_cN7N.mjs';
|
|
2
|
+
import { E as Entity } from './entTypes-C9TNWMk6.mjs';
|
|
3
3
|
|
|
4
4
|
interface ProductDetails {
|
|
5
5
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CustomerData, b as Customer } from './cusTypes-
|
|
2
|
-
import { E as Entity } from './entTypes-
|
|
1
|
+
import { C as CustomerData, b as Customer } from './cusTypes-sh5_cN7N.js';
|
|
2
|
+
import { E as Entity } from './entTypes-BDqnMLZ4.js';
|
|
3
3
|
|
|
4
4
|
interface ProductDetails {
|
|
5
5
|
id: string;
|
package/dist/next/index.d.mts
CHANGED
|
@@ -31,6 +31,11 @@ interface CreateEntityParams {
|
|
|
31
31
|
featureId: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
interface CancelParams {
|
|
35
|
+
productId: string;
|
|
36
|
+
entityId?: string;
|
|
37
|
+
cancelImmediately?: boolean;
|
|
38
|
+
}
|
|
34
39
|
interface TrackParams {
|
|
35
40
|
featureId?: string;
|
|
36
41
|
eventName?: string;
|
|
@@ -53,10 +58,7 @@ declare const useAutumn: () => {
|
|
|
53
58
|
entityData?: EntityDataParams;
|
|
54
59
|
}) => Promise<any>;
|
|
55
60
|
track: (params: TrackParams) => Promise<any>;
|
|
56
|
-
cancel: (
|
|
57
|
-
productId: string;
|
|
58
|
-
entityId?: string;
|
|
59
|
-
}) => Promise<any>;
|
|
61
|
+
cancel: (params: CancelParams) => Promise<any>;
|
|
60
62
|
openBillingPortal: (options?: {
|
|
61
63
|
returnUrl?: string;
|
|
62
64
|
}) => Promise<any>;
|
|
@@ -117,6 +119,8 @@ interface CustomerProduct {
|
|
|
117
119
|
current_period_end?: number | null;
|
|
118
120
|
trial_ends_at?: number;
|
|
119
121
|
entity_id?: string;
|
|
122
|
+
is_add_on: boolean;
|
|
123
|
+
is_default: boolean;
|
|
120
124
|
}
|
|
121
125
|
interface Customer {
|
|
122
126
|
id: string | null;
|
|
@@ -291,8 +295,9 @@ type AuthResult = Promise<{
|
|
|
291
295
|
} | null>;
|
|
292
296
|
|
|
293
297
|
declare function autumnHandler(options: {
|
|
294
|
-
secretKey?: string;
|
|
295
298
|
identify: (request: NextRequest) => AuthResult;
|
|
299
|
+
url?: string;
|
|
300
|
+
secretKey?: string;
|
|
296
301
|
}): {
|
|
297
302
|
GET: (request: NextRequest) => Promise<NextResponse<any>>;
|
|
298
303
|
POST: (request: NextRequest) => Promise<NextResponse<any>>;
|
package/dist/next/index.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ interface CreateEntityParams {
|
|
|
31
31
|
featureId: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
interface CancelParams {
|
|
35
|
+
productId: string;
|
|
36
|
+
entityId?: string;
|
|
37
|
+
cancelImmediately?: boolean;
|
|
38
|
+
}
|
|
34
39
|
interface TrackParams {
|
|
35
40
|
featureId?: string;
|
|
36
41
|
eventName?: string;
|
|
@@ -53,10 +58,7 @@ declare const useAutumn: () => {
|
|
|
53
58
|
entityData?: EntityDataParams;
|
|
54
59
|
}) => Promise<any>;
|
|
55
60
|
track: (params: TrackParams) => Promise<any>;
|
|
56
|
-
cancel: (
|
|
57
|
-
productId: string;
|
|
58
|
-
entityId?: string;
|
|
59
|
-
}) => Promise<any>;
|
|
61
|
+
cancel: (params: CancelParams) => Promise<any>;
|
|
60
62
|
openBillingPortal: (options?: {
|
|
61
63
|
returnUrl?: string;
|
|
62
64
|
}) => Promise<any>;
|
|
@@ -117,6 +119,8 @@ interface CustomerProduct {
|
|
|
117
119
|
current_period_end?: number | null;
|
|
118
120
|
trial_ends_at?: number;
|
|
119
121
|
entity_id?: string;
|
|
122
|
+
is_add_on: boolean;
|
|
123
|
+
is_default: boolean;
|
|
120
124
|
}
|
|
121
125
|
interface Customer {
|
|
122
126
|
id: string | null;
|
|
@@ -291,8 +295,9 @@ type AuthResult = Promise<{
|
|
|
291
295
|
} | null>;
|
|
292
296
|
|
|
293
297
|
declare function autumnHandler(options: {
|
|
294
|
-
secretKey?: string;
|
|
295
298
|
identify: (request: NextRequest) => AuthResult;
|
|
299
|
+
url?: string;
|
|
300
|
+
secretKey?: string;
|
|
296
301
|
}): {
|
|
297
302
|
GET: (request: NextRequest) => Promise<NextResponse<any>>;
|
|
298
303
|
POST: (request: NextRequest) => Promise<NextResponse<any>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType } from './cusTypes-
|
|
1
|
+
import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType } from './cusTypes-BD42O-7Z.mjs';
|
|
2
2
|
|
|
3
3
|
type EntityExpandOption = "invoices";
|
|
4
4
|
|
|
@@ -137,6 +137,7 @@ interface CancelParams {
|
|
|
137
137
|
customer_id: string;
|
|
138
138
|
product_id: string;
|
|
139
139
|
entity_id?: string;
|
|
140
|
+
cancel_immediately?: boolean;
|
|
140
141
|
}
|
|
141
142
|
interface CancelResult {
|
|
142
143
|
success: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType } from './cusTypes-
|
|
1
|
+
import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType } from './cusTypes-BD42O-7Z.js';
|
|
2
2
|
|
|
3
3
|
type EntityExpandOption = "invoices";
|
|
4
4
|
|
|
@@ -137,6 +137,7 @@ interface CancelParams {
|
|
|
137
137
|
customer_id: string;
|
|
138
138
|
product_id: string;
|
|
139
139
|
entity_id?: string;
|
|
140
|
+
cancel_immediately?: boolean;
|
|
140
141
|
}
|
|
141
142
|
interface CancelResult {
|
|
142
143
|
success: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-
|
|
1
|
+
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-CPVfO1bd.mjs';
|
|
2
2
|
import { R as Result, A as AutumnError } from './response-BCg7kiiN.mjs';
|
|
3
|
-
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-
|
|
3
|
+
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BD42O-7Z.mjs';
|
|
4
4
|
|
|
5
5
|
declare class Autumn {
|
|
6
6
|
private readonly secretKey;
|
|
@@ -13,6 +13,7 @@ declare class Autumn {
|
|
|
13
13
|
publishableKey?: string;
|
|
14
14
|
url?: string;
|
|
15
15
|
version?: string;
|
|
16
|
+
headers?: Record<string, string>;
|
|
16
17
|
});
|
|
17
18
|
getLevel(): "secret" | "publishable";
|
|
18
19
|
get(path: string): Promise<Result<any, AutumnError>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-
|
|
1
|
+
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-JLwH7X3l.js';
|
|
2
2
|
import { R as Result, A as AutumnError } from './response-BCg7kiiN.js';
|
|
3
|
-
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-
|
|
3
|
+
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BD42O-7Z.js';
|
|
4
4
|
|
|
5
5
|
declare class Autumn {
|
|
6
6
|
private readonly secretKey;
|
|
@@ -13,6 +13,7 @@ declare class Autumn {
|
|
|
13
13
|
publishableKey?: string;
|
|
14
14
|
url?: string;
|
|
15
15
|
version?: string;
|
|
16
|
+
headers?: Record<string, string>;
|
|
16
17
|
});
|
|
17
18
|
getLevel(): "secret" | "publishable";
|
|
18
19
|
get(path: string): Promise<Result<any, AutumnError>>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-
|
|
2
|
-
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-
|
|
1
|
+
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-CPVfO1bd.mjs';
|
|
2
|
+
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BD42O-7Z.mjs';
|
|
3
|
+
|
|
4
|
+
interface CancelParams {
|
|
5
|
+
productId: string;
|
|
6
|
+
entityId?: string;
|
|
7
|
+
cancelImmediately?: boolean;
|
|
8
|
+
}
|
|
3
9
|
|
|
4
10
|
declare const attachAction: (args: Omit<{
|
|
5
11
|
customerId: string;
|
|
@@ -14,10 +20,8 @@ declare const attachAction: (args: Omit<{
|
|
|
14
20
|
}, "customerId"> & {
|
|
15
21
|
encryptedCustomerId?: string;
|
|
16
22
|
}, request?: Request) => Promise<any>;
|
|
17
|
-
declare const cancelAction: (args: Omit<{
|
|
23
|
+
declare const cancelAction: (args: Omit<CancelParams & {
|
|
18
24
|
customerId: string;
|
|
19
|
-
productId: string;
|
|
20
|
-
entityId?: string;
|
|
21
25
|
}, "customerId"> & {
|
|
22
26
|
encryptedCustomerId?: string;
|
|
23
27
|
}, request?: Request) => Promise<any>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-
|
|
2
|
-
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-
|
|
1
|
+
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-JLwH7X3l.js';
|
|
2
|
+
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BD42O-7Z.js';
|
|
3
|
+
|
|
4
|
+
interface CancelParams {
|
|
5
|
+
productId: string;
|
|
6
|
+
entityId?: string;
|
|
7
|
+
cancelImmediately?: boolean;
|
|
8
|
+
}
|
|
3
9
|
|
|
4
10
|
declare const attachAction: (args: Omit<{
|
|
5
11
|
customerId: string;
|
|
@@ -14,10 +20,8 @@ declare const attachAction: (args: Omit<{
|
|
|
14
20
|
}, "customerId"> & {
|
|
15
21
|
encryptedCustomerId?: string;
|
|
16
22
|
}, request?: Request) => Promise<any>;
|
|
17
|
-
declare const cancelAction: (args: Omit<{
|
|
23
|
+
declare const cancelAction: (args: Omit<CancelParams & {
|
|
18
24
|
customerId: string;
|
|
19
|
-
productId: string;
|
|
20
|
-
entityId?: string;
|
|
21
25
|
}, "customerId"> & {
|
|
22
26
|
encryptedCustomerId?: string;
|
|
23
27
|
}, request?: Request) => Promise<any>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createAutumnClient } from "../server/cusActions";
|
|
3
3
|
import { withAuth } from "./auth/withAuth";
|
|
4
4
|
import { toServerResponse } from "./utils";
|
|
5
|
+
import { toSnakeCase } from "../../libraries/react/utils/toSnakeCase";
|
|
5
6
|
const attachAction = withAuth({
|
|
6
7
|
fn: async ({
|
|
7
8
|
customerId,
|
|
@@ -31,17 +32,9 @@ const attachAction = withAuth({
|
|
|
31
32
|
withCustomerData: true
|
|
32
33
|
});
|
|
33
34
|
const cancelAction = withAuth({
|
|
34
|
-
fn: async ({
|
|
35
|
-
customerId,
|
|
36
|
-
productId,
|
|
37
|
-
entityId
|
|
38
|
-
}) => {
|
|
35
|
+
fn: async (params) => {
|
|
39
36
|
const autumn = createAutumnClient();
|
|
40
|
-
let res = await autumn.cancel(
|
|
41
|
-
customer_id: customerId,
|
|
42
|
-
product_id: productId,
|
|
43
|
-
entity_id: entityId
|
|
44
|
-
});
|
|
37
|
+
let res = await autumn.cancel(toSnakeCase(params));
|
|
45
38
|
return toServerResponse(res);
|
|
46
39
|
}
|
|
47
40
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createAutumnClient } from "../server/cusActions";
|
|
3
3
|
import { withAuth } from "./auth/withAuth";
|
|
4
4
|
import { toServerResponse } from "./utils";
|
|
5
|
+
import { toSnakeCase } from "../../libraries/react/utils/toSnakeCase";
|
|
5
6
|
const attachAction = withAuth({
|
|
6
7
|
fn: async ({
|
|
7
8
|
customerId,
|
|
@@ -31,17 +32,9 @@ const attachAction = withAuth({
|
|
|
31
32
|
withCustomerData: true
|
|
32
33
|
});
|
|
33
34
|
const cancelAction = withAuth({
|
|
34
|
-
fn: async ({
|
|
35
|
-
customerId,
|
|
36
|
-
productId,
|
|
37
|
-
entityId
|
|
38
|
-
}) => {
|
|
35
|
+
fn: async (params) => {
|
|
39
36
|
const autumn = createAutumnClient();
|
|
40
|
-
let res = await autumn.cancel(
|
|
41
|
-
customer_id: customerId,
|
|
42
|
-
product_id: productId,
|
|
43
|
-
entity_id: entityId
|
|
44
|
-
});
|
|
37
|
+
let res = await autumn.cancel(toSnakeCase(params));
|
|
45
38
|
return toServerResponse(res);
|
|
46
39
|
}
|
|
47
40
|
});
|
package/dist/sdk/customers.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './prodEnums-C1lccCWI.mjs';
|
|
2
|
-
export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, G as GetCustomerParams, U as UpdateCustomerParams } from './cusTypes-
|
|
2
|
+
export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, G as GetCustomerParams, U as UpdateCustomerParams } from './cusTypes-wBxbodEe.mjs';
|
package/dist/sdk/customers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './prodEnums-C1lccCWI.js';
|
|
2
|
-
export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, G as GetCustomerParams, U as UpdateCustomerParams } from './cusTypes-
|
|
2
|
+
export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, G as GetCustomerParams, U as UpdateCustomerParams } from './cusTypes-BTV6ui4e.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-
|
|
1
|
+
import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-BTV6ui4e.js';
|
|
2
2
|
|
|
3
3
|
type EntityExpandOption = "invoices";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-
|
|
1
|
+
import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-wBxbodEe.mjs';
|
|
2
2
|
|
|
3
3
|
type EntityExpandOption = "invoices";
|
|
4
4
|
|
package/dist/sdk/entities.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import './cusTypes-
|
|
2
|
-
export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-
|
|
1
|
+
import './cusTypes-wBxbodEe.mjs';
|
|
2
|
+
export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-CJjjWn54.mjs';
|
|
3
3
|
import './prodEnums-C1lccCWI.mjs';
|
package/dist/sdk/entities.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import './cusTypes-
|
|
2
|
-
export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-
|
|
1
|
+
import './cusTypes-BTV6ui4e.js';
|
|
2
|
+
export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-BwLV9Jn4.js';
|
|
3
3
|
import './prodEnums-C1lccCWI.js';
|
package/dist/sdk/general.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as CustomerData } from './cusTypes-
|
|
2
|
-
import { b as EntityData } from './entTypes-
|
|
1
|
+
import { e as CustomerData } from './cusTypes-wBxbodEe.mjs';
|
|
2
|
+
import { b as EntityData } from './entTypes-CJjjWn54.mjs';
|
|
3
3
|
import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.mjs';
|
|
4
4
|
import './prodEnums-C1lccCWI.mjs';
|
|
5
5
|
import './products.mjs';
|
|
@@ -26,6 +26,7 @@ interface CancelParams {
|
|
|
26
26
|
customer_id: string;
|
|
27
27
|
product_id: string;
|
|
28
28
|
entity_id?: string;
|
|
29
|
+
cancel_immediately?: boolean;
|
|
29
30
|
}
|
|
30
31
|
interface CancelResult {
|
|
31
32
|
success: boolean;
|
package/dist/sdk/general.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as CustomerData } from './cusTypes-
|
|
2
|
-
import { b as EntityData } from './entTypes-
|
|
1
|
+
import { e as CustomerData } from './cusTypes-BTV6ui4e.js';
|
|
2
|
+
import { b as EntityData } from './entTypes-BwLV9Jn4.js';
|
|
3
3
|
import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.js';
|
|
4
4
|
import './prodEnums-C1lccCWI.js';
|
|
5
5
|
import './products.js';
|
|
@@ -26,6 +26,7 @@ interface CancelParams {
|
|
|
26
26
|
customer_id: string;
|
|
27
27
|
product_id: string;
|
|
28
28
|
entity_id?: string;
|
|
29
|
+
cancel_immediately?: boolean;
|
|
29
30
|
}
|
|
30
31
|
interface CancelResult {
|
|
31
32
|
success: boolean;
|
package/dist/sdk/index.d.mts
CHANGED
|
@@ -2,10 +2,10 @@ import { AttachParams, AttachResult, UsageParams, UsageResult, CancelParams, Can
|
|
|
2
2
|
export { AttachFeatureOptions, EntitledBalance } from './general.mjs';
|
|
3
3
|
import { Product, CreateProductParams, ListProductsParams } from './products.mjs';
|
|
4
4
|
export { FreeTrial, PriceTier, ProductItem } from './products.mjs';
|
|
5
|
-
import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-
|
|
6
|
-
export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-
|
|
7
|
-
import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-
|
|
8
|
-
export { b as EntityData, c as EntityExpandOption } from './entTypes-
|
|
5
|
+
import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-wBxbodEe.mjs';
|
|
6
|
+
export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-wBxbodEe.mjs';
|
|
7
|
+
import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-CJjjWn54.mjs';
|
|
8
|
+
export { b as EntityData, c as EntityExpandOption } from './entTypes-CJjjWn54.mjs';
|
|
9
9
|
import { CreateReferralCodeParams, RedeemReferralCodeParams } from './referrals.mjs';
|
|
10
10
|
export { CreateReferralCodeResult, RedeemReferralCodeResult } from './referrals.mjs';
|
|
11
11
|
export { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario } from './check.mjs';
|
|
@@ -51,6 +51,7 @@ declare class Autumn {
|
|
|
51
51
|
publishableKey?: string;
|
|
52
52
|
url?: string;
|
|
53
53
|
version?: string;
|
|
54
|
+
headers?: Record<string, string>;
|
|
54
55
|
});
|
|
55
56
|
getLevel(): "secret" | "publishable";
|
|
56
57
|
get(path: string): Promise<Result<any, AutumnError>>;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { AttachParams, AttachResult, UsageParams, UsageResult, CancelParams, Can
|
|
|
2
2
|
export { AttachFeatureOptions, EntitledBalance } from './general.js';
|
|
3
3
|
import { Product, CreateProductParams, ListProductsParams } from './products.js';
|
|
4
4
|
export { FreeTrial, PriceTier, ProductItem } from './products.js';
|
|
5
|
-
import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-
|
|
6
|
-
export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-
|
|
7
|
-
import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-
|
|
8
|
-
export { b as EntityData, c as EntityExpandOption } from './entTypes-
|
|
5
|
+
import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-BTV6ui4e.js';
|
|
6
|
+
export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-BTV6ui4e.js';
|
|
7
|
+
import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-BwLV9Jn4.js';
|
|
8
|
+
export { b as EntityData, c as EntityExpandOption } from './entTypes-BwLV9Jn4.js';
|
|
9
9
|
import { CreateReferralCodeParams, RedeemReferralCodeParams } from './referrals.js';
|
|
10
10
|
export { CreateReferralCodeResult, RedeemReferralCodeResult } from './referrals.js';
|
|
11
11
|
export { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario } from './check.js';
|
|
@@ -51,6 +51,7 @@ declare class Autumn {
|
|
|
51
51
|
publishableKey?: string;
|
|
52
52
|
url?: string;
|
|
53
53
|
version?: string;
|
|
54
|
+
headers?: Record<string, string>;
|
|
54
55
|
});
|
|
55
56
|
getLevel(): "secret" | "publishable";
|
|
56
57
|
get(path: string): Promise<Result<any, AutumnError>>;
|
package/dist/sdk/index.js
CHANGED
|
@@ -302,10 +302,10 @@ var Autumn = class {
|
|
|
302
302
|
this.publishableKey = options?.publishableKey || process.env.AUTUMN_PUBLISHABLE_KEY;
|
|
303
303
|
} catch (error) {
|
|
304
304
|
}
|
|
305
|
-
if (!this.secretKey && !this.publishableKey) {
|
|
305
|
+
if (!this.secretKey && !this.publishableKey && !options?.headers) {
|
|
306
306
|
throw new Error("Autumn secret key or publishable key is required");
|
|
307
307
|
}
|
|
308
|
-
this.headers = {
|
|
308
|
+
this.headers = options?.headers || {
|
|
309
309
|
Authorization: `Bearer ${this.secretKey || this.publishableKey}`,
|
|
310
310
|
"Content-Type": "application/json"
|
|
311
311
|
};
|
|
@@ -324,12 +324,17 @@ var Autumn = class {
|
|
|
324
324
|
return toContainerResult(response);
|
|
325
325
|
}
|
|
326
326
|
async post(path, body) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
327
|
+
try {
|
|
328
|
+
const response = await fetch(`${this.url}${path}`, {
|
|
329
|
+
method: "POST",
|
|
330
|
+
headers: this.headers,
|
|
331
|
+
body: JSON.stringify(body)
|
|
332
|
+
});
|
|
333
|
+
return toContainerResult(response);
|
|
334
|
+
} catch (error) {
|
|
335
|
+
console.error("Error sending request:", error);
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
333
338
|
}
|
|
334
339
|
async delete(path) {
|
|
335
340
|
const response = await fetch(`${this.url}${path}`, {
|
package/dist/sdk/index.mjs
CHANGED
|
@@ -300,10 +300,10 @@ var Autumn = class {
|
|
|
300
300
|
this.publishableKey = options?.publishableKey || process.env.AUTUMN_PUBLISHABLE_KEY;
|
|
301
301
|
} catch (error) {
|
|
302
302
|
}
|
|
303
|
-
if (!this.secretKey && !this.publishableKey) {
|
|
303
|
+
if (!this.secretKey && !this.publishableKey && !options?.headers) {
|
|
304
304
|
throw new Error("Autumn secret key or publishable key is required");
|
|
305
305
|
}
|
|
306
|
-
this.headers = {
|
|
306
|
+
this.headers = options?.headers || {
|
|
307
307
|
Authorization: `Bearer ${this.secretKey || this.publishableKey}`,
|
|
308
308
|
"Content-Type": "application/json"
|
|
309
309
|
};
|
|
@@ -322,12 +322,17 @@ var Autumn = class {
|
|
|
322
322
|
return toContainerResult(response);
|
|
323
323
|
}
|
|
324
324
|
async post(path, body) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
325
|
+
try {
|
|
326
|
+
const response = await fetch(`${this.url}${path}`, {
|
|
327
|
+
method: "POST",
|
|
328
|
+
headers: this.headers,
|
|
329
|
+
body: JSON.stringify(body)
|
|
330
|
+
});
|
|
331
|
+
return toContainerResult(response);
|
|
332
|
+
} catch (error) {
|
|
333
|
+
console.error("Error sending request:", error);
|
|
334
|
+
throw error;
|
|
335
|
+
}
|
|
331
336
|
}
|
|
332
337
|
async delete(path) {
|
|
333
338
|
const response = await fetch(`${this.url}${path}`, {
|
|
@@ -330,10 +330,10 @@ var Autumn = class {
|
|
|
330
330
|
this.publishableKey = options?.publishableKey || process.env.AUTUMN_PUBLISHABLE_KEY;
|
|
331
331
|
} catch (error) {
|
|
332
332
|
}
|
|
333
|
-
if (!this.secretKey && !this.publishableKey) {
|
|
333
|
+
if (!this.secretKey && !this.publishableKey && !options?.headers) {
|
|
334
334
|
throw new Error("Autumn secret key or publishable key is required");
|
|
335
335
|
}
|
|
336
|
-
this.headers = {
|
|
336
|
+
this.headers = options?.headers || {
|
|
337
337
|
Authorization: `Bearer ${this.secretKey || this.publishableKey}`,
|
|
338
338
|
"Content-Type": "application/json"
|
|
339
339
|
};
|
|
@@ -352,12 +352,17 @@ var Autumn = class {
|
|
|
352
352
|
return toContainerResult(response);
|
|
353
353
|
}
|
|
354
354
|
async post(path, body) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
355
|
+
try {
|
|
356
|
+
const response = await fetch(`${this.url}${path}`, {
|
|
357
|
+
method: "POST",
|
|
358
|
+
headers: this.headers,
|
|
359
|
+
body: JSON.stringify(body)
|
|
360
|
+
});
|
|
361
|
+
return toContainerResult(response);
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error("Error sending request:", error);
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
361
366
|
}
|
|
362
367
|
async delete(path) {
|
|
363
368
|
const response = await fetch(`${this.url}${path}`, {
|