@tstdl/base 0.93.100 → 0.93.102

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 (84) hide show
  1. package/authentication/client/authentication.service.d.ts +1 -1
  2. package/authentication/client/authentication.service.js +23 -11
  3. package/notification/api/index.d.ts +1 -0
  4. package/notification/api/index.js +1 -0
  5. package/notification/api/notification.api.d.ts +8 -16
  6. package/notification/api/notification.api.js +13 -26
  7. package/notification/index.d.ts +1 -1
  8. package/notification/index.js +1 -1
  9. package/notification/models/in-app-notification.model.d.ts +9 -4
  10. package/notification/models/in-app-notification.model.js +25 -10
  11. package/notification/models/index.d.ts +1 -1
  12. package/notification/models/index.js +1 -1
  13. package/notification/models/notification-log.model.d.ts +42 -5
  14. package/notification/models/notification-log.model.js +34 -20
  15. package/notification/models/notification-preference.model.d.ts +2 -2
  16. package/notification/models/notification-preference.model.js +9 -9
  17. package/notification/models/notification-type.model.d.ts +17 -0
  18. package/notification/models/{notification-category.model.js → notification-type.model.js} +12 -13
  19. package/notification/models/web-push-subscription.model.d.ts +2 -2
  20. package/notification/models/web-push-subscription.model.js +8 -7
  21. package/notification/server/api/notification.api-controller.d.ts +2 -2
  22. package/notification/server/api/notification.api-controller.js +4 -3
  23. package/notification/server/drizzle/{0000_glorious_randall.sql → 0000_shiny_the_anarchist.sql} +27 -32
  24. package/notification/server/drizzle/meta/0000_snapshot.json +179 -179
  25. package/notification/server/drizzle/meta/_journal.json +2 -2
  26. package/notification/server/module.d.ts +2 -0
  27. package/notification/server/module.js +1 -0
  28. package/notification/server/providers/channel-provider.d.ts +4 -3
  29. package/notification/server/providers/channel-provider.js +2 -1
  30. package/notification/server/providers/email-channel-provider.d.ts +3 -3
  31. package/notification/server/providers/email-channel-provider.js +7 -9
  32. package/notification/server/providers/in-app-channel-provider.d.ts +5 -5
  33. package/notification/server/providers/in-app-channel-provider.js +15 -16
  34. package/notification/server/providers/index.d.ts +1 -1
  35. package/notification/server/providers/index.js +1 -1
  36. package/notification/server/providers/web-push-channel-provider.d.ts +5 -4
  37. package/notification/server/providers/web-push-channel-provider.js +8 -7
  38. package/notification/server/schemas.d.ts +3 -3
  39. package/notification/server/schemas.js +3 -4
  40. package/notification/server/services/index.d.ts +2 -4
  41. package/notification/server/services/index.js +2 -4
  42. package/notification/server/services/notification-delivery.worker.d.ts +7 -1
  43. package/notification/server/services/notification-delivery.worker.js +49 -37
  44. package/notification/server/services/notification-sse.service.d.ts +4 -7
  45. package/notification/server/services/notification-sse.service.js +4 -11
  46. package/notification/server/services/notification-template.d.ts +2 -2
  47. package/notification/server/services/notification-template.js +3 -1
  48. package/notification/server/services/notification-template.service.d.ts +1 -1
  49. package/notification/server/services/notification-template.service.js +7 -3
  50. package/notification/server/services/notification-type.service.d.ts +11 -0
  51. package/notification/server/services/notification-type.service.js +41 -0
  52. package/notification/server/services/notification.service.d.ts +4 -5
  53. package/notification/server/services/notification.service.js +44 -27
  54. package/notification/tests/notification-api.test.js +95 -0
  55. package/notification/tests/notification-flow.test.js +174 -28
  56. package/notification/tests/notification-type.service.test.d.ts +1 -0
  57. package/notification/tests/notification-type.service.test.js +35 -0
  58. package/package.json +1 -1
  59. package/rate-limit/postgres/postgres-rate-limiter.d.ts +9 -4
  60. package/rate-limit/postgres/postgres-rate-limiter.js +17 -10
  61. package/rate-limit/rate-limiter.d.ts +6 -6
  62. package/rate-limit/tests/postgres-rate-limiter.test.js +1 -1
  63. package/task-queue/postgres/task-queue.js +1 -1
  64. package/task-queue/task-context.d.ts +1 -14
  65. package/task-queue/task-context.js +0 -30
  66. package/task-queue/task-queue.d.ts +4 -12
  67. package/task-queue/task-queue.js +38 -89
  68. package/task-queue/tests/extensive-dependencies.test.d.ts +1 -0
  69. package/task-queue/tests/extensive-dependencies.test.js +234 -0
  70. package/task-queue/tests/worker.test.js +0 -21
  71. package/task-queue/types.d.ts +1 -8
  72. package/notification/enums.d.ts +0 -22
  73. package/notification/enums.js +0 -19
  74. package/notification/models/notification-category.model.d.ts +0 -17
  75. package/notification/server/services/notification-category.service.d.ts +0 -11
  76. package/notification/server/services/notification-category.service.js +0 -41
  77. package/notification/server/services/notification-delivery.task.d.ts +0 -9
  78. package/notification/server/services/notification-delivery.task.js +0 -1
  79. package/notification/server/services/singleton.d.ts +0 -3
  80. package/notification/server/services/singleton.js +0 -10
  81. package/notification/tests/notification-category.service.test.js +0 -36
  82. package/notification/tests/test-notification.model.d.ts +0 -4
  83. package/notification/tests/test-notification.model.js +0 -25
  84. /package/notification/tests/{notification-category.service.test.d.ts → notification-api.test.d.ts} +0 -0
