autumn-js 0.1.4 → 0.1.6

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 (162) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +6 -46
  2. package/dist/libraries/backend/better-auth.d.ts +6 -46
  3. package/dist/libraries/backend/better-auth.js +17 -14
  4. package/dist/libraries/backend/better-auth.mjs +18 -16
  5. package/dist/libraries/backend/{chunk-P6KFNVAM.mjs → chunk-2LSEWYPD.mjs} +1 -1
  6. package/dist/libraries/backend/{chunk-3HEVKGSY.mjs → chunk-WBYCMG34.mjs} +2 -1
  7. package/dist/libraries/backend/convex.js +2 -1
  8. package/dist/libraries/backend/convex.mjs +2 -2
  9. package/dist/libraries/backend/elysia.js +2 -1
  10. package/dist/libraries/backend/elysia.mjs +2 -2
  11. package/dist/libraries/backend/express.js +2 -1
  12. package/dist/libraries/backend/express.mjs +2 -2
  13. package/dist/libraries/backend/fastify.js +2 -1
  14. package/dist/libraries/backend/fastify.mjs +2 -2
  15. package/dist/libraries/backend/hono.js +2 -1
  16. package/dist/libraries/backend/hono.mjs +2 -2
  17. package/dist/libraries/backend/index.js +2 -1
  18. package/dist/libraries/backend/index.mjs +2 -2
  19. package/dist/libraries/backend/next.js +2 -1
  20. package/dist/libraries/backend/next.mjs +2 -2
  21. package/dist/libraries/backend/react-router.js +2 -1
  22. package/dist/libraries/backend/react-router.mjs +2 -2
  23. package/dist/libraries/backend/remix_dep.js +2 -1
  24. package/dist/libraries/backend/remix_dep.mjs +2 -2
  25. package/dist/libraries/backend/routes/backendRouter.js +2 -1
  26. package/dist/libraries/backend/routes/backendRouter.mjs +2 -2
  27. package/dist/libraries/backend/routes/productRoutes.js +2 -1
  28. package/dist/libraries/backend/routes/productRoutes.mjs +1 -1
  29. package/dist/libraries/backend/supabase.js +2 -1
  30. package/dist/libraries/backend/supabase.mjs +2 -2
  31. package/dist/libraries/backend/tanstack.js +2 -1
  32. package/dist/libraries/backend/tanstack.mjs +2 -2
  33. package/dist/libraries/react/AutumnContext.d.mts +6 -6
  34. package/dist/libraries/react/AutumnContext.d.ts +6 -6
  35. package/dist/libraries/react/AutumnContext.mjs +4 -4
  36. package/dist/libraries/react/BaseAutumnProvider.d.mts +6 -6
  37. package/dist/libraries/react/BaseAutumnProvider.d.ts +6 -6
  38. package/dist/libraries/react/BaseAutumnProvider.mjs +6 -6
  39. package/dist/libraries/react/{ReactAutumnClient-Dk1xLBOC.d.ts → ReactAutumnClient-CK8k8OA5.d.ts} +17 -17
  40. package/dist/libraries/react/{ReactAutumnClient-b59cM6db.d.mts → ReactAutumnClient-CjaZ_g4X.d.mts} +17 -17
  41. package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -2
  42. package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -2
  43. package/dist/libraries/react/ReactAutumnProvider.mjs +7 -7
  44. package/dist/libraries/react/{attachTypes-CcB6xjSF.d.ts → attachTypes-BetWkt95.d.ts} +5 -5
  45. package/dist/libraries/react/{attachTypes-DqUN3q8s.d.mts → attachTypes-DbI59BLC.d.mts} +5 -5
  46. package/dist/libraries/react/{chunk-XFNHMA6J.mjs → chunk-33OTK7MB.mjs} +1 -1
  47. package/dist/libraries/react/{chunk-ADKXC74U.mjs → chunk-7PFOXY3Y.mjs} +18 -18
  48. package/dist/libraries/react/{chunk-AXQT5O4P.mjs → chunk-F5QUME7S.mjs} +1 -1
  49. package/dist/libraries/react/{chunk-6TQS3YV6.mjs → chunk-GUDRYJ3O.mjs} +2 -2
  50. package/dist/libraries/react/{chunk-5X73Q4YJ.mjs → chunk-IM2FNHYV.mjs} +2 -2
  51. package/dist/libraries/react/{chunk-IUYVVTGM.mjs → chunk-KLSRAX2F.mjs} +1 -1
  52. package/dist/libraries/react/{chunk-KZQPLQR5.mjs → chunk-KZVVSY52.mjs} +1 -1
  53. package/dist/libraries/react/{chunk-K55IHYAQ.mjs → chunk-PGU4IXT7.mjs} +1 -1
  54. package/dist/libraries/react/{chunk-QNIJJHAD.mjs → chunk-QW2YS3JY.mjs} +1 -1
  55. package/dist/libraries/react/{chunk-PLEVZHHH.mjs → chunk-TJMYXANS.mjs} +1 -1
  56. package/dist/libraries/react/{chunk-NV52XFEQ.mjs → chunk-ZT5TN67S.mjs} +3 -3
  57. package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -6
  58. package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -6
  59. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  60. package/dist/libraries/react/client/clientCompMethods.d.mts +6 -6
  61. package/dist/libraries/react/client/clientCompMethods.d.ts +6 -6
  62. package/dist/libraries/react/client/clientCusMethods.d.mts +6 -6
  63. package/dist/libraries/react/client/clientCusMethods.d.ts +6 -6
  64. package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -6
  65. package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -6
  66. package/dist/libraries/react/client/clientGenMethods.d.mts +6 -6
  67. package/dist/libraries/react/client/clientGenMethods.d.ts +6 -6
  68. package/dist/libraries/react/client/clientProdMethods.d.mts +6 -6
  69. package/dist/libraries/react/client/clientProdMethods.d.ts +6 -6
  70. package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -6
  71. package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -6
  72. package/dist/libraries/react/client/types/clientAttachTypes.d.mts +20 -20
  73. package/dist/libraries/react/client/types/clientAttachTypes.d.ts +20 -20
  74. package/dist/libraries/react/client/types/clientGenTypes.d.mts +4 -4
  75. package/dist/libraries/react/client/types/clientGenTypes.d.ts +4 -4
  76. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +2 -2
  77. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +2 -2
  78. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +18 -18
  79. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +2 -2
  80. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +2 -2
  81. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +1 -1
  82. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +1 -1
  83. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +18 -18
  84. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +1 -1
  85. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +1 -1
  86. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  87. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  88. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +2 -2
  89. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +18 -18
  90. package/dist/libraries/react/{cusTypes-DHjT-9rV.d.ts → cusTypes-D5d_cu-K.d.ts} +5 -5
  91. package/dist/libraries/react/{cusTypes-CSmAk5io.d.mts → cusTypes-DINgmPwV.d.mts} +5 -5
  92. package/dist/libraries/react/{entTypes-CoF9enrR.d.ts → entTypes-DNW_l3s0.d.ts} +1 -1
  93. package/dist/libraries/react/{entTypes-S4hkh1RG.d.mts → entTypes-biskqmpT.d.mts} +1 -1
  94. package/dist/libraries/react/{genTypes-fEH_nqSm.d.mts → genTypes-DSvR32on.d.mts} +5 -5
  95. package/dist/libraries/react/{genTypes-DsiuvyWS.d.ts → genTypes-EyxQImzh.d.ts} +5 -5
  96. package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +6 -6
  97. package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +6 -6
  98. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +6 -6
  99. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +6 -6
  100. package/dist/libraries/react/hooks/useAnalytics.d.mts +2 -2
  101. package/dist/libraries/react/hooks/useAnalytics.d.ts +2 -2
  102. package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
  103. package/dist/libraries/react/hooks/useCustomer.d.mts +6 -6
  104. package/dist/libraries/react/hooks/useCustomer.d.ts +6 -6
  105. package/dist/libraries/react/hooks/useCustomer.mjs +6 -6
  106. package/dist/libraries/react/hooks/useCustomerBase.d.mts +6 -6
  107. package/dist/libraries/react/hooks/useCustomerBase.d.ts +6 -6
  108. package/dist/libraries/react/hooks/useCustomerBase.mjs +5 -5
  109. package/dist/libraries/react/hooks/useEntity.d.mts +6 -6
  110. package/dist/libraries/react/hooks/useEntity.d.ts +6 -6
  111. package/dist/libraries/react/hooks/useEntity.mjs +6 -6
  112. package/dist/libraries/react/hooks/useEntityBase.d.mts +8 -8
  113. package/dist/libraries/react/hooks/useEntityBase.d.ts +8 -8
  114. package/dist/libraries/react/hooks/useEntityBase.mjs +5 -5
  115. package/dist/libraries/react/hooks/usePaywall.d.mts +1 -1
  116. package/dist/libraries/react/hooks/usePaywall.d.ts +1 -1
  117. package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
  118. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  119. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  120. package/dist/libraries/react/hooks/usePricingTable.mjs +5 -5
  121. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
  122. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
  123. package/dist/libraries/react/hooks/useProductsBase.d.mts +6 -6
  124. package/dist/libraries/react/hooks/useProductsBase.d.ts +6 -6
  125. package/dist/libraries/react/index.js +2 -2
  126. package/dist/libraries/react/index.mjs +2 -2
  127. package/dist/libraries/react/{prodTypes--VvnyGlN.d.mts → prodTypes-Bmoibf-M.d.mts} +5 -5
  128. package/dist/libraries/react/{prodTypes--VvnyGlN.d.ts → prodTypes-Bmoibf-M.d.ts} +5 -5
  129. package/dist/next/client/NextAutumnClient.d.mts +6 -6
  130. package/dist/next/client/NextAutumnClient.d.ts +6 -6
  131. package/dist/next/client/NextAutumnProvider.d.mts +1 -1
  132. package/dist/next/client/NextAutumnProvider.d.ts +1 -1
  133. package/dist/next/client/clientUtils.d.mts +2 -2
  134. package/dist/next/client/clientUtils.d.ts +2 -2
  135. package/dist/next/client/{entTypes-mOI7WnPZ.d.mts → entTypes-CHHBdhBK.d.mts} +1 -1
  136. package/dist/next/client/{entTypes-BAD1NMvb.d.ts → entTypes-vjIG3B1G.d.ts} +1 -1
  137. package/dist/next/client/hooks/useAutumn.d.mts +3 -3
  138. package/dist/next/client/hooks/useAutumn.d.ts +3 -3
  139. package/dist/next/client/hooks/useCustomer.d.mts +4 -4
  140. package/dist/next/client/hooks/useCustomer.d.ts +4 -4
  141. package/dist/next/client/hooks/useEntity.d.mts +3 -3
  142. package/dist/next/client/hooks/useEntity.d.ts +3 -3
  143. package/dist/next/client/types.d.mts +2 -2
  144. package/dist/next/client/types.d.ts +2 -2
  145. package/dist/next/server/auth/withNextAuth.d.mts +1 -1
  146. package/dist/next/server/auth/withNextAuth.d.ts +1 -1
  147. package/dist/next/server/componentActions.d.mts +1 -1
  148. package/dist/next/server/componentActions.d.ts +1 -1
  149. package/dist/next/server/cusActions.d.mts +15 -15
  150. package/dist/next/server/cusActions.d.ts +15 -15
  151. package/dist/next/server/genActions.d.mts +1 -1
  152. package/dist/next/server/genActions.d.ts +1 -1
  153. package/package.json +1 -1
  154. package/dist/libraries/react/{chunk-EFRTEIEY.mjs → chunk-QV6Q2XXO.mjs} +6 -6
  155. package/dist/next/client/{attachTypes-9VCTaz0m.d.mts → attachTypes-DZFtFEmv.d.mts} +2 -2
  156. package/dist/next/client/{attachTypes-DLxEa_Wj.d.ts → attachTypes-DxJ0LCjT.d.ts} +2 -2
  157. package/dist/next/client/{clientAttachTypes-umadXlvp.d.ts → clientAttachTypes-BXtfXB4v.d.ts} +2 -2
  158. package/dist/next/client/{clientAttachTypes-BzsPgggN.d.mts → clientAttachTypes-qsdoMt_B.d.mts} +2 -2
  159. package/dist/next/client/{cusTypes-CYojUJSJ.d.ts → cusTypes-BHYpk8bK.d.ts} +2 -2
  160. package/dist/next/client/{cusTypes-CIGvysWL.d.mts → cusTypes-Q54uLNO5.d.mts} +2 -2
  161. package/dist/next/server/{cusTypes-DgoOZMIt.d.ts → cusTypes-D38IpLCT.d.mts} +4 -4
  162. package/dist/next/server/{cusTypes-DgoOZMIt.d.mts → cusTypes-D38IpLCT.d.ts} +4 -4
