@infuro/cms-core 1.0.34 → 1.0.36

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 (152) hide show
  1. package/README.md +13 -0
  2. package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
  3. package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
  4. package/dist/admin.cjs +35254 -21613
  5. package/dist/admin.d.cts +192 -9
  6. package/dist/admin.d.ts +192 -9
  7. package/dist/admin.js +34301 -20755
  8. package/dist/api.cjs +137 -17531
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +15 -17528
  12. package/dist/auth.cjs +192 -1034
  13. package/dist/auth.d.cts +197 -54
  14. package/dist/auth.d.ts +197 -54
  15. package/dist/auth.js +4 -966
  16. package/dist/chunk-2AEVFOQP.cjs +30436 -0
  17. package/dist/chunk-3DZRIZOD.cjs +52 -0
  18. package/dist/chunk-5ELSW2UP.js +150 -0
  19. package/dist/chunk-7NMT3GBR.cjs +29 -0
  20. package/dist/chunk-COBORIJH.cjs +2373 -0
  21. package/dist/chunk-CRFV5WJK.js +16 -0
  22. package/dist/chunk-D5FBNKQM.cjs +104 -0
  23. package/dist/chunk-FG6I64HP.js +604 -0
  24. package/dist/chunk-GO7PPYNU.js +76 -0
  25. package/dist/chunk-HCIRL37O.js +21 -0
  26. package/dist/chunk-HF3L2GIT.cjs +194 -0
  27. package/dist/chunk-HT5DI3XW.cjs +82 -0
  28. package/dist/chunk-JC6DLWTE.js +21 -0
  29. package/dist/chunk-JS2W7XZ4.js +30312 -0
  30. package/dist/chunk-JXF23MPG.js +25 -0
  31. package/dist/chunk-KFFB6EMZ.js +123 -0
  32. package/dist/chunk-KPKFNLQQ.cjs +648 -0
  33. package/dist/chunk-LI2IXVAY.js +171 -0
  34. package/dist/chunk-MQBT33IV.js +48 -0
  35. package/dist/chunk-OOTLNH63.cjs +18 -0
  36. package/dist/chunk-PNOKNSG2.cjs +222 -0
  37. package/dist/chunk-SHUYVCID.js +4 -0
  38. package/dist/chunk-SPQFNIYJ.cjs +132 -0
  39. package/dist/chunk-SYBOCAWB.js +97 -0
  40. package/dist/chunk-TDV6EJHV.js +192 -0
  41. package/dist/chunk-UCKN4BBY.cjs +24 -0
  42. package/dist/chunk-UF3BYUXY.js +616 -0
  43. package/dist/chunk-UPLVMVRX.cjs +23 -0
  44. package/dist/chunk-USNT2KNT.cjs +6 -0
  45. package/dist/chunk-VMY2S32H.js +2342 -0
  46. package/dist/chunk-WEMDMVHQ.js +216 -0
  47. package/dist/chunk-WO2DW4AU.cjs +182 -0
  48. package/dist/chunk-X47PBV4I.js +79 -0
  49. package/dist/chunk-X6H5VBQ2.cjs +620 -0
  50. package/dist/chunk-XQ3QUHWR.cjs +83 -0
  51. package/dist/chunk-XW5ATPRW.cjs +155 -0
  52. package/dist/cli.cjs +107 -86
  53. package/dist/cli.js +66 -29
  54. package/dist/email-queue-CGZBVVAS.js +2 -0
  55. package/dist/email-queue-TPZWLTIV.cjs +23 -0
  56. package/dist/emit-order-notification-trigger-D2N3KFHL.cjs +16 -0
  57. package/dist/emit-order-notification-trigger-IVLWKKJL.js +3 -0
  58. package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
  59. package/dist/erp-config-enabled-T37X7T34.js +2 -0
  60. package/dist/erp-order-invoice-3YISSOWW.js +3 -0
  61. package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
  62. package/dist/event-order-defaults-EMWBIGL3.cjs +39 -0
  63. package/dist/event-order-defaults-SDRNAZHC.js +2 -0
  64. package/dist/hooks.cjs +259 -132
  65. package/dist/hooks.d.cts +42 -1
  66. package/dist/hooks.d.ts +42 -1
  67. package/dist/hooks.js +234 -91
  68. package/dist/index.cjs +3679 -22356
  69. package/dist/index.d.cts +2173 -643
  70. package/dist/index.d.ts +2173 -643
  71. package/dist/index.js +2587 -22119
  72. package/dist/interpolate-WAKPN56R.cjs +11 -0
  73. package/dist/interpolate-WDUWDF3I.js +2 -0
  74. package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
  75. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  76. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  77. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  78. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  79. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  80. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  81. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  82. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  83. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  84. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  85. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  86. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  87. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  88. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  89. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  90. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  91. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  92. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  93. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  94. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  95. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  96. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  97. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  98. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  99. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  100. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  101. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  102. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  103. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  104. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  105. package/dist/migrations/1781220000000-AddWhatsappTriggerBindings.ts +23 -0
  106. package/dist/migrations/1781230000000-AddOrderNotificationTriggers.ts +46 -0
  107. package/dist/migrations/1781240000000-DropEventOrderNotificationColumns.ts +29 -0
  108. package/dist/migrations/1781250000000-RemoveOrderRefundedTrigger.ts +36 -0
  109. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  110. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  111. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  112. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  113. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  114. package/dist/razorpay-KLO2KNCB.js +49 -0
  115. package/dist/razorpay-U23LGY72.cjs +56 -0
  116. package/dist/rbac-debug-db-HWP65A4O.cjs +35 -0
  117. package/dist/rbac-debug-db-QJH3AD34.js +33 -0
  118. package/dist/sms-defaults-2NL24H57.js +2 -0
  119. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  120. package/dist/stripe-4FD27QVJ.js +51 -0
  121. package/dist/stripe-VU6OEG2D.cjs +57 -0
  122. package/dist/theme.cjs +31 -59
  123. package/dist/theme.d.cts +78 -3
  124. package/dist/theme.d.ts +78 -3
  125. package/dist/theme.js +23 -20
  126. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  127. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  128. package/dist/whatsapp-trigger-dispatcher-ONHXI7UY.cjs +19 -0
  129. package/dist/whatsapp-trigger-dispatcher-PWFI4FKP.js +6 -0
  130. package/package.json +147 -142
  131. package/dist/admin.cjs.map +0 -1
  132. package/dist/admin.js.map +0 -1
  133. package/dist/api.cjs.map +0 -1
  134. package/dist/api.js.map +0 -1
  135. package/dist/auth.cjs.map +0 -1
  136. package/dist/auth.js.map +0 -1
  137. package/dist/cli.cjs.map +0 -1
  138. package/dist/cli.js.map +0 -1
  139. package/dist/config-DJ5CmQvS.d.cts +0 -8
  140. package/dist/config-DJ5CmQvS.d.ts +0 -8
  141. package/dist/hooks.cjs.map +0 -1
  142. package/dist/hooks.js.map +0 -1
  143. package/dist/index-Bf5GO8fu.d.cts +0 -583
  144. package/dist/index-DOiJuMQA.d.ts +0 -583
  145. package/dist/index.cjs.map +0 -1
  146. package/dist/index.js.map +0 -1
  147. package/dist/theme.cjs.map +0 -1
  148. package/dist/theme.js.map +0 -1
  149. package/dist/types-DCVaXlPV.d.cts +0 -78
  150. package/dist/types-DCVaXlPV.d.ts +0 -78
  151. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  152. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
