@infuro/cms-core 1.0.34 → 1.0.35

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 (158) 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 +34329 -20923
  5. package/dist/admin.d.cts +186 -9
  6. package/dist/admin.d.ts +186 -9
  7. package/dist/admin.js +34140 -20829
  8. package/dist/api.cjs +120 -17515
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +14 -17528
  12. package/dist/auth.cjs +192 -1034
  13. package/dist/auth.d.cts +194 -51
  14. package/dist/auth.d.ts +194 -51
  15. package/dist/auth.js +4 -966
  16. package/dist/chunk-2XE4X74C.js +29602 -0
  17. package/dist/chunk-3DZRIZOD.cjs +52 -0
  18. package/dist/chunk-3KPNTQBV.cjs +620 -0
  19. package/dist/chunk-46GKADYE.cjs +84 -0
  20. package/dist/chunk-4TRPKBKO.js +589 -0
  21. package/dist/chunk-5ELSW2UP.js +150 -0
  22. package/dist/chunk-6KPQWRFW.js +171 -0
  23. package/dist/chunk-7NMT3GBR.cjs +29 -0
  24. package/dist/chunk-7YIBMQDR.cjs +86 -0
  25. package/dist/chunk-BGJAV67S.cjs +29710 -0
  26. package/dist/chunk-CNTSLED2.cjs +559 -0
  27. package/dist/chunk-CRFV5WJK.js +16 -0
  28. package/dist/chunk-D5FBNKQM.cjs +104 -0
  29. package/dist/chunk-EF2JBPDM.js +114 -0
  30. package/dist/chunk-EQPITOP6.js +543 -0
  31. package/dist/chunk-GO7PPYNU.js +76 -0
  32. package/dist/chunk-HF3L2GIT.cjs +194 -0
  33. package/dist/chunk-J7XHLOLO.js +830 -0
  34. package/dist/chunk-JBRR5UYL.js +87 -0
  35. package/dist/chunk-JC6DLWTE.js +21 -0
  36. package/dist/chunk-JHF4YYRC.cjs +188 -0
  37. package/dist/chunk-JXF23MPG.js +25 -0
  38. package/dist/chunk-MQBT33IV.js +48 -0
  39. package/dist/chunk-N44BJZ4C.cjs +123 -0
  40. package/dist/chunk-OOTLNH63.cjs +18 -0
  41. package/dist/chunk-PAMVINEX.cjs +577 -0
  42. package/dist/chunk-PNOKNSG2.cjs +222 -0
  43. package/dist/chunk-QM733NUK.js +186 -0
  44. package/dist/chunk-R73BKDRO.cjs +90 -0
  45. package/dist/chunk-SHUYVCID.js +4 -0
  46. package/dist/chunk-SYBOCAWB.js +97 -0
  47. package/dist/chunk-TDV6EJHV.js +192 -0
  48. package/dist/chunk-TFUOHI37.cjs +839 -0
  49. package/dist/chunk-TIAEXJLI.cjs +182 -0
  50. package/dist/chunk-UPLVMVRX.cjs +23 -0
  51. package/dist/chunk-USNT2KNT.cjs +6 -0
  52. package/dist/chunk-WEMDMVHQ.js +216 -0
  53. package/dist/chunk-XDSNZUW7.js +564 -0
  54. package/dist/chunk-XQ3QUHWR.cjs +83 -0
  55. package/dist/chunk-XW5ATPRW.cjs +155 -0
  56. package/dist/chunk-ZQ4X6OAU.js +82 -0
  57. package/dist/chunk-ZSVCP6N3.js +83 -0
  58. package/dist/cli.cjs +103 -84
  59. package/dist/cli.js +62 -27
  60. package/dist/email-FKR4FXFI.js +5 -0
  61. package/dist/email-KVKVPNCL.cjs +58 -0
  62. package/dist/email-queue-CGZBVVAS.js +2 -0
  63. package/dist/email-queue-TPZWLTIV.cjs +23 -0
  64. package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
  65. package/dist/erp-config-enabled-T37X7T34.js +2 -0
  66. package/dist/erp-order-invoice-3YISSOWW.js +3 -0
  67. package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
  68. package/dist/event-order-defaults-6E543227.js +2 -0
  69. package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
  70. package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
  71. package/dist/event-order-notifications-IIIF23D5.js +10 -0
  72. package/dist/hooks.cjs +259 -132
  73. package/dist/hooks.d.cts +42 -1
  74. package/dist/hooks.d.ts +42 -1
  75. package/dist/hooks.js +234 -91
  76. package/dist/index.cjs +3884 -22307
  77. package/dist/index.d.cts +2203 -772
  78. package/dist/index.d.ts +2203 -772
  79. package/dist/index.js +2871 -22064
  80. package/dist/interpolate-WAKPN56R.cjs +11 -0
  81. package/dist/interpolate-WDUWDF3I.js +2 -0
  82. package/dist/layout-36UFTHC5.cjs +11 -0
  83. package/dist/layout-AOBN26XG.js +2 -0
  84. package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
  85. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  86. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  87. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  88. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  89. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  90. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  91. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  92. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  93. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  94. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  95. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  96. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  97. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  98. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  99. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  100. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  101. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  102. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  103. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  104. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  105. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  106. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  107. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  108. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  109. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  110. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  111. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  112. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  113. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  114. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  115. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  116. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  117. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  118. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  119. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  120. package/dist/razorpay-KLO2KNCB.js +49 -0
  121. package/dist/razorpay-U23LGY72.cjs +56 -0
  122. package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
  123. package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
  124. package/dist/sms-defaults-2NL24H57.js +2 -0
  125. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  126. package/dist/stripe-4FD27QVJ.js +51 -0
  127. package/dist/stripe-VU6OEG2D.cjs +57 -0
  128. package/dist/theme.cjs +31 -59
  129. package/dist/theme.d.cts +78 -3
  130. package/dist/theme.d.ts +78 -3
  131. package/dist/theme.js +23 -20
  132. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  133. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  134. package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
  135. package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
  136. package/package.json +147 -142
  137. package/dist/admin.cjs.map +0 -1
  138. package/dist/admin.js.map +0 -1
  139. package/dist/api.cjs.map +0 -1
  140. package/dist/api.js.map +0 -1
  141. package/dist/auth.cjs.map +0 -1
  142. package/dist/auth.js.map +0 -1
  143. package/dist/cli.cjs.map +0 -1
  144. package/dist/cli.js.map +0 -1
  145. package/dist/config-DJ5CmQvS.d.cts +0 -8
  146. package/dist/config-DJ5CmQvS.d.ts +0 -8
  147. package/dist/hooks.cjs.map +0 -1
  148. package/dist/hooks.js.map +0 -1
  149. package/dist/index-Bf5GO8fu.d.cts +0 -583
  150. package/dist/index-DOiJuMQA.d.ts +0 -583
  151. package/dist/index.cjs.map +0 -1
  152. package/dist/index.js.map +0 -1
  153. package/dist/theme.cjs.map +0 -1
  154. package/dist/theme.js.map +0 -1
  155. package/dist/types-DCVaXlPV.d.cts +0 -78
  156. package/dist/types-DCVaXlPV.d.ts +0 -78
  157. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  158. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