@@ -8,8 +8,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { User } from '../../authentication/models/user.model.js';
11
- import { TenantEntity, TenantReference, UuidProperty } from '../../orm/index.js';
12
- import { StringProperty } from '../../schema/index.js';
11
+ import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
12
+ import { StringProperty, Uint8ArrayProperty } from '../../schema/index.js';
13
13
  import { NotificationTable } from './notification-table.js';
14
14
  let WebPushSubscription = class WebPushSubscription extends TenantEntity {
15
15
  static entityName = 'WebPushSubscription';
@@ -28,14 +28,15 @@ __decorate([
28
28
  __metadata("design:type", String)
29
29
  ], WebPushSubscription.prototype, "endpoint", void 0);
30
30
  __decorate([
31
- StringProperty(),
32
- __metadata("design:type", String)
31
+ Uint8ArrayProperty(),
32
+ __metadata("design:type", Uint8Array)
33
33
  ], WebPushSubscription.prototype, "p256dh", void 0);
34
34
  __decorate([
35
- StringProperty(),
36
- __metadata("design:type", String)
35
+ Uint8ArrayProperty(),
36
+ __metadata("design:type", Uint8Array)
37
37
  ], WebPushSubscription.prototype, "auth", void 0);
38
38
  WebPushSubscription = __decorate([
39
- NotificationTable({ name: 'web_push_subscription' })
39
+ NotificationTable(),
40
+ Unique(['tenantId', 'userId', 'endpoint'])
40
41
  ], WebPushSubscription);
41
42
  export { WebPushSubscription };
@@ -1,8 +1,8 @@
1
1
  import type { ApiController, ApiRequestContext } from '../../../api/types.js';
2
+ import type { ServerSentEventsSource } from '../../../sse/server-sent-events-source.js';
2
3
  import type { NotificationApiDefinition } from '../../api/notification.api.js';
3
- import { NotificationService } from '../services/notification.service.js';
4
4
  import { NotificationSseService } from '../services/notification-sse.service.js';
5
- import type { ServerSentEventsSource } from '../../../sse/server-sent-events-source.js';
5
+ import { NotificationService } from '../services/notification.service.js';
6
6
  export declare class NotificationApiController implements ApiController<NotificationApiDefinition> {
7
7
  protected readonly notificationService: NotificationService;
8
8
  protected readonly sseService: NotificationSseService;
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { apiController } from '../../../api/server/index.js';
8
8
  import { inject } from '../../../injector/index.js';
9
+ import { decodeBase64 } from '../../../utils/base64.js';
9
10
  import { notificationApiDefinition } from '../../api/notification.api.js';
10
- import { NotificationService } from '../services/notification.service.js';
11
11
  import { NotificationSseService } from '../services/notification-sse.service.js';
12
+ import { NotificationService } from '../services/notification.service.js';
12
13
  let NotificationApiController = class NotificationApiController {
13
14
  notificationService = inject(NotificationService);
14
15
  sseService = inject(NotificationSseService);
@@ -36,12 +37,12 @@ let NotificationApiController = class NotificationApiController {
36
37
  }
37
38
  async updatePreference({ parameters, getToken }) {
38
39
  const token = await getToken();
39
- await this.notificationService.updatePreference(token.payload.tenant, token.payload.subject, parameters.categoryId, parameters.channel, parameters.enabled);
40
+ await this.notificationService.updatePreference(token.payload.tenant, token.payload.subject, parameters.type, parameters.channel, parameters.enabled);
40
41
  return 'ok';
41
42
  }
42
43
  async registerWebPush({ parameters, getToken }) {
43
44
  const token = await getToken();
44
- await this.notificationService.registerWebPush(token.payload.tenant, token.payload.subject, parameters.endpoint, parameters.keys.p256dh, parameters.keys.auth);
45
+ await this.notificationService.registerWebPush(token.payload.tenant, token.payload.subject, parameters.endpoint, decodeBase64(parameters.keys.p256dhBase64), decodeBase64(parameters.keys.authBase64));
45
46
  return 'ok';
46
47
  }
47
48
  };
@@ -6,37 +6,15 @@ CREATE TABLE "notification"."in_app" (
6
6
  "tenant_id" uuid NOT NULL,
7
7
  "user_id" uuid NOT NULL,
8
8
  "log_id" uuid NOT NULL,
9
- "read_at" timestamp with time zone,
10
- "archived_at" timestamp with time zone,
11
- "revision" integer NOT NULL,
12
- "revision_timestamp" timestamp with time zone NOT NULL,
13
- "create_timestamp" timestamp with time zone NOT NULL,
14
- "delete_timestamp" timestamp with time zone,
15
- "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
9
+ "read_timestamp" timestamp with time zone,
10
+ "archive_timestamp" timestamp with time zone,
16
11
  CONSTRAINT "in_app_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
17
12
  );
18
13
  --> statement-breakpoint
19
- CREATE TABLE "notification"."category" (
20
- "id" uuid DEFAULT gen_random_uuid() NOT NULL,
21
- "tenant_id" uuid NOT NULL,
22
- "label" text NOT NULL,
23
- "key" text NOT NULL,
24
- "throttling" jsonb,
25
- "escalations" jsonb,
26
- "revision" integer NOT NULL,
27
- "revision_timestamp" timestamp with time zone NOT NULL,
28
- "create_timestamp" timestamp with time zone NOT NULL,
29
- "delete_timestamp" timestamp with time zone,
30
- "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
31
- CONSTRAINT "category_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
32
- CONSTRAINT "category_tenant_id_key_unique" UNIQUE("tenant_id","key")
33
- );
34
- --> statement-breakpoint
35
14
  CREATE TABLE "notification"."log" (
36
15
  "id" uuid DEFAULT gen_random_uuid() NOT NULL,
37
16
  "tenant_id" uuid NOT NULL,
38
17
  "user_id" uuid NOT NULL,
39
- "category_id" uuid NOT NULL,
40
18
  "type" text NOT NULL,
41
19
  "priority" "notification"."notification_priority" NOT NULL,
42
20
  "status" "notification"."notification_status" NOT NULL,
@@ -47,14 +25,15 @@ CREATE TABLE "notification"."log" (
47
25
  "create_timestamp" timestamp with time zone NOT NULL,
48
26
  "delete_timestamp" timestamp with time zone,
49
27
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
50
- CONSTRAINT "log_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
28
+ CONSTRAINT "log_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
29
+ CONSTRAINT "log_tenant_id_id_user_id_unique" UNIQUE("tenant_id","id","user_id")
51
30
  );
52
31
  --> statement-breakpoint
53
32
  CREATE TABLE "notification"."preference" (
54
33
  "id" uuid DEFAULT gen_random_uuid() NOT NULL,
55
34
  "tenant_id" uuid NOT NULL,
56
35
  "user_id" uuid NOT NULL,
57
- "category_id" uuid NOT NULL,
36
+ "type" text NOT NULL,
58
37
  "channel" "notification"."notification_channel" NOT NULL,
59
38
  "enabled" boolean NOT NULL,
60
39
  "revision" integer NOT NULL,
@@ -63,7 +42,21 @@ CREATE TABLE "notification"."preference" (
63
42
  "delete_timestamp" timestamp with time zone,
64
43
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
65
44
  CONSTRAINT "preference_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
66
- CONSTRAINT "preference_tenant_id_user_id_category_id_channel_unique" UNIQUE("tenant_id","user_id","category_id","channel")
45
+ CONSTRAINT "preference_tenant_id_user_id_type_channel_unique" UNIQUE("tenant_id","user_id","type","channel")
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE TABLE "notification"."type" (
49
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
50
+ "label" text NOT NULL,
51
+ "key" text NOT NULL,
52
+ "throttling" jsonb,
53
+ "escalations" jsonb,
54
+ "revision" integer NOT NULL,
55
+ "revision_timestamp" timestamp with time zone NOT NULL,
56
+ "create_timestamp" timestamp with time zone NOT NULL,
57
+ "delete_timestamp" timestamp with time zone,
58
+ "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
59
+ CONSTRAINT "type_key_unique" UNIQUE("key")
67
60
  );
68
61
  --> statement-breakpoint
69
62
  CREATE TABLE "notification"."web_push_subscription" (
@@ -78,13 +71,15 @@ CREATE TABLE "notification"."web_push_subscription" (
78
71
  "create_timestamp" timestamp with time zone NOT NULL,
79
72
  "delete_timestamp" timestamp with time zone,
80
73
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
81
- CONSTRAINT "web_push_subscription_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
74
+ CONSTRAINT "web_push_subscription_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
75
+ CONSTRAINT "web_push_subscription_tenant_id_user_id_endpoint_unique" UNIQUE("tenant_id","user_id","endpoint")
82
76
  );
83
77
  --> statement-breakpoint
84
78
  ALTER TABLE "notification"."in_app" ADD CONSTRAINT "in_app_id_user_fkey" FOREIGN KEY ("tenant_id","user_id") REFERENCES "authentication"."user"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
85
- ALTER TABLE "notification"."in_app" ADD CONSTRAINT "in_app_id_log_fkey" FOREIGN KEY ("tenant_id","log_id") REFERENCES "notification"."log"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
79
+ ALTER TABLE "notification"."in_app" ADD CONSTRAINT "in_app_tenantId_logId_userId_log_fkey" FOREIGN KEY ("tenant_id","log_id","user_id") REFERENCES "notification"."log"("tenant_id","id","user_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
80
+ ALTER TABLE "notification"."log" ADD CONSTRAINT "log_type_type_key_fk" FOREIGN KEY ("type") REFERENCES "notification"."type"("key") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
86
81
  ALTER TABLE "notification"."log" ADD CONSTRAINT "log_id_user_fkey" FOREIGN KEY ("tenant_id","user_id") REFERENCES "authentication"."user"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
87
- ALTER TABLE "notification"."log" ADD CONSTRAINT "log_id_category_fkey" FOREIGN KEY ("tenant_id","category_id") REFERENCES "notification"."category"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
82
+ ALTER TABLE "notification"."preference" ADD CONSTRAINT "preference_type_type_key_fk" FOREIGN KEY ("type") REFERENCES "notification"."type"("key") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
88
83
  ALTER TABLE "notification"."preference" ADD CONSTRAINT "preference_id_user_fkey" FOREIGN KEY ("tenant_id","user_id") REFERENCES "authentication"."user"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
89
- ALTER TABLE "notification"."preference" ADD CONSTRAINT "preference_id_category_fkey" FOREIGN KEY ("tenant_id","category_id") REFERENCES "notification"."category"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
90
- ALTER TABLE "notification"."web_push_subscription" ADD CONSTRAINT "web_push_subscription_id_user_fkey" FOREIGN KEY ("tenant_id","user_id") REFERENCES "authentication"."user"("tenant_id","id") ON DELETE no action ON UPDATE no action;
84
+ ALTER TABLE "notification"."web_push_subscription" ADD CONSTRAINT "web_push_subscription_id_user_fkey" FOREIGN KEY ("tenant_id","user_id") REFERENCES "authentication"."user"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
85
+ CREATE INDEX "in_app_tenant_id_user_id_read_timestamp_archive_timestamp_idx" ON "notification"."in_app" USING btree ("tenant_id","user_id","read_timestamp","archive_timestamp");
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "270350fd-bfb6-488b-8b07-1e4e937e4f19",
2
+ "id": "8f352123-edd8-491f-a4ad-008d09531722",
3
3
  "prevId": "00000000-0000-0000-0000-000000000000",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -33,51 +33,54 @@
33
33
  "primaryKey": false,
34
34
  "notNull": true
35
35
  },
36
- "read_at": {
37
- "name": "read_at",
36
+ "read_timestamp": {
37
+ "name": "read_timestamp",
38
38
  "type": "timestamp with time zone",
39
39
  "primaryKey": false,
40
40
  "notNull": false
41
41
  },
42
- "archived_at": {
43
- "name": "archived_at",
42
+ "archive_timestamp": {
43
+ "name": "archive_timestamp",
44
44
  "type": "timestamp with time zone",
45
45
  "primaryKey": false,
46
46
  "notNull": false
47
- },
48
- "revision": {
49
- "name": "revision",
50
- "type": "integer",
51
- "primaryKey": false,
52
- "notNull": true
53
- },
54
- "revision_timestamp": {
55
- "name": "revision_timestamp",
56
- "type": "timestamp with time zone",
57
- "primaryKey": false,
58
- "notNull": true
59
- },
60
- "create_timestamp": {
61
- "name": "create_timestamp",
62
- "type": "timestamp with time zone",
63
- "primaryKey": false,
64
- "notNull": true
65
- },
66
- "delete_timestamp": {
67
- "name": "delete_timestamp",
68
- "type": "timestamp with time zone",
69
- "primaryKey": false,
70
- "notNull": false
71
- },
72
- "attributes": {
73
- "name": "attributes",
74
- "type": "jsonb",
75
- "primaryKey": false,
76
- "notNull": true,
77
- "default": "'{}'::jsonb"
78
47
  }
79
48
  },
80
- "indexes": {},
49
+ "indexes": {
50
+ "in_app_tenant_id_user_id_read_timestamp_archive_timestamp_idx": {
51
+ "name": "in_app_tenant_id_user_id_read_timestamp_archive_timestamp_idx",
52
+ "columns": [
53
+ {
54
+ "expression": "tenant_id",
55
+ "isExpression": false,
56
+ "asc": true,
57
+ "nulls": "last"
58
+ },
59
+ {
60
+ "expression": "user_id",
61
+ "isExpression": false,
62
+ "asc": true,
63
+ "nulls": "last"
64
+ },
65
+ {
66
+ "expression": "read_timestamp",
67
+ "isExpression": false,
68
+ "asc": true,
69
+ "nulls": "last"
70
+ },
71
+ {
72
+ "expression": "archive_timestamp",
73
+ "isExpression": false,
74
+ "asc": true,
75
+ "nulls": "last"
76
+ }
77
+ ],
78
+ "isUnique": false,
79
+ "concurrently": false,
80
+ "method": "btree",
81
+ "with": {}
82
+ }
83
+ },
81
84
  "foreignKeys": {
82
85
  "in_app_id_user_fkey": {
83
86
  "name": "in_app_id_user_fkey",
@@ -95,18 +98,20 @@
95
98
  "onDelete": "no action",
96
99
  "onUpdate": "no action"
97
100
  },
98
- "in_app_id_log_fkey": {
99
- "name": "in_app_id_log_fkey",
101
+ "in_app_tenantId_logId_userId_log_fkey": {
102
+ "name": "in_app_tenantId_logId_userId_log_fkey",
100
103
  "tableFrom": "in_app",
101
104
  "tableTo": "log",
102
105
  "schemaTo": "notification",
103
106
  "columnsFrom": [
104
107
  "tenant_id",
105
- "log_id"
108
+ "log_id",
109
+ "user_id"
106
110
  ],
107
111
  "columnsTo": [
108
112
  "tenant_id",
109
- "id"
113
+ "id",
114
+ "user_id"
110
115
  ],
111
116
  "onDelete": "no action",
112
117
  "onUpdate": "no action"
@@ -126,104 +131,6 @@
126
131
  "checkConstraints": {},
127
132
  "isRLSEnabled": false
128
133
  },
129
- "notification.category": {
130
- "name": "category",
131
- "schema": "notification",
132
- "columns": {
133
- "id": {
134
- "name": "id",
135
- "type": "uuid",
136
- "primaryKey": false,
137
- "notNull": true,
138
- "default": "gen_random_uuid()"
139
- },
140
- "tenant_id": {
141
- "name": "tenant_id",
142
- "type": "uuid",
143
- "primaryKey": false,
144
- "notNull": true
145
- },
146
- "label": {
147
- "name": "label",
148
- "type": "text",
149
- "primaryKey": false,
150
- "notNull": true
151
- },
152
- "key": {
153
- "name": "key",
154
- "type": "text",
155
- "primaryKey": false,
156
- "notNull": true
157
- },
158
- "throttling": {
159
- "name": "throttling",
160
- "type": "jsonb",
161
- "primaryKey": false,
162
- "notNull": false
163
- },
164
- "escalations": {
165
- "name": "escalations",
166
- "type": "jsonb",
167
- "primaryKey": false,
168
- "notNull": false
169
- },
170
- "revision": {
171
- "name": "revision",
172
- "type": "integer",
173
- "primaryKey": false,
174
- "notNull": true
175
- },
176
- "revision_timestamp": {
177
- "name": "revision_timestamp",
178
- "type": "timestamp with time zone",
179
- "primaryKey": false,
180
- "notNull": true
181
- },
182
- "create_timestamp": {
183
- "name": "create_timestamp",
184
- "type": "timestamp with time zone",
185
- "primaryKey": false,
186
- "notNull": true
187
- },
188
- "delete_timestamp": {
189
- "name": "delete_timestamp",
190
- "type": "timestamp with time zone",
191
- "primaryKey": false,
192
- "notNull": false
193
- },
194
- "attributes": {
195
- "name": "attributes",
196
- "type": "jsonb",
197
- "primaryKey": false,
198
- "notNull": true,
199
- "default": "'{}'::jsonb"
200
- }
201
- },
202
- "indexes": {},
203
- "foreignKeys": {},
204
- "compositePrimaryKeys": {
205
- "category_tenant_id_id_pk": {
206
- "name": "category_tenant_id_id_pk",
207
- "columns": [
208
- "tenant_id",
209
- "id"
210
- ]
211
- }
212
- },
213
- "uniqueConstraints": {
214
- "category_tenant_id_key_unique": {
215
- "name": "category_tenant_id_key_unique",
216
- "nullsNotDistinct": false,
217
- "columns": [
218
- "tenant_id",
219
- "key"
220
- ]
221
- }
222
- },
223
- "policies": {},
224
- "checkConstraints": {},
225
- "isRLSEnabled": false
226
- },
227
134
  "notification.log": {
228
135
  "name": "log",
229
136
  "schema": "notification",
@@ -247,12 +154,6 @@
247
154
  "primaryKey": false,
248
155
  "notNull": true
249
156
  },
250
- "category_id": {
251
- "name": "category_id",
252
- "type": "uuid",
253
- "primaryKey": false,
254
- "notNull": true
255
- },
256
157
  "type": {
257
158
  "name": "type",
258
159
  "type": "text",
@@ -319,30 +220,28 @@
319
220
  },
320
221
  "indexes": {},
321
222
  "foreignKeys": {
322
- "log_id_user_fkey": {
323
- "name": "log_id_user_fkey",
223
+ "log_type_type_key_fk": {
224
+ "name": "log_type_type_key_fk",
324
225
  "tableFrom": "log",
325
- "tableTo": "user",
326
- "schemaTo": "authentication",
226
+ "tableTo": "type",
227
+ "schemaTo": "notification",
327
228
  "columnsFrom": [
328
- "tenant_id",
329
- "user_id"
229
+ "type"
330
230
  ],
331
231
  "columnsTo": [
332
- "tenant_id",
333
- "id"
232
+ "key"
334
233
  ],
335
234
  "onDelete": "no action",
336
235
  "onUpdate": "no action"
337
236
  },
338
- "log_id_category_fkey": {
339
- "name": "log_id_category_fkey",
237
+ "log_id_user_fkey": {
238
+ "name": "log_id_user_fkey",
340
239
  "tableFrom": "log",
341
- "tableTo": "category",
342
- "schemaTo": "notification",
240
+ "tableTo": "user",
241
+ "schemaTo": "authentication",
343
242
  "columnsFrom": [
344
243
  "tenant_id",
345
- "category_id"
244
+ "user_id"
346
245
  ],
347
246
  "columnsTo": [
348
247
  "tenant_id",
@@ -361,7 +260,17 @@
361
260
  ]
362
261
  }
363
262
  },
364
- "uniqueConstraints": {},
263
+ "uniqueConstraints": {
264
+ "log_tenant_id_id_user_id_unique": {
265
+ "name": "log_tenant_id_id_user_id_unique",
266
+ "nullsNotDistinct": false,
267
+ "columns": [
268
+ "tenant_id",
269
+ "id",
270
+ "user_id"
271
+ ]
272
+ }
273
+ },
365
274
  "policies": {},
366
275
  "checkConstraints": {},
367
276
  "isRLSEnabled": false
@@ -389,9 +298,9 @@
389
298
  "primaryKey": false,
390
299
  "notNull": true
391
300
  },
392
- "category_id": {
393
- "name": "category_id",
394
- "type": "uuid",
301
+ "type": {
302
+ "name": "type",
303
+ "type": "text",
395
304
  "primaryKey": false,
396
305
  "notNull": true
397
306
  },
@@ -442,30 +351,28 @@
442
351
  },
443
352
  "indexes": {},
444
353
  "foreignKeys": {
445
- "preference_id_user_fkey": {
446
- "name": "preference_id_user_fkey",
354
+ "preference_type_type_key_fk": {
355
+ "name": "preference_type_type_key_fk",
447
356
  "tableFrom": "preference",
448
- "tableTo": "user",
449
- "schemaTo": "authentication",
357
+ "tableTo": "type",
358
+ "schemaTo": "notification",
450
359
  "columnsFrom": [
451
- "tenant_id",
452
- "user_id"
360
+ "type"
453
361
  ],
454
362
  "columnsTo": [
455
- "tenant_id",
456
- "id"
363
+ "key"
457
364
  ],
458
365
  "onDelete": "no action",
459
366
  "onUpdate": "no action"
460
367
  },
461
- "preference_id_category_fkey": {
462
- "name": "preference_id_category_fkey",
368
+ "preference_id_user_fkey": {
369
+ "name": "preference_id_user_fkey",
463
370
  "tableFrom": "preference",
464
- "tableTo": "category",
465
- "schemaTo": "notification",
371
+ "tableTo": "user",
372
+ "schemaTo": "authentication",
466
373
  "columnsFrom": [
467
374
  "tenant_id",
468
- "category_id"
375
+ "user_id"
469
376
  ],
470
377
  "columnsTo": [
471
378
  "tenant_id",
@@ -485,13 +392,13 @@
485
392
  }
486
393
  },
487
394
  "uniqueConstraints": {
488
- "preference_tenant_id_user_id_category_id_channel_unique": {
489
- "name": "preference_tenant_id_user_id_category_id_channel_unique",
395
+ "preference_tenant_id_user_id_type_channel_unique": {
396
+ "name": "preference_tenant_id_user_id_type_channel_unique",
490
397
  "nullsNotDistinct": false,
491
398
  "columns": [
492
399
  "tenant_id",
493
400
  "user_id",
494
- "category_id",
401
+ "type",
495
402
  "channel"
496
403
  ]
497
404
  }
@@ -500,6 +407,89 @@
500
407
  "checkConstraints": {},
501
408
  "isRLSEnabled": false
502
409
  },
410
+ "notification.type": {
411
+ "name": "type",
412
+ "schema": "notification",
413
+ "columns": {
414
+ "id": {
415
+ "name": "id",
416
+ "type": "uuid",
417
+ "primaryKey": true,
418
+ "notNull": true,
419
+ "default": "gen_random_uuid()"
420
+ },
421
+ "label": {
422
+ "name": "label",
423
+ "type": "text",
424
+ "primaryKey": false,
425
+ "notNull": true
426
+ },
427
+ "key": {
428
+ "name": "key",
429
+ "type": "text",
430
+ "primaryKey": false,
431
+ "notNull": true
432
+ },
433
+ "throttling": {
434
+ "name": "throttling",
435
+ "type": "jsonb",
436
+ "primaryKey": false,
437
+ "notNull": false
438
+ },
439
+ "escalations": {
440
+ "name": "escalations",
441
+ "type": "jsonb",
442
+ "primaryKey": false,
443
+ "notNull": false
444
+ },
445
+ "revision": {
446
+ "name": "revision",
447
+ "type": "integer",
448
+ "primaryKey": false,
449
+ "notNull": true
450
+ },
451
+ "revision_timestamp": {
452
+ "name": "revision_timestamp",
453
+ "type": "timestamp with time zone",
454
+ "primaryKey": false,
455
+ "notNull": true
456
+ },
457
+ "create_timestamp": {
458
+ "name": "create_timestamp",
459
+ "type": "timestamp with time zone",
460
+ "primaryKey": false,
461
+ "notNull": true
462
+ },
463
+ "delete_timestamp": {
464
+ "name": "delete_timestamp",
465
+ "type": "timestamp with time zone",
466
+ "primaryKey": false,
467
+ "notNull": false
468
+ },
469
+ "attributes": {
470
+ "name": "attributes",
471
+ "type": "jsonb",
472
+ "primaryKey": false,
473
+ "notNull": true,
474
+ "default": "'{}'::jsonb"
475
+ }
476
+ },
477
+ "indexes": {},
478
+ "foreignKeys": {},
479
+ "compositePrimaryKeys": {},
480
+ "uniqueConstraints": {
481
+ "type_key_unique": {
482
+ "name": "type_key_unique",
483
+ "nullsNotDistinct": false,
484
+ "columns": [
485
+ "key"
486
+ ]
487
+ }
488
+ },
489
+ "policies": {},
490
+ "checkConstraints": {},
491
+ "isRLSEnabled": false
492
+ },
503
493
  "notification.web_push_subscription": {
504
494
  "name": "web_push_subscription",
505
495
  "schema": "notification",
@@ -601,7 +591,17 @@
601
591
  ]
602
592
  }
603
593
  },
604
- "uniqueConstraints": {},
594
+ "uniqueConstraints": {
595
+ "web_push_subscription_tenant_id_user_id_endpoint_unique": {
596
+ "name": "web_push_subscription_tenant_id_user_id_endpoint_unique",
597
+ "nullsNotDistinct": false,
598
+ "columns": [
599
+ "tenant_id",
600
+ "user_id",
601
+ "endpoint"
602
+ ]
603
+ }
604
+ },
605
605
  "policies": {},
606
606
  "checkConstraints": {},
607
607
  "isRLSEnabled": false
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "7",
8
- "when": 1769475703872,
9
- "tag": "0000_glorious_randall",
8
+ "when": 1769546272361,
9
+ "tag": "0000_shiny_the_anarchist",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]