@or-sdk/notifications 1.1.20 → 1.2.0
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/CHANGELOG.md +9 -0
- package/dist/cjs/Notifications.js +93 -44
- package/dist/cjs/Notifications.js.map +1 -1
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/schemas/config.schema.js +24 -0
- package/dist/cjs/schemas/config.schema.js.map +1 -0
- package/dist/cjs/schemas/createTrailEvent.schema.js +10 -0
- package/dist/cjs/schemas/createTrailEvent.schema.js.map +1 -0
- package/dist/cjs/schemas/index.js +21 -0
- package/dist/cjs/schemas/index.js.map +1 -0
- package/dist/cjs/schemas/listTrailEvents.schema.js +21 -0
- package/dist/cjs/schemas/listTrailEvents.schema.js.map +1 -0
- package/dist/cjs/schemas/trailEvent.schema.js +25 -0
- package/dist/cjs/schemas/trailEvent.schema.js.map +1 -0
- package/dist/esm/Notifications.js +25 -18
- package/dist/esm/Notifications.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/config.schema.js +21 -0
- package/dist/esm/schemas/config.schema.js.map +1 -0
- package/dist/esm/schemas/createTrailEvent.schema.js +7 -0
- package/dist/esm/schemas/createTrailEvent.schema.js.map +1 -0
- package/dist/esm/schemas/index.js +5 -0
- package/dist/esm/schemas/index.js.map +1 -0
- package/dist/esm/schemas/listTrailEvents.schema.js +18 -0
- package/dist/esm/schemas/listTrailEvents.schema.js.map +1 -0
- package/dist/esm/schemas/trailEvent.schema.js +22 -0
- package/dist/esm/schemas/trailEvent.schema.js.map +1 -0
- package/dist/types/Notifications.d.ts +11 -8
- package/dist/types/Notifications.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemas/config.schema.d.ts +48 -0
- package/dist/types/schemas/config.schema.d.ts.map +1 -0
- package/dist/types/schemas/createTrailEvent.schema.d.ts +72 -0
- package/dist/types/schemas/createTrailEvent.schema.d.ts.map +1 -0
- package/dist/types/schemas/index.d.ts +5 -0
- package/dist/types/schemas/index.d.ts.map +1 -0
- package/dist/types/schemas/listTrailEvents.schema.d.ts +46 -0
- package/dist/types/schemas/listTrailEvents.schema.d.ts.map +1 -0
- package/dist/types/schemas/trailEvent.schema.d.ts +120 -0
- package/dist/types/schemas/trailEvent.schema.d.ts.map +1 -0
- package/dist/types/types.d.ts +0 -29
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/Notifications.ts +88 -39
- package/src/index.ts +2 -1
- package/src/schemas/config.schema.ts +37 -0
- package/src/schemas/createTrailEvent.schema.ts +12 -0
- package/src/schemas/index.ts +4 -0
- package/src/schemas/listTrailEvents.schema.ts +39 -0
- package/src/schemas/trailEvent.schema.ts +46 -0
- package/src/types.ts +0 -48
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailEvent.schema.js","sourceRoot":"","sources":["../../../src/schemas/trailEvent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAE1C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IAEtF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IAGhF,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAElG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAGzG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAEtF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAGpF,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAElF,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAElG,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IAE7G,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACnG,CAAC,CAAC,WAAW,EAAE,CAAC;AAIjB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAEvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAEjF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAExE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAE9E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAEnF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAE/F,UAAU,EAAE,0BAA0B;CACvC,CAAC,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Base } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
2
|
+
import type { CreateTrailEvent, ListTrailEventsParams, NotificationsConfig, TrailEvent } from './schemas';
|
|
3
|
+
import type { FullNotificationItem, ListNotificationsParams, NewUserNotification, NotificationItem, SACreateNotificationParams, SAListNotifications } from './types';
|
|
3
4
|
export declare class Notifications extends Base {
|
|
5
|
+
private readonly validateInputs;
|
|
6
|
+
private readonly validateOutputs;
|
|
4
7
|
constructor(params: NotificationsConfig);
|
|
5
8
|
listNotifications(params?: ListNotificationsParams): Promise<NotificationItem[]>;
|
|
6
|
-
markSeen(): Promise<
|
|
7
|
-
createUserNotification(data: NewUserNotification): Promise<
|
|
8
|
-
SACreateNotification(params: SACreateNotificationParams): Promise<
|
|
9
|
+
markSeen(): Promise<void>;
|
|
10
|
+
createUserNotification(data: NewUserNotification): Promise<void>;
|
|
11
|
+
SACreateNotification(params: SACreateNotificationParams): Promise<void>;
|
|
9
12
|
SAListNotifications(params?: SAListNotifications): Promise<FullNotificationItem[]>;
|
|
10
|
-
SAUpdateNotification(id: string, data: FullNotificationItem): Promise<
|
|
11
|
-
SADeleteNotification(id: string): Promise<
|
|
12
|
-
createTrailEvent(data:
|
|
13
|
-
listTrailEvents(params
|
|
13
|
+
SAUpdateNotification(id: string, data: FullNotificationItem): Promise<void>;
|
|
14
|
+
SADeleteNotification(id: string): Promise<void>;
|
|
15
|
+
createTrailEvent(data: CreateTrailEvent): Promise<void>;
|
|
16
|
+
listTrailEvents(params: ListTrailEventsParams): Promise<TrailEvent[]>;
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=Notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AASpC,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAWjB,qBAAa,aAAc,SAAQ,IAAI;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;gBAqC9B,MAAM,EAAE,mBAAmB;IAsB1B,iBAAiB,CAAC,MAAM,GAAS,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IActF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAazB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAchE,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvE,mBAAmB,CAAC,MAAM,GAAS,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAcxF,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3E,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc/C,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBvD,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CASnF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const notificationsConfigSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
3
|
+
token: z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodString>]>;
|
|
4
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
validateInputs: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
validateOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, {
|
|
8
|
+
discoveryUrl: z.ZodUndefined;
|
|
9
|
+
notificationsUrl: z.ZodString;
|
|
10
|
+
}>, "strip", z.ZodTypeAny, {
|
|
11
|
+
token: string | ((...args: unknown[]) => string);
|
|
12
|
+
notificationsUrl: string;
|
|
13
|
+
accountId?: string | undefined;
|
|
14
|
+
validateInputs?: boolean | undefined;
|
|
15
|
+
validateOutputs?: boolean | undefined;
|
|
16
|
+
discoveryUrl?: undefined;
|
|
17
|
+
}, {
|
|
18
|
+
token: string | ((...args: unknown[]) => string);
|
|
19
|
+
notificationsUrl: string;
|
|
20
|
+
accountId?: string | undefined;
|
|
21
|
+
validateInputs?: boolean | undefined;
|
|
22
|
+
validateOutputs?: boolean | undefined;
|
|
23
|
+
discoveryUrl?: undefined;
|
|
24
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
25
|
+
token: z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodString>]>;
|
|
26
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
validateInputs: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
validateOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, {
|
|
30
|
+
discoveryUrl: z.ZodString;
|
|
31
|
+
notificationsUrl: z.ZodUndefined;
|
|
32
|
+
}>, "strip", z.ZodTypeAny, {
|
|
33
|
+
token: string | ((...args: unknown[]) => string);
|
|
34
|
+
discoveryUrl: string;
|
|
35
|
+
accountId?: string | undefined;
|
|
36
|
+
validateInputs?: boolean | undefined;
|
|
37
|
+
validateOutputs?: boolean | undefined;
|
|
38
|
+
notificationsUrl?: undefined;
|
|
39
|
+
}, {
|
|
40
|
+
token: string | ((...args: unknown[]) => string);
|
|
41
|
+
discoveryUrl: string;
|
|
42
|
+
accountId?: string | undefined;
|
|
43
|
+
validateInputs?: boolean | undefined;
|
|
44
|
+
validateOutputs?: boolean | undefined;
|
|
45
|
+
notificationsUrl?: undefined;
|
|
46
|
+
}>]>;
|
|
47
|
+
export type NotificationsConfig = z.infer<typeof notificationsConfigSchema>;
|
|
48
|
+
//# sourceMappingURL=config.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/config.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAapC,CAAC;AAKH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createTrailEventSchema: z.ZodObject<{
|
|
3
|
+
service: z.ZodString;
|
|
4
|
+
data: z.ZodObject<{
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
icon: z.ZodString;
|
|
7
|
+
url: z.ZodOptional<z.ZodString>;
|
|
8
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
9
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
'creator.name': z.ZodString;
|
|
12
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
13
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
14
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16
|
+
message: z.ZodString;
|
|
17
|
+
icon: z.ZodString;
|
|
18
|
+
url: z.ZodOptional<z.ZodString>;
|
|
19
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
20
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
'creator.name': z.ZodString;
|
|
23
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
24
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
25
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
27
|
+
message: z.ZodString;
|
|
28
|
+
icon: z.ZodString;
|
|
29
|
+
url: z.ZodOptional<z.ZodString>;
|
|
30
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
31
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
'creator.name': z.ZodString;
|
|
34
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
35
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
36
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
service: string;
|
|
40
|
+
data: {
|
|
41
|
+
message: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
'creator.name': string;
|
|
44
|
+
url?: string | undefined;
|
|
45
|
+
urlName?: string | undefined;
|
|
46
|
+
flowId?: string | undefined;
|
|
47
|
+
botId?: string | undefined;
|
|
48
|
+
'creator.userId'?: string | undefined;
|
|
49
|
+
'creator.multiUserId'?: string | undefined;
|
|
50
|
+
'creator.flowId'?: string | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
service: string;
|
|
56
|
+
data: {
|
|
57
|
+
message: string;
|
|
58
|
+
icon: string;
|
|
59
|
+
'creator.name': string;
|
|
60
|
+
url?: string | undefined;
|
|
61
|
+
urlName?: string | undefined;
|
|
62
|
+
flowId?: string | undefined;
|
|
63
|
+
botId?: string | undefined;
|
|
64
|
+
'creator.userId'?: string | undefined;
|
|
65
|
+
'creator.multiUserId'?: string | undefined;
|
|
66
|
+
'creator.flowId'?: string | undefined;
|
|
67
|
+
} & {
|
|
68
|
+
[k: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
export type CreateTrailEvent = Omit<z.infer<typeof createTrailEventSchema>, never>;
|
|
72
|
+
//# sourceMappingURL=createTrailEvent.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTrailEvent.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/createTrailEvent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listTrailEventsParamsSchema: z.ZodObject<{
|
|
3
|
+
service: z.ZodString;
|
|
4
|
+
from: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
dateFrom: z.ZodOptional<z.ZodDate>;
|
|
7
|
+
dateTo: z.ZodOptional<z.ZodDate>;
|
|
8
|
+
id: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
9
|
+
userId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
creatorName: z.ZodString;
|
|
13
|
+
creatorUserId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
creatorMultiUserId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
creatorFlowId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
service: string;
|
|
18
|
+
creatorName: string;
|
|
19
|
+
flowId?: string | undefined;
|
|
20
|
+
botId?: string | undefined;
|
|
21
|
+
id?: string | undefined;
|
|
22
|
+
userId?: string | undefined;
|
|
23
|
+
from?: number | undefined;
|
|
24
|
+
size?: number | undefined;
|
|
25
|
+
dateFrom?: Date | undefined;
|
|
26
|
+
dateTo?: Date | undefined;
|
|
27
|
+
creatorUserId?: string | undefined;
|
|
28
|
+
creatorMultiUserId?: string | undefined;
|
|
29
|
+
creatorFlowId?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
service: string;
|
|
32
|
+
creatorName: string;
|
|
33
|
+
flowId?: string | undefined;
|
|
34
|
+
botId?: string | undefined;
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
userId?: string | undefined;
|
|
37
|
+
from?: number | undefined;
|
|
38
|
+
size?: number | undefined;
|
|
39
|
+
dateFrom?: Date | undefined;
|
|
40
|
+
dateTo?: Date | undefined;
|
|
41
|
+
creatorUserId?: string | undefined;
|
|
42
|
+
creatorMultiUserId?: string | undefined;
|
|
43
|
+
creatorFlowId?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export type ListTrailEventsParams = Omit<z.infer<typeof listTrailEventsParamsSchema>, never>;
|
|
46
|
+
//# sourceMappingURL=listTrailEvents.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTrailEvents.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/listTrailEvents.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const trailEventAttributesSchema: z.ZodObject<{
|
|
3
|
+
message: z.ZodString;
|
|
4
|
+
icon: z.ZodString;
|
|
5
|
+
url: z.ZodOptional<z.ZodString>;
|
|
6
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
7
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
'creator.name': z.ZodString;
|
|
10
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
11
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
12
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
icon: z.ZodString;
|
|
16
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
'creator.name': z.ZodString;
|
|
21
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
22
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
23
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
25
|
+
message: z.ZodString;
|
|
26
|
+
icon: z.ZodString;
|
|
27
|
+
url: z.ZodOptional<z.ZodString>;
|
|
28
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
29
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
'creator.name': z.ZodString;
|
|
32
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
33
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
34
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
36
|
+
export type TrailEventAttributes = z.infer<typeof trailEventAttributesSchema>;
|
|
37
|
+
export declare const trailEventSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodReadonly<z.ZodString>;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
accountId: z.ZodString;
|
|
41
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
timestamp: z.ZodReadonly<z.ZodDate>;
|
|
43
|
+
attributes: z.ZodObject<{
|
|
44
|
+
message: z.ZodString;
|
|
45
|
+
icon: z.ZodString;
|
|
46
|
+
url: z.ZodOptional<z.ZodString>;
|
|
47
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
48
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
49
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
'creator.name': z.ZodString;
|
|
51
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
52
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
53
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
55
|
+
message: z.ZodString;
|
|
56
|
+
icon: z.ZodString;
|
|
57
|
+
url: z.ZodOptional<z.ZodString>;
|
|
58
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
59
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
60
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
'creator.name': z.ZodString;
|
|
62
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
63
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
64
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
66
|
+
message: z.ZodString;
|
|
67
|
+
icon: z.ZodString;
|
|
68
|
+
url: z.ZodOptional<z.ZodString>;
|
|
69
|
+
urlName: z.ZodOptional<z.ZodString>;
|
|
70
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
botId: z.ZodOptional<z.ZodString>;
|
|
72
|
+
'creator.name': z.ZodString;
|
|
73
|
+
'creator.userId': z.ZodOptional<z.ZodString>;
|
|
74
|
+
'creator.multiUserId': z.ZodOptional<z.ZodString>;
|
|
75
|
+
'creator.flowId': z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
accountId: string;
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
timestamp: Date;
|
|
82
|
+
attributes: {
|
|
83
|
+
message: string;
|
|
84
|
+
icon: string;
|
|
85
|
+
'creator.name': string;
|
|
86
|
+
url?: string | undefined;
|
|
87
|
+
urlName?: string | undefined;
|
|
88
|
+
flowId?: string | undefined;
|
|
89
|
+
botId?: string | undefined;
|
|
90
|
+
'creator.userId'?: string | undefined;
|
|
91
|
+
'creator.multiUserId'?: string | undefined;
|
|
92
|
+
'creator.flowId'?: string | undefined;
|
|
93
|
+
} & {
|
|
94
|
+
[k: string]: unknown;
|
|
95
|
+
};
|
|
96
|
+
userId?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
accountId: string;
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
timestamp: Date;
|
|
102
|
+
attributes: {
|
|
103
|
+
message: string;
|
|
104
|
+
icon: string;
|
|
105
|
+
'creator.name': string;
|
|
106
|
+
url?: string | undefined;
|
|
107
|
+
urlName?: string | undefined;
|
|
108
|
+
flowId?: string | undefined;
|
|
109
|
+
botId?: string | undefined;
|
|
110
|
+
'creator.userId'?: string | undefined;
|
|
111
|
+
'creator.multiUserId'?: string | undefined;
|
|
112
|
+
'creator.flowId'?: string | undefined;
|
|
113
|
+
} & {
|
|
114
|
+
[k: string]: unknown;
|
|
115
|
+
};
|
|
116
|
+
userId?: string | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export type TrailEvent = Omit<z.infer<typeof trailEventSchema>, never>;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=trailEvent.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailEvent.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/trailEvent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAwBhB,CAAC;AAEjB,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { Token } from '@or-sdk/base';
|
|
2
|
-
export type NotificationsConfig = {
|
|
3
|
-
token: Token;
|
|
4
|
-
discoveryUrl?: string;
|
|
5
|
-
notificationsUrl?: string;
|
|
6
|
-
accountId?: string;
|
|
7
|
-
};
|
|
8
1
|
export type ListNotificationsParams = {
|
|
9
2
|
from?: number;
|
|
10
3
|
size?: number;
|
|
@@ -61,26 +54,4 @@ export type SAListNotifications = {
|
|
|
61
54
|
tags?: string[];
|
|
62
55
|
};
|
|
63
56
|
};
|
|
64
|
-
export type NewTrailEvent = {
|
|
65
|
-
service: string;
|
|
66
|
-
data: {
|
|
67
|
-
message: string;
|
|
68
|
-
icon?: string;
|
|
69
|
-
urlName?: string;
|
|
70
|
-
url?: string;
|
|
71
|
-
[key: string]: unknown;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export type ListTrailParams = {
|
|
75
|
-
from?: number;
|
|
76
|
-
size?: number;
|
|
77
|
-
service?: string;
|
|
78
|
-
};
|
|
79
|
-
export type TrailEvent = {
|
|
80
|
-
id: string;
|
|
81
|
-
data: {
|
|
82
|
-
message: string;
|
|
83
|
-
};
|
|
84
|
-
dateCreated: Date;
|
|
85
|
-
};
|
|
86
57
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,IAAI,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/notifications",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"dev": "pnpm build:watch:esm"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@or-sdk/base": "^0.39.2"
|
|
21
|
+
"@or-sdk/base": "^0.39.2",
|
|
22
|
+
"zod": "^3.22.4"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"concurrently": "9.0.1",
|
|
@@ -27,5 +28,5 @@
|
|
|
27
28
|
"publishConfig": {
|
|
28
29
|
"access": "public"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "def6c1982fcefc97f2f7fdad5892ec95d1535c3a"
|
|
31
32
|
}
|
package/src/Notifications.ts
CHANGED
|
@@ -1,42 +1,89 @@
|
|
|
1
1
|
import { Base } from '@or-sdk/base';
|
|
2
|
+
|
|
2
3
|
import { SERVICE_KEY } from './constants';
|
|
3
4
|
import {
|
|
5
|
+
notificationsConfigSchema,
|
|
6
|
+
createTrailEventSchema,
|
|
7
|
+
listTrailEventsParamsSchema,
|
|
8
|
+
trailEventSchema,
|
|
9
|
+
} from './schemas';
|
|
10
|
+
import type {
|
|
11
|
+
CreateTrailEvent,
|
|
12
|
+
ListTrailEventsParams,
|
|
13
|
+
NotificationsConfig,
|
|
14
|
+
TrailEvent,
|
|
15
|
+
} from './schemas';
|
|
16
|
+
import type {
|
|
4
17
|
FullNotificationItem,
|
|
5
18
|
ListNotificationsParams,
|
|
6
|
-
ListTrailParams,
|
|
7
|
-
NewTrailEvent,
|
|
8
19
|
NewUserNotification,
|
|
9
20
|
NotificationItem,
|
|
10
|
-
NotificationsConfig,
|
|
11
21
|
SACreateNotificationParams,
|
|
12
22
|
SAListNotifications,
|
|
13
|
-
TrailEvent,
|
|
14
23
|
} from './types';
|
|
15
24
|
|
|
16
25
|
/**
|
|
17
26
|
* OneReach Notifications service client
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* ## Installation:
|
|
29
|
+
*
|
|
30
|
+
* ```sh
|
|
31
|
+
* npm i '@or-sdk/notifications'
|
|
21
32
|
* ```
|
|
22
33
|
*/
|
|
23
34
|
export class Notifications extends Base {
|
|
35
|
+
private readonly validateInputs: boolean;
|
|
36
|
+
private readonly validateOutputs: boolean;
|
|
37
|
+
|
|
24
38
|
/**
|
|
39
|
+
* To create Notifications client do:
|
|
40
|
+
*
|
|
25
41
|
* ```typescript
|
|
26
|
-
* import { Notifications } from '@or-sdk/notifications'
|
|
27
|
-
*
|
|
42
|
+
* import { Notifications } from '@or-sdk/notifications';
|
|
43
|
+
*
|
|
44
|
+
* const notifications = new Notifications({
|
|
45
|
+
* token: () => token,
|
|
46
|
+
* notificationsUrl: 'https://notifications.api.example.com',
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* or with service discovery URL:
|
|
51
|
+
*
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const notifications = new Notifications({
|
|
54
|
+
* token: () => token,
|
|
55
|
+
* discoveryUrl: 'https://discovery.api.example.com',
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* ## Validation
|
|
60
|
+
*
|
|
61
|
+
* To disable validation of input params and/or output results do:
|
|
62
|
+
*
|
|
63
|
+
* ```typescript
|
|
64
|
+
* import { Notifications } from '@or-sdk/notifications';
|
|
65
|
+
*
|
|
66
|
+
* const notifications = new Notifications({
|
|
67
|
+
* // ...
|
|
68
|
+
* validateInputs: false, // to disable validation of client methods' arguments
|
|
69
|
+
* validateOutputs: false, // to disable validation of client methods' results
|
|
70
|
+
* });
|
|
28
71
|
* ```
|
|
29
72
|
*/
|
|
30
73
|
constructor(params: NotificationsConfig) {
|
|
31
|
-
const
|
|
74
|
+
const parsedParams = params.validateInputs ? notificationsConfigSchema.parse(params) : params;
|
|
75
|
+
const { token, discoveryUrl, accountId, notificationsUrl, validateInputs, validateOutputs } = parsedParams;
|
|
32
76
|
|
|
33
77
|
super({
|
|
34
78
|
token,
|
|
35
|
-
|
|
79
|
+
serviceUrl: notificationsUrl,
|
|
80
|
+
discoveryUrl: discoveryUrl,
|
|
36
81
|
serviceKey: SERVICE_KEY,
|
|
37
82
|
accountId,
|
|
38
|
-
serviceUrl: notificationsUrl,
|
|
39
83
|
});
|
|
84
|
+
|
|
85
|
+
this.validateInputs = validateInputs ?? true;
|
|
86
|
+
this.validateOutputs = validateOutputs ?? true;
|
|
40
87
|
}
|
|
41
88
|
|
|
42
89
|
/**
|
|
@@ -46,7 +93,7 @@ export class Notifications extends Base {
|
|
|
46
93
|
* ```
|
|
47
94
|
*/
|
|
48
95
|
public async listNotifications(params = {} as ListNotificationsParams): Promise<NotificationItem[]> {
|
|
49
|
-
return this.callApiV2({
|
|
96
|
+
return await this.callApiV2({
|
|
50
97
|
route: '/user',
|
|
51
98
|
method: 'GET',
|
|
52
99
|
params,
|
|
@@ -59,8 +106,8 @@ export class Notifications extends Base {
|
|
|
59
106
|
* await notifications.markSeen();
|
|
60
107
|
* ```
|
|
61
108
|
*/
|
|
62
|
-
public async markSeen(): Promise<
|
|
63
|
-
|
|
109
|
+
public async markSeen(): Promise<void> {
|
|
110
|
+
await this.callApiV2({
|
|
64
111
|
route: '/user',
|
|
65
112
|
method: 'POST',
|
|
66
113
|
});
|
|
@@ -72,8 +119,8 @@ export class Notifications extends Base {
|
|
|
72
119
|
* await notifications.createUserNotification({type, data});
|
|
73
120
|
* ```
|
|
74
121
|
*/
|
|
75
|
-
public async createUserNotification(data: NewUserNotification): Promise<
|
|
76
|
-
|
|
122
|
+
public async createUserNotification(data: NewUserNotification): Promise<void> {
|
|
123
|
+
await this.callApiV2({
|
|
77
124
|
route: '/user',
|
|
78
125
|
method: 'PUT',
|
|
79
126
|
data,
|
|
@@ -86,8 +133,8 @@ export class Notifications extends Base {
|
|
|
86
133
|
* await notifications.SACreateNotification({type, data, accountId, userId, dateCreated, parentId});
|
|
87
134
|
* ```
|
|
88
135
|
*/
|
|
89
|
-
public async SACreateNotification(params: SACreateNotificationParams): Promise<
|
|
90
|
-
|
|
136
|
+
public async SACreateNotification(params: SACreateNotificationParams): Promise<void> {
|
|
137
|
+
await this.callApiV2({
|
|
91
138
|
route: '/service',
|
|
92
139
|
method: 'PUT',
|
|
93
140
|
data: params,
|
|
@@ -114,9 +161,9 @@ export class Notifications extends Base {
|
|
|
114
161
|
* await notifications.SAUpdateNotification(id, {type, data, accountId, userId, dateCreated, parentId});
|
|
115
162
|
* ```
|
|
116
163
|
*/
|
|
117
|
-
public async SAUpdateNotification(id: string, data: FullNotificationItem): Promise<
|
|
118
|
-
|
|
119
|
-
route: `/service/${id}`,
|
|
164
|
+
public async SAUpdateNotification(id: string, data: FullNotificationItem): Promise<void> {
|
|
165
|
+
await this.callApiV2({
|
|
166
|
+
route: `/service/${encodeURIComponent(id)}`,
|
|
120
167
|
method: 'POST',
|
|
121
168
|
data,
|
|
122
169
|
});
|
|
@@ -128,41 +175,43 @@ export class Notifications extends Base {
|
|
|
128
175
|
* await notifications.SADeleteNotification(id);
|
|
129
176
|
* ```
|
|
130
177
|
*/
|
|
131
|
-
public async SADeleteNotification(id: string): Promise<
|
|
132
|
-
|
|
133
|
-
route: `/service/${id}`,
|
|
178
|
+
public async SADeleteNotification(id: string): Promise<void> {
|
|
179
|
+
await this.callApiV2({
|
|
180
|
+
route: `/service/${encodeURIComponent(id)}`,
|
|
134
181
|
method: 'DELETE',
|
|
135
182
|
});
|
|
136
183
|
}
|
|
137
184
|
|
|
138
185
|
/**
|
|
139
|
-
* Create trail event
|
|
186
|
+
* Create new trail event
|
|
187
|
+
*
|
|
140
188
|
* ```typescript
|
|
141
|
-
* await notifications.createTrailEvent({service, data});
|
|
189
|
+
* await notifications.createTrailEvent({service: 'pgsql', data});
|
|
142
190
|
* ```
|
|
143
191
|
*/
|
|
144
|
-
public async createTrailEvent(data:
|
|
145
|
-
|
|
146
|
-
|
|
192
|
+
public async createTrailEvent(data: CreateTrailEvent): Promise<void> {
|
|
193
|
+
const parsedData = this.validateInputs ? createTrailEventSchema.parse(data) : data;
|
|
194
|
+
await this.callApiV2({
|
|
195
|
+
route: `/trail/${encodeURIComponent(parsedData.service)}`,
|
|
147
196
|
method: 'PUT',
|
|
148
|
-
data:
|
|
197
|
+
data: parsedData.data,
|
|
149
198
|
});
|
|
150
199
|
}
|
|
151
200
|
|
|
152
|
-
|
|
153
201
|
/**
|
|
154
|
-
* List trail
|
|
202
|
+
* List trail events
|
|
203
|
+
*
|
|
155
204
|
* ```typescript
|
|
156
|
-
* await notifications.listTrailEvents({
|
|
205
|
+
* await notifications.listTrailEvents({ service: 'pgsql' });
|
|
157
206
|
* ```
|
|
158
207
|
*/
|
|
159
|
-
public async listTrailEvents(params
|
|
160
|
-
|
|
208
|
+
public async listTrailEvents(params: ListTrailEventsParams): Promise<TrailEvent[]> {
|
|
209
|
+
const parsedParams = this.validateInputs ? listTrailEventsParamsSchema.parse(params) : params;
|
|
210
|
+
const response = await this.callApiV2<TrailEvent[]>({
|
|
161
211
|
route: '/trail',
|
|
162
212
|
method: 'GET',
|
|
163
|
-
params,
|
|
213
|
+
params: parsedParams,
|
|
164
214
|
});
|
|
215
|
+
return this.validateOutputs ? trailEventSchema.array().parse(response) : response;
|
|
165
216
|
}
|
|
166
217
|
}
|
|
167
|
-
|
|
168
|
-
|