@open-mercato/core 0.4.6-develop-0c668dfcae → 0.4.6-develop-91451bbf8d

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.
@@ -0,0 +1,93 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ class Migration20260227133000 extends Migration {
3
+ async up() {
4
+ this.addSql(`
5
+ update "role_acls" as ra
6
+ set
7
+ "features_json" = case
8
+ when ra."features_json" is null or jsonb_typeof(ra."features_json") <> 'array'
9
+ then '["progress.*"]'::jsonb
10
+ else ra."features_json" || '"progress.*"'::jsonb
11
+ end,
12
+ "updated_at" = now()
13
+ from "roles" as r
14
+ where ra."role_id" = r."id"
15
+ and ra."deleted_at" is null
16
+ and r."deleted_at" is null
17
+ and r."name" = 'admin'
18
+ and (
19
+ ra."features_json" is null
20
+ or jsonb_typeof(ra."features_json") <> 'array'
21
+ or not (ra."features_json" ? 'progress.*')
22
+ );
23
+ `);
24
+ this.addSql(`
25
+ update "role_acls" as ra
26
+ set
27
+ "features_json" = case
28
+ when ra."features_json" is null or jsonb_typeof(ra."features_json") <> 'array'
29
+ then '["progress.view"]'::jsonb
30
+ else ra."features_json" || '"progress.view"'::jsonb
31
+ end,
32
+ "updated_at" = now()
33
+ from "roles" as r
34
+ where ra."role_id" = r."id"
35
+ and ra."deleted_at" is null
36
+ and r."deleted_at" is null
37
+ and r."name" = 'employee'
38
+ and (
39
+ ra."features_json" is null
40
+ or jsonb_typeof(ra."features_json") <> 'array'
41
+ or not (ra."features_json" ? 'progress.view')
42
+ );
43
+ `);
44
+ }
45
+ async down() {
46
+ this.addSql(`
47
+ update "role_acls" as ra
48
+ set
49
+ "features_json" = coalesce(
50
+ (
51
+ select jsonb_agg(feature)
52
+ from jsonb_array_elements_text(ra."features_json") as feature
53
+ where feature <> 'progress.*'
54
+ ),
55
+ '[]'::jsonb
56
+ ),
57
+ "updated_at" = now()
58
+ from "roles" as r
59
+ where ra."role_id" = r."id"
60
+ and ra."deleted_at" is null
61
+ and r."deleted_at" is null
62
+ and r."name" = 'admin'
63
+ and ra."features_json" is not null
64
+ and jsonb_typeof(ra."features_json") = 'array'
65
+ and ra."features_json" ? 'progress.*';
66
+ `);
67
+ this.addSql(`
68
+ update "role_acls" as ra
69
+ set
70
+ "features_json" = coalesce(
71
+ (
72
+ select jsonb_agg(feature)
73
+ from jsonb_array_elements_text(ra."features_json") as feature
74
+ where feature <> 'progress.view'
75
+ ),
76
+ '[]'::jsonb
77
+ ),
78
+ "updated_at" = now()
79
+ from "roles" as r
80
+ where ra."role_id" = r."id"
81
+ and ra."deleted_at" is null
82
+ and r."deleted_at" is null
83
+ and r."name" = 'employee'
84
+ and ra."features_json" is not null
85
+ and jsonb_typeof(ra."features_json") = 'array'
86
+ and ra."features_json" ? 'progress.view';
87
+ `);
88
+ }
89
+ }
90
+ export {
91
+ Migration20260227133000
92
+ };
93
+ //# sourceMappingURL=Migration20260227133000.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/progress/migrations/Migration20260227133000.ts"],
4
+ "sourcesContent": ["import { Migration } from '@mikro-orm/migrations';\n\nexport class Migration20260227133000 extends Migration {\n\n override async up(): Promise<void> {\n this.addSql(`\n update \"role_acls\" as ra\n set\n \"features_json\" = case\n when ra.\"features_json\" is null or jsonb_typeof(ra.\"features_json\") <> 'array'\n then '[\"progress.*\"]'::jsonb\n else ra.\"features_json\" || '\"progress.*\"'::jsonb\n end,\n \"updated_at\" = now()\n from \"roles\" as r\n where ra.\"role_id\" = r.\"id\"\n and ra.\"deleted_at\" is null\n and r.\"deleted_at\" is null\n and r.\"name\" = 'admin'\n and (\n ra.\"features_json\" is null\n or jsonb_typeof(ra.\"features_json\") <> 'array'\n or not (ra.\"features_json\" ? 'progress.*')\n );\n `);\n\n this.addSql(`\n update \"role_acls\" as ra\n set\n \"features_json\" = case\n when ra.\"features_json\" is null or jsonb_typeof(ra.\"features_json\") <> 'array'\n then '[\"progress.view\"]'::jsonb\n else ra.\"features_json\" || '\"progress.view\"'::jsonb\n end,\n \"updated_at\" = now()\n from \"roles\" as r\n where ra.\"role_id\" = r.\"id\"\n and ra.\"deleted_at\" is null\n and r.\"deleted_at\" is null\n and r.\"name\" = 'employee'\n and (\n ra.\"features_json\" is null\n or jsonb_typeof(ra.\"features_json\") <> 'array'\n or not (ra.\"features_json\" ? 'progress.view')\n );\n `);\n }\n\n override async down(): Promise<void> {\n this.addSql(`\n update \"role_acls\" as ra\n set\n \"features_json\" = coalesce(\n (\n select jsonb_agg(feature)\n from jsonb_array_elements_text(ra.\"features_json\") as feature\n where feature <> 'progress.*'\n ),\n '[]'::jsonb\n ),\n \"updated_at\" = now()\n from \"roles\" as r\n where ra.\"role_id\" = r.\"id\"\n and ra.\"deleted_at\" is null\n and r.\"deleted_at\" is null\n and r.\"name\" = 'admin'\n and ra.\"features_json\" is not null\n and jsonb_typeof(ra.\"features_json\") = 'array'\n and ra.\"features_json\" ? 'progress.*';\n `);\n\n this.addSql(`\n update \"role_acls\" as ra\n set\n \"features_json\" = coalesce(\n (\n select jsonb_agg(feature)\n from jsonb_array_elements_text(ra.\"features_json\") as feature\n where feature <> 'progress.view'\n ),\n '[]'::jsonb\n ),\n \"updated_at\" = now()\n from \"roles\" as r\n where ra.\"role_id\" = r.\"id\"\n and ra.\"deleted_at\" is null\n and r.\"deleted_at\" is null\n and r.\"name\" = 'employee'\n and ra.\"features_json\" is not null\n and jsonb_typeof(ra.\"features_json\") = 'array'\n and ra.\"features_json\" ? 'progress.view';\n `);\n }\n\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,gCAAgC,UAAU;AAAA,EAErD,MAAe,KAAoB;AACjC,SAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAmBX;AAED,SAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAmBX;AAAA,EACH;AAAA,EAEA,MAAe,OAAsB;AACnC,SAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAoBX;AAED,SAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAoBX;AAAA,EACH;AAEF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/core",
3
- "version": "0.4.6-develop-0c668dfcae",
3
+ "version": "0.4.6-develop-91451bbf8d",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -207,7 +207,7 @@
207
207
  }
