autumn-js 0.0.45 → 0.0.47

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 (27) hide show
  1. package/dist/libraries/backend/{client-DJJAbrX7.d.ts → client-W8zaXEoh.d.ts} +1 -0
  2. package/dist/libraries/backend/{client-C4aZxBxK.d.mts → client-nfo5MENW.d.mts} +1 -0
  3. package/dist/libraries/backend/express.d.mts +3 -0
  4. package/dist/libraries/backend/express.d.ts +3 -0
  5. package/dist/libraries/backend/express.js +2 -1
  6. package/dist/libraries/backend/express.mjs +2 -1
  7. package/dist/libraries/backend/routes/backendRouter.d.mts +1 -1
  8. package/dist/libraries/backend/routes/backendRouter.d.ts +1 -1
  9. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  10. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  11. package/dist/libraries/react/hooks/useCustomer.d.mts +4 -3
  12. package/dist/libraries/react/hooks/useCustomer.d.ts +4 -3
  13. package/dist/next/server/cusActions.d.mts +1 -1
  14. package/dist/next/server/cusActions.d.ts +1 -1
  15. package/dist/next/server/genActions.d.mts +1 -1
  16. package/dist/next/server/genActions.d.ts +1 -1
  17. package/dist/next/server/{genTypes-DNndDcib.d.mts → genTypes-8tvMa4lq.d.ts} +2 -1
  18. package/dist/next/server/{genTypes-DaYkl9Ex.d.ts → genTypes-D0BvK77f.d.mts} +2 -1
  19. package/dist/sdk/{entTypes-oQpX0x_Y.d.ts → entTypes-CL-fMvnC.d.mts} +2 -1
  20. package/dist/sdk/{entTypes-DAoQnp8D.d.mts → entTypes-DtPO-a4R.d.ts} +2 -1
  21. package/dist/sdk/entities.d.mts +1 -1
  22. package/dist/sdk/entities.d.ts +1 -1
  23. package/dist/sdk/general.d.mts +1 -1
  24. package/dist/sdk/general.d.ts +1 -1
  25. package/dist/sdk/index.d.mts +2 -2
  26. package/dist/sdk/index.d.ts +2 -2
  27. package/package.json +1 -1
@@ -120,6 +120,7 @@ interface CreateEntityParams {
120
120
  id: string;
121
121
  name: string;
122
122
  feature_id: string;
123
+ customer_data?: CustomerData;
123
124
  }
