@infuro/cms-core 1.0.33 → 1.0.34

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 (38) hide show
  1. package/README.md +9 -6
  2. package/dist/admin.cjs +980 -801
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +7 -2
  5. package/dist/admin.d.ts +7 -2
  6. package/dist/admin.js +1021 -842
  7. package/dist/admin.js.map +1 -1
  8. package/dist/api.cjs +1858 -848
  9. package/dist/api.cjs.map +1 -1
  10. package/dist/api.d.cts +1 -1
  11. package/dist/api.d.ts +1 -1
  12. package/dist/api.js +1824 -815
  13. package/dist/api.js.map +1 -1
  14. package/dist/auth.cjs +94 -11
  15. package/dist/auth.cjs.map +1 -1
  16. package/dist/auth.d.cts +17 -1
  17. package/dist/auth.d.ts +17 -1
  18. package/dist/auth.js +89 -11
  19. package/dist/auth.js.map +1 -1
  20. package/dist/cli.cjs +39 -0
  21. package/dist/cli.cjs.map +1 -1
  22. package/dist/cli.js +39 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/{index-rZTnpK7y.d.cts → index-Bf5GO8fu.d.cts} +3 -2
  25. package/dist/{index-DWd5Gjc4.d.ts → index-DOiJuMQA.d.ts} +3 -2
  26. package/dist/index.cjs +2078 -841
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +83 -8
  29. package/dist/index.d.ts +83 -8
  30. package/dist/index.js +2013 -786
  31. package/dist/index.js.map +1 -1
  32. package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
  33. package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
  34. package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
  35. package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
  36. package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
  37. package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
  38. package/package.json +4 -3
