@infuro/cms-core 1.0.9 → 1.0.11

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 (41) hide show
  1. package/dist/admin.cjs +2568 -1184
  2. package/dist/admin.cjs.map +1 -1
  3. package/dist/admin.d.cts +41 -2
  4. package/dist/admin.d.ts +41 -2
  5. package/dist/admin.js +2594 -1214
  6. package/dist/admin.js.map +1 -1
  7. package/dist/api.cjs +1695 -151
  8. package/dist/api.cjs.map +1 -1
  9. package/dist/api.d.cts +2 -1
  10. package/dist/api.d.ts +2 -1
  11. package/dist/api.js +1689 -146
  12. package/dist/api.js.map +1 -1
  13. package/dist/auth.cjs +153 -9
  14. package/dist/auth.cjs.map +1 -1
  15. package/dist/auth.d.cts +17 -27
  16. package/dist/auth.d.ts +17 -27
  17. package/dist/auth.js +143 -8
  18. package/dist/auth.js.map +1 -1
  19. package/dist/cli.cjs +1 -1
  20. package/dist/cli.cjs.map +1 -1
  21. package/dist/cli.js +1 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/helpers-dlrF_49e.d.cts +60 -0
  24. package/dist/helpers-dlrF_49e.d.ts +60 -0
  25. package/dist/{index-P5ajDo8-.d.ts → index-C_CZLmHD.d.cts} +88 -1
  26. package/dist/{index-P5ajDo8-.d.cts → index-DeO4AnAj.d.ts} +88 -1
  27. package/dist/index.cjs +3340 -715
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +154 -5
  30. package/dist/index.d.ts +154 -5
  31. package/dist/index.js +2821 -223
  32. package/dist/index.js.map +1 -1
  33. package/dist/migrations/1772178563555-ChatAndKnowledgeBase.ts +33 -17
  34. package/dist/migrations/1774300000000-RbacSeedGroupsAndPermissionUnique.ts +24 -0
  35. package/dist/migrations/1774300000001-SeedAdministratorUsersPermission.ts +35 -0
  36. package/dist/migrations/1774400000000-CustomerAdminAccessContactUser.ts +37 -0
  37. package/dist/migrations/1774400000001-StorefrontCartWishlist.ts +100 -0
  38. package/dist/migrations/1774400000002-WishlistGuestId.ts +29 -0
  39. package/dist/migrations/1774500000000-ProductCollectionHsn.ts +15 -0
  40. package/package.json +13 -7
  41. /package/{dist → src/admin}/admin.css +0 -0