208
208
  },
209
209
  "dependencies": {
210
- "@open-mercato/shared": "0.4.6-develop-0c668dfcae",
210
+ "@open-mercato/shared": "0.4.6-develop-91451bbf8d",
211
211
  "@types/html-to-text": "^9.0.4",
212
212
  "@types/semver": "^7.5.8",
213
213
  "@xyflow/react": "^12.6.0",
@@ -0,0 +1,95 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+
3
+ export class Migration20260227133000 extends Migration {
4
+
5
+ override async up(): Promise<void> {
6
+ this.addSql(`
7
+ update "role_acls" as ra
8
+ set
9
+ "features_json" = case
10
+ when ra."features_json" is null or jsonb_typeof(ra."features_json") <> 'array'
11
+ then '["progress.*"]'::jsonb
12
+ else ra."features_json" || '"progress.*"'::jsonb
13
+ end,
14
+ "updated_at" = now()
15
+ from "roles" as r
16
+ where ra."role_id" = r."id"
17
+ and ra."deleted_at" is null
18
+ and r."deleted_at" is null
19
+ and r."name" = 'admin'
20
+ and (
21
+ ra."features_json" is null
22
+ or jsonb_typeof(ra."features_json") <> 'array'
23
+ or not (ra."features_json" ? 'progress.*')
24
+ );
25
+ `);
26
+
27
+ this.addSql(`
28
+ update "role_acls" as ra
29
+ set
30
+ "features_json" = case
31
+ when ra."features_json" is null or jsonb_typeof(ra."features_json") <> 'array'
32
+ then '["progress.view"]'::jsonb
33
+ else ra."features_json" || '"progress.view"'::jsonb
34
+ end,
35
+ "updated_at" = now()
36
+ from "roles" as r
37
+ where ra."role_id" = r."id"
38
+ and ra."deleted_at" is null
39
+ and r."deleted_at" is null
40
+ and r."name" = 'employee'
41
+ and (
42
+ ra."features_json" is null
43
+ or jsonb_typeof(ra."features_json") <> 'array'
44
+ or not (ra."features_json" ? 'progress.view')
45
+ );
46
+ `);
47
+ }
48
+
49
+ override async down(): Promise<void> {
50
+ this.addSql(`
51
+ update "role_acls" as ra
52
+ set
53
+ "features_json" = coalesce(
54
+ (
55
+ select jsonb_agg(feature)
56
+ from jsonb_array_elements_text(ra."features_json") as feature
57
+ where feature <> 'progress.*'
58
+ ),
59
+ '[]'::jsonb
60
+ ),
61
+ "updated_at" = now()
62
+ from "roles" as r
63
+ where ra."role_id" = r."id"
64
+ and ra."deleted_at" is null
65
+ and r."deleted_at" is null
66
+ and r."name" = 'admin'
67
+ and ra."features_json" is not null
68
+ and jsonb_typeof(ra."features_json") = 'array'
69
+ and ra."features_json" ? 'progress.*';
70
+ `);
71
+
72
+ this.addSql(`
73
+ update "role_acls" as ra
74
+ set
75
+ "features_json" = coalesce(
76
+ (
77
+ select jsonb_agg(feature)
78
+ from jsonb_array_elements_text(ra."features_json") as feature
79
+ where feature <> 'progress.view'
80
+ ),
81
+ '[]'::jsonb
82
+ ),
83
+ "updated_at" = now()
84
+ from "roles" as r
85
+ where ra."role_id" = r."id"
86
+ and ra."deleted_at" is null
87
+ and r."deleted_at" is null
88
+ and r."name" = 'employee'
89
+ and ra."features_json" is not null
90
+ and jsonb_typeof(ra."features_json") = 'array'
91
+ and ra."features_json" ? 'progress.view';
92
+ `);
93
+ }
94
+
95
+ }