@@ -11,6 +11,7 @@ declare const autumn: (options?: {
11
11
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
12
12
  body: {
13
13
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
14
+ errorOnNotFound?: boolean | undefined;
14
15
  };
15
16
  } & {
16
17
  method?: "POST" | undefined;
@@ -36,35 +37,16 @@ declare const autumn: (options?: {
36
37
  } : any>;
37
38
  options: {
38
39
  method: "POST";
39
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
40
- session: {
41
- session: Record<string, any> & {
42
- id: string;
43
- token: string;
44
- userId: string;
45
- expiresAt: Date;
46
- createdAt: Date;
47
- updatedAt: Date;
48
- ipAddress?: string | null | undefined;
49
- userAgent?: string | null | undefined;
50
- };
51
- user: Record<string, any> & {
52
- id: string;
53
- name: string;
54
- emailVerified: boolean;
55
- email: string;
56
- createdAt: Date;
57
- updatedAt: Date;
58
- image?: string | null | undefined;
59
- };
60
- };
61
- }>)[];
40
+ use: never[];
62
41
  body: z.ZodObject<{
42
+ errorOnNotFound: z.ZodOptional<z.ZodBoolean>;
63
43
  expand: z.ZodOptional<z.ZodArray<z.ZodEnum<["invoices", "rewards", "trials_used", "entities", "referrals", "payment_method"]>, "many">>;
64
44
  }, "strip", z.ZodTypeAny, {
65
45
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
46
+ errorOnNotFound?: boolean | undefined;
66
47
  }, {
67
48
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
49
+ errorOnNotFound?: boolean | undefined;
68
50
  }>;
69
51
  metadata: {
70
52
  isAction: boolean;
@@ -99,29 +81,7 @@ declare const autumn: (options?: {
99
81
  } : any>;
100
82
  options: {
101
83
  method: "GET";
102
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
103
- session: {
104
- session: Record<string, any> & {
105
- id: string;
106
- token: string;
107
- userId: string;
108
- expiresAt: Date;
109
- createdAt: Date;
110
- updatedAt: Date;
111
- ipAddress?: string | null | undefined;
112
- userAgent?: string | null | undefined;
113
- };
114
- user: Record<string, any> & {
115
- id: string;
116
- name: string;
117
- emailVerified: boolean;
118
- email: string;
119
- createdAt: Date;
120
- updatedAt: Date;
121
- image?: string | null | undefined;
122
- };
123
- };
124
- }>)[];
84
+ use: never[];
125
85
  } & {
126
86
  use: any[];
127
87
  };
@@ -11,6 +11,7 @@ declare const autumn: (options?: {
11
11
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
12
12
  body: {
13
13
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
14
+ errorOnNotFound?: boolean | undefined;
14
15
  };
15
16
  } & {
16
17
  method?: "POST" | undefined;
@@ -36,35 +37,16 @@ declare const autumn: (options?: {
36
37
  } : any>;
37
38
  options: {
38
39
  method: "POST";
39
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
40
- session: {
41
- session: Record<string, any> & {
42
- id: string;
43
- token: string;
44
- userId: string;
45
- expiresAt: Date;
46
- createdAt: Date;
47
- updatedAt: Date;
48
- ipAddress?: string | null | undefined;
49
- userAgent?: string | null | undefined;
50
- };
51
- user: Record<string, any> & {
52
- id: string;
53
- name: string;
54
- emailVerified: boolean;
55
- email: string;
56
- createdAt: Date;
57
- updatedAt: Date;
58
- image?: string | null | undefined;
59
- };
60
- };
61
- }>)[];
40
+ use: never[];
62
41
  body: z.ZodObject<{
42
+ errorOnNotFound: z.ZodOptional<z.ZodBoolean>;
63
43
  expand: z.ZodOptional<z.ZodArray<z.ZodEnum<["invoices", "rewards", "trials_used", "entities", "referrals", "payment_method"]>, "many">>;
64
44
  }, "strip", z.ZodTypeAny, {
65
45
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
46
+ errorOnNotFound?: boolean | undefined;
66
47
  }, {
67
48
  expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
49
+ errorOnNotFound?: boolean | undefined;
68
50
  }>;
69
51
  metadata: {
70
52
  isAction: boolean;
@@ -99,29 +81,7 @@ declare const autumn: (options?: {
99
81
  } : any>;
100
82
  options: {
101
83
  method: "GET";
102
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
103
- session: {
104
- session: Record<string, any> & {
105
- id: string;
106
- token: string;
107
- userId: string;
108
- expiresAt: Date;
109
- createdAt: Date;
110
- updatedAt: Date;
111
- ipAddress?: string | null | undefined;
112
- userAgent?: string | null | undefined;
113
- };
114
- user: Record<string, any> & {
115
- id: string;
116
- name: string;
117
- emailVerified: boolean;
118
- email: string;
119
- createdAt: Date;
120
- updatedAt: Date;
121
- image?: string | null | undefined;
122
- };
123
- };
124
- }>)[];
84
+ use: never[];
125
85
  } & {
126
86
  use: any[];
127
87
  };
@@ -1089,7 +1089,8 @@ var listProductsHandler = withAuth({
1089
1089
  return await autumn2.products.list({
1090
1090
  customer_id
1091
1091
  });
1092
- }
1092
+ },
1093
+ requireCustomer: false
1093
1094
  });
1094
1095
  var addProductRoutes = async (router2) => {
1095
1096
  (0, import_rou34.addRoute)(router2, "GET", `${BASE_PATH}/products`, {
@@ -1183,7 +1184,7 @@ var router = createRouterWithOptions();
1183
1184
  var betterAuthPathMap = {
1184
1185
  // "create-customer": "customers",
1185
1186
  // "customers/get": "customers",
1186
- "checkout": "checkout",
1187
+ checkout: "checkout",
1187
1188
  attach: "attach",
1188
1189
  check: "check",
1189
1190
  track: "track",
@@ -1196,7 +1197,8 @@ var betterAuthPathMap = {
1196
1197
  var handleReq = async ({
1197
1198
  ctx,
1198
1199
  options,
1199
- method
1200
+ method,
1201
+ session
1200
1202
  }) => {
1201
1203
  let { found, error: resError } = secretKeyCheck();
1202
1204
  if (!found && !options?.secretKey) {
@@ -1225,16 +1227,16 @@ var handleReq = async ({
1225
1227
  const { data, params: pathParams } = match;
1226
1228
  const { handler } = data;
1227
1229
  const body = ctx.body;
1228
- const session = ctx.context.session;
1230
+ const finalSession = session || ctx.context.session;
1229
1231
  const identify = async () => {
1230
- if (!session) {
1232
+ if (!finalSession) {
1231
1233
  return;
1232
1234
  }
1233
1235
  return {
1234
- customerId: session.user.id,
1236
+ customerId: finalSession.user.id,
1235
1237
  customerData: {
1236
- email: session.user.email,
1237
- name: session.user.name
1238
+ email: finalSession.user.email,
1239
+ name: finalSession.user.name
1238
1240
  }
1239
1241
  };
1240
1242
  };
@@ -1255,8 +1257,6 @@ var handleReq = async ({
1255
1257
  return ctx.json(result.body, { status: result.statusCode });
1256
1258
  };
1257
1259
  var autumn = (options) => {
1258
- let secretKey = options?.secretKey;
1259
- let url = options?.url;
1260
1260
  return {
1261
1261
  id: "autumn",
1262
1262
  endpoints: {
@@ -1264,8 +1264,9 @@ var autumn = (options) => {
1264
1264
  "/autumn/customers",
1265
1265
  {
1266
1266
  method: "POST",
1267
- use: [import_api.sessionMiddleware],
1267
+ use: [],
1268
1268
  body: import_zod8.z.object({
1269
+ errorOnNotFound: import_zod8.z.boolean().optional(),
1269
1270
  expand: import_zod8.z.array(CustomerExpandEnum).optional()
1270
1271
  }),
1271
1272
  metadata: {
@@ -1273,17 +1274,19 @@ var autumn = (options) => {
1273
1274
  }
1274
1275
  },
1275
1276
  async (ctx) => {
1276
- return await handleReq({ ctx, options, method: "POST" });
1277
+ const session = await (0, import_api.getSessionFromCtx)(ctx);
1278
+ return await handleReq({ ctx, options, method: "POST", session });
1277
1279
  }
1278
1280
  ),
1279
1281
  listProducts: (0, import_plugins.createAuthEndpoint)(
1280
1282
  "/autumn/products",
1281
1283
  {
1282
1284
  method: "GET",
1283
- use: [import_api.sessionMiddleware]
1285
+ use: []
1284
1286
  },
1285
1287
  async (ctx) => {
1286
- return await handleReq({ ctx, options, method: "GET" });
1288
+ const session = await (0, import_api.getSessionFromCtx)(ctx);
1289
+ return await handleReq({ ctx, options, method: "GET", session });
1287
1290
  }
1288
1291
  ),
1289
1292
  checkout: (0, import_plugins.createAuthEndpoint)(
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -28,13 +28,13 @@ import "./chunk-KSG3E4Q2.mjs";
28
28
  import { createAuthEndpoint } from "better-auth/plugins";
29
29
  import { APIError, createEndpoint } from "better-call";
30
30
  import { findRoute } from "rou3";
31
- import { sessionMiddleware } from "better-auth/api";
31
+ import { getSessionFromCtx, sessionMiddleware } from "better-auth/api";
32
32
  import { z } from "zod";
33
33
  var router = createRouterWithOptions();
34
34
  var betterAuthPathMap = {
35
35
  // "create-customer": "customers",
36
36
  // "customers/get": "customers",
37
- "checkout": "checkout",
37
+ checkout: "checkout",
38
38
  attach: "attach",
39
39
  check: "check",
40
40
  track: "track",
@@ -47,7 +47,8 @@ var betterAuthPathMap = {
47
47
  var handleReq = async ({
48
48
  ctx,
49
49
  options,
50
- method
50
+ method,
51
+ session
51
52
  }) => {
52
53
  let { found, error: resError } = secretKeyCheck();
53
54
  if (!found && !options?.secretKey) {
@@ -76,16 +77,16 @@ var handleReq = async ({
76
77
  const { data, params: pathParams } = match;
77
78
  const { handler } = data;
78
79
  const body = ctx.body;
79
- const session = ctx.context.session;
80
+ const finalSession = session || ctx.context.session;
80
81
  const identify = async () => {
81
- if (!session) {
82
+ if (!finalSession) {
82
83
  return;
83
84
  }
84
85
  return {
85
- customerId: session.user.id,
86
+ customerId: finalSession.user.id,
86
87
  customerData: {
87
- email: session.user.email,
88
- name: session.user.name
88
+ email: finalSession.user.email,
89
+ name: finalSession.user.name
89
90
  }
90
91
  };
91
92
  };
@@ -106,8 +107,6 @@ var handleReq = async ({
106
107
  return ctx.json(result.body, { status: result.statusCode });
107
108
  };
108
109
  var autumn = (options) => {
109
- let secretKey = options?.secretKey;
110
- let url = options?.url;
111
110
  return {
112
111
  id: "autumn",
113
112
  endpoints: {
@@ -115,8 +114,9 @@ var autumn = (options) => {
115
114
  "/autumn/customers",
116
115
  {
117
116
  method: "POST",
118
- use: [sessionMiddleware],
117
+ use: [],
119
118
  body: z.object({
119
+ errorOnNotFound: z.boolean().optional(),
120
120
  expand: z.array(CustomerExpandEnum).optional()
121
121
  }),
122
122
  metadata: {
@@ -124,17 +124,19 @@ var autumn = (options) => {
124
124
  }
125
125
  },
126
126
  async (ctx) => {
127
- return await handleReq({ ctx, options, method: "POST" });
127
+ const session = await getSessionFromCtx(ctx);
128
+ return await handleReq({ ctx, options, method: "POST", session });
128
129
  }
129
130
  ),
130
131
  listProducts: createAuthEndpoint(
131
132
  "/autumn/products",
132
133
  {
133
134
  method: "GET",
134
- use: [sessionMiddleware]
135
+ use: []
135
136
  },
136
137
  async (ctx) => {
137
- return await handleReq({ ctx, options, method: "GET" });
138
+ const session = await getSessionFromCtx(ctx);
139
+ return await handleReq({ ctx, options, method: "GET", session });
138
140
  }
139
141
  ),
140
142
  checkout: createAuthEndpoint(
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QVLMREDB.mjs";
4
4
  import {
5
5
  addProductRoutes
6
- } from "./chunk-3HEVKGSY.mjs";
6
+ } from "./chunk-WBYCMG34.mjs";
7
7
  import {
8
8
  addReferralRoutes
9
9
  } from "./chunk-Y63QWBQ6.mjs";
@@ -15,7 +15,8 @@ var listProductsHandler = withAuth({
15
15
  return await autumn.products.list({
16
16
  customer_id
17
17
  });
18
- }
18
+ },
19
+ requireCustomer: false
19
20
  });
20
21
  var addProductRoutes = async (router) => {
21
22
  addRoute(router, "GET", `${BASE_PATH}/products`, {
@@ -1086,7 +1086,8 @@ var listProductsHandler = withAuth({
1086
1086
  return await autumn.products.list({
1087
1087
  customer_id
1088
1088
  });
1089
- }
1089
+ },
1090
+ requireCustomer: false
1090
1091
  });
1091
1092
  var addProductRoutes = async (router) => {
1092
1093
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1090,7 +1090,8 @@ var listProductsHandler = withAuth({
1090
1090
  return await autumn.products.list({
1091
1091
  customer_id
1092
1092
  });
1093
- }
1093
+ },
1094
+ requireCustomer: false
1094
1095
  });
1095
1096
  var addProductRoutes = async (router) => {
1096
1097
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";
@@ -1086,7 +1086,8 @@ var listProductsHandler = withAuth({
1086
1086
  return await autumn.products.list({
1087
1087
  customer_id
1088
1088
  });
1089
- }
1089
+ },
1090
+ requireCustomer: false
1090
1091
  });
1091
1092
  var addProductRoutes = async (router) => {
1092
1093
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRouterWithOptions
3
- } from "./chunk-P6KFNVAM.mjs";
3
+ } from "./chunk-2LSEWYPD.mjs";
4
4
  import "./chunk-QVLMREDB.mjs";
5
- import "./chunk-3HEVKGSY.mjs";
5
+ import "./chunk-WBYCMG34.mjs";
6
6
  import "./chunk-Y63QWBQ6.mjs";
7
7
  import "./chunk-7Z2OYXN4.mjs";
8
8
  import "./chunk-NTPYEOME.mjs";
@@ -1086,7 +1086,8 @@ var listProductsHandler = withAuth({
1086
1086
  return await autumn.products.list({
1087
1087
  customer_id
1088
1088
  });
1089
- }
1089
+ },
1090
+ requireCustomer: false
1090
1091
  });
1091
1092
  var addProductRoutes = async (router) => {
1092
1093
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRouterWithOptions
3
- } from "../chunk-P6KFNVAM.mjs";
3
+ } from "../chunk-2LSEWYPD.mjs";
4
4
  import "../chunk-QVLMREDB.mjs";
5
- import "../chunk-3HEVKGSY.mjs";
5
+ import "../chunk-WBYCMG34.mjs";
6
6
  import "../chunk-Y63QWBQ6.mjs";
7
7
  import "../chunk-7Z2OYXN4.mjs";
8
8
  import "../chunk-NTPYEOME.mjs";
@@ -797,7 +797,8 @@ var listProductsHandler = withAuth({
797
797
  return await autumn.products.list({
798
798
  customer_id
799
799
  });
800
- }
800
+ },
801
+ requireCustomer: false
801
802
  });
802
803
  var addProductRoutes = async (router) => {
803
804
  (0, import_rou3.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  addProductRoutes
3
- } from "../chunk-3HEVKGSY.mjs";
3
+ } from "../chunk-WBYCMG34.mjs";
4
4
  import "../chunk-NTPYEOME.mjs";
5
5
  import "../chunk-TTNUEXHB.mjs";
6
6
  import "../chunk-2TEL6LR5.mjs";
@@ -1087,7 +1087,8 @@ var listProductsHandler = withAuth({
1087
1087
  return await autumn.products.list({
1088
1088
  customer_id
1089
1089
  });
1090
- }
1090
+ },
1091
+ requireCustomer: false
1091
1092
  });
1092
1093
  var addProductRoutes = async (router) => {
1093
1094
  (0, import_rou34.addRoute)(router, "GET", `${BASE_PATH}/products`, {
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-P6KFNVAM.mjs";
6
+ } from "./chunk-2LSEWYPD.mjs";
7
7
  import "./chunk-QVLMREDB.mjs";
8
- import "./chunk-3HEVKGSY.mjs";
8
+ import "./chunk-WBYCMG34.mjs";
9
9
  import "./chunk-Y63QWBQ6.mjs";
10
10
  import "./chunk-7Z2OYXN4.mjs";
11
11
  import "./chunk-NTPYEOME.mjs";