@@ -0,0 +1,99 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class CreateCustomerAndCustomerContacts1778660000004
4
+ implements MigrationInterface
5
+ {
6
+ name = 'CreateCustomerAndCustomerContacts1778660000004';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ // Create customer table
10
+ await queryRunner.query(`
11
+ CREATE TABLE "customer" (
12
+ "id" SERIAL NOT NULL,
13
+ "userId" integer,
14
+ "name" character varying NOT NULL,
15
+ "email" character varying NOT NULL,
16
+ "phone" character varying NOT NULL,
17
+ "createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
18
+ "updatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
19
+ "deletedAt" TIMESTAMP,
20
+ "deleted" boolean NOT NULL DEFAULT false,
21
+ "createdBy" integer,
22
+ "updatedBy" integer,
23
+ "deletedBy" integer,
24
+ CONSTRAINT "PK_customer_id" PRIMARY KEY ("id"),
25
+ CONSTRAINT "UQ_customer_email" UNIQUE ("email"),
26
+ CONSTRAINT "UQ_customer_phone" UNIQUE ("phone")
27
+ )
28
+ `);
29
+
30
+ // Add foreign key for userId
31
+ await queryRunner.query(`
32
+ ALTER TABLE "customer"
33
+ ADD CONSTRAINT "FK_customer_user"
34
+ FOREIGN KEY ("userId")
35
+ REFERENCES "users"("id")
36
+ ON DELETE SET NULL
37
+ ON UPDATE NO ACTION
38
+ `);
39
+
40
+ // Create customer_contacts table
41
+ await queryRunner.query(`
42
+ CREATE TABLE "customer_contacts" (
43
+ "id" SERIAL NOT NULL,
44
+ "customerId" integer NOT NULL,
45
+ "contactId" integer NOT NULL,
46
+ CONSTRAINT "PK_customer_contacts_id" PRIMARY KEY ("id")
47
+ )
48
+ `);
49
+
50
+ // Add foreign key for customerId
51
+ await queryRunner.query(`
52
+ ALTER TABLE "customer_contacts"
53
+ ADD CONSTRAINT "FK_customer_contacts_customer"
54
+ FOREIGN KEY ("customerId")
55
+ REFERENCES "customer"("id")
56
+ ON DELETE CASCADE
57
+ ON UPDATE NO ACTION
58
+ `);
59
+
60
+ // Add foreign key for contactId
61
+ await queryRunner.query(`
62
+ ALTER TABLE "customer_contacts"
63
+ ADD CONSTRAINT "FK_customer_contacts_contact"
64
+ FOREIGN KEY ("contactId")
65
+ REFERENCES "contacts"("id")
66
+ ON DELETE CASCADE
67
+ ON UPDATE NO ACTION
68
+ `);
69
+ }
70
+
71
+ public async down(queryRunner: QueryRunner): Promise<void> {
72
+ // Drop foreign keys from customer_contacts
73
+ await queryRunner.query(`
74
+ ALTER TABLE "customer_contacts"
75
+ DROP CONSTRAINT "FK_customer_contacts_contact"
76
+ `);
77
+
78
+ await queryRunner.query(`
79
+ ALTER TABLE "customer_contacts"
80
+ DROP CONSTRAINT "FK_customer_contacts_customer"
81
+ `);
82
+
83
+ // Drop customer_contacts table
84
+ await queryRunner.query(`
85
+ DROP TABLE "customer_contacts"
86
+ `);
87
+
88
+ // Drop foreign key from customer
89
+ await queryRunner.query(`
90
+ ALTER TABLE "customer"
91
+ DROP CONSTRAINT "FK_customer_user"
92
+ `);
93
+
94
+ // Drop customer table
95
+ await queryRunner.query(`
96
+ DROP TABLE "customer"
97
+ `);
98
+ }
99
+ }
@@ -0,0 +1,39 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class AddCustomerIdToVendorCustomers1778660000005
4
+ implements MigrationInterface
5
+ {
6
+ name = 'AddCustomerIdToVendorCustomers1778660000005';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ // Add customerId column
10
+ await queryRunner.query(`
11
+ ALTER TABLE "vendor_customers"
12
+ ADD COLUMN "customerId" integer
13
+ `);
14
+
15
+ // Add foreign key constraint
16
+ await queryRunner.query(`
17
+ ALTER TABLE "vendor_customers"
18
+ ADD CONSTRAINT "FK_vendor_customers_customer"
19
+ FOREIGN KEY ("customerId")
20
+ REFERENCES "customer"("id")
21
+ ON DELETE CASCADE
22
+ ON UPDATE NO ACTION
23
+ `);
24
+ }
25
+
26
+ public async down(queryRunner: QueryRunner): Promise<void> {
27
+ // Drop foreign key constraint
28
+ await queryRunner.query(`
29
+ ALTER TABLE "vendor_customers"
30
+ DROP CONSTRAINT "FK_vendor_customers_customer"
31
+ `);
32
+
33
+ // Drop customerId column
34
+ await queryRunner.query(`
35
+ ALTER TABLE "vendor_customers"
36
+ DROP COLUMN "customerId"
37
+ `);
38
+ }
39
+ }
@@ -0,0 +1,36 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class UpdateVendorCustomersContactNullable1778660000006
4
+ implements MigrationInterface
5
+ {
6
+ name = 'UpdateVendorCustomersContactNullable1778660000006';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ // Drop unique constraint
10
+ await queryRunner.query(`
11
+ ALTER TABLE "vendor_customers"
12
+ DROP CONSTRAINT "UQ_vendor_customers_vendor_contact"
13
+ `);
14
+
15
+ // Make contactId nullable
16
+ await queryRunner.query(`
17
+ ALTER TABLE "vendor_customers"
18
+ ALTER COLUMN "contactId" DROP NOT NULL
19
+ `);
20
+ }
21
+
22
+ public async down(queryRunner: QueryRunner): Promise<void> {
23
+ // Make contactId NOT NULL again
24
+ await queryRunner.query(`
25
+ ALTER TABLE "vendor_customers"
26
+ ALTER COLUMN "contactId" SET NOT NULL
27
+ `);
28
+
29
+ // Recreate unique constraint
30
+ await queryRunner.query(`
31
+ ALTER TABLE "vendor_customers"
32
+ ADD CONSTRAINT "UQ_vendor_customers_vendor_contact"
33
+ UNIQUE ("vendorId", "contactId")
34
+ `);
35
+ }
36
+ }
@@ -0,0 +1,39 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /** Vendor Owner group: access customer contacts in admin. */
4
+ export class VendorOwnerCustomerContactsPermission1778660000007
5
+ implements MigrationInterface
6
+ {
7
+ name = 'VendorOwnerCustomerContactsPermission1778660000007';
8
+
9
+ public async up(queryRunner: QueryRunner): Promise<void> {
10
+ await queryRunner.query(`
11
+ INSERT INTO "permissions"
12
+ ("groupId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
13
+ SELECT
14
+ g.id,
15
+ 'customer_contacts',
16
+ true,
17
+ true,
18
+ true,
19
+ false
20
+ FROM "user_groups" g
21
+ WHERE g.name = 'Vendor Owner'
22
+ AND g.deleted = false
23
+ ON CONFLICT ("groupId", "entity") DO UPDATE SET
24
+ "canCreate" = true,
25
+ "canRead" = true,
26
+ "canUpdate" = true
27
+ `);
28
+ }
29
+
30
+ public async down(queryRunner: QueryRunner): Promise<void> {
31
+ await queryRunner.query(`
32
+ DELETE FROM "permissions" p
33
+ USING "user_groups" g
34
+ WHERE p."groupId" = g.id
35
+ AND g.name = 'Vendor Owner'
36
+ AND p.entity = 'customer_contacts'
37
+ `);
38
+ }
39
+ }
@@ -0,0 +1,39 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /** Vendor Owner group: access contacts in admin. */
4
+ export class VendorOwnerContactsPermission1779300000000
5
+ implements MigrationInterface
6
+ {
7
+ name = 'VendorOwnerContactsPermission1779300000000';
8
+
9
+ public async up(queryRunner: QueryRunner): Promise<void> {
10
+ await queryRunner.query(`
11
+ INSERT INTO "permissions"
12
+ ("groupId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
13
+ SELECT
14
+ g.id,
15
+ 'contacts',
16
+ true,
17
+ true,
18
+ true,
19
+ false
20
+ FROM "user_groups" g
21
+ WHERE g.name = 'Vendor Owner'
22
+ AND g.deleted = false
23
+ ON CONFLICT ("groupId", "entity") DO UPDATE SET
24
+ "canCreate" = true,
25
+ "canRead" = true,
26
+ "canUpdate" = true
27
+ `);
28
+ }
29
+
30
+ public async down(queryRunner: QueryRunner): Promise<void> {
31
+ await queryRunner.query(`
32
+ DELETE FROM "permissions" p
33
+ USING "user_groups" g
34
+ WHERE p."groupId" = g.id
35
+ AND g.name = 'Vendor Owner'
36
+ AND p.entity = 'contacts'
37
+ `);
38
+ }
39
+ }
@@ -0,0 +1,33 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class AddCustomerContactIdToOrders1779400000000 implements MigrationInterface {
4
+ name = 'AddCustomerContactIdToOrders1779400000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`
8
+ ALTER TABLE "orders"
9
+ ADD COLUMN "customerContactId" integer
10
+ `);
11
+
12
+ await queryRunner.query(`
13
+ ALTER TABLE "orders"
14
+ ADD CONSTRAINT "FK_orders_customer_contact"
15
+ FOREIGN KEY ("customerContactId")
16
+ REFERENCES "customer_contacts"("id")
17
+ ON DELETE SET NULL
18
+ ON UPDATE NO ACTION
19
+ `);
20
+ }
21
+
22
+ public async down(queryRunner: QueryRunner): Promise<void> {
23
+ await queryRunner.query(`
24
+ ALTER TABLE "orders"
25
+ DROP CONSTRAINT "FK_orders_customer_contact"
26
+ `);
27
+
28
+ await queryRunner.query(`
29
+ ALTER TABLE "orders"
30
+ DROP COLUMN "customerContactId"
31
+ `);
32
+ }
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infuro/cms-core",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -94,6 +94,7 @@
94
94
  "dependencies": {
95
95
  "@aws-sdk/client-s3": "^3.858.0",
96
96
  "@aws-sdk/client-ses": "^3.858.0",
97
+ "@aws-sdk/client-sts": "^3.1059.0",
97
98
  "@huggingface/inference": "^4.13.15",
98
99
  "@radix-ui/react-avatar": "^1.1.10",
99
100
  "@radix-ui/react-checkbox": "^1.3.2",
@@ -114,6 +115,7 @@
114
115
  "class-variance-authority": "^0.7.1",
115
116
  "clsx": "^2.1.1",
116
117
  "country-state-city": "^3.2.1",
118
+ "cron-parser": "^4.9.0",
117
119
  "fastq": "^1.20.0",
118
120
  "googleapis": "^154.1.0",
119
121
  "ioredis": "^5.7.0",
@@ -126,8 +128,7 @@
126
128
  "papaparse": "^5.4.1",
127
129
  "pdf-parse": "^1.1.1",
128
130
  "pg": "^8.20.0",
129
- "pg-boss": "^10.0.0",
130
- "cron-parser": "^4.9.0",
131
+ "pg-boss": ">=10.0.0",
131
132
  "razorpay": "^2.9.6",
132
133
  "react-chartjs-2": "^5.3.0",
133
134
  "react-qr-code": "^2.0.21",