package/dist/auth.js CHANGED
@@ -1,966 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __esm = (fn, res) => function __init() {
4
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
- };
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
-
11
- // src/auth/permission-entities.ts
12
- function isSuperAdminGroupName(name) {
13
- return name === ADMIN_GROUP_NAME;
14
- }
15
- function getPermissionableEntityKeys(entityMap) {
16
- const fromMap = Object.keys(entityMap).filter((k) => !PERMISSION_ENTITY_INTERNAL_EXCLUDE.has(k));
17
- const logical = PERMISSION_LOGICAL_ENTITIES.filter((k) => !fromMap.includes(k));
18
- return [...fromMap.sort(), ...logical].filter((k, i, a) => a.indexOf(k) === i);
19
- }
20
- function permissionRowsToRecord(rows) {
21
- const out = {};
22
- if (!rows?.length) return out;
23
- for (const p of rows) {
24
- out[p.entity] = {
25
- c: !!p.canCreate,
26
- r: !!p.canRead,
27
- u: !!p.canUpdate,
28
- d: !!p.canDelete
29
- };
30
- }
31
- return out;
32
- }
33
- function hasEntityPermission(record, entity, action) {
34
- const p = record?.[entity];
35
- if (!p) return false;
36
- if (action === "create") return p.c;
37
- if (action === "read") return p.r;
38
- if (action === "update") return p.u;
39
- return p.d;
40
- }
41
- var PERMISSION_ENTITY_INTERNAL_EXCLUDE, PERMISSION_LOGICAL_ENTITIES, ADMIN_GROUP_NAME;
42
- var init_permission_entities = __esm({
43
- "src/auth/permission-entities.ts"() {
44
- "use strict";
45
- PERMISSION_ENTITY_INTERNAL_EXCLUDE = /* @__PURE__ */ new Set([
46
- "users",
47
- "password_reset_tokens",
48
- "user_groups",
49
- "permissions",
50
- "comments",
51
- "form_fields",
52
- "configs",
53
- "knowledge_base_chunks",
54
- "carts",
55
- "cart_items",
56
- "wishlists",
57
- "wishlist_items",
58
- "message_templates",
59
- "vendor_users"
60
- ]);
61
- PERMISSION_LOGICAL_ENTITIES = [
62
- "users",
63
- "forms",
64
- "form_submissions",
65
- "dashboard",
66
- "upload",
67
- "settings",
68
- "analytics",
69
- "chat"
70
- ];
71
- ADMIN_GROUP_NAME = "Administrator";
72
- }
73
- });
74
-
75
- // src/auth/role-helpers.ts
76
- function isSuperAdmin(user) {
77
- if (!user) return false;
78
- if (user.groupId === SUPER_ADMIN_GROUP_ID) return true;
79
- if (user.isRBACAdmin === true) return true;
80
- return isSuperAdminGroupName(user.groupName);
81
- }
82
- function isVendorAdmin(user) {
83
- if (!user?.email || isSuperAdmin(user)) return false;
84
- if (user.groupId === VENDOR_ADMIN_GROUP_ID) return true;
85
- if ((user.vendorIds?.length ?? 0) > 0) return true;
86
- return isVendorGroupName(user.groupName);
87
- }
88
- var SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID;
89
- var init_role_helpers = __esm({
90
- "src/auth/role-helpers.ts"() {
91
- "use strict";
92
- init_permission_entities();
93
- init_vendor_scope();
94
- SUPER_ADMIN_GROUP_ID = 1;
95
- VENDOR_ADMIN_GROUP_ID = 5;
96
- }
97
- });
98
-
99
- // src/auth/vendor-scope.ts
100
- function isVendorGroupName(name) {
101
- if (!name?.trim()) return false;
102
- const n = name.trim().toLowerCase();
103
- return n === VENDOR_OWNER_GROUP_NAME.toLowerCase() || n.includes("vendor");
104
- }
105
- function isPlatformAdministrator(user) {
106
- if (!user?.email) return false;
107
- return isSuperAdmin(user);
108
- }
109
- function isVendorPortalUser(user) {
110
- if (user?.isVendorPortal === true) return true;
111
- if (!user?.email || isPlatformAdministrator(user)) return false;
112
- if (isVendorAdmin(user)) return true;
113
- return isVendorGroupName(user.groupName);
114
- }
115
- function isVendorStaff(user) {
116
- return isVendorPortalUser(user);
117
- }
118
- function isVendorOwner(user) {
119
- if (user?.isVendorOwner === true) return true;
120
- if (!user?.email || isPlatformAdministrator(user)) return false;
121
- if (user.vendorRole === "staff") return false;
122
- if (user.vendorRole === "owner") return true;
123
- if (!isVendorPortalUser(user)) return false;
124
- return user.groupName?.trim().toLowerCase() === VENDOR_OWNER_GROUP_NAME.toLowerCase();
125
- }
126
- function canManageVendorTeam(user) {
127
- return isPlatformAdministrator(user) || isVendorOwner(user);
128
- }
129
- function canManageVendorRoles(user) {
130
- return isPlatformAdministrator(user) || isVendorOwner(user);
131
- }
132
- function canOnboardVendors(user) {
133
- return isPlatformAdministrator(user);
134
- }
135
- function resolveVendorScopeFromSessionUser(user) {
136
- if (!user?.email) return { type: "deny" };
137
- if (isPlatformAdministrator(user)) return { type: "all" };
138
- const vendorIds = user.vendorIds ?? [];
139
- if (vendorIds.length === 0) return { type: "deny" };
140
- const preferred = user.activeVendorId ?? vendorIds[0];
141
- const vendorId = vendorIds.includes(preferred) ? preferred : vendorIds[0];
142
- return { type: "vendor", vendorId, vendorIds };
143
- }
144
- function vendorPortalFlagsFromUser(input) {
145
- const vendorIds = input.vendorIds ?? [];
146
- const isVendorPortal = !input.isRBACAdmin && (vendorIds.length > 0 || isVendorGroupName(input.groupName));
147
- const isVendorOwner2 = isVendorPortal && input.vendorRole !== "staff" && (input.vendorRole === "owner" || input.groupName?.trim().toLowerCase() === VENDOR_OWNER_GROUP_NAME.toLowerCase());
148
- return { isVendorPortal, isVendorOwner: isVendorOwner2 };
149
- }
150
- var VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_OWNER_GROUP_NAME;
151
- var init_vendor_scope = __esm({
152
- "src/auth/vendor-scope.ts"() {
153
- "use strict";
154
- init_role_helpers();
155
- VENDOR_SCOPED_STORE_ENTITIES = /* @__PURE__ */ new Set([
156
- "products",
157
- "collections",
158
- "brands",
159
- "product_categories",
160
- "orders",
161
- "payments",
162
- "taxes",
163
- "attributes",
164
- "vendor_customers",
165
- "discounts"
166
- ]);
167
- VENDOR_STORE_RBAC_ENTITIES = /* @__PURE__ */ new Set([
168
- ...VENDOR_SCOPED_STORE_ENTITIES,
169
- "order_discounts",
170
- "order_addresses"
171
- ]);
172
- VENDOR_OWNER_GROUP_NAME = "Vendor Owner";
173
- }
174
- });
175
-
176
- // src/auth/rbac-debug-db.ts
177
- var rbac_debug_db_exports = {};
178
- __export(rbac_debug_db_exports, {
179
- loadDbPermissionsForUser: () => loadDbPermissionsForUser
180
- });
181
- async function loadDbPermissionsForUser(dataSource, userId) {
182
- const rows = await dataSource.query(
183
- `
184
- SELECT u."groupId" AS "groupId", g.name AS "groupName",
185
- p.entity, p."canCreate", p."canRead", p."canUpdate", p."canDelete"
186
- FROM users u
187
- LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
188
- LEFT JOIN permissions p ON p."groupId" = g.id
189
- WHERE u.id = $1
190
- `,
191
- [userId]
192
- );
193
- const groupId = rows[0]?.groupId ?? null;
194
- const groupName = rows[0]?.groupName ?? null;
195
- const permRows = rows.filter((r) => r.entity).map((r) => ({
196
- entity: r.entity,
197
- canCreate: !!r.canCreate,
198
- canRead: !!r.canRead,
199
- canUpdate: !!r.canUpdate,
200
- canDelete: !!r.canDelete
201
- }));
202
- return {
203
- groupId,
204
- groupName,
205
- dbEntityPerms: summarizeEntityPerms(permissionRowsToRecord(permRows))
206
- };
207
- }
208
- var init_rbac_debug_db = __esm({
209
- "src/auth/rbac-debug-db.ts"() {
210
- "use strict";
211
- init_permission_entities();
212
- init_rbac_debug();
213
- }
214
- });
215
-
216
- // src/auth/rbac-debug.ts
217
- function isRbacDebugEnabled() {
218
- const v = process.env.CMS_RBAC_DEBUG?.trim().toLowerCase();
219
- if (v === "1" || v === "true" || v === "yes") return true;
220
- if (v === "0" || v === "false" || v === "no") return false;
221
- return process.env.NODE_ENV === "development";
222
- }
223
- function logRbac(message, data) {
224
- if (!isRbacDebugEnabled()) return;
225
- if (data) console.info(LOG_PREFIX, message, data);
226
- else console.info(LOG_PREFIX, message);
227
- }
228
- function summarizeEntityPerms(entityPerms) {
229
- const out = {};
230
- if (!entityPerms) return out;
231
- for (const [entity, p] of Object.entries(entityPerms)) {
232
- out[entity] = { c: p.c, r: p.r, u: p.u, d: p.d };
233
- }
234
- return out;
235
- }
236
- function vendorPortalFallbackReason(user, entity, action) {
237
- if (!isVendorPortalUser(user)) return null;
238
- if (entity === "dashboard" && action === "read") return "vendor_portal_dashboard_fallback";
239
- if (entity === "analytics" && action === "read") return "vendor_portal_analytics_fallback";
240
- if (entity === "settings" && action === "read") return "vendor_portal_settings_read_fallback";
241
- if (VENDOR_STORE_RBAC_ENTITIES.has(entity) && action === "read") return "vendor_portal_store_read_fallback";
242
- return null;
243
- }
244
- function explainSessionEntityAccess(user, entity, action) {
245
- const userSnapshot = {
246
- email: user?.email ?? null,
247
- id: user?.id ?? null,
248
- groupId: user?.groupId ?? null,
249
- groupName: user?.groupName ?? null,
250
- isRBACAdmin: user?.isRBACAdmin ?? false,
251
- adminAccess: user?.adminAccess ?? null,
252
- vendorIds: user?.vendorIds ?? [],
253
- activeVendorId: user?.activeVendorId ?? null,
254
- vendorRole: user?.vendorRole ?? null,
255
- isVendorPortal: user?.isVendorPortal ?? false,
256
- isVendorOwner: user?.isVendorOwner ?? false,
257
- isVendorPortalComputed: isVendorPortalUser(user),
258
- isVendorOwnerComputed: isVendorOwner(user),
259
- jwtEntityPerms: summarizeEntityPerms(user?.entityPerms),
260
- jwtEntityPermForTarget: user?.entityPerms?.[entity] ?? null
261
- };
262
- if (!user?.email) {
263
- return { allowed: false, reason: "no_session_email", userSnapshot };
264
- }
265
- if (user.isRBACAdmin) {
266
- return { allowed: true, reason: "platform_administrator", userSnapshot };
267
- }
268
- const vendorIds = user.vendorIds ?? [];
269
- const isStaff = user.vendorRole === "staff";
270
- if (vendorIds.length > 0) {
271
- if (entity === "dashboard" && action === "read") {
272
- return { allowed: true, reason: "vendor_link_dashboard_read", userSnapshot };
273
- }
274
- if (entity === "analytics" && action === "read") {
275
- return { allowed: true, reason: "vendor_link_analytics_read", userSnapshot };
276
- }
277
- if (entity === "settings") {
278
- if (action === "read") {
279
- return { allowed: true, reason: "vendor_link_settings_read", userSnapshot };
280
- }
281
- if (action === "update" && !isStaff) {
282
- return { allowed: true, reason: "vendor_link_settings_update", userSnapshot };
283
- }
284
- }
285
- if (VENDOR_STORE_RBAC_ENTITIES.has(entity)) {
286
- if (isStaff && action === "read") {
287
- return { allowed: true, reason: "vendor_staff_store_read", userSnapshot };
288
- }
289
- if (!isStaff) {
290
- return { allowed: true, reason: "vendor_link_store_full", userSnapshot };
291
- }
292
- return {
293
- allowed: false,
294
- reason: "vendor_staff_store_write_denied",
295
- userSnapshot
296
- };
297
- }
298
- }
299
- if (isVendorPortalUser(user) && isVendorOwner(user)) {
300
- if (entity === "dashboard" && action === "read") {
301
- return { allowed: true, reason: "vendor_owner_group_dashboard", userSnapshot };
302
- }
303
- if (entity === "analytics" && action === "read") {
304
- return { allowed: true, reason: "vendor_owner_group_analytics", userSnapshot };
305
- }
306
- if (entity === "settings" && (action === "read" || action === "update")) {
307
- return { allowed: true, reason: "vendor_owner_group_settings", userSnapshot };
308
- }
309
- if (VENDOR_STORE_RBAC_ENTITIES.has(entity)) {
310
- return { allowed: true, reason: "vendor_owner_group_store", userSnapshot };
311
- }
312
- }
313
- const vendorPortalReason = vendorPortalFallbackReason(user, entity, action);
314
- if (vendorPortalReason) {
315
- return { allowed: true, reason: vendorPortalReason, userSnapshot };
316
- }
317
- const explicit = user.entityPerms?.[entity];
318
- if (explicit !== void 0) {
319
- const allowed2 = hasEntityPermission(user.entityPerms, entity, action);
320
- return {
321
- allowed: allowed2,
322
- reason: allowed2 ? "jwt_entity_perms_allow" : "jwt_entity_perms_deny",
323
- userSnapshot
324
- };
325
- }
326
- const allowed = hasEntityPermission(user.entityPerms, entity, action);
327
- return {
328
- allowed,
329
- reason: allowed ? "entity_perms_fallback_allow" : "no_matching_rule",
330
- userSnapshot
331
- };
332
- }
333
- async function logEntityAccessDecision(dataSource, context, user, entity, action, extra) {
334
- if (!isRbacDebugEnabled()) return;
335
- const explanation = explainSessionEntityAccess(user, entity, action);
336
- let dbPermissions;
337
- if (dataSource && user?.id) {
338
- const id = Number(user.id);
339
- if (Number.isFinite(id)) {
340
- try {
341
- const { loadDbPermissionsForUser: loadDbPermissionsForUser2 } = await Promise.resolve().then(() => (init_rbac_debug_db(), rbac_debug_db_exports));
342
- dbPermissions = await loadDbPermissionsForUser2(dataSource, id);
343
- } catch (e) {
344
- dbPermissions = { error: e instanceof Error ? e.message : String(e) };
345
- }
346
- }
347
- }
348
- logRbac(context, {
349
- entity,
350
- action,
351
- allowed: explanation.allowed,
352
- reason: explanation.reason,
353
- ...explanation.userSnapshot,
354
- dbPermissions,
355
- ...extra
356
- });
357
- }
358
- var LOG_PREFIX;
359
- var init_rbac_debug = __esm({
360
- "src/auth/rbac-debug.ts"() {
361
- "use strict";
362
- init_permission_entities();
363
- init_vendor_scope();
364
- LOG_PREFIX = "[cms-rbac]";
365
- }
366
- });
367
-
368
- // src/auth/helpers.ts
369
- init_rbac_debug();
370
- init_vendor_scope();
371
- var RBAC_ADMIN_ONLY_ENTITIES = /* @__PURE__ */ new Set(["users", "user_groups", "permissions"]);
372
- function sessionHasEntityAccess(user, entity, action) {
373
- return explainSessionEntityAccess(user, entity, action).allowed;
374
- }
375
- function canManageRoles(user) {
376
- return !!(user?.email && user.isRBACAdmin);
377
- }
378
- var OPEN_ENDPOINTS = [
379
- { "/api/contacts": ["POST"] },
380
- { "/api/form-submissions": ["POST"] },
381
- { "/api/blogs": ["GET"] }
382
- ];
383
- var PERMISSION_REQUIRED_ENDPOINTS = {};
384
- function isOpenEndpoint(pathname) {
385
- return OPEN_ENDPOINTS.some((endpoint) => pathname.startsWith(Object.keys(endpoint)[0]));
386
- }
387
- function getRequiredPermission(pathname) {
388
- return null;
389
- }
390
- function isPublicMethod(pathname, method) {
391
- for (const endpoint of OPEN_ENDPOINTS) {
392
- const key = Object.keys(endpoint)[0];
393
- if (pathname.startsWith(key) && endpoint[key].includes(method)) return true;
394
- }
395
- return false;
396
- }
397
- function createAuthHelpers(getSession, NextResponse) {
398
- return createAuthHelpersFromGetSession(getSession, NextResponse);
399
- }
400
- function createCmsAuthBundle(getSession, NextResponse) {
401
- const auth = createAuthHelpers(getSession, NextResponse);
402
- return {
403
- requireAuth: auth.requireAuth,
404
- requireAdminAccess: auth.requireAdminAccess,
405
- requireEntityPermission: auth.requireEntityPermission,
406
- getSessionUser: auth.getAuthenticatedUser,
407
- getAuthenticatedUser: auth.getAuthenticatedUser
408
- };
409
- }
410
- function createAuthHelpersFromGetSession(getSession, NextResponse) {
411
- return {
412
- async requireAuth() {
413
- const session = await getSession();
414
- if (!session?.user?.email) {
415
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
416
- }
417
- return null;
418
- },
419
- async requirePermission() {
420
- const session = await getSession();
421
- if (!session?.user?.email) {
422
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
423
- }
424
- return null;
425
- },
426
- async requireEntityPermission(_req, entity, action) {
427
- const session = await getSession();
428
- if (!session?.user?.email) {
429
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
430
- }
431
- const u = session.user;
432
- const allowed = sessionHasEntityAccess(u, entity, action);
433
- const { reason } = explainSessionEntityAccess(u, entity, action);
434
- logRbac("authHelpers.requireEntityPermission", {
435
- entity,
436
- action,
437
- allowed,
438
- reason,
439
- email: u.email,
440
- groupName: u.groupName,
441
- vendorIds: u.vendorIds,
442
- isVendorPortal: u.isVendorPortal,
443
- isVendorOwner: u.isVendorOwner
444
- });
445
- if (allowed) return null;
446
- return NextResponse.json({ error: "Forbidden", entity, action, reason }, { status: 403 });
447
- },
448
- async requireAdminAccess() {
449
- const session = await getSession();
450
- if (!session?.user?.email) {
451
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
452
- }
453
- const u = session.user;
454
- if (u.isRBACAdmin) return null;
455
- if (isVendorPortalUser(u)) return null;
456
- if (u.adminAccess === true) return null;
457
- if (u.adminAccess === false) {
458
- logRbac("requireAdminAccess denied (adminAccess:false)", {
459
- email: u.email,
460
- groupName: u.groupName,
461
- isVendorPortal: u.isVendorPortal
462
- });
463
- return NextResponse.json({ error: "Forbidden", reason: "admin_access" }, { status: 403 });
464
- }
465
- logRbac("requireAdminAccess denied (no matching rule)", {
466
- email: u.email,
467
- adminAccess: u.adminAccess,
468
- groupName: u.groupName,
469
- isVendorPortal: u.isVendorPortal
470
- });
471
- return NextResponse.json({ error: "Forbidden", reason: "admin_access" }, { status: 403 });
472
- },
473
- async getAuthenticatedUser() {
474
- const session = await getSession();
475
- return session?.user ?? null;
476
- }
477
- };
478
- }
479
-
480
- // src/auth/index.ts
481
- init_rbac_debug();
482
- init_role_helpers();
483
- init_vendor_scope();
484
- init_permission_entities();
485
-
486
- // src/auth/seed-permissions.ts
487
- init_permission_entities();
488
- async function seedAdministratorPermissions(dataSource, entityMap) {
489
- const entities = getPermissionableEntityKeys(entityMap);
490
- const groupRepo = dataSource.getRepository(entityMap.user_groups);
491
- const permRepo = dataSource.getRepository(entityMap.permissions);
492
- const adminGroup = await groupRepo.findOne({ where: { name: ADMIN_GROUP_NAME, deleted: false } });
493
- console.log("ADMIN GROUP", adminGroup);
494
- if (!adminGroup) return;
495
- const fullCrud = { canCreate: true, canRead: true, canUpdate: true, canDelete: true };
496
- for (const entity of entities) {
497
- const existing = await permRepo.findOne({
498
- where: { groupId: adminGroup.id, entity }
499
- });
500
- console.log("EXISTING", existing);
501
- if (existing) {
502
- existing.canCreate = true;
503
- existing.canRead = true;
504
- existing.canUpdate = true;
505
- existing.canDelete = true;
506
- await permRepo.save(existing);
507
- } else {
508
- await permRepo.save(
509
- permRepo.create({
510
- groupId: adminGroup.id,
511
- entity,
512
- ...fullCrud
513
- })
514
- );
515
- }
516
- }
517
- }
518
-
519
- // src/auth/middleware.ts
520
- import { getToken } from "next-auth/jwt";
521
-
522
- // src/auth/auth-debug.ts
523
- var LOG_PREFIX2 = "[cms-auth]";
524
- function isAuthDebugEnabled() {
525
- const v = process.env.CMS_AUTH_DEBUG?.trim().toLowerCase();
526
- if (v === "1" || v === "true" || v === "yes") return true;
527
- if (v === "0" || v === "false" || v === "no") return false;
528
- return process.env.NODE_ENV === "development";
529
- }
530
- function isAuthDebugClientEnabled() {
531
- if (typeof window === "undefined") return false;
532
- const v = process.env.NEXT_PUBLIC_CMS_AUTH_DEBUG?.trim().toLowerCase();
533
- if (v === "1" || v === "true" || v === "yes") return true;
534
- if (v === "0" || v === "false" || v === "no") return false;
535
- return process.env.NODE_ENV === "development";
536
- }
537
- function logAuth(message, data) {
538
- if (!isAuthDebugEnabled()) return;
539
- if (data) console.info(LOG_PREFIX2, message, data);
540
- else console.info(LOG_PREFIX2, message);
541
- }
542
- function logAuthClient(message, data) {
543
- if (!isAuthDebugClientEnabled()) return;
544
- if (data) console.info(LOG_PREFIX2, message, data);
545
- else console.info(LOG_PREFIX2, message);
546
- }
547
- function summarizeSessionUserForLog(user) {
548
- if (!user || typeof user !== "object") return { present: false };
549
- const u = user;
550
- return {
551
- present: true,
552
- email: u.email ?? null,
553
- id: u.id ?? null,
554
- adminAccess: u.adminAccess ?? null,
555
- isRBACAdmin: u.isRBACAdmin ?? null,
556
- isVendorPortal: u.isVendorPortal ?? null,
557
- groupName: u.groupName ?? null
558
- };
559
- }
560
- function nextAuthCookieDebugInfo() {
561
- const nextAuthUrl = process.env.NEXTAUTH_URL ?? "(unset)";
562
- const isHttps = nextAuthUrl.startsWith("https");
563
- return {
564
- nextAuthUrl,
565
- hasSecret: Boolean(process.env.NEXTAUTH_SECRET),
566
- cookieName: isHttps ? "__Secure-next-auth.session-token" : "next-auth.session-token",
567
- cookieSecure: isHttps,
568
- nodeEnv: process.env.NODE_ENV ?? "(unset)"
569
- };
570
- }
571
-
572
- // src/auth/middleware.ts
573
- var defaultPublicApiMethods = {
574
- "/api/contacts": ["POST"],
575
- "/api/form-submissions": ["POST"],
576
- "/api/blogs": ["GET"],
577
- "/api/forms": ["GET"],
578
- "/api/auth": ["GET", "POST"],
579
- "/api/health": ["GET"],
580
- "/api/users/forgot-password": ["POST"],
581
- "/api/users/set-password": ["POST"],
582
- "/api/users/invite": ["POST"]
583
- };
584
- function legacyGetSessionToken(request) {
585
- const secure = request.cookies.get("__Secure-next-auth.session-token")?.value;
586
- const regular = request.cookies.get("next-auth.session-token")?.value;
587
- return secure ?? regular;
588
- }
589
- function sessionCookiePresence(request) {
590
- const secure = request.cookies.get("__Secure-next-auth.session-token")?.value;
591
- const regular = request.cookies.get("next-auth.session-token")?.value;
592
- const hasChunked = Boolean(request.cookies.get("next-auth.session-token.0")?.value) || Boolean(request.cookies.get("__Secure-next-auth.session-token.0")?.value);
593
- return {
594
- hasSecureToken: Boolean(secure),
595
- hasRegularToken: Boolean(regular),
596
- hasChunkedToken: hasChunked,
597
- resolved: Boolean(secure ?? regular)
598
- };
599
- }
600
- function isPublicMethod2(pathname, method, publicApiMethods) {
601
- for (const [endpoint, methods] of Object.entries(publicApiMethods)) {
602
- if (pathname.startsWith(endpoint) && methods.includes(method)) return true;
603
- }
604
- return false;
605
- }
606
- async function hasValidSession(request, secret, legacyGetToken) {
607
- if (request.req) {
608
- const token = await getToken({ req: request.req, secret });
609
- return token != null;
610
- }
611
- return Boolean(legacyGetToken(request));
612
- }
613
- function createCmsMiddleware(config = {}) {
614
- const {
615
- publicAdminPaths = ["/admin/signin", "/admin/forgot-password", "/admin/reset-password", "/admin/invite"],
616
- publicApiMethods = defaultPublicApiMethods,
617
- signInPath = "/admin/signin",
618
- getSessionToken = legacyGetSessionToken,
619
- secret = process.env.NEXTAUTH_SECRET
620
- } = config;
621
- return async function cmsMiddleware(request) {
622
- const pathname = request.nextUrl.pathname;
623
- const method = request.method;
624
- if (publicAdminPaths.some((p) => pathname === p || pathname.startsWith(p + "/"))) {
625
- return { type: "next" };
626
- }
627
- if (pathname.startsWith("/admin")) {
628
- const authenticated = await hasValidSession(request, secret, getSessionToken);
629
- const cookies = sessionCookiePresence(request);
630
- if (!authenticated) {
631
- logAuth("middleware: admin redirect to signin (no session)", {
632
- pathname,
633
- method,
634
- usesGetToken: Boolean(request.req),
635
- ...cookies,
636
- expectedCookieName: process.env.NEXTAUTH_URL?.startsWith("https") ? "__Secure-next-auth.session-token" : "next-auth.session-token"
637
- });
638
- return { type: "redirect", url: new URL(signInPath, request.url).toString() };
639
- }
640
- logAuth("middleware: admin allowed", {
641
- pathname,
642
- method,
643
- usesGetToken: Boolean(request.req),
644
- ...cookies
645
- });
646
- }
647
- if (pathname.startsWith("/api")) {
648
- if (isPublicMethod2(pathname, method, publicApiMethods)) {
649
- return { type: "next" };
650
- }
651
- const authenticated = await hasValidSession(request, secret, getSessionToken);
652
- if (!authenticated) {
653
- logAuth("middleware: api 401 (no session)", {
654
- pathname,
655
- method,
656
- usesGetToken: Boolean(request.req),
657
- ...sessionCookiePresence(request)
658
- });
659
- return { type: "json", status: 401, body: { error: "Unauthorized" } };
660
- }
661
- }
662
- return { type: "next" };
663
- };
664
- }
665
-
666
- // src/auth/nextauth-options.ts
667
- init_permission_entities();
668
- init_role_helpers();
669
- init_vendor_scope();
670
- import _CredentialsProvider from "next-auth/providers/credentials";
671
- var CredentialsProvider = _CredentialsProvider.default ?? _CredentialsProvider;
672
- function sessionUserFromNextAuthUser(user) {
673
- const g = user.group;
674
- const isRBACAdmin = isSuperAdmin({
675
- groupId: user.groupId ?? void 0,
676
- groupName: g?.name,
677
- isRBACAdmin: false
678
- });
679
- const entityPerms = permissionRowsToRecord(g?.permissions);
680
- const rawAdminAccess = user.adminAccess;
681
- const adminAccess = rawAdminAccess === true ? true : rawAdminAccess === false ? false : void 0;
682
- const vendorIds = user.vendorIds ?? [];
683
- const vendorRole = user.vendorRole ?? null;
684
- const { isVendorPortal, isVendorOwner: isVendorOwner2 } = vendorPortalFlagsFromUser({
685
- email: user.email,
686
- isRBACAdmin,
687
- groupName: g?.name,
688
- vendorIds,
689
- vendorRole
690
- });
691
- return {
692
- id: user.id.toString(),
693
- email: user.email,
694
- name: user.name,
695
- groupId: user.groupId ?? void 0,
696
- groupName: g?.name ?? void 0,
697
- isRBACAdmin,
698
- entityPerms,
699
- adminAccess,
700
- vendorIds,
701
- activeVendorId: user.activeVendorId ?? vendorIds[0] ?? null,
702
- vendorRole,
703
- isVendorPortal,
704
- isVendorOwner: isVendorOwner2
705
- };
706
- }
707
- function isCustomerGroupUser(user) {
708
- return user.group?.name?.toLocaleLowerCase().trim() === "customer";
709
- }
710
- function callbackUrlTargetsAdmin(callbackUrl) {
711
- const raw = callbackUrl.trim();
712
- if (!raw) return false;
713
- if (raw.startsWith("/admin")) return true;
714
- try {
715
- const path = raw.startsWith("http") ? new URL(raw).pathname : raw.split("?")[0] ?? raw;
716
- return path.startsWith("/admin");
717
- } catch {
718
- return raw.includes("/admin");
719
- }
720
- }
721
- function permitsCustomerLogin(allowCustomerLogin, credentials) {
722
- if (allowCustomerLogin === true) return true;
723
- if (allowCustomerLogin === false) return false;
724
- const callbackUrl = typeof credentials?.callbackUrl === "string" ? credentials.callbackUrl : "";
725
- return !callbackUrlTargetsAdmin(callbackUrl);
726
- }
727
- function getNextAuthOptions(config) {
728
- const {
729
- getUserByEmail,
730
- comparePassword,
731
- signInPage = "/admin/signin",
732
- secret,
733
- extend,
734
- enablePasswordLogin = true,
735
- enableOtpLogin = false,
736
- authorizeOtp,
737
- allowCustomerLogin
738
- } = config;
739
- logAuth("getNextAuthOptions init", nextAuthCookieDebugInfo());
740
- const providers = [];
741
- if (enablePasswordLogin) {
742
- providers.push(
743
- CredentialsProvider({
744
- name: "credentials",
745
- credentials: {
746
- email: { label: "Email", type: "email" },
747
- password: { label: "Password", type: "password" }
748
- },
749
- async authorize(credentials) {
750
- const creds = credentials;
751
- const email = creds?.email?.trim() ?? "";
752
- if (!email || !creds?.password) {
753
- logAuth("authorize(credentials) rejected", { reason: "missing_email_or_password" });
754
- return null;
755
- }
756
- try {
757
- const user = await getUserByEmail(email);
758
- if (!user) {
759
- logAuth("authorize(credentials) rejected", { reason: "user_not_found", email });
760
- return null;
761
- }
762
- if (user.blocked) {
763
- logAuth("authorize(credentials) rejected", { reason: "blocked", email, userId: user.id });
764
- return null;
765
- }
766
- if (user.deleted) {
767
- logAuth("authorize(credentials) rejected", { reason: "deleted", email, userId: user.id });
768
- return null;
769
- }
770
- if (!user.password) {
771
- logAuth("authorize(credentials) rejected", { reason: "no_password", email, userId: user.id });
772
- return null;
773
- }
774
- const valid = await comparePassword(creds.password, user.password);
775
- if (!valid) {
776
- logAuth("authorize(credentials) rejected", { reason: "invalid_password", email, userId: user.id });
777
- return null;
778
- }
779
- if (isCustomerGroupUser(user) && !permitsCustomerLogin(allowCustomerLogin, creds)) {
780
- logAuth("authorize(credentials) rejected", {
781
- reason: "customer_group",
782
- email,
783
- userId: user.id,
784
- callbackUrl: creds?.callbackUrl ?? null
785
- });
786
- return null;
787
- }
788
- const sessionUser = sessionUserFromNextAuthUser(user);
789
- logAuth("authorize(credentials) ok", summarizeSessionUserForLog(sessionUser));
790
- return sessionUser;
791
- } catch (err) {
792
- console.error("[cms-auth] authorize error (credentials):", err instanceof Error ? err.message : err);
793
- logAuth("authorize(credentials) error", {
794
- email,
795
- message: err instanceof Error ? err.message : String(err)
796
- });
797
- return null;
798
- }
799
- }
800
- })
801
- );
802
- }
803
- if (enableOtpLogin && authorizeOtp) {
804
- providers.push(
805
- CredentialsProvider({
806
- id: "otp",
807
- name: "otp",
808
- credentials: {
809
- identifier: { label: "Email or phone", type: "text" },
810
- code: { label: "Code", type: "text" },
811
- channel: { label: "Channel", type: "text" }
812
- },
813
- async authorize(credentials) {
814
- const creds = credentials;
815
- const identifier = typeof creds?.identifier === "string" ? creds.identifier.trim() : "";
816
- const code = typeof creds?.code === "string" ? creds.code.trim() : "";
817
- const ch = creds?.channel === "sms" ? "sms" : "email";
818
- if (!identifier || !code) return null;
819
- try {
820
- const user = await authorizeOtp({ identifier, channel: ch, code });
821
- if (!user || user.blocked || user.deleted) return null;
822
- if (isCustomerGroupUser(user) && !permitsCustomerLogin(allowCustomerLogin, creds)) {
823
- logAuth("authorize(otp) rejected", {
824
- reason: "customer_group",
825
- identifier,
826
- callbackUrl: creds?.callbackUrl ?? null
827
- });
828
- return null;
829
- }
830
- return sessionUserFromNextAuthUser(user);
831
- } catch (err) {
832
- console.error("[cms-auth] authorize error (otp):", err instanceof Error ? err.message : err);
833
- return null;
834
- }
835
- }
836
- })
837
- );
838
- }
839
- const options = {
840
- secret: secret ?? process.env.NEXTAUTH_SECRET,
841
- providers,
842
- session: { strategy: "jwt" },
843
- pages: { signIn: signInPage },
844
- cookies: {
845
- sessionToken: {
846
- name: process.env.NEXTAUTH_URL?.startsWith("https") ? "__Secure-next-auth.session-token" : "next-auth.session-token",
847
- options: {
848
- httpOnly: true,
849
- sameSite: "lax",
850
- path: "/",
851
- secure: process.env.NEXTAUTH_URL?.startsWith("https") ?? false
852
- }
853
- }
854
- },
855
- callbacks: {
856
- async jwt({ token, user, trigger, session }) {
857
- if (user) {
858
- logAuth("jwt callback: new sign-in", {
859
- trigger,
860
- user: summarizeSessionUserForLog(user)
861
- });
862
- const u = user;
863
- token.id = u.id;
864
- token.groupId = u.groupId;
865
- token.groupName = u.groupName;
866
- token.isRBACAdmin = u.isRBACAdmin;
867
- token.entityPerms = u.entityPerms;
868
- token.adminAccess = u.adminAccess;
869
- token.vendorIds = u.vendorIds;
870
- token.activeVendorId = u.activeVendorId;
871
- token.vendorRole = u.vendorRole;
872
- token.isVendorPortal = u.isVendorPortal;
873
- token.isVendorOwner = u.isVendorOwner;
874
- }
875
- if (trigger === "update" && session && typeof session === "object") {
876
- logAuth("jwt callback: session update", { trigger });
877
- const s = session;
878
- const t = token;
879
- if (typeof s.name === "string") t.name = s.name;
880
- if (typeof s.email === "string") t.email = s.email;
881
- if (typeof s.activeVendorId === "number") t.activeVendorId = s.activeVendorId;
882
- }
883
- return token;
884
- },
885
- async session({ session, token }) {
886
- const t = token;
887
- logAuth("session callback", {
888
- tokenHasId: t.id != null,
889
- tokenEmail: typeof t.email === "string" ? t.email : null,
890
- sessionUser: summarizeSessionUserForLog(session.user)
891
- });
892
- if (session.user) {
893
- if (typeof t.name === "string") session.user.name = t.name;
894
- if (typeof t.email === "string") session.user.email = t.email;
895
- session.user.id = t.id;
896
- session.user.groupId = t.groupId;
897
- session.user.groupName = t.groupName;
898
- session.user.isRBACAdmin = t.isRBACAdmin;
899
- session.user.entityPerms = t.entityPerms;
900
- session.user.adminAccess = t.adminAccess;
901
- session.user.vendorIds = t.vendorIds;
902
- session.user.activeVendorId = t.activeVendorId;
903
- session.user.vendorRole = t.vendorRole;
904
- session.user.isVendorPortal = t.isVendorPortal;
905
- session.user.isVendorOwner = t.isVendorOwner;
906
- }
907
- return session;
908
- }
909
- }
910
- };
911
- return extend ? extend(options) : options;
912
- }
913
- function getStorefrontNextAuthOptions(config) {
914
- return getNextAuthOptions({ ...config, allowCustomerLogin: true });
915
- }
916
- export {
917
- ADMIN_GROUP_NAME,
918
- OPEN_ENDPOINTS,
919
- PERMISSION_REQUIRED_ENDPOINTS,
920
- RBAC_ADMIN_ONLY_ENTITIES,
921
- SUPER_ADMIN_GROUP_ID,
922
- VENDOR_ADMIN_GROUP_ID,
923
- VENDOR_OWNER_GROUP_NAME,
924
- VENDOR_SCOPED_STORE_ENTITIES,
925
- VENDOR_STORE_RBAC_ENTITIES,
926
- canManageRoles,
927
- canManageVendorRoles,
928
- canManageVendorTeam,
929
- canOnboardVendors,
930
- createAuthHelpers,
931
- createCmsAuthBundle,
932
- createCmsMiddleware,
933
- defaultPublicApiMethods,
934
- explainSessionEntityAccess,
935
- getNextAuthOptions,
936
- getPermissionableEntityKeys,
937
- getRequiredPermission,
938
- getStorefrontNextAuthOptions,
939
- hasEntityPermission,
940
- isAuthDebugClientEnabled,
941
- isAuthDebugEnabled,
942
- isOpenEndpoint,
943
- isPlatformAdministrator,
944
- isPublicMethod,
945
- isRbacDebugEnabled,
946
- isSuperAdmin,
947
- isSuperAdminGroupName,
948
- isVendorAdmin,
949
- isVendorGroupName,
950
- isVendorOwner,
951
- isVendorPortalUser,
952
- isVendorStaff,
953
- logAuth,
954
- logAuthClient,
955
- logEntityAccessDecision,
956
- logRbac,
957
- nextAuthCookieDebugInfo,
958
- permissionRowsToRecord,
959
- resolveVendorScopeFromSessionUser,
960
- seedAdministratorPermissions,
961
- sessionHasEntityAccess,
962
- summarizeEntityPerms,
963
- summarizeSessionUserForLog,
964
- vendorPortalFlagsFromUser
965
- };
966
- //# sourceMappingURL=auth.js.map
1
+ export { createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, getStorefrontNextAuthOptions, isAuthDebugClientEnabled, isAuthDebugEnabled, logAuth, logAuthClient, nextAuthCookieDebugInfo, seedAdministratorPermissions, summarizeSessionUserForLog } from './chunk-FG6I64HP.js';
2
+ export { OPEN_ENDPOINTS, PERMISSION_REQUIRED_ENDPOINTS, RBAC_ADMIN_ONLY_ENTITIES, canManageRoles, createAuthHelpers, createCmsAuthBundle, getRequiredPermission, isOpenEndpoint, isPublicMethod, sessionHasEntityAccess } from './chunk-LI2IXVAY.js';
3
+ export { ADMIN_GROUP_NAME, SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID, VENDOR_OWNER_GROUP_NAME, VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, canManageVendorRoles, canManageVendorTeam, canOnboardVendors, explainSessionEntityAccess, getPermissionableEntityKeys, hasEntityPermission, isPlatformAdministrator, isRbacDebugEnabled, isSuperAdmin, isSuperAdminGroupName, isVendorAdmin, isVendorGroupName, isVendorOwner, isVendorPortalUser, isVendorStaff, logEntityAccessDecision, logRbac, permissionRowsToRecord, resolveVendorScopeFromSessionUser, summarizeEntityPerms, vendorPortalFlagsFromUser } from './chunk-UF3BYUXY.js';
4
+ import './chunk-SHUYVCID.js';