@@ -0,0 +1,60 @@
1
+ /** Canonical name for new installs / migrations */
2
+ declare const ADMIN_GROUP_NAME = "Administrator";
3
+ /** System administrator group (roles UI + users / user_groups / permissions bypass). */
4
+ declare function isSuperAdminGroupName(name: string | null | undefined): boolean;
5
+ type EntityCrudAction = 'create' | 'read' | 'update' | 'delete';
6
+ type EntityPermissionFlags = {
7
+ c: boolean;
8
+ r: boolean;
9
+ u: boolean;
10
+ d: boolean;
11
+ };
12
+ declare function getPermissionableEntityKeys(entityMap: Record<string, unknown>): string[];
13
+ declare function permissionRowsToRecord(rows: Array<{
14
+ entity: string;
15
+ canCreate: boolean;
16
+ canRead: boolean;
17
+ canUpdate: boolean;
18
+ canDelete: boolean;
19
+ }> | undefined): Record<string, EntityPermissionFlags>;
20
+ declare function hasEntityPermission(record: Record<string, EntityPermissionFlags> | undefined, entity: string, action: EntityCrudAction): boolean;
21
+
22
+ /** isRBACAdmin bypasses entity checks only for these (users / roles plumbing). */
23
+ declare const RBAC_ADMIN_ONLY_ENTITIES: Set<string>;
24
+ interface SessionUser {
25
+ id?: string;
26
+ email?: string | null;
27
+ name?: string | null;
28
+ groupId?: number;
29
+ /** @deprecated use entityPerms / isRBACAdmin */
30
+ permissions?: string[];
31
+ /** Administrator group: full access only for users, user_groups, permissions */
32
+ isRBACAdmin?: boolean;
33
+ entityPerms?: Record<string, EntityPermissionFlags>;
34
+ /** When false and not isRBACAdmin, admin API/UI is denied. */
35
+ adminAccess?: boolean;
36
+ }
37
+ declare function sessionHasEntityAccess(user: SessionUser | null | undefined, entity: string, action: EntityCrudAction): boolean;
38
+ declare function canManageRoles(user: SessionUser | null | undefined): boolean;
39
+ type GetSession = () => Promise<{
40
+ user?: SessionUser;
41
+ } | null>;
42
+ declare const OPEN_ENDPOINTS: Array<Record<string, string[]>>;
43
+ declare const PERMISSION_REQUIRED_ENDPOINTS: Record<string, string[]>;
44
+ declare function isOpenEndpoint(pathname: string): boolean;
45
+ declare function getRequiredPermission(pathname: string): string[] | null;
46
+ declare function isPublicMethod(pathname: string, method: string): boolean;
47
+ interface AuthHelpers {
48
+ requireAuth(req: Request): Promise<Response | null>;
49
+ requirePermission(req: Request, permission: string): Promise<Response | null>;
50
+ requireEntityPermission(req: Request, entity: string, action: EntityCrudAction): Promise<Response | null>;
51
+ requireAdminAccess(req: Request): Promise<Response | null>;
52
+ getAuthenticatedUser(): Promise<SessionUser | null>;
53
+ }
54
+ declare function createAuthHelpers(getSession: GetSession, NextResponse: {
55
+ json: (body: unknown, init?: {
56
+ status?: number;
57
+ }) => Response;
58
+ }): AuthHelpers;
59
+
60
+ export { ADMIN_GROUP_NAME as A, type EntityCrudAction as E, type GetSession as G, OPEN_ENDPOINTS as O, PERMISSION_REQUIRED_ENDPOINTS as P, RBAC_ADMIN_ONLY_ENTITIES as R, type SessionUser as S, type AuthHelpers as a, type EntityPermissionFlags as b, canManageRoles as c, createAuthHelpers as d, getRequiredPermission as e, isPublicMethod as f, getPermissionableEntityKeys as g, hasEntityPermission as h, isOpenEndpoint as i, isSuperAdminGroupName as j, permissionRowsToRecord as p, sessionHasEntityAccess as s };
@@ -1,5 +1,45 @@
1
1
  import * as typeorm from 'typeorm';
2
2
  import { DataSource } from 'typeorm';
3
+ import { E as EntityCrudAction, S as SessionUser } from './helpers-dlrF_49e.cjs';
4
+
5
+ /** Social entry: use `iconUrl` for an image, or `icon` (emoji/text) as fallback when no image. */
6
+ interface SocialLinkItem {
7
+ url: string;
8
+ iconUrl?: string;
9
+ icon?: string;
10
+ }
11
+ interface CompanyDetails {
12
+ logoUrl?: string;
13
+ companyName?: string;
14
+ supportEmail?: string;
15
+ supportPhone?: string;
16
+ socialLinks?: SocialLinkItem[];
17
+ /** Shown below footer rows; from email plugin settings */
18
+ footerDisclaimer?: string;
19
+ /** Heading above social icons (default "Follow Us") */
20
+ followUsTitle?: string;
21
+ }
22
+ /** One row in order-placed transactional emails */
23
+ interface OrderPlacedLineItem {
24
+ productName: string;
25
+ quantity: number;
26
+ unitPrice: number | string;
27
+ lineTotal: number | string;
28
+ sku?: string | null;
29
+ }
30
+ /** Merge branding + email plugin settings for layout (email overrides when set). */
31
+ declare function mergeEmailLayoutCompanyDetails(branding: Record<string, string>, emailSettings: Record<string, string>): CompanyDetails;
32
+ interface EmailTemplateResult {
33
+ subject: string;
34
+ bodyHtml: string;
35
+ text?: string;
36
+ }
37
+ type TemplateContext<T = unknown> = T & {
38
+ companyDetails: CompanyDetails;
39
+ };
40
+ declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission"];
41
+ type EmailTemplateName = (typeof EMAIL_TEMPLATE_NAMES)[number];
42
+ declare function getCompanyDetailsFromSettings(settingsGroup: Record<string, string>): CompanyDetails;
3
43
 
