@or-sdk/notifications 1.1.20 → 1.2.0-beta.2979.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/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 -4
- 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
|
@@ -54,59 +54,83 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
54
54
|
exports.Notifications = void 0;
|
|
55
55
|
var base_1 = require("@or-sdk/base");
|
|
56
56
|
var constants_1 = require("./constants");
|
|
57
|
+
var schemas_1 = require("./schemas");
|
|
57
58
|
var Notifications = (function (_super) {
|
|
58
59
|
__extends(Notifications, _super);
|
|
59
60
|
function Notifications(params) {
|
|
60
|
-
var
|
|
61
|
-
|
|
61
|
+
var _this = this;
|
|
62
|
+
var parsedParams = params.validateInputs ? schemas_1.notificationsConfigSchema.parse(params) : params;
|
|
63
|
+
var token = parsedParams.token, discoveryUrl = parsedParams.discoveryUrl, accountId = parsedParams.accountId, notificationsUrl = parsedParams.notificationsUrl, validateInputs = parsedParams.validateInputs, validateOutputs = parsedParams.validateOutputs;
|
|
64
|
+
_this = _super.call(this, {
|
|
62
65
|
token: token,
|
|
66
|
+
serviceUrl: notificationsUrl,
|
|
63
67
|
discoveryUrl: discoveryUrl,
|
|
64
68
|
serviceKey: constants_1.SERVICE_KEY,
|
|
65
69
|
accountId: accountId,
|
|
66
|
-
serviceUrl: notificationsUrl,
|
|
67
70
|
}) || this;
|
|
71
|
+
_this.validateInputs = validateInputs !== null && validateInputs !== void 0 ? validateInputs : true;
|
|
72
|
+
_this.validateOutputs = validateOutputs !== null && validateOutputs !== void 0 ? validateOutputs : true;
|
|
73
|
+
return _this;
|
|
68
74
|
}
|
|
69
75
|
Notifications.prototype.listNotifications = function () {
|
|
70
76
|
return __awaiter(this, arguments, void 0, function (params) {
|
|
71
77
|
if (params === void 0) { params = {}; }
|
|
72
78
|
return __generator(this, function (_a) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4, this.callApiV2({
|
|
81
|
+
route: '/user',
|
|
82
|
+
method: 'GET',
|
|
83
|
+
params: params,
|
|
84
|
+
})];
|
|
85
|
+
case 1: return [2, _a.sent()];
|
|
86
|
+
}
|
|
78
87
|
});
|
|
79
88
|
});
|
|
80
89
|
};
|
|
81
90
|
Notifications.prototype.markSeen = function () {
|
|
82
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
92
|
return __generator(this, function (_a) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4, this.callApiV2({
|
|
95
|
+
route: '/user',
|
|
96
|
+
method: 'POST',
|
|
97
|
+
})];
|
|
98
|
+
case 1:
|
|
99
|
+
_a.sent();
|
|
100
|
+
return [2];
|
|
101
|
+
}
|
|
88
102
|
});
|
|
89
103
|
});
|
|
90
104
|
};
|
|
91
105
|
Notifications.prototype.createUserNotification = function (data) {
|
|
92
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
107
|
return __generator(this, function (_a) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
switch (_a.label) {
|
|
109
|
+
case 0: return [4, this.callApiV2({
|
|
110
|
+
route: '/user',
|
|
111
|
+
method: 'PUT',
|
|
112
|
+
data: data,
|
|
113
|
+
})];
|
|
114
|
+
case 1:
|
|
115
|
+
_a.sent();
|
|
116
|
+
return [2];
|
|
117
|
+
}
|
|
99
118
|
});
|
|
100
119
|
});
|
|
101
120
|
};
|
|
102
121
|
Notifications.prototype.SACreateNotification = function (params) {
|
|
103
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
104
123
|
return __generator(this, function (_a) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
switch (_a.label) {
|
|
125
|
+
case 0: return [4, this.callApiV2({
|
|
126
|
+
route: '/service',
|
|
127
|
+
method: 'PUT',
|
|
128
|
+
data: params,
|
|
129
|
+
})];
|
|
130
|
+
case 1:
|
|
131
|
+
_a.sent();
|
|
132
|
+
return [2];
|
|
133
|
+
}
|
|
110
134
|
});
|
|
111
135
|
});
|
|
112
136
|
};
|
|
@@ -125,44 +149,69 @@ var Notifications = (function (_super) {
|
|
|
125
149
|
Notifications.prototype.SAUpdateNotification = function (id, data) {
|
|
126
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
151
|
return __generator(this, function (_a) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
152
|
+
switch (_a.label) {
|
|
153
|
+
case 0: return [4, this.callApiV2({
|
|
154
|
+
route: "/service/".concat(encodeURIComponent(id)),
|
|
155
|
+
method: 'POST',
|
|
156
|
+
data: data,
|
|
157
|
+
})];
|
|
158
|
+
case 1:
|
|
159
|
+
_a.sent();
|
|
160
|
+
return [2];
|
|
161
|
+
}
|
|
133
162
|
});
|
|
134
163
|
});
|
|
135
164
|
};
|
|
136
165
|
Notifications.prototype.SADeleteNotification = function (id) {
|
|
137
166
|
return __awaiter(this, void 0, void 0, function () {
|
|
138
167
|
return __generator(this, function (_a) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0: return [4, this.callApiV2({
|
|
170
|
+
route: "/service/".concat(encodeURIComponent(id)),
|
|
171
|
+
method: 'DELETE',
|
|
172
|
+
})];
|
|
173
|
+
case 1:
|
|
174
|
+
_a.sent();
|
|
175
|
+
return [2];
|
|
176
|
+
}
|
|
143
177
|
});
|
|
144
178
|
});
|
|
145
179
|
};
|
|
146
180
|
Notifications.prototype.createTrailEvent = function (data) {
|
|
147
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
182
|
+
var parsedData;
|
|
148
183
|
return __generator(this, function (_a) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
184
|
+
switch (_a.label) {
|
|
185
|
+
case 0:
|
|
186
|
+
parsedData = this.validateInputs ? schemas_1.createTrailEventSchema.parse(data) : data;
|
|
187
|
+
return [4, this.callApiV2({
|
|
188
|
+
route: "/trail/".concat(encodeURIComponent(parsedData.service)),
|
|
189
|
+
method: 'PUT',
|
|
190
|
+
data: parsedData.data,
|
|
191
|
+
})];
|
|
192
|
+
case 1:
|
|
193
|
+
_a.sent();
|
|
194
|
+
return [2];
|
|
195
|
+
}
|
|
154
196
|
});
|
|
155
197
|
});
|
|
156
198
|
};
|
|
157
|
-
Notifications.prototype.listTrailEvents = function () {
|
|
158
|
-
return __awaiter(this,
|
|
159
|
-
|
|
199
|
+
Notifications.prototype.listTrailEvents = function (params) {
|
|
200
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
201
|
+
var parsedParams, response;
|
|
160
202
|
return __generator(this, function (_a) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
203
|
+
switch (_a.label) {
|
|
204
|
+
case 0:
|
|
205
|
+
parsedParams = this.validateInputs ? schemas_1.listTrailEventsParamsSchema.parse(params) : params;
|
|
206
|
+
return [4, this.callApiV2({
|
|
207
|
+
route: '/trail',
|
|
208
|
+
method: 'GET',
|
|
209
|
+
params: parsedParams,
|
|
210
|
+
})];
|
|
211
|
+
case 1:
|
|
212
|
+
response = _a.sent();
|
|
213
|
+
return [2, this.validateOutputs ? schemas_1.trailEventSchema.array().parse(response) : response];
|
|
214
|
+
}
|
|
166
215
|
});
|
|
167
216
|
});
|
|
168
217
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;
|
|
1
|
+
{"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAEpC,yCAA0C;AAC1C,qCAKmB;AAyBnB;IAAmC,iCAAI;IAuCrC,uBAAY,MAA2B;QAAvC,iBAcC;QAbC,IAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACtF,IAAA,KAAK,GAAiF,YAAY,MAA7F,EAAE,YAAY,GAAmE,YAAY,aAA/E,EAAE,SAAS,GAAwD,YAAY,UAApE,EAAE,gBAAgB,GAAsC,YAAY,iBAAlD,EAAE,cAAc,GAAsB,YAAY,eAAlC,EAAE,eAAe,GAAK,YAAY,gBAAjB,CAAkB;QAE3G,QAAA,MAAK,YAAC;YACJ,KAAK,OAAA;YACL,UAAU,EAAE,gBAAgB;YAC5B,YAAY,EAAE,YAAY;YAC1B,UAAU,EAAE,uBAAW;YACvB,SAAS,WAAA;SACV,CAAC,SAAC;QAEH,KAAI,CAAC,cAAc,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC;QAC7C,KAAI,CAAC,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,e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ar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
var Notifications_1 = require("./Notifications");
|
|
19
|
-
Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return Notifications_1.Notifications; } });
|
|
17
|
+
__exportStar(require("./Notifications"), exports);
|
|
20
18
|
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./schemas"), exports);
|
|
21
20
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0CAAwB;AACxB,4CAA0B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notificationsConfigSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var baseNotificationsConfig = zod_1.z.object({
|
|
6
|
+
token: zod_1.z.union([
|
|
7
|
+
zod_1.z.string().min(1),
|
|
8
|
+
zod_1.z.function().args().returns(zod_1.z.string()),
|
|
9
|
+
]).describe('Authorization token or factory function'),
|
|
10
|
+
accountId: zod_1.z.string().uuid().optional().describe('Account ID for cross-account requests'),
|
|
11
|
+
validateInputs: zod_1.z.boolean().optional().describe('If true validate inputs'),
|
|
12
|
+
validateOutputs: zod_1.z.boolean().optional().describe('If true validate outputs'),
|
|
13
|
+
});
|
|
14
|
+
exports.notificationsConfigSchema = zod_1.z.union([
|
|
15
|
+
baseNotificationsConfig.extend({
|
|
16
|
+
discoveryUrl: zod_1.z.undefined(),
|
|
17
|
+
notificationsUrl: zod_1.z.string().url().describe('URL of notifications API service'),
|
|
18
|
+
}),
|
|
19
|
+
baseNotificationsConfig.extend({
|
|
20
|
+
discoveryUrl: zod_1.z.string().url().describe('URL of service discovery API'),
|
|
21
|
+
notificationsUrl: zod_1.z.undefined(),
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
24
|
+
//# sourceMappingURL=config.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.schema.js","sourceRoot":"","sources":["../../../src/schemas/config.schema.ts"],"names":[],"mappings":";;;AACA,2BAAwB;AAExB,IAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAEvC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC;QACb,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,OAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;KACxC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAA4B;IAEjF,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAGzF,cAAc,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAE1E,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAC7E,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,OAAC,CAAC,KAAK,CAAC;IAC/C,uBAAuB,CAAC,MAAM,CAAC;QAE7B,YAAY,EAAE,OAAC,CAAC,SAAS,EAAE;QAE3B,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAChF,CAAC;IACF,uBAAuB,CAAC,MAAM,CAAC;QAE7B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QAEvE,gBAAgB,EAAE,OAAC,CAAC,SAAS,EAAE;KAChC,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTrailEventSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var trailEvent_schema_1 = require("./trailEvent.schema");
|
|
6
|
+
exports.createTrailEventSchema = zod_1.z.object({
|
|
7
|
+
service: trailEvent_schema_1.trailEventSchema.shape.name,
|
|
8
|
+
data: trailEvent_schema_1.trailEventSchema.shape.attributes,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=createTrailEvent.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTrailEvent.schema.js","sourceRoot":"","sources":["../../../src/schemas/createTrailEvent.schema.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAExB,yDAAuD;AAE1C,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAE7C,OAAO,EAAE,oCAAgB,CAAC,KAAK,CAAC,IAAI;IAEpC,IAAI,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU;CACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config.schema"), exports);
|
|
18
|
+
__exportStar(require("./createTrailEvent.schema"), exports);
|
|
19
|
+
__exportStar(require("./listTrailEvents.schema"), exports);
|
|
20
|
+
__exportStar(require("./trailEvent.schema"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,4DAA0C;AAC1C,2DAAyC;AACzC,sDAAoC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTrailEventsParamsSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var trailEvent_schema_1 = require("./trailEvent.schema");
|
|
6
|
+
exports.listTrailEventsParamsSchema = zod_1.z.object({
|
|
7
|
+
service: trailEvent_schema_1.trailEventSchema.shape.name,
|
|
8
|
+
from: zod_1.z.number().int().min(0).optional().describe('The starting point for the list of events'),
|
|
9
|
+
size: zod_1.z.number().min(1).optional().describe('The number of events to retrieve'),
|
|
10
|
+
dateFrom: zod_1.z.coerce.date().optional().describe('The start date for filtering events'),
|
|
11
|
+
dateTo: zod_1.z.coerce.date().optional().describe('The end date for filtering events'),
|
|
12
|
+
id: trailEvent_schema_1.trailEventSchema.shape.id.optional(),
|
|
13
|
+
userId: trailEvent_schema_1.trailEventSchema.shape.userId.optional(),
|
|
14
|
+
flowId: trailEvent_schema_1.trailEventSchema.shape.attributes.shape.flowId,
|
|
15
|
+
botId: trailEvent_schema_1.trailEventSchema.shape.attributes.shape.botId,
|
|
16
|
+
creatorName: trailEvent_schema_1.trailEventSchema.shape.attributes.shape['creator.name'],
|
|
17
|
+
creatorUserId: trailEvent_schema_1.trailEventSchema.shape.attributes.shape['creator.userId'],
|
|
18
|
+
creatorMultiUserId: trailEvent_schema_1.trailEventSchema.shape.attributes.shape['creator.multiUserId'],
|
|
19
|
+
creatorFlowId: trailEvent_schema_1.trailEventSchema.shape.attributes.shape['creator.flowId'],
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=listTrailEvents.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTrailEvents.schema.js","sourceRoot":"","sources":["../../../src/schemas/listTrailEvents.schema.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAExB,yDAAuD;AAE1C,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAElD,OAAO,EAAE,oCAAgB,CAAC,KAAK,CAAC,IAAI;IAGpC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAE9F,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAG/E,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAEpF,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAGhF,EAAE,EAAE,oCAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;IAExC,MAAM,EAAE,oCAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;IAGhD,MAAM,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM;IAEtD,KAAK,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;IAGpD,WAAW,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC;IAEpE,aAAa,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAExE,kBAAkB,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAElF,aAAa,EAAE,oCAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC;CACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trailEventSchema = void 0;
|
|
4
|
+
var zod_1 = require("zod");
|
|
5
|
+
var trailEventAttributesSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().min(1).describe('The message to be displayed in the notification'),
|
|
7
|
+
icon: zod_1.z.string().min(1).describe('The icon to be displayed in the notification'),
|
|
8
|
+
url: zod_1.z.string().url().optional().describe('The URL to be opened when the notification is clicked'),
|
|
9
|
+
urlName: zod_1.z.string().min(1).optional().describe('The name of the URL to be displayed in the notification'),
|
|
10
|
+
flowId: zod_1.z.string().uuid().optional().describe('The flow ID associated with the event'),
|
|
11
|
+
botId: zod_1.z.string().uuid().optional().describe('The bot ID associated with the event'),
|
|
12
|
+
'creator.name': zod_1.z.string().min(1).describe('The name of the creator of the event'),
|
|
13
|
+
'creator.userId': zod_1.z.string().uuid().optional().describe('The user ID of the creator of the event'),
|
|
14
|
+
'creator.multiUserId': zod_1.z.string().uuid().optional().describe('The multi-user ID of the creator of the event'),
|
|
15
|
+
'creator.flowId': zod_1.z.string().uuid().optional().describe('The flow ID of the creator of the event'),
|
|
16
|
+
}).passthrough();
|
|
17
|
+
exports.trailEventSchema = zod_1.z.object({
|
|
18
|
+
id: zod_1.z.string().uuid().readonly().describe('Unique identifier of the trail event'),
|
|
19
|
+
name: zod_1.z.string().min(1).describe('The service that triggered the event'),
|
|
20
|
+
accountId: zod_1.z.string().uuid().describe('Account ID related to the trail event'),
|
|
21
|
+
userId: zod_1.z.string().uuid().optional().describe('User ID related to the trail event'),
|
|
22
|
+
timestamp: zod_1.z.date().readonly().describe('Date-time of the trail event as ISO date-time string'),
|
|
23
|
+
attributes: trailEventAttributesSchema,
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=trailEvent.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailEvent.schema.js","sourceRoot":"","sources":["../../../src/schemas/trailEvent.schema.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAExB,IAAM,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAE1C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IAEtF,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IAGhF,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAElG,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC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AE,OAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAE/F,UAAU,EAAE,0BAA0B;CACvC,CAAC,CAAC"}
|
|
@@ -9,20 +9,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Base } from '@or-sdk/base';
|
|
11
11
|
import { SERVICE_KEY } from './constants';
|
|
12
|
+
import { notificationsConfigSchema, createTrailEventSchema, listTrailEventsParamsSchema, trailEventSchema, } from './schemas';
|
|
12
13
|
export class Notifications extends Base {
|
|
13
14
|
constructor(params) {
|
|
14
|
-
const
|
|
15
|
+
const parsedParams = params.validateInputs ? notificationsConfigSchema.parse(params) : params;
|
|
16
|
+
const { token, discoveryUrl, accountId, notificationsUrl, validateInputs, validateOutputs } = parsedParams;
|
|
15
17
|
super({
|
|
16
18
|
token,
|
|
17
|
-
|
|
19
|
+
serviceUrl: notificationsUrl,
|
|
20
|
+
discoveryUrl: discoveryUrl,
|
|
18
21
|
serviceKey: SERVICE_KEY,
|
|
19
22
|
accountId,
|
|
20
|
-
serviceUrl: notificationsUrl,
|
|
21
23
|
});
|
|
24
|
+
this.validateInputs = validateInputs !== null && validateInputs !== void 0 ? validateInputs : true;
|
|
25
|
+
this.validateOutputs = validateOutputs !== null && validateOutputs !== void 0 ? validateOutputs : true;
|
|
22
26
|
}
|
|
23
27
|
listNotifications() {
|
|
24
28
|
return __awaiter(this, arguments, void 0, function* (params = {}) {
|
|
25
|
-
return this.callApiV2({
|
|
29
|
+
return yield this.callApiV2({
|
|
26
30
|
route: '/user',
|
|
27
31
|
method: 'GET',
|
|
28
32
|
params,
|
|
@@ -31,7 +35,7 @@ export class Notifications extends Base {
|
|
|
31
35
|
}
|
|
32
36
|
markSeen() {
|
|
33
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
38
|
+
yield this.callApiV2({
|
|
35
39
|
route: '/user',
|
|
36
40
|
method: 'POST',
|
|
37
41
|
});
|
|
@@ -39,7 +43,7 @@ export class Notifications extends Base {
|
|
|
39
43
|
}
|
|
40
44
|
createUserNotification(data) {
|
|
41
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
|
|
46
|
+
yield this.callApiV2({
|
|
43
47
|
route: '/user',
|
|
44
48
|
method: 'PUT',
|
|
45
49
|
data,
|
|
@@ -48,7 +52,7 @@ export class Notifications extends Base {
|
|
|
48
52
|
}
|
|
49
53
|
SACreateNotification(params) {
|
|
50
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
|
|
55
|
+
yield this.callApiV2({
|
|
52
56
|
route: '/service',
|
|
53
57
|
method: 'PUT',
|
|
54
58
|
data: params,
|
|
@@ -66,8 +70,8 @@ export class Notifications extends Base {
|
|
|
66
70
|
}
|
|
67
71
|
SAUpdateNotification(id, data) {
|
|
68
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
70
|
-
route: `/service/${id}`,
|
|
73
|
+
yield this.callApiV2({
|
|
74
|
+
route: `/service/${encodeURIComponent(id)}`,
|
|
71
75
|
method: 'POST',
|
|
72
76
|
data,
|
|
73
77
|
});
|
|
@@ -75,28 +79,31 @@ export class Notifications extends Base {
|
|
|
75
79
|
}
|
|
76
80
|
SADeleteNotification(id) {
|
|
77
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
|
|
79
|
-
route: `/service/${id}`,
|
|
82
|
+
yield this.callApiV2({
|
|
83
|
+
route: `/service/${encodeURIComponent(id)}`,
|
|
80
84
|
method: 'DELETE',
|
|
81
85
|
});
|
|
82
86
|
});
|
|
83
87
|
}
|
|
84
88
|
createTrailEvent(data) {
|
|
85
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const parsedData = this.validateInputs ? createTrailEventSchema.parse(data) : data;
|
|
91
|
+
yield this.callApiV2({
|
|
92
|
+
route: `/trail/${encodeURIComponent(parsedData.service)}`,
|
|
88
93
|
method: 'PUT',
|
|
89
|
-
data:
|
|
94
|
+
data: parsedData.data,
|
|
90
95
|
});
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
|
-
listTrailEvents() {
|
|
94
|
-
return __awaiter(this,
|
|
95
|
-
|
|
98
|
+
listTrailEvents(params) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const parsedParams = this.validateInputs ? listTrailEventsParamsSchema.parse(params) : params;
|
|
101
|
+
const response = yield this.callApiV2({
|
|
96
102
|
route: '/trail',
|
|
97
103
|
method: 'GET',
|
|
98
|
-
params,
|
|
104
|
+
params: parsedParams,
|
|
99
105
|
});
|
|
106
|
+
return this.validateOutputs ? trailEventSchema.array().parse(response) : response;
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAyBnB,MAAM,OAAO,aAAc,SAAQ,IAAI;IAuCrC,YAAY,MAA2B;QACrC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9F,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,e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","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const baseNotificationsConfig = z.object({
|
|
3
|
+
token: z.union([
|
|
4
|
+
z.string().min(1),
|
|
5
|
+
z.function().args().returns(z.string()),
|
|
6
|
+
]).describe('Authorization token or factory function'),
|
|
7
|
+
accountId: z.string().uuid().optional().describe('Account ID for cross-account requests'),
|
|
8
|
+
validateInputs: z.boolean().optional().describe('If true validate inputs'),
|
|
9
|
+
validateOutputs: z.boolean().optional().describe('If true validate outputs'),
|
|
10
|
+
});
|
|
11
|
+
export const notificationsConfigSchema = z.union([
|
|
12
|
+
baseNotificationsConfig.extend({
|
|
13
|
+
discoveryUrl: z.undefined(),
|
|
14
|
+
notificationsUrl: z.string().url().describe('URL of notifications API service'),
|
|
15
|
+
}),
|
|
16
|
+
baseNotificationsConfig.extend({
|
|
17
|
+
discoveryUrl: z.string().url().describe('URL of service discovery API'),
|
|
18
|
+
notificationsUrl: z.undefined(),
|
|
19
|
+
}),
|
|
20
|
+
]);
|
|
21
|
+
//# sourceMappingURL=config.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.schema.js","sourceRoot":"","sources":["../../../src/schemas/config.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAEvC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;QACb,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KACxC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAA4B;IAEjF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAGzF,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAE1E,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAC7E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC/C,uBAAuB,CAAC,MAAM,CAAC;QAE7B,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE;QAE3B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAChF,CAAC;IACF,uBAAuB,CAAC,MAAM,CAAC;QAE7B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QAEvE,gBAAgB,EAAE,CAAC,CAAC,SAAS,EAAE;KAChC,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { trailEventSchema } from './trailEvent.schema';
|
|
3
|
+
export const createTrailEventSchema = z.object({
|
|
4
|
+
service: trailEventSchema.shape.name,
|
|
5
|
+
data: trailEventSchema.shape.attributes,
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=createTrailEvent.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTrailEvent.schema.js","sourceRoot":"","sources":["../../../src/schemas/createTrailEvent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAE7C,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI;IAEpC,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,UAAU;CACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { trailEventSchema } from './trailEvent.schema';
|
|
3
|
+
export const listTrailEventsParamsSchema = z.object({
|
|
4
|
+
service: trailEventSchema.shape.name,
|
|
5
|
+
from: z.number().int().min(0).optional().describe('The starting point for the list of events'),
|
|
6
|
+
size: z.number().min(1).optional().describe('The number of events to retrieve'),
|
|
7
|
+
dateFrom: z.coerce.date().optional().describe('The start date for filtering events'),
|
|
8
|
+
dateTo: z.coerce.date().optional().describe('The end date for filtering events'),
|
|
9
|
+
id: trailEventSchema.shape.id.optional(),
|
|
10
|
+
userId: trailEventSchema.shape.userId.optional(),
|
|
11
|
+
flowId: trailEventSchema.shape.attributes.shape.flowId,
|
|
12
|
+
botId: trailEventSchema.shape.attributes.shape.botId,
|
|
13
|
+
creatorName: trailEventSchema.shape.attributes.shape['creator.name'],
|
|
14
|
+
creatorUserId: trailEventSchema.shape.attributes.shape['creator.userId'],
|
|
15
|
+
creatorMultiUserId: trailEventSchema.shape.attributes.shape['creator.multiUserId'],
|
|
16
|
+
creatorFlowId: trailEventSchema.shape.attributes.shape['creator.flowId'],
|
|
17
|
+
});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cAAc,CAAC;IAEpE,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAExE,kBAAkB,EAAE,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAElF,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC;CACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const trailEventAttributesSchema = z.object({
|
|
3
|
+
message: z.string().min(1).describe('The message to be displayed in the notification'),
|
|
4
|
+
icon: z.string().min(1).describe('The icon to be displayed in the notification'),
|
|
5
|
+
url: z.string().url().optional().describe('The URL to be opened when the notification is clicked'),
|
|
6
|
+
urlName: z.string().min(1).optional().describe('The name of the URL to be displayed in the notification'),
|
|
7
|
+
flowId: z.string().uuid().optional().describe('The flow ID associated with the event'),
|
|
8
|
+
botId: z.string().uuid().optional().describe('The bot ID associated with the event'),
|
|
9
|
+
'creator.name': z.string().min(1).describe('The name of the creator of the event'),
|
|
10
|
+
'creator.userId': z.string().uuid().optional().describe('The user ID of the creator of the event'),
|
|
11
|
+
'creator.multiUserId': z.string().uuid().optional().describe('The multi-user ID of the creator of the event'),
|
|
12
|
+
'creator.flowId': z.string().uuid().optional().describe('The flow ID of the creator of the event'),
|
|
13
|
+
}).passthrough();
|
|
14
|
+
export const trailEventSchema = z.object({
|
|
15
|
+
id: z.string().uuid().readonly().describe('Unique identifier of the trail event'),
|
|
16
|
+
name: z.string().min(1).describe('The service that triggered the event'),
|
|
17
|
+
accountId: z.string().uuid().describe('Account ID related to the trail event'),
|
|
18
|
+
userId: z.string().uuid().optional().describe('User ID related to the trail event'),
|
|
19
|
+
timestamp: z.date().readonly().describe('Date-time of the trail event as ISO date-time string'),
|
|
20
|
+
attributes: trailEventAttributesSchema,
|
|
21
|
+
});
|
|
22
|
+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