@tstdl/base 0.93.98 → 0.93.100
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.
- package/context/context.d.ts +1 -1
- package/context/context.js +4 -0
- package/document-management/api/document-management.api.d.ts +2 -2
- package/document-management/service-models/document.service-model.d.ts +1 -1
- package/file/mime-type.d.ts +2 -2
- package/file/mime-type.js +2 -3
- package/file/server/index.d.ts +1 -0
- package/file/server/index.js +1 -0
- package/file/server/mime-type.d.ts +2 -0
- package/file/server/mime-type.js +5 -0
- package/notification/api/notification.api.d.ts +78 -0
- package/notification/api/notification.api.js +81 -0
- package/notification/enums.d.ts +22 -0
- package/notification/enums.js +19 -0
- package/notification/index.d.ts +2 -0
- package/notification/index.js +2 -0
- package/notification/models/in-app-notification.model.d.ts +9 -0
- package/notification/models/in-app-notification.model.js +42 -0
- package/notification/models/index.d.ts +6 -0
- package/notification/models/index.js +6 -0
- package/notification/models/notification-category.model.d.ts +17 -0
- package/notification/models/notification-category.model.js +41 -0
- package/notification/models/notification-log.model.d.ts +13 -0
- package/notification/models/notification-log.model.js +59 -0
- package/notification/models/notification-preference.model.d.ts +9 -0
- package/notification/models/notification-preference.model.js +45 -0
- package/notification/models/notification-table.d.ts +3 -0
- package/notification/models/notification-table.js +4 -0
- package/notification/models/web-push-subscription.model.d.ts +8 -0
- package/notification/models/web-push-subscription.model.js +41 -0
- package/notification/server/api/notification.api-controller.d.ts +16 -0
- package/notification/server/api/notification.api-controller.js +51 -0
- package/notification/server/drizzle/0000_glorious_randall.sql +90 -0
- package/notification/server/drizzle/meta/0000_snapshot.json +652 -0
- package/notification/server/drizzle/meta/_journal.json +13 -0
- package/notification/server/drizzle.config.d.ts +2 -0
- package/notification/server/drizzle.config.js +11 -0
- package/notification/server/index.d.ts +4 -0
- package/notification/server/index.js +4 -0
- package/notification/server/module.d.ts +12 -0
- package/notification/server/module.js +21 -0
- package/notification/server/providers/channel-provider.d.ts +4 -0
- package/notification/server/providers/channel-provider.js +1 -0
- package/notification/server/providers/email-channel-provider.d.ts +6 -0
- package/notification/server/providers/email-channel-provider.js +34 -0
- package/notification/server/providers/in-app-channel-provider.d.ts +7 -0
- package/notification/server/providers/in-app-channel-provider.js +31 -0
- package/notification/server/providers/index.d.ts +4 -0
- package/notification/server/providers/index.js +4 -0
- package/notification/server/providers/web-push-channel-provider.d.ts +6 -0
- package/notification/server/providers/web-push-channel-provider.js +26 -0
- package/notification/server/schemas.d.ts +25 -0
- package/notification/server/schemas.js +12 -0
- package/notification/server/services/index.d.ts +8 -0
- package/notification/server/services/index.js +8 -0
- package/notification/server/services/notification-category.service.d.ts +11 -0
- package/notification/server/services/notification-category.service.js +41 -0
- package/notification/server/services/notification-delivery.task.d.ts +9 -0
- package/notification/server/services/notification-delivery.task.js +1 -0
- package/notification/server/services/notification-delivery.worker.d.ts +12 -0
- package/notification/server/services/notification-delivery.worker.js +108 -0
- package/notification/server/services/notification-sse.service.d.ts +13 -0
- package/notification/server/services/notification-sse.service.js +74 -0
- package/notification/server/services/notification-template.d.ts +12 -0
- package/notification/server/services/notification-template.js +1 -0
- package/notification/server/services/notification-template.service.d.ts +7 -0
- package/notification/server/services/notification-template.service.js +29 -0
- package/notification/server/services/notification.service.d.ts +17 -0
- package/notification/server/services/notification.service.js +80 -0
- package/notification/server/services/singleton.d.ts +3 -0
- package/notification/server/services/singleton.js +10 -0
- package/notification/tests/notification-category.service.test.d.ts +1 -0
- package/notification/tests/notification-category.service.test.js +36 -0
- package/notification/tests/notification-flow.test.d.ts +1 -0
- package/notification/tests/notification-flow.test.js +112 -0
- package/notification/tests/notification-sse.service.test.d.ts +1 -0
- package/notification/tests/notification-sse.service.test.js +20 -0
- package/notification/tests/test-notification.model.d.ts +4 -0
- package/notification/tests/test-notification.model.js +25 -0
- package/orm/server/transactional.d.ts +3 -2
- package/orm/server/transactional.js +3 -2
- package/package.json +5 -3
- package/task-queue/task-queue.d.ts +7 -2
- package/task-queue/task-queue.js +4 -1
- package/unit-test/integration-setup.d.ts +7 -6
- package/unit-test/integration-setup.js +7 -2
package/context/context.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Function, SimplifyObject } from '../types/index.js';
|
|
|
3
3
|
* Creates a new context provider
|
|
4
4
|
* @param name name of of the context used for function names
|
|
5
5
|
*/
|
|
6
|
-
export declare function createContextProvider<Context, const Name extends string>(name: Name): SimplifyObject<Record<`getCurrent${Name}Context`, {
|
|
6
|
+
export declare function createContextProvider<Context, const Name extends string>(name: Name): SimplifyObject<Record<`tryGetCurrent${Name}Context`, () => Context | null> & Record<`getCurrent${Name}Context`, {
|
|
7
7
|
(required: true, debugFn: Function): Context;
|
|
8
8
|
(required?: false, debugFn?: Function): Context | null;
|
|
9
9
|
(required: boolean, debugFn: Function): Context | null;
|
package/context/context.js
CHANGED
|
@@ -5,6 +5,9 @@ import { isNotNull, isString } from '../utils/type-guards.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export function createContextProvider(name) {
|
|
7
7
|
let currentContext = null;
|
|
8
|
+
function tryGetCurrentContext() {
|
|
9
|
+
return currentContext;
|
|
10
|
+
}
|
|
8
11
|
function getCurrentContext(required = false, debugFn) {
|
|
9
12
|
if (required) {
|
|
10
13
|
assertInContext(debugFn);
|
|
@@ -57,6 +60,7 @@ export function createContextProvider(name) {
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
return {
|
|
63
|
+
[`tryGetCurrent${name}Context`](...args) { return tryGetCurrentContext(...args); },
|
|
60
64
|
[`getCurrent${name}Context`](...args) { return getCurrentContext(...args); },
|
|
61
65
|
[`setCurrent${name}Context`](...args) { return setCurrentContext(...args); },
|
|
62
66
|
[`runIn${name}Context`](...args) { return runInContext(...args); },
|
|
@@ -369,7 +369,7 @@ export declare const documentManagementApiDefinition: {
|
|
|
369
369
|
method: "POST";
|
|
370
370
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
371
371
|
id: string;
|
|
372
|
-
state: "error" | "pending" | "running" | "completed" | "
|
|
372
|
+
state: "error" | "pending" | "running" | "completed" | "failed" | "review";
|
|
373
373
|
}>;
|
|
374
374
|
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
375
375
|
credentials: true;
|
|
@@ -785,7 +785,7 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
|
|
|
785
785
|
method: "POST";
|
|
786
786
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
787
787
|
id: string;
|
|
788
|
-
state: "error" | "pending" | "running" | "completed" | "
|
|
788
|
+
state: "error" | "pending" | "running" | "completed" | "failed" | "review";
|
|
789
789
|
}>;
|
|
790
790
|
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
791
791
|
credentials: true;
|
|
@@ -236,7 +236,7 @@ export declare const addOrArchiveDocumentToOrFromCollectionParametersSchema: imp
|
|
|
236
236
|
}>;
|
|
237
237
|
export declare const proceedDocumentWorkflowParametersSchema: import("../../schema/index.js").ObjectSchema<{
|
|
238
238
|
id: string;
|
|
239
|
-
state: "error" | "pending" | "running" | "completed" | "
|
|
239
|
+
state: "error" | "pending" | "running" | "completed" | "failed" | "review";
|
|
240
240
|
}>;
|
|
241
241
|
export type MetadataParameter = SchemaOutput<typeof metadataParameterObjectSchema>;
|
|
242
242
|
export type LoadDataParameters = SchemaOutput<typeof loadDataParametersSchema>;
|
package/file/mime-type.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function getMimeType(file:
|
|
2
|
-
export declare function getMimeType<F>(file:
|
|
1
|
+
export declare function getMimeType(file: Uint8Array | ReadableStream<Uint8Array>): Promise<string | undefined>;
|
|
2
|
+
export declare function getMimeType<F>(file: Uint8Array | ReadableStream<Uint8Array>, fallback: F): Promise<string | F>;
|
|
3
3
|
export declare function getMimeTypeExtensions(mimeType: string): string[];
|
package/file/mime-type.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { fileTypeFromBuffer,
|
|
2
|
-
import { isReadableStream, isString, isUint8Array } from '../utils/type-guards.js';
|
|
1
|
+
import { fileTypeFromBuffer, fileTypeFromStream } from 'file-type';
|
|
3
2
|
import { match } from 'ts-pattern';
|
|
3
|
+
import { isReadableStream, isUint8Array } from '../utils/type-guards.js';
|
|
4
4
|
import { mimeTypesMap } from './mime-types.js';
|
|
5
5
|
export async function getMimeType(file, fallback) {
|
|
6
6
|
const result = await match(file)
|
|
7
|
-
.when(isString, async (f) => await fileTypeFromFile(f))
|
|
8
7
|
.when(isUint8Array, async (f) => await fileTypeFromBuffer(f))
|
|
9
8
|
.when((isReadableStream), async (f) => await fileTypeFromStream(f))
|
|
10
9
|
.exhaustive();
|
package/file/server/index.d.ts
CHANGED
package/file/server/index.js
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ServerSentEvents } from '../../sse/server-sent-events.js';
|
|
2
|
+
export declare const notificationApiDefinition: {
|
|
3
|
+
resource: string;
|
|
4
|
+
endpoints: {
|
|
5
|
+
stream: {
|
|
6
|
+
resource: string;
|
|
7
|
+
method: "GET";
|
|
8
|
+
result: typeof ServerSentEvents;
|
|
9
|
+
};
|
|
10
|
+
listInApp: {
|
|
11
|
+
resource: string;
|
|
12
|
+
method: "GET";
|
|
13
|
+
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
14
|
+
offset?: number | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
includeArchived?: boolean | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
result: import("../../schema/index.js").ArraySchema<{
|
|
19
|
+
type: string;
|
|
20
|
+
id: string;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
priority: string;
|
|
23
|
+
logId: string;
|
|
24
|
+
payload?: {} | undefined;
|
|
25
|
+
readAt?: number | undefined;
|
|
26
|
+
archivedAt?: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
markRead: {
|
|
30
|
+
resource: string;
|
|
31
|
+
method: "POST";
|
|
32
|
+
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
33
|
+
id: string;
|
|
34
|
+
}>;
|
|
35
|
+
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
36
|
+
};
|
|
37
|
+
archive: {
|
|
38
|
+
resource: string;
|
|
39
|
+
method: "POST";
|
|
40
|
+
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
41
|
+
id: string;
|
|
42
|
+
}>;
|
|
43
|
+
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
44
|
+
};
|
|
45
|
+
getPreferences: {
|
|
46
|
+
resource: string;
|
|
47
|
+
method: "GET";
|
|
48
|
+
result: import("../../schema/index.js").ArraySchema<{
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
channel: string;
|
|
51
|
+
categoryId: string;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
updatePreference: {
|
|
55
|
+
resource: string;
|
|
56
|
+
method: "POST";
|
|
57
|
+
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
58
|
+
readonly categoryId: string;
|
|
59
|
+
readonly channel: string;
|
|
60
|
+
readonly enabled: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
63
|
+
};
|
|
64
|
+
registerWebPush: {
|
|
65
|
+
resource: string;
|
|
66
|
+
method: "POST";
|
|
67
|
+
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
68
|
+
readonly endpoint: string;
|
|
69
|
+
readonly keys: {
|
|
70
|
+
auth: string;
|
|
71
|
+
p256dh: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
result: import("../../schema/index.js").LiteralSchema<"ok">;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type NotificationApiDefinition = typeof notificationApiDefinition;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineApi } from '../../api/types.js';
|
|
2
|
+
import { boolean, explicitObject, literal, number, object, optional, string, array, unknown } from '../../schema/index.js';
|
|
3
|
+
import { NotificationChannel } from '../enums.js';
|
|
4
|
+
import { ServerSentEvents } from '../../sse/server-sent-events.js';
|
|
5
|
+
export const notificationApiDefinition = defineApi({
|
|
6
|
+
resource: 'notification',
|
|
7
|
+
endpoints: {
|
|
8
|
+
stream: {
|
|
9
|
+
resource: 'stream',
|
|
10
|
+
method: 'GET',
|
|
11
|
+
result: ServerSentEvents,
|
|
12
|
+
},
|
|
13
|
+
listInApp: {
|
|
14
|
+
resource: 'in-app',
|
|
15
|
+
method: 'GET',
|
|
16
|
+
parameters: object({
|
|
17
|
+
limit: optional(number()),
|
|
18
|
+
offset: optional(number()),
|
|
19
|
+
includeArchived: optional(boolean()),
|
|
20
|
+
}),
|
|
21
|
+
result: array(object({
|
|
22
|
+
id: string(),
|
|
23
|
+
logId: string(),
|
|
24
|
+
readAt: optional(number()),
|
|
25
|
+
archivedAt: optional(number()),
|
|
26
|
+
// Add more joined fields from Log if needed, or return polymorphic payload
|
|
27
|
+
type: string(),
|
|
28
|
+
priority: string(),
|
|
29
|
+
createdAt: number(),
|
|
30
|
+
payload: optional(object({})),
|
|
31
|
+
})),
|
|
32
|
+
},
|
|
33
|
+
markRead: {
|
|
34
|
+
resource: 'in-app/:id/read',
|
|
35
|
+
method: 'POST',
|
|
36
|
+
parameters: object({
|
|
37
|
+
id: string(),
|
|
38
|
+
}),
|
|
39
|
+
result: literal('ok'),
|
|
40
|
+
},
|
|
41
|
+
archive: {
|
|
42
|
+
resource: 'in-app/:id/archive',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
parameters: object({
|
|
45
|
+
id: string(),
|
|
46
|
+
}),
|
|
47
|
+
result: literal('ok'),
|
|
48
|
+
},
|
|
49
|
+
getPreferences: {
|
|
50
|
+
resource: 'preferences',
|
|
51
|
+
method: 'GET',
|
|
52
|
+
result: array(object({
|
|
53
|
+
categoryId: string(),
|
|
54
|
+
channel: string(),
|
|
55
|
+
enabled: boolean(),
|
|
56
|
+
})),
|
|
57
|
+
},
|
|
58
|
+
updatePreference: {
|
|
59
|
+
resource: 'preferences',
|
|
60
|
+
method: 'POST',
|
|
61
|
+
parameters: explicitObject({
|
|
62
|
+
categoryId: string(),
|
|
63
|
+
channel: string(),
|
|
64
|
+
enabled: boolean(),
|
|
65
|
+
}),
|
|
66
|
+
result: literal('ok'),
|
|
67
|
+
},
|
|
68
|
+
registerWebPush: {
|
|
69
|
+
resource: 'web-push/register',
|
|
70
|
+
method: 'POST',
|
|
71
|
+
parameters: explicitObject({
|
|
72
|
+
endpoint: string(),
|
|
73
|
+
keys: object({
|
|
74
|
+
p256dh: string(),
|
|
75
|
+
auth: string(),
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
result: literal('ok'),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type EnumType } from '../enumeration/index.js';
|
|
2
|
+
export declare const NotificationChannel: {
|
|
3
|
+
readonly InApp: "in-app";
|
|
4
|
+
readonly Email: "email";
|
|
5
|
+
readonly WebPush: "web-push";
|
|
6
|
+
};
|
|
7
|
+
export type NotificationChannel = EnumType<typeof NotificationChannel>;
|
|
8
|
+
export declare const NotificationPriority: {
|
|
9
|
+
readonly Low: "low";
|
|
10
|
+
readonly Medium: "medium";
|
|
11
|
+
readonly High: "high";
|
|
12
|
+
readonly Urgent: "urgent";
|
|
13
|
+
};
|
|
14
|
+
export type NotificationPriority = EnumType<typeof NotificationPriority>;
|
|
15
|
+
export declare const NotificationStatus: {
|
|
16
|
+
readonly Pending: "pending";
|
|
17
|
+
readonly Sent: "sent";
|
|
18
|
+
readonly Delivered: "delivered";
|
|
19
|
+
readonly Read: "read";
|
|
20
|
+
readonly Failed: "failed";
|
|
21
|
+
};
|
|
22
|
+
export type NotificationStatus = EnumType<typeof NotificationStatus>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineEnum } from '../enumeration/index.js';
|
|
2
|
+
export const NotificationChannel = defineEnum('NotificationChannel', {
|
|
3
|
+
InApp: 'in-app',
|
|
4
|
+
Email: 'email',
|
|
5
|
+
WebPush: 'web-push',
|
|
6
|
+
});
|
|
7
|
+
export const NotificationPriority = defineEnum('NotificationPriority', {
|
|
8
|
+
Low: 'low',
|
|
9
|
+
Medium: 'medium',
|
|
10
|
+
High: 'high',
|
|
11
|
+
Urgent: 'urgent',
|
|
12
|
+
});
|
|
13
|
+
export const NotificationStatus = defineEnum('NotificationStatus', {
|
|
14
|
+
Pending: 'pending',
|
|
15
|
+
Sent: 'sent',
|
|
16
|
+
Delivered: 'delivered',
|
|
17
|
+
Read: 'read',
|
|
18
|
+
Failed: 'failed',
|
|
19
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TenantEntity, type Uuid } from '../../orm/index.js';
|
|
2
|
+
import type { Timestamp } from '../../orm/types.js';
|
|
3
|
+
export declare class InAppNotification extends TenantEntity {
|
|
4
|
+
static readonly entityName = "InAppNotification";
|
|
5
|
+
userId: Uuid;
|
|
6
|
+
logId: Uuid;
|
|
7
|
+
readAt: Timestamp | null;
|
|
8
|
+
archivedAt: Timestamp | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { User } from '../../authentication/models/user.model.js';
|
|
11
|
+
import { TenantEntity, TenantReference, TimestampProperty, UuidProperty } from '../../orm/index.js';
|
|
12
|
+
import { NotificationLog } from './notification-log.model.js';
|
|
13
|
+
import { NotificationTable } from './notification-table.js';
|
|
14
|
+
let InAppNotification = class InAppNotification extends TenantEntity {
|
|
15
|
+
static entityName = 'InAppNotification';
|
|
16
|
+
userId;
|
|
17
|
+
logId;
|
|
18
|
+
readAt;
|
|
19
|
+
archivedAt;
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
UuidProperty(),
|
|
23
|
+
TenantReference(() => User),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], InAppNotification.prototype, "userId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
UuidProperty(),
|
|
28
|
+
TenantReference(() => NotificationLog),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], InAppNotification.prototype, "logId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
TimestampProperty({ nullable: true }),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], InAppNotification.prototype, "readAt", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
TimestampProperty({ nullable: true }),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], InAppNotification.prototype, "archivedAt", void 0);
|
|
39
|
+
InAppNotification = __decorate([
|
|
40
|
+
NotificationTable({ name: 'in_app' })
|
|
41
|
+
], InAppNotification);
|
|
42
|
+
export { InAppNotification };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './in-app-notification.model.js';
|
|
2
|
+
export * from './notification-category.model.js';
|
|
3
|
+
export * from './notification-log.model.js';
|
|
4
|
+
export * from './notification-preference.model.js';
|
|
5
|
+
export * from './notification-table.js';
|
|
6
|
+
export * from './web-push-subscription.model.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './in-app-notification.model.js';
|
|
2
|
+
export * from './notification-category.model.js';
|
|
3
|
+
export * from './notification-log.model.js';
|
|
4
|
+
export * from './notification-preference.model.js';
|
|
5
|
+
export * from './notification-table.js';
|
|
6
|
+
export * from './web-push-subscription.model.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TenantEntity } from '../../orm/index.js';
|
|
2
|
+
import { NotificationChannel } from '../enums.js';
|
|
3
|
+
export type ThrottlingConfig = {
|
|
4
|
+
limit: number;
|
|
5
|
+
intervalMs: number;
|
|
6
|
+
};
|
|
7
|
+
export type EscalationRule = {
|
|
8
|
+
delayMs: number;
|
|
9
|
+
channel: NotificationChannel;
|
|
10
|
+
};
|
|
11
|
+
export declare class NotificationCategory extends TenantEntity {
|
|
12
|
+
static readonly entityName = "NotificationCategory";
|
|
13
|
+
label: string;
|
|
14
|
+
key: string;
|
|
15
|
+
throttling: ThrottlingConfig | null;
|
|
16
|
+
escalations: EscalationRule[] | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { JsonProperty, TenantEntity, Unique } from '../../orm/index.js';
|
|
11
|
+
import { StringProperty } from '../../schema/index.js';
|
|
12
|
+
import { NotificationChannel } from '../enums.js';
|
|
13
|
+
import { NotificationTable } from './notification-table.js';
|
|
14
|
+
let NotificationCategory = class NotificationCategory extends TenantEntity {
|
|
15
|
+
static entityName = 'NotificationCategory';
|
|
16
|
+
label;
|
|
17
|
+
key;
|
|
18
|
+
throttling;
|
|
19
|
+
escalations;
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
StringProperty(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], NotificationCategory.prototype, "label", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
StringProperty(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], NotificationCategory.prototype, "key", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
JsonProperty({ nullable: true }),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], NotificationCategory.prototype, "throttling", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
JsonProperty({ nullable: true }),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], NotificationCategory.prototype, "escalations", void 0);
|
|
37
|
+
NotificationCategory = __decorate([
|
|
38
|
+
NotificationTable({ name: 'category' }),
|
|
39
|
+
Unique(['tenantId', 'key'])
|
|
40
|
+
], NotificationCategory);
|
|
41
|
+
export { NotificationCategory };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Json, TenantEntity, type Uuid } from '../../orm/index.js';
|
|
2
|
+
import type { ObjectLiteral } from '../../types/types.js';
|
|
3
|
+
import { NotificationPriority, NotificationStatus } from '../enums.js';
|
|
4
|
+
export declare class NotificationLog extends TenantEntity {
|
|
5
|
+
static readonly entityName = "NotificationLog";
|
|
6
|
+
userId: Uuid;
|
|
7
|
+
categoryId: Uuid;
|
|
8
|
+
type: string;
|
|
9
|
+
priority: NotificationPriority;
|
|
10
|
+
status: NotificationStatus;
|
|
11
|
+
currentStep: number;
|
|
12
|
+
payload: Json<ObjectLiteral> | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { User } from '../../authentication/models/user.model.js';
|
|
11
|
+
import { JsonProperty, TenantEntity, TenantReference, UuidProperty } from '../../orm/index.js';
|
|
12
|
+
import { Enumeration, Integer, StringProperty } from '../../schema/index.js';
|
|
13
|
+
import { NotificationPriority, NotificationStatus } from '../enums.js';
|
|
14
|
+
import { NotificationCategory } from './notification-category.model.js';
|
|
15
|
+
import { NotificationTable } from './notification-table.js';
|
|
16
|
+
let NotificationLog = class NotificationLog extends TenantEntity {
|
|
17
|
+
static entityName = 'NotificationLog';
|
|
18
|
+
userId;
|
|
19
|
+
categoryId;
|
|
20
|
+
type;
|
|
21
|
+
priority;
|
|
22
|
+
status;
|
|
23
|
+
currentStep;
|
|
24
|
+
payload;
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
UuidProperty(),
|
|
28
|
+
TenantReference(() => User),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], NotificationLog.prototype, "userId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
UuidProperty(),
|
|
33
|
+
TenantReference(() => NotificationCategory),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], NotificationLog.prototype, "categoryId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
StringProperty(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], NotificationLog.prototype, "type", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
Enumeration(NotificationPriority),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], NotificationLog.prototype, "priority", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Enumeration(NotificationStatus),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], NotificationLog.prototype, "status", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Integer(),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], NotificationLog.prototype, "currentStep", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
JsonProperty({ nullable: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], NotificationLog.prototype, "payload", void 0);
|
|
56
|
+
NotificationLog = __decorate([
|
|
57
|
+
NotificationTable({ name: 'log' })
|
|
58
|
+
], NotificationLog);
|
|
59
|
+
export { NotificationLog };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TenantEntity, type Uuid } from '../../orm/index.js';
|
|
2
|
+
import { NotificationChannel } from '../enums.js';
|
|
3
|
+
export declare class NotificationPreference extends TenantEntity {
|
|
4
|
+
static readonly entityName = "NotificationPreference";
|
|
5
|
+
userId: Uuid;
|
|
6
|
+
categoryId: Uuid;
|
|
7
|
+
channel: NotificationChannel;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { User } from '../../authentication/models/user.model.js';
|
|
11
|
+
import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
|
|
12
|
+
import { BooleanProperty, Enumeration } from '../../schema/index.js';
|
|
13
|
+
import { NotificationChannel } from '../enums.js';
|
|
14
|
+
import { NotificationCategory } from './notification-category.model.js';
|
|
15
|
+
import { NotificationTable } from './notification-table.js';
|
|
16
|
+
let NotificationPreference = class NotificationPreference extends TenantEntity {
|
|
17
|
+
static entityName = 'NotificationPreference';
|
|
18
|
+
userId;
|
|
19
|
+
categoryId;
|
|
20
|
+
channel;
|
|
21
|
+
enabled;
|
|
22
|
+
};
|
|
23
|
+
__decorate([
|
|
24
|
+
UuidProperty(),
|
|
25
|
+
TenantReference(() => User),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], NotificationPreference.prototype, "userId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
UuidProperty(),
|
|
30
|
+
TenantReference(() => NotificationCategory),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], NotificationPreference.prototype, "categoryId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
Enumeration(NotificationChannel),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], NotificationPreference.prototype, "channel", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
BooleanProperty(),
|
|
39
|
+
__metadata("design:type", Boolean)
|
|
40
|
+
], NotificationPreference.prototype, "enabled", void 0);
|
|
41
|
+
NotificationPreference = __decorate([
|
|
42
|
+
NotificationTable({ name: 'preference' }),
|
|
43
|
+
Unique(['tenantId', 'userId', 'categoryId', 'channel'])
|
|
44
|
+
], NotificationPreference);
|
|
45
|
+
export { NotificationPreference };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
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';
|
|
13
|
+
import { NotificationTable } from './notification-table.js';
|
|
14
|
+
let WebPushSubscription = class WebPushSubscription extends TenantEntity {
|
|
15
|
+
static entityName = 'WebPushSubscription';
|
|
16
|
+
userId;
|
|
17
|
+
endpoint;
|
|
18
|
+
p256dh;
|
|
19
|
+
auth;
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
UuidProperty(),
|
|
23
|
+
TenantReference(() => User),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], WebPushSubscription.prototype, "userId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
StringProperty(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], WebPushSubscription.prototype, "endpoint", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
StringProperty(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], WebPushSubscription.prototype, "p256dh", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
StringProperty(),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], WebPushSubscription.prototype, "auth", void 0);
|
|
38
|
+
WebPushSubscription = __decorate([
|
|
39
|
+
NotificationTable({ name: 'web_push_subscription' })
|
|
40
|
+
], WebPushSubscription);
|
|
41
|
+
export { WebPushSubscription };
|