4
44
  /**
5
45
  * Storage plugin contract: upload a file and return its public URL.
@@ -14,6 +54,7 @@ interface CrudHandlerOptions {
14
54
  json: (body: unknown, init?: {
15
55
  status?: number;
16
56
  }) => Response;
57
+ requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
17
58
  }
18
59
  declare function createCrudHandler(dataSource: DataSource, entityMap: EntityMap, options: CrudHandlerOptions): {
19
60
  GET(req: Request, resource: string): Promise<Response>;
@@ -48,6 +89,8 @@ interface ForgotPasswordConfig extends AuthHandlersConfig {
48
89
  subject: string;
49
90
  html: string;
50
91
  text?: string;
92
+ /** Plain reset URL for templated emails (preferred over parsing html). */
93
+ resetLink?: string;
51
94
  }) => Promise<void>;
52
95
  resetExpiryHours?: number;
53
96
  afterCreateToken?: (email: string, resetLink: string) => Promise<void>;
@@ -101,11 +144,13 @@ declare function createUserAuthApiRouter(config: UserAuthApiConfig): {
101
144
  * All accept injectable deps; upload supports S3 or local.
102
145
  */
103
146
 
147
+ type RequireEntityPermissionFn = (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
104
148
  interface CmsHandlersBase {
105
149
  json: (body: unknown, init?: {
106
150
  status?: number;
107
151
  }) => Response;
108
152
  requireAuth: (req: Request) => Promise<Response | null>;
153
+ requireEntityPermission?: RequireEntityPermissionFn;
109
154
  }
110
155
  interface DashboardStatsConfig extends CmsHandlersBase {
111
156
  dataSource: DataSource;
@@ -160,6 +205,12 @@ interface FormSubmissionHandlerConfig {
160
205
  json: (body: unknown, init?: {
161
206
  status?: number;
162
207
  }) => Response;
208
+ /** When set, form submission notification email is queued (CRM recipient). */
209
+ getCms?: () => Promise<{
210
+ getPlugin: (name: string) => unknown;
211
+ }>;
212
+ getCompanyDetails?: () => Promise<CompanyDetails>;
213
+ getRecipientForChannel?: (channel: 'crm' | 'sales' | 'fulfilment') => Promise<string | null>;
163
214
  }
164
215
  interface FormSubmissionGetByIdConfig extends CmsHandlersBase {
165
216
  dataSource: DataSource;
@@ -172,6 +223,11 @@ interface UsersApiConfig extends CmsHandlersBase {
172
223
  dataSource: DataSource;
173
224
  entityMap: EntityMap;
174
225
  baseUrl: string;
226
+ /** When set with email queue/plugin, invite emails are sent on user create and regenerate-invite. */
227
+ getCms?: () => Promise<{
228
+ getPlugin: (name: string) => unknown;
229
+ }>;
230
+ getCompanyDetails?: () => Promise<CompanyDetails>;
175
231
  }
176
232
  declare function createUsersApiHandlers(config: UsersApiConfig): {
177
233
  list(req: Request): Promise<Response>;
@@ -240,6 +296,10 @@ interface CmsApiHandlerConfig {
240
296
  crudResources?: string[];
241
297
  /** When set, analytics and userAuth.sendEmail can be derived from getPlugin('analytics') and getPlugin('email') when not provided. */
242
298
  getCms?: CmsGetter;
299
+ /** Optional: used when deriving userAuth.sendEmail to pass company details into email templates (e.g. from settings). */
300
+ getCompanyDetails?: () => Promise<CompanyDetails>;
301
+ /** Optional: used for form submission and other channel-based email recipients (from settings group "email"). */
302
+ getRecipientForChannel?: (channel: 'crm' | 'sales' | 'fulfilment') => Promise<string | null>;
243
303
  userAuth?: UserAuthApiConfig;
244
304
  /** GET /api/dashboard/stats */
245
305
  dashboard?: DashboardStatsConfig;
@@ -267,9 +327,36 @@ interface CmsApiHandlerConfig {
267
327
  settings?: SettingsApiConfig;
268
328
  /** POST /api/chat/identify, GET /api/chat/conversations/:id/messages, POST /api/chat/messages */
269
329
  chat?: ChatApiConfig;
330
+ /** When set, CRUD and admin routes enforce entity-level permissions from session */
331
+ requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
332
+ /** Required for GET/POST/PATCH/DELETE /api/admin/roles */
333
+ getSessionUser?: () => Promise<SessionUser | null>;
270
334
  }
271
335
  declare function createCmsApiHandler(config: CmsApiHandlerConfig): {
272
336
  handle(method: string, path: string[], req: Request): Promise<Response>;
273
337
  };
274
338
 
275
- export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type ChangePasswordConfig as C, type DashboardStatsConfig as D, type EntityMap as E, type ForgotPasswordConfig as F, createUserProfileHandler as G, createUsersApiHandlers as H, type InviteAcceptConfig as I, type StorageService as S, type UploadHandlerConfig as U, type AuthHandlersConfig as a, type CmsApiHandlerConfig as b, type CmsGetter as c, type CrudHandlerOptions as d, type FormBySlugConfig as e, type SetPasswordConfig as f, type SettingsApiConfig as g, type UserAuthApiConfig as h, type UserAvatarConfig as i, type UserProfileConfig as j, type UsersApiConfig as k, createAnalyticsHandlers as l, createBlogBySlugHandler as m, createChangePasswordHandler as n, createCmsApiHandler as o, createCrudByIdHandler as p, createCrudHandler as q, createDashboardStatsHandler as r, createForgotPasswordHandler as s, createFormBySlugHandler as t, createInviteAcceptHandler as u, createSetPasswordHandler as v, createSettingsApiHandlers as w, createUploadHandler as x, createUserAuthApiRouter as y, createUserAvatarHandler as z };
339
+ interface StorefrontApiConfig {
340
+ dataSource: DataSource;
341
+ entityMap: EntityMap;
342
+ json: (body: unknown, init?: {
343
+ status?: number;
344
+ headers?: HeadersInit;
345
+ }) => Response;
346
+ getSessionUser: () => Promise<SessionUser | null>;
347
+ guestCookieName?: string;
348
+ /** Required for POST storefront/register */
349
+ hashPassword?: (plain: string) => Promise<string>;
350
+ /** When set, new registrations are blocked until email is verified and a signup email is sent. */
351
+ getCms?: () => Promise<{
352
+ getPlugin: (name: string) => unknown;
353
+ }>;
354
+ getCompanyDetails?: () => Promise<CompanyDetails>;
355
+ /** Origin for verify links (e.g. process.env.NEXTAUTH_URL). Required with getCms for verification URLs. */
356
+ publicSiteUrl?: string;
357
+ }
358
+ declare function createStorefrontApiHandler(config: StorefrontApiConfig): {
359
+ handle(method: string, path: string[], req: Request): Promise<Response>;
360
+ };
361
+
362
+ export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type CompanyDetails as C, type DashboardStatsConfig as D, type EmailTemplateResult as E, type ForgotPasswordConfig as F, createSetPasswordHandler as G, createSettingsApiHandlers as H, type InviteAcceptConfig as I, createStorefrontApiHandler as J, createUploadHandler as K, createUserAuthApiRouter as L, createUserAvatarHandler as M, createUserProfileHandler as N, type OrderPlacedLineItem as O, createUsersApiHandlers as P, getCompanyDetailsFromSettings as Q, mergeEmailLayoutCompanyDetails as R, type StorageService as S, type TemplateContext as T, type UploadHandlerConfig as U, type EmailTemplateName as a, type AuthHandlersConfig as b, type ChangePasswordConfig as c, type CmsApiHandlerConfig as d, type CmsGetter as e, type CrudHandlerOptions as f, type EntityMap as g, type FormBySlugConfig as h, type SetPasswordConfig as i, type SettingsApiConfig as j, type SocialLinkItem as k, type StorefrontApiConfig as l, type UserAuthApiConfig as m, type UserAvatarConfig as n, type UserProfileConfig as o, type UsersApiConfig as p, createAnalyticsHandlers as q, createBlogBySlugHandler as r, createChangePasswordHandler as s, createCmsApiHandler as t, createCrudByIdHandler as u, createCrudHandler as v, createDashboardStatsHandler as w, createForgotPasswordHandler as x, createFormBySlugHandler as y, createInviteAcceptHandler as z };
@@ -1,5 +1,45 @@
1
1
  import * as typeorm from 'typeorm';
2
2
  import { DataSource } from 'typeorm';
3
+ import { E as EntityCrudAction, S as SessionUser } from './helpers-dlrF_49e.js';
4
+
5
+ /** Social entry: use `iconUrl` for an image, or `icon` (emoji/text) as fallback when no image. */
6
+ interface SocialLinkItem {
7
+ url: string;
8
+ iconUrl?: string;
9
+ icon?: string;
10
+ }
11
+ interface CompanyDetails {
12
+ logoUrl?: string;
13
+ companyName?: string;
14
+ supportEmail?: string;
15
+ supportPhone?: string;
16
+ socialLinks?: SocialLinkItem[];
17
+ /** Shown below footer rows; from email plugin settings */
18
+ footerDisclaimer?: string;
19
+ /** Heading above social icons (default "Follow Us") */
20
+ followUsTitle?: string;
21
+ }
22
+ /** One row in order-placed transactional emails */
23
+ interface OrderPlacedLineItem {
24
+ productName: string;
25
+ quantity: number;
26
+ unitPrice: number | string;
27
+ lineTotal: number | string;
28
+ sku?: string | null;
29
+ }
30
+ /** Merge branding + email plugin settings for layout (email overrides when set). */
31
+ declare function mergeEmailLayoutCompanyDetails(branding: Record<string, string>, emailSettings: Record<string, string>): CompanyDetails;
32
+ interface EmailTemplateResult {
33
+ subject: string;
34
+ bodyHtml: string;
35
+ text?: string;
36
+ }
37
+ type TemplateContext<T = unknown> = T & {
38
+ companyDetails: CompanyDetails;
39
+ };
40
+ declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission"];
41
+ type EmailTemplateName = (typeof EMAIL_TEMPLATE_NAMES)[number];
42
+ declare function getCompanyDetailsFromSettings(settingsGroup: Record<string, string>): CompanyDetails;
3
43
 
4
44
  /**
5
45
  * Storage plugin contract: upload a file and return its public URL.
@@ -14,6 +54,7 @@ interface CrudHandlerOptions {
14
54
  json: (body: unknown, init?: {
15
55
  status?: number;
16
56
  }) => Response;
57
+ requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
17
58
  }
18
59
  declare function createCrudHandler(dataSource: DataSource, entityMap: EntityMap, options: CrudHandlerOptions): {
19
60
  GET(req: Request, resource: string): Promise<Response>;
@@ -48,6 +89,8 @@ interface ForgotPasswordConfig extends AuthHandlersConfig {
48
89
  subject: string;
49
90
  html: string;
50
91
  text?: string;
92
+ /** Plain reset URL for templated emails (preferred over parsing html). */
93
+ resetLink?: string;
51
94
  }) => Promise<void>;
52
95
  resetExpiryHours?: number;
53
96
  afterCreateToken?: (email: string, resetLink: string) => Promise<void>;
@@ -101,11 +144,13 @@ declare function createUserAuthApiRouter(config: UserAuthApiConfig): {
101
144
  * All accept injectable deps; upload supports S3 or local.
102
145
  */
103
146
 
147
+ type RequireEntityPermissionFn = (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
104
148
  interface CmsHandlersBase {
105
149
  json: (body: unknown, init?: {
106
150
  status?: number;
107
151
  }) => Response;
108
152
  requireAuth: (req: Request) => Promise<Response | null>;
153
+ requireEntityPermission?: RequireEntityPermissionFn;
109
154
  }
110
155
  interface DashboardStatsConfig extends CmsHandlersBase {
111
156
  dataSource: DataSource;
@@ -160,6 +205,12 @@ interface FormSubmissionHandlerConfig {
160
205
  json: (body: unknown, init?: {
161
206
  status?: number;
162
207
  }) => Response;
208
+ /** When set, form submission notification email is queued (CRM recipient). */
209
+ getCms?: () => Promise<{
210
+ getPlugin: (name: string) => unknown;
211
+ }>;
212
+ getCompanyDetails?: () => Promise<CompanyDetails>;
213
+ getRecipientForChannel?: (channel: 'crm' | 'sales' | 'fulfilment') => Promise<string | null>;
163
214
  }
164
215
  interface FormSubmissionGetByIdConfig extends CmsHandlersBase {
165
216
  dataSource: DataSource;
@@ -172,6 +223,11 @@ interface UsersApiConfig extends CmsHandlersBase {
172
223
  dataSource: DataSource;
173
224
  entityMap: EntityMap;
174
225
  baseUrl: string;
226
+ /** When set with email queue/plugin, invite emails are sent on user create and regenerate-invite. */
227
+ getCms?: () => Promise<{
228
+ getPlugin: (name: string) => unknown;
229
+ }>;
230
+ getCompanyDetails?: () => Promise<CompanyDetails>;
175
231
  }
176
232
  declare function createUsersApiHandlers(config: UsersApiConfig): {
177
233
  list(req: Request): Promise<Response>;
@@ -240,6 +296,10 @@ interface CmsApiHandlerConfig {
240
296
  crudResources?: string[];
241
297
  /** When set, analytics and userAuth.sendEmail can be derived from getPlugin('analytics') and getPlugin('email') when not provided. */
242
298
  getCms?: CmsGetter;
299
+ /** Optional: used when deriving userAuth.sendEmail to pass company details into email templates (e.g. from settings). */
300
+ getCompanyDetails?: () => Promise<CompanyDetails>;
301
+ /** Optional: used for form submission and other channel-based email recipients (from settings group "email"). */
302
+ getRecipientForChannel?: (channel: 'crm' | 'sales' | 'fulfilment') => Promise<string | null>;
243
303
  userAuth?: UserAuthApiConfig;
244
304
  /** GET /api/dashboard/stats */
245
305
  dashboard?: DashboardStatsConfig;
@@ -267,9 +327,36 @@ interface CmsApiHandlerConfig {
267
327
  settings?: SettingsApiConfig;
268
328
  /** POST /api/chat/identify, GET /api/chat/conversations/:id/messages, POST /api/chat/messages */
269
329
  chat?: ChatApiConfig;
330
+ /** When set, CRUD and admin routes enforce entity-level permissions from session */
331
+ requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
332
+ /** Required for GET/POST/PATCH/DELETE /api/admin/roles */
333
+ getSessionUser?: () => Promise<SessionUser | null>;
270
334
  }
271
335
  declare function createCmsApiHandler(config: CmsApiHandlerConfig): {
272
336
  handle(method: string, path: string[], req: Request): Promise<Response>;
273
337
  };
274
338
 
275
- export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type ChangePasswordConfig as C, type DashboardStatsConfig as D, type EntityMap as E, type ForgotPasswordConfig as F, createUserProfileHandler as G, createUsersApiHandlers as H, type InviteAcceptConfig as I, type StorageService as S, type UploadHandlerConfig as U, type AuthHandlersConfig as a, type CmsApiHandlerConfig as b, type CmsGetter as c, type CrudHandlerOptions as d, type FormBySlugConfig as e, type SetPasswordConfig as f, type SettingsApiConfig as g, type UserAuthApiConfig as h, type UserAvatarConfig as i, type UserProfileConfig as j, type UsersApiConfig as k, createAnalyticsHandlers as l, createBlogBySlugHandler as m, createChangePasswordHandler as n, createCmsApiHandler as o, createCrudByIdHandler as p, createCrudHandler as q, createDashboardStatsHandler as r, createForgotPasswordHandler as s, createFormBySlugHandler as t, createInviteAcceptHandler as u, createSetPasswordHandler as v, createSettingsApiHandlers as w, createUploadHandler as x, createUserAuthApiRouter as y, createUserAvatarHandler as z };
339
+ interface StorefrontApiConfig {
340
+ dataSource: DataSource;
341
+ entityMap: EntityMap;
342
+ json: (body: unknown, init?: {
343
+ status?: number;
344
+ headers?: HeadersInit;
345
+ }) => Response;
346
+ getSessionUser: () => Promise<SessionUser | null>;
347
+ guestCookieName?: string;
348
+ /** Required for POST storefront/register */
349
+ hashPassword?: (plain: string) => Promise<string>;
350
+ /** When set, new registrations are blocked until email is verified and a signup email is sent. */
351
+ getCms?: () => Promise<{
352
+ getPlugin: (name: string) => unknown;
353
+ }>;
354
+ getCompanyDetails?: () => Promise<CompanyDetails>;
355
+ /** Origin for verify links (e.g. process.env.NEXTAUTH_URL). Required with getCms for verification URLs. */
356
+ publicSiteUrl?: string;
357
+ }
358
+ declare function createStorefrontApiHandler(config: StorefrontApiConfig): {
359
+ handle(method: string, path: string[], req: Request): Promise<Response>;
360
+ };
361
+
362
+ export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type CompanyDetails as C, type DashboardStatsConfig as D, type EmailTemplateResult as E, type ForgotPasswordConfig as F, createSetPasswordHandler as G, createSettingsApiHandlers as H, type InviteAcceptConfig as I, createStorefrontApiHandler as J, createUploadHandler as K, createUserAuthApiRouter as L, createUserAvatarHandler as M, createUserProfileHandler as N, type OrderPlacedLineItem as O, createUsersApiHandlers as P, getCompanyDetailsFromSettings as Q, mergeEmailLayoutCompanyDetails as R, type StorageService as S, type TemplateContext as T, type UploadHandlerConfig as U, type EmailTemplateName as a, type AuthHandlersConfig as b, type ChangePasswordConfig as c, type CmsApiHandlerConfig as d, type CmsGetter as e, type CrudHandlerOptions as f, type EntityMap as g, type FormBySlugConfig as h, type SetPasswordConfig as i, type SettingsApiConfig as j, type SocialLinkItem as k, type StorefrontApiConfig as l, type UserAuthApiConfig as m, type UserAvatarConfig as n, type UserProfileConfig as o, type UsersApiConfig as p, createAnalyticsHandlers as q, createBlogBySlugHandler as r, createChangePasswordHandler as s, createCmsApiHandler as t, createCrudByIdHandler as u, createCrudHandler as v, createDashboardStatsHandler as w, createForgotPasswordHandler as x, createFormBySlugHandler as y, createInviteAcceptHandler as z };