124
125
  interface CreateEntityResult {
125
126
  success: boolean;
@@ -120,6 +120,7 @@ interface CreateEntityParams {
120
120
  id: string;
121
121
  name: string;
122
122
  feature_id: string;
123
+ customer_data?: CustomerData;
123
124
  }
124
125
  interface CreateEntityResult {
125
126
  success: boolean;
@@ -1,8 +1,11 @@
1
+ import { A as Autumn } from './client-nfo5MENW.mjs';
1
2
  import { AuthResult } from './utils/AuthFunction.mjs';
3
+ import './response-ByHPEnHs.mjs';
2
4
 
3
5
  type AutumnRequestHandler = (req: any, res: any, next: any) => void;
4
6
  type AutumnHandlerOptions = {
5
7
  identify: (req: any) => AuthResult;
8
+ autumn?: (req: any) => Autumn | Autumn;
6
9
  version?: string;
7
10
  };
8
11
  declare const autumnHandler: (options?: AutumnHandlerOptions) => AutumnRequestHandler;
@@ -1,8 +1,11 @@
1
+ import { A as Autumn } from './client-W8zaXEoh.js';
1
2
  import { AuthResult } from './utils/AuthFunction.js';
3
+ import './response-ByHPEnHs.js';
2
4
 
3
5
  type AutumnRequestHandler = (req: any, res: any, next: any) => void;
4
6
  type AutumnHandlerOptions = {
5
7
  identify: (req: any) => AuthResult;
8
+ autumn?: (req: any) => Autumn | Autumn;
6
9
  version?: string;
7
10
  };
8
11
  declare const autumnHandler: (options?: AutumnHandlerOptions) => AutumnRequestHandler;
@@ -756,8 +756,9 @@ var autumnHandler = (options) => {
756
756
  }
757
757
  }
758
758
  try {
759
+ let autumnClient = typeof options?.autumn === "function" ? options.autumn(req) : options?.autumn || autumn;
759
760
  let result = await handler({
760
- autumn,
761
+ autumn: autumnClient,
761
762
  body,
762
763
  path: req.path,
763
764
  getCustomer: async () => {
@@ -40,8 +40,9 @@ var autumnHandler = (options) => {
40
40
  }
41
41
  }
42
42
  try {
43
+ let autumnClient = typeof options?.autumn === "function" ? options.autumn(req) : options?.autumn || autumn;
43
44
  let result = await handler({
44
- autumn,
45
+ autumn: autumnClient,
45
46
  body,
46
47
  path: req.path,
47
48
  getCustomer: async () => {
@@ -1,5 +1,5 @@
1
1
  import * as rou3 from 'rou3';
2
- import { A as Autumn } from '../client-C4aZxBxK.mjs';
2
+ import { A as Autumn } from '../client-nfo5MENW.mjs';
3
3
  import '../response-ByHPEnHs.mjs';
4
4
 
5
5
  type RouteData = {
@@ -1,5 +1,5 @@
1
1
  import * as rou3 from 'rou3';
2
- import { A as Autumn } from '../client-DJJAbrX7.js';
2
+ import { A as Autumn } from '../client-W8zaXEoh.js';
3
3
  import '../response-ByHPEnHs.js';
4
4
 
5
5
  type RouteData = {
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../client-C4aZxBxK.mjs';
1
+ import { A as Autumn, C as CustomerData } from '../client-nfo5MENW.mjs';
2
2
  import { AuthResult } from './AuthFunction.mjs';
3
3
  import '../response-ByHPEnHs.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../client-DJJAbrX7.js';
1
+ import { A as Autumn, C as CustomerData } from '../client-W8zaXEoh.js';
2
2
  import { AuthResult } from './AuthFunction.js';
3
3
  import '../response-ByHPEnHs.js';
4
4
 
@@ -1,17 +1,18 @@
1
1
  import { UseCustomerParams } from './useCustomerProvider.mjs';
2
2
  import { A as AutumnError } from '../error-CG2LXoa7.mjs';
3
3
  import { b as Customer } from '../cusTypes-CrKQos3U.mjs';
4
+ import { E as Entity } from '../entTypes-D5hhz3BB.mjs';
5
+ import { A as AutumnPromise } from '../response-T-FFa-qt.mjs';
6
+ import { CreateEntityParams } from '../client/types/clientEntTypes.mjs';
4
7
  import '../ReactAutumnClient-b8N5xZyk.mjs';
5
- import '../client/types/clientEntTypes.mjs';
6
8
  import '../client/types/clientGenTypes.mjs';
7
- import '../response-T-FFa-qt.mjs';
8
- import '../entTypes-D5hhz3BB.mjs';
9
9
 
10
10
  interface UseCustomerResult {
11
11
  customer: Customer | null;
12
12
  isLoading: boolean;
13
13
  error: AutumnError | null;
14
14
  refetch: () => Promise<void>;
15
+ createEntity: (params: CreateEntityParams | CreateEntityParams[]) => AutumnPromise<Entity | Entity[]>;
15
16
  }
16
17
  declare const useCustomer: (params?: UseCustomerParams) => UseCustomerResult;
17
18
 
@@ -1,17 +1,18 @@
1
1
  import { UseCustomerParams } from './useCustomerProvider.js';
2
2
  import { A as AutumnError } from '../error-CG2LXoa7.js';
3
3
  import { b as Customer } from '../cusTypes-CrKQos3U.js';
4
+ import { E as Entity } from '../entTypes-Pu4KEgBU.js';
5
+ import { A as AutumnPromise } from '../response-muDt0SJZ.js';
6
+ import { CreateEntityParams } from '../client/types/clientEntTypes.js';
4
7
  import '../ReactAutumnClient-CXWgmZSf.js';
5
- import '../client/types/clientEntTypes.js';
6
8
  import '../client/types/clientGenTypes.js';
7
- import '../response-muDt0SJZ.js';
8
- import '../entTypes-Pu4KEgBU.js';
9
9
 
10
10
  interface UseCustomerResult {
11
11
  customer: Customer | null;
12
12
  isLoading: boolean;
13
13
  error: AutumnError | null;
14
14
  refetch: () => Promise<void>;
15
+ createEntity: (params: CreateEntityParams | CreateEntityParams[]) => AutumnPromise<Entity | Entity[]>;
15
16
  }
16
17
  declare const useCustomer: (params?: UseCustomerParams) => UseCustomerResult;
17
18
 
@@ -1,4 +1,4 @@
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 } from './genTypes-DNndDcib.mjs';
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 } from './genTypes-D0BvK77f.mjs';
2
2
  import { R as Result, A as AutumnError } from './response-BCg7kiiN.mjs';
3
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-BY1nr3mk.mjs';
4
4
 
@@ -1,4 +1,4 @@
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 } from './genTypes-DaYkl9Ex.js';
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 } from './genTypes-8tvMa4lq.js';
2
2
  import { R as Result, A as AutumnError } from './response-BCg7kiiN.js';
3
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-BY1nr3mk.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { j as AttachFeatureOptions } from './genTypes-DNndDcib.mjs';
1
+ import { j as AttachFeatureOptions } from './genTypes-D0BvK77f.mjs';
2
2
  import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BY1nr3mk.mjs';
3
3
 
4
4
  interface EntityDataParams {
@@ -1,4 +1,4 @@
1
- import { j as AttachFeatureOptions } from './genTypes-DaYkl9Ex.js';
1
+ import { j as AttachFeatureOptions } from './genTypes-8tvMa4lq.js';
2
2
  import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BY1nr3mk.js';
3
3
 
4
4
  interface EntityDataParams {
@@ -1,4 +1,4 @@
1
- import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType, C as CustomerData } from './cusTypes-BY1nr3mk.mjs';
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-BY1nr3mk.js';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -6,6 +6,7 @@ interface CreateEntityParams {
6
6
  id: string;
7
7
  name: string;
8
8
  feature_id: string;
9
+ customer_data?: CustomerData;
9
10
  }
10
11
  interface CreateEntityResult {
11
12
  success: boolean;
@@ -1,4 +1,4 @@
1
- import { d as CustomerProduct, e as CustomerFeature, f as CustomerInvoice, A as AppEnv, I as Infinite, P as ProductItemIntervalType, g as UsageModel, F as FreeTrialDuration, h as UsageModelType, C as CustomerData } from './cusTypes-BY1nr3mk.js';
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-BY1nr3mk.mjs';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -6,6 +6,7 @@ interface CreateEntityParams {
6
6
  id: string;
7
7
  name: string;
8
8
  feature_id: string;
9
+ customer_data?: CustomerData;
9
10
  }
10
11
  interface CreateEntityResult {
11
12
  success: boolean;
@@ -1,4 +1,4 @@
1
- import { d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-Cw74Oy0H.js';
1
+ import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-pV7nKIcc.mjs';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -6,6 +6,7 @@ interface CreateEntityParams {
6
6
  id: string;
7
7
  name: string;
8
8
  feature_id: string;
9
+ customer_data?: CustomerData;
9
10
  }
10
11
  interface CreateEntityResult {
11
12
  success: boolean;
@@ -1,4 +1,4 @@
1
- import { d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-pV7nKIcc.mjs';
1
+ import { e as CustomerData, d as CustomerProduct, c as CustomerFeature, f as CustomerInvoice } from './cusTypes-Cw74Oy0H.js';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -6,6 +6,7 @@ interface CreateEntityParams {
6
6
  id: string;
7
7
  name: string;
8
8
  feature_id: string;
9
+ customer_data?: CustomerData;
9
10
  }
10
11
  interface CreateEntityResult {
11
12
  success: boolean;
@@ -1,3 +1,3 @@
1
1
  import './cusTypes-pV7nKIcc.mjs';
2
- export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-DAoQnp8D.mjs';
2
+ export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-CL-fMvnC.mjs';
3
3
  import './prodEnums-C1lccCWI.mjs';
@@ -1,3 +1,3 @@
1
1
  import './cusTypes-Cw74Oy0H.js';
2
- export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-oQpX0x_Y.js';
2
+ export { C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult, E as Entity, b as EntityData, G as GetEntityParams } from './entTypes-DtPO-a4R.js';
3
3
  import './prodEnums-C1lccCWI.js';
@@ -1,5 +1,5 @@
1
1
  import { e as CustomerData } from './cusTypes-pV7nKIcc.mjs';
2
- import { b as EntityData } from './entTypes-DAoQnp8D.mjs';
2
+ import { b as EntityData } from './entTypes-CL-fMvnC.mjs';
3
3
  import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.mjs';
4
4
  import './prodEnums-C1lccCWI.mjs';
5
5
  import './products.mjs';
@@ -1,5 +1,5 @@
1
1
  import { e as CustomerData } from './cusTypes-Cw74Oy0H.js';
2
- import { b as EntityData } from './entTypes-oQpX0x_Y.js';
2
+ import { b as EntityData } from './entTypes-DtPO-a4R.js';
3
3
  import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.js';
4
4
  import './prodEnums-C1lccCWI.js';
5
5
  import './products.js';
@@ -4,8 +4,8 @@ import { Product, CreateProductParams, ListProductsParams } from './products.mjs
4
4
  export { FreeTrial, PriceTier, ProductItem } from './products.mjs';
5
5
  import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-pV7nKIcc.mjs';
6
6
  export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-pV7nKIcc.mjs';
7
- import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-DAoQnp8D.mjs';
8
- export { b as EntityData, c as EntityExpandOption } from './entTypes-DAoQnp8D.mjs';
7
+ import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-CL-fMvnC.mjs';
8
+ export { b as EntityData, c as EntityExpandOption } from './entTypes-CL-fMvnC.mjs';
9
9
  export { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario } from './check.mjs';
10
10
  export { A as AppEnv, F as FreeTrialDuration, I as Infinite, P as ProductItemInterval, b as ProductItemIntervalType, U as UsageModel, a as UsageModelType } from './prodEnums-C1lccCWI.mjs';
11
11
 
@@ -4,8 +4,8 @@ import { Product, CreateProductParams, ListProductsParams } from './products.js'
4
4
  export { FreeTrial, PriceTier, ProductItem } from './products.js';
5
5
  import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-Cw74Oy0H.js';
6
6
  export { e as CustomerData, g as CustomerExpandOption, c as CustomerFeature, f as CustomerInvoice, d as CustomerProduct, P as ProductStatus } from './cusTypes-Cw74Oy0H.js';
7
- import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-oQpX0x_Y.js';
8
- export { b as EntityData, c as EntityExpandOption } from './entTypes-oQpX0x_Y.js';
7
+ import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as CreateEntityResult, D as DeleteEntityResult } from './entTypes-DtPO-a4R.js';
8
+ export { b as EntityData, c as EntityExpandOption } from './entTypes-DtPO-a4R.js';
9
9
  export { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario } from './check.js';
10
10
  export { A as AppEnv, F as FreeTrialDuration, I as Infinite, P as ProductItemInterval, b as ProductItemIntervalType, U as UsageModel, a as UsageModelType } from './prodEnums-C1lccCWI.js';
11
11
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "autumn-js",
3
3
  "description": "Autumn JS Library",
4
- "version": "0.0.45",
4
+ "version": "0.0.47",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
7
7
  "cli": "tsx src/cli/index.ts",