@@ -0,0 +1,84 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class RenameProductTaxesToProductConfig1781190000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'RenameProductTaxesToProductConfig1781190000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ // Rename table if old table exists
10
+ await queryRunner.query(`
11
+ DO $$
12
+ BEGIN
13
+ IF EXISTS (
14
+ SELECT 1
15
+ FROM information_schema.tables
16
+ WHERE table_name = 'product_taxes'
17
+ ) THEN
18
+ ALTER TABLE "product_taxes"
19
+ RENAME TO "product_config";
20
+ END IF;
21
+ END $$;
22
+ `);
23
+
24
+ // Add refundPolicyId
25
+ await queryRunner.query(`
26
+ ALTER TABLE "product_config"
27
+ ADD COLUMN IF NOT EXISTS "refundPolicyId" integer
28
+ `);
29
+
30
+ // FK to refund policies
31
+ await queryRunner.query(`
32
+ DO $$ BEGIN
33
+ IF NOT EXISTS (
34
+ SELECT 1
35
+ FROM pg_constraint
36
+ WHERE conname = 'FK_product_config_refund_policy'
37
+ ) THEN
38
+ ALTER TABLE "product_config"
39
+ ADD CONSTRAINT "FK_product_config_refund_policy"
40
+ FOREIGN KEY ("refundPolicyId")
41
+ REFERENCES "refund_policies"("id")
42
+ ON DELETE SET NULL
43
+ ON UPDATE NO ACTION;
44
+ END IF;
45
+ END $$;
46
+ `);
47
+
48
+ // Index
49
+ await queryRunner.query(`
50
+ CREATE INDEX IF NOT EXISTS "IDX_product_config_refund_policy"
51
+ ON "product_config" ("refundPolicyId")
52
+ `);
53
+ }
54
+
55
+ public async down(queryRunner: QueryRunner): Promise<void> {
56
+ await queryRunner.query(`
57
+ DROP INDEX IF EXISTS "IDX_product_config_refund_policy"
58
+ `);
59
+
60
+ await queryRunner.query(`
61
+ ALTER TABLE "product_config"
62
+ DROP CONSTRAINT IF EXISTS "FK_product_config_refund_policy"
63
+ `);
64
+
65
+ await queryRunner.query(`
66
+ ALTER TABLE "product_config"
67
+ DROP COLUMN IF EXISTS "refundPolicyId"
68
+ `);
69
+
70
+ await queryRunner.query(`
71
+ DO $$
72
+ BEGIN
73
+ IF EXISTS (
74
+ SELECT 1
75
+ FROM information_schema.tables
76
+ WHERE table_name = 'product_config'
77
+ ) THEN
78
+ ALTER TABLE "product_config"
79
+ RENAME TO "product_taxes";
80
+ END IF;
81
+ END $$;
82
+ `);
83
+ }
84
+ }
@@ -0,0 +1,51 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class VendorOwnerProductConfigPermissions1781200000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'VendorOwnerProductConfigPermissions1781200000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ const entities = [
10
+ 'product_variants',
11
+ 'product_config',
12
+ 'product_attributes',
13
+ ];
14
+
15
+ for (const entity of entities) {
16
+ await queryRunner.query(`
17
+ INSERT INTO "permissions"
18
+ ("groupId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
19
+ SELECT
20
+ g.id,
21
+ '${entity}',
22
+ true,
23
+ true,
24
+ true,
25
+ true
26
+ FROM "user_groups" g
27
+ WHERE g.name = 'Vendor Owner'
28
+ AND g.deleted = false
29
+ ON CONFLICT ("groupId", "entity") DO UPDATE SET
30
+ "canCreate" = true,
31
+ "canRead" = true,
32
+ "canUpdate" = true,
33
+ "canDelete" = true
34
+ `);
35
+ }
36
+ }
37
+
38
+ public async down(queryRunner: QueryRunner): Promise<void> {
39
+ await queryRunner.query(`
40
+ DELETE FROM "permissions" p
41
+ USING "user_groups" g
42
+ WHERE p."groupId" = g.id
43
+ AND g.name = 'Vendor Owner'
44
+ AND p.entity IN (
45
+ 'product_variants',
46
+ 'product_config',
47
+ 'product_attributes'
48
+ )
49
+ `);
50
+ }
51
+ }
@@ -0,0 +1,46 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class VendorRoleProductConfigPermissions1781210000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'VendorRoleProductConfigPermissions1781210000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ const entities = [
10
+ 'product_variants',
11
+ 'product_config',
12
+ 'product_attributes',
13
+ ];
14
+
15
+ for (const entity of entities) {
16
+ await queryRunner.query(`
17
+ INSERT INTO "vendor_role_permissions"
18
+ ("vendorRoleId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
19
+ SELECT
20
+ vr.id,
21
+ '${entity}',
22
+ true,
23
+ true,
24
+ true,
25
+ true
26
+ FROM "vendor_roles" vr
27
+ ON CONFLICT ("vendorRoleId", "entity") DO UPDATE SET
28
+ "canCreate" = true,
29
+ "canRead" = true,
30
+ "canUpdate" = true,
31
+ "canDelete" = true
32
+ `);
33
+ }
34
+ }
35
+
36
+ public async down(queryRunner: QueryRunner): Promise<void> {
37
+ await queryRunner.query(`
38
+ DELETE FROM "vendor_role_permissions"
39
+ WHERE "entity" IN (
40
+ 'product_variants',
41
+ 'product_config',
42
+ 'product_attributes'
43
+ )
44
+ `);
45
+ }
46
+ }
@@ -0,0 +1,243 @@
1
+ import type { QueryRunner } from 'typeorm';
2
+
3
+ /** Self-contained for dist/migrations — do not import from src/lib. */
4
+
5
+ const RBAC_ENTITIES = [
6
+ 'products',
7
+ 'collections',
8
+ 'brands',
9
+ 'product_categories',
10
+ 'orders',
11
+ 'payments',
12
+ 'taxes',
13
+ 'attributes',
14
+ 'vendor_customers',
15
+ 'discounts',
16
+ 'order_discounts',
17
+ 'order_addresses',
18
+ 'events',
19
+ 'event_products',
20
+ 'dashboard',
21
+ 'settings',
22
+ 'team',
23
+ 'roles',
24
+ ] as const;
25
+
26
+ type Perm = { c: boolean; r: boolean; u: boolean; d: boolean };
27
+
28
+ type RoleDef = {
29
+ name: string;
30
+ description: string;
31
+ isSystem: boolean;
32
+ isOwnerRole: boolean;
33
+ permissions: Record<string, Perm>;
34
+ };
35
+
36
+ function full(): Perm {
37
+ return { c: true, r: true, u: true, d: true };
38
+ }
39
+ function read(): Perm {
40
+ return { c: false, r: true, u: false, d: false };
41
+ }
42
+ function none(): Perm {
43
+ return { c: false, r: false, u: false, d: false };
44
+ }
45
+ function readUpdate(): Perm {
46
+ return { c: false, r: true, u: true, d: false };
47
+ }
48
+
49
+ const STORE_ENTITIES = RBAC_ENTITIES.filter(
50
+ (e) => !['dashboard', 'settings', 'team', 'roles'].includes(e)
51
+ );
52
+
53
+ function storePerms(spec: Record<string, Perm | 'full' | 'read' | 'none'>): Record<string, Perm> {
54
+ const resolve = (v: Perm | 'full' | 'read' | 'none'): Perm => {
55
+ if (v === 'full') return full();
56
+ if (v === 'read') return read();
57
+ if (v === 'none') return none();
58
+ return v;
59
+ };
60
+ const out: Record<string, Perm> = {};
61
+ for (const entity of STORE_ENTITIES) {
62
+ out[entity] = resolve(spec[entity] ?? 'none');
63
+ }
64
+ return out;
65
+ }
66
+
67
+ const DEFAULT_ROLES: RoleDef[] = [
68
+ {
69
+ name: 'Owner',
70
+ description: 'Full store access and team/role management',
71
+ isSystem: true,
72
+ isOwnerRole: true,
73
+ permissions: {
74
+ ...storePerms(Object.fromEntries(STORE_ENTITIES.map((e) => [e, 'full']))),
75
+ dashboard: read(),
76
+ settings: readUpdate(),
77
+ team: full(),
78
+ roles: full(),
79
+ },
80
+ },
81
+ {
82
+ name: 'Manager',
83
+ description: 'Day-to-day store operations',
84
+ isSystem: true,
85
+ isOwnerRole: false,
86
+ permissions: {
87
+ ...storePerms({
88
+ products: 'full',
89
+ collections: 'full',
90
+ brands: 'full',
91
+ product_categories: 'full',
92
+ orders: 'full',
93
+ vendor_customers: 'full',
94
+ discounts: 'full',
95
+ order_discounts: 'full',
96
+ order_addresses: 'full',
97
+ payments: 'read',
98
+ taxes: 'read',
99
+ attributes: 'read',
100
+ }),
101
+ dashboard: read(),
102
+ settings: read(),
103
+ team: none(),
104
+ roles: none(),
105
+ },
106
+ },
107
+ {
108
+ name: 'Catalog Staff',
109
+ description: 'Manage products and catalog content',
110
+ isSystem: true,
111
+ isOwnerRole: false,
112
+ permissions: {
113
+ ...storePerms({
114
+ products: 'full',
115
+ collections: 'full',
116
+ brands: 'full',
117
+ product_categories: 'full',
118
+ attributes: 'full',
119
+ orders: 'read',
120
+ vendor_customers: 'read',
121
+ }),
122
+ dashboard: read(),
123
+ settings: none(),
124
+ team: none(),
125
+ roles: none(),
126
+ },
127
+ },
128
+ {
129
+ name: 'Fulfillment',
130
+ description: 'Orders and fulfillment',
131
+ isSystem: true,
132
+ isOwnerRole: false,
133
+ permissions: {
134
+ ...storePerms({
135
+ products: 'read',
136
+ orders: 'full',
137
+ order_addresses: 'full',
138
+ order_discounts: 'read',
139
+ vendor_customers: 'read',
140
+ }),
141
+ dashboard: read(),
142
+ settings: none(),
143
+ team: none(),
144
+ roles: none(),
145
+ },
146
+ },
147
+ {
148
+ name: 'Viewer',
149
+ description: 'Read-only access to store data',
150
+ isSystem: true,
151
+ isOwnerRole: false,
152
+ permissions: {
153
+ ...storePerms(Object.fromEntries(STORE_ENTITIES.map((e) => [e, 'read']))),
154
+ dashboard: read(),
155
+ settings: none(),
156
+ team: none(),
157
+ roles: none(),
158
+ },
159
+ },
160
+ ];
161
+
162
+ async function insertRolePermissions(
163
+ queryRunner: QueryRunner,
164
+ vendorRoleId: number,
165
+ permissions: Record<string, Perm>
166
+ ): Promise<void> {
167
+ for (const entity of RBAC_ENTITIES) {
168
+ const p = permissions[entity];
169
+ if (!p) continue;
170
+ await queryRunner.query(
171
+ `
172
+ INSERT INTO "vendor_role_permissions"
173
+ ("vendorRoleId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
174
+ VALUES ($1, $2, $3, $4, $5, $6)
175
+ ON CONFLICT ("vendorRoleId", "entity") DO NOTHING
176
+ `,
177
+ [vendorRoleId, entity, p.c, p.r, p.u, p.d]
178
+ );
179
+ }
180
+ }
181
+
182
+ /** Seed default vendor roles + backfill vendor_users.vendorRoleId (migration-safe). */
183
+ export async function seedVendorRolesForMigration(
184
+ queryRunner: QueryRunner,
185
+ vendorId: number
186
+ ): Promise<void> {
187
+ const existing = (await queryRunner.query(
188
+ `SELECT id, name, "isOwnerRole" FROM "vendor_roles" WHERE "vendorId" = $1 AND "deleted" = false`,
189
+ [vendorId]
190
+ )) as Array<{ id: number; name: string; isOwnerRole: boolean }>;
191
+
192
+ let ownerRoleId = 0;
193
+ let viewerRoleId = 0;
194
+
195
+ if (existing.length > 0) {
196
+ for (const r of existing) {
197
+ if (r.isOwnerRole) ownerRoleId = r.id;
198
+ if (r.name === 'Viewer') viewerRoleId = r.id;
199
+ }
200
+ } else {
201
+ for (const def of DEFAULT_ROLES) {
202
+ const inserted = (await queryRunner.query(
203
+ `
204
+ INSERT INTO "vendor_roles"
205
+ ("vendorId", "name", "description", "isSystem", "isOwnerRole")
206
+ VALUES ($1, $2, $3, $4, $5)
207
+ RETURNING id
208
+ `,
209
+ [vendorId, def.name, def.description, def.isSystem, def.isOwnerRole]
210
+ )) as Array<{ id: number }>;
211
+ const roleId = inserted[0]?.id;
212
+ if (!roleId) continue;
213
+ if (def.isOwnerRole) ownerRoleId = roleId;
214
+ if (def.name === 'Viewer') viewerRoleId = roleId;
215
+ await insertRolePermissions(queryRunner, roleId, def.permissions);
216
+ }
217
+ }
218
+
219
+ if (ownerRoleId) {
220
+ await queryRunner.query(
221
+ `
222
+ UPDATE "vendor_users" vu
223
+ SET "vendorRoleId" = $1
224
+ WHERE vu."vendorId" = $2
225
+ AND vu."role" = 'owner'
226
+ AND vu."vendorRoleId" IS NULL
227
+ `,
228
+ [ownerRoleId, vendorId]
229
+ );
230
+ }
231
+ if (viewerRoleId) {
232
+ await queryRunner.query(
233
+ `
234
+ UPDATE "vendor_users" vu
235
+ SET "vendorRoleId" = $1
236
+ WHERE vu."vendorId" = $2
237
+ AND vu."role" = 'staff'
238
+ AND vu."vendorRoleId" IS NULL
239
+ `,
240
+ [viewerRoleId, vendorId]
241
+ );
242
+ }
243
+ }
@@ -0,0 +1,3 @@
1
+ export { queueErpPaidOrderForOrderId } from './chunk-TDV6EJHV.js';
2
+ import './chunk-SYBOCAWB.js';
3
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkHF3L2GIT_cjs = require('./chunk-HF3L2GIT.cjs');
4
+ require('./chunk-D5FBNKQM.cjs');
5
+ require('./chunk-USNT2KNT.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "queueErpPaidOrderForOrderId", {
10
+ enumerable: true,
11
+ get: function () { return chunkHF3L2GIT_cjs.queueErpPaidOrderForOrderId; }
12
+ });
@@ -0,0 +1,2 @@
1
+ export { JOB_RUNNER_QUEUE, PgBossService } from './chunk-GO7PPYNU.js';
2
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunkXQ3QUHWR_cjs = require('./chunk-XQ3QUHWR.cjs');
4
+ require('./chunk-USNT2KNT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "JOB_RUNNER_QUEUE", {
9
+ enumerable: true,
10
+ get: function () { return chunkXQ3QUHWR_cjs.JOB_RUNNER_QUEUE; }
11
+ });
12
+ Object.defineProperty(exports, "PgBossService", {
13
+ enumerable: true,
14
+ get: function () { return chunkXQ3QUHWR_cjs.PgBossService; }
15
+ });
@@ -0,0 +1,49 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+ import Razorpay from 'razorpay';
3
+ import crypto from 'crypto';
4
+
5
+ var RazorpayPaymentService = class {
6
+ static {
7
+ __name(this, "RazorpayPaymentService");
8
+ }
9
+ razorpay;
10
+ keySecret;
11
+ webhookSecret;
12
+ constructor(config) {
13
+ this.razorpay = new Razorpay({
14
+ key_id: config.keyId,
15
+ key_secret: config.keySecret
16
+ });
17
+ this.keySecret = config.keySecret;
18
+ this.webhookSecret = config.webhookSecret;
19
+ }
20
+ async createPaymentIntent(amount, currency, metadata) {
21
+ const order = await this.razorpay.orders.create({
22
+ amount: Math.round(amount * 100),
23
+ currency: currency.toUpperCase(),
24
+ notes: metadata
25
+ });
26
+ return {
27
+ id: order.id,
28
+ clientSecret: order.id,
29
+ amount,
30
+ currency,
31
+ status: order.status
32
+ };
33
+ }
34
+ async capturePayment(paymentId, amount) {
35
+ try {
36
+ await this.razorpay.payments.capture(paymentId, amount ? Math.round(amount * 100) : 0, "INR");
37
+ return true;
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+ verifyWebhookSignature(payload, signature) {
43
+ const secret = this.webhookSecret || this.keySecret;
44
+ const expectedSignature = crypto.createHmac("sha256", secret).update(typeof payload === "string" ? payload : payload.toString("utf8")).digest("hex");
45
+ return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expectedSignature));
46
+ }
47
+ };
48
+
49
+ export { RazorpayPaymentService };
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
+ var Razorpay = require('razorpay');
5
+ var crypto = require('crypto');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var Razorpay__default = /*#__PURE__*/_interopDefault(Razorpay);
10
+ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
11
+
12
+ var RazorpayPaymentService = class {
13
+ static {
14
+ chunkUSNT2KNT_cjs.__name(this, "RazorpayPaymentService");
15
+ }
16
+ razorpay;
17
+ keySecret;
18
+ webhookSecret;
19
+ constructor(config) {
20
+ this.razorpay = new Razorpay__default.default({
21
+ key_id: config.keyId,
22
+ key_secret: config.keySecret
23
+ });
24
+ this.keySecret = config.keySecret;
25
+ this.webhookSecret = config.webhookSecret;
26
+ }
27
+ async createPaymentIntent(amount, currency, metadata) {
28
+ const order = await this.razorpay.orders.create({
29
+ amount: Math.round(amount * 100),
30
+ currency: currency.toUpperCase(),
31
+ notes: metadata
32
+ });
33
+ return {
34
+ id: order.id,
35
+ clientSecret: order.id,
36
+ amount,
37
+ currency,
38
+ status: order.status
39
+ };
40
+ }
41
+ async capturePayment(paymentId, amount) {
42
+ try {
43
+ await this.razorpay.payments.capture(paymentId, amount ? Math.round(amount * 100) : 0, "INR");
44
+ return true;
45
+ } catch {
46
+ return false;
47
+ }
48
+ }
49
+ verifyWebhookSignature(payload, signature) {
50
+ const secret = this.webhookSecret || this.keySecret;
51
+ const expectedSignature = crypto__default.default.createHmac("sha256", secret).update(typeof payload === "string" ? payload : payload.toString("utf8")).digest("hex");
52
+ return crypto__default.default.timingSafeEqual(Buffer.from(signature), Buffer.from(expectedSignature));
53
+ }
54
+ };
55
+
56
+ exports.RazorpayPaymentService = RazorpayPaymentService;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var chunk3KPNTQBV_cjs = require('./chunk-3KPNTQBV.cjs');
4
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
5
+
6
+ // src/auth/rbac-debug-db.ts
7
+ async function loadDbPermissionsForUser(dataSource, userId) {
8
+ const rows = await dataSource.query(`
9
+ SELECT u."groupId" AS "groupId", g.name AS "groupName",
10
+ p.entity, p."canCreate", p."canRead", p."canUpdate", p."canDelete"
11
+ FROM users u
12
+ LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
13
+ LEFT JOIN permissions p ON p."groupId" = g.id
14
+ WHERE u.id = $1
15
+ `, [
16
+ userId
17
+ ]);
18
+ const groupId = rows[0]?.groupId ?? null;
19
+ const groupName = rows[0]?.groupName ?? null;
20
+ const permRows = rows.filter((r) => r.entity).map((r) => ({
21
+ entity: r.entity,
22
+ canCreate: !!r.canCreate,
23
+ canRead: !!r.canRead,
24
+ canUpdate: !!r.canUpdate,
25
+ canDelete: !!r.canDelete
26
+ }));
27
+ return {
28
+ groupId,
29
+ groupName,
30
+ dbEntityPerms: chunk3KPNTQBV_cjs.summarizeEntityPerms(chunk3KPNTQBV_cjs.permissionRowsToRecord(permRows))
31
+ };
32
+ }
33
+ chunkUSNT2KNT_cjs.__name(loadDbPermissionsForUser, "loadDbPermissionsForUser");
34
+
35
+ exports.loadDbPermissionsForUser = loadDbPermissionsForUser;
@@ -0,0 +1,33 @@
1
+ import { summarizeEntityPerms, permissionRowsToRecord } from './chunk-4TRPKBKO.js';
2
+ import { __name } from './chunk-SHUYVCID.js';
3
+
4
+ // src/auth/rbac-debug-db.ts
5
+ async function loadDbPermissionsForUser(dataSource, userId) {
6
+ const rows = await dataSource.query(`
7
+ SELECT u."groupId" AS "groupId", g.name AS "groupName",
8
+ p.entity, p."canCreate", p."canRead", p."canUpdate", p."canDelete"
9
+ FROM users u
10
+ LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
11
+ LEFT JOIN permissions p ON p."groupId" = g.id
12
+ WHERE u.id = $1
13
+ `, [
14
+ userId
15
+ ]);
16
+ const groupId = rows[0]?.groupId ?? null;
17
+ const groupName = rows[0]?.groupName ?? null;
18
+ const permRows = rows.filter((r) => r.entity).map((r) => ({
19
+ entity: r.entity,
20
+ canCreate: !!r.canCreate,
21
+ canRead: !!r.canRead,
22
+ canUpdate: !!r.canUpdate,
23
+ canDelete: !!r.canDelete
24
+ }));
25
+ return {
26
+ groupId,
27
+ groupName,
28
+ dbEntityPerms: summarizeEntityPerms(permissionRowsToRecord(permRows))
29
+ };
30
+ }
31
+ __name(loadDbPermissionsForUser, "loadDbPermissionsForUser");
32
+
33
+ export { loadDbPermissionsForUser };
@@ -0,0 +1,2 @@
1
+ export { SMS_MESSAGE_TEMPLATE_DEFAULTS, getSmsTemplateDefault, resolveSmsTemplateForSend } from './chunk-MQBT33IV.js';
2
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var chunk3DZRIZOD_cjs = require('./chunk-3DZRIZOD.cjs');
4
+ require('./chunk-USNT2KNT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "SMS_MESSAGE_TEMPLATE_DEFAULTS", {
9
+ enumerable: true,
10
+ get: function () { return chunk3DZRIZOD_cjs.SMS_MESSAGE_TEMPLATE_DEFAULTS; }
11
+ });
12
+ Object.defineProperty(exports, "getSmsTemplateDefault", {
13
+ enumerable: true,
14
+ get: function () { return chunk3DZRIZOD_cjs.getSmsTemplateDefault; }
15
+ });
16
+ Object.defineProperty(exports, "resolveSmsTemplateForSend", {
17
+ enumerable: true,
18
+ get: function () { return chunk3DZRIZOD_cjs.resolveSmsTemplateForSend; }
19
+ });