@livetronics/wocul-domain 1.6.0 → 1.8.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/README.md +11 -0
- package/dist/events/data.d.ts +1462 -165
- package/dist/events/data.js +11 -1
- package/dist/events/types.d.ts +3 -3
- package/dist/events/types.js +4 -1
- package/dist/intents.d.ts +6 -0
- package/dist/intents.js +7 -0
- package/dist/notifications.d.ts +9 -0
- package/dist/notifications.js +11 -1
- package/package.json +1 -1
package/dist/events/data.js
CHANGED
|
@@ -73,8 +73,10 @@ exports.eventFactsSchema = zod_1.z
|
|
|
73
73
|
idTaskQuestion: id.optional(),
|
|
74
74
|
/** APPROVED or CHANGES_REQUESTED. */
|
|
75
75
|
decision: zod_1.z.string().optional(),
|
|
76
|
-
/** CREATE, BULK_IMPORT or
|
|
76
|
+
/** CREATE, BULK_IMPORT, ROUTINE or BULK_MOVE. */
|
|
77
77
|
origin: zod_1.z.string().optional(),
|
|
78
|
+
/** When a role changed, ISO 8601: part of that email's key. */
|
|
79
|
+
changedAt: zod_1.z.string().optional(),
|
|
78
80
|
/** Why the agent wrote a comment: AI_REPLY or ASSIGNEE_WELCOME. */
|
|
79
81
|
purpose: zod_1.z.string().optional(),
|
|
80
82
|
/** The one person a change is for; null when nobody is to be told. */
|
|
@@ -223,6 +225,14 @@ exports.eventDataSchemas = {
|
|
|
223
225
|
...factual
|
|
224
226
|
})
|
|
225
227
|
.passthrough(),
|
|
228
|
+
/** Something every member may read changed; `category` says which part. */
|
|
229
|
+
'org.changed': zod_1.z
|
|
230
|
+
.object({ category: zod_1.z.string().optional(), ...factual })
|
|
231
|
+
.passthrough(),
|
|
232
|
+
/** Something of one person's own changed; `staff` names them. */
|
|
233
|
+
'staff.changed': zod_1.z
|
|
234
|
+
.object({ category: zod_1.z.string().optional(), staff, ...factual })
|
|
235
|
+
.passthrough(),
|
|
226
236
|
'notification.created': zod_1.z
|
|
227
237
|
.object({
|
|
228
238
|
idStaff: id,
|
package/dist/events/types.d.ts
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
* - intents: written to the same outbox but sent to a service's Redis
|
|
10
10
|
* stream instead of a channel. They wake the service; they are not hints.
|
|
11
11
|
*/
|
|
12
|
-
export declare const DOMAIN_EVENT_TYPES: readonly ["task.created", "task.changed", "task.removed", "comment.changed", "approval.changed", "board.changed", "project.changed", "membership.changed", "okr.changed", "run.changed", "draft.changed", "pulse.changed", "kb.changed", "cycle.closed", "dictionary.profiled", "subscription.changed", "deepwork.changed", "plan.changed"];
|
|
12
|
+
export declare const DOMAIN_EVENT_TYPES: readonly ["task.created", "task.changed", "task.removed", "comment.changed", "approval.changed", "board.changed", "project.changed", "membership.changed", "okr.changed", "run.changed", "draft.changed", "pulse.changed", "kb.changed", "cycle.closed", "dictionary.profiled", "subscription.changed", "deepwork.changed", "plan.changed", "org.changed", "staff.changed"];
|
|
13
13
|
export type DomainEventType = (typeof DOMAIN_EVENT_TYPES)[number];
|
|
14
14
|
export declare const NOTIFICATION_EVENT_TYPES: readonly ["notification.created", "notification.read"];
|
|
15
15
|
export type NotificationEventType = (typeof NOTIFICATION_EVENT_TYPES)[number];
|
|
16
16
|
/** Every type a realtime subscriber can receive. */
|
|
17
|
-
export declare const REALTIME_EVENT_TYPES: readonly ["task.created", "task.changed", "task.removed", "comment.changed", "approval.changed", "board.changed", "project.changed", "membership.changed", "okr.changed", "run.changed", "draft.changed", "pulse.changed", "kb.changed", "cycle.closed", "dictionary.profiled", "subscription.changed", "deepwork.changed", "plan.changed", "notification.created", "notification.read"];
|
|
17
|
+
export declare const REALTIME_EVENT_TYPES: readonly ["task.created", "task.changed", "task.removed", "comment.changed", "approval.changed", "board.changed", "project.changed", "membership.changed", "okr.changed", "run.changed", "draft.changed", "pulse.changed", "kb.changed", "cycle.closed", "dictionary.profiled", "subscription.changed", "deepwork.changed", "plan.changed", "org.changed", "staff.changed", "notification.created", "notification.read"];
|
|
18
18
|
export type RealtimeEventType = (typeof REALTIME_EVENT_TYPES)[number];
|
|
19
19
|
export declare const INTENT_TYPES: readonly ["notification.requested", "email.requested", "aicomment.requested", "kbproposal.requested", "run.requested"];
|
|
20
20
|
export type IntentType = (typeof INTENT_TYPES)[number];
|
|
21
|
-
export declare const ENTITY_TYPES: readonly ["task", "comment", "approval", "sprint", "kanbanColumn", "project", "member", "objective", "keyResult", "run", "draft", "pulse", "document", "cycle", "dictionary", "subscription", "deepwork", "plan", "notification", "email", "aicomment", "kbproposal", "staff"];
|
|
21
|
+
export declare const ENTITY_TYPES: readonly ["task", "comment", "approval", "sprint", "kanbanColumn", "project", "member", "objective", "keyResult", "run", "draft", "pulse", "document", "cycle", "dictionary", "subscription", "deepwork", "plan", "organisation", "notification", "email", "aicomment", "kbproposal", "staff"];
|
|
22
22
|
export type EntityType = (typeof ENTITY_TYPES)[number];
|
|
23
23
|
export declare const ACTOR_TYPES: readonly ["STAFF", "SYSTEM", "AGENT"];
|
|
24
24
|
export type ActorType = (typeof ACTOR_TYPES)[number];
|
package/dist/events/types.js
CHANGED
|
@@ -30,7 +30,9 @@ exports.DOMAIN_EVENT_TYPES = [
|
|
|
30
30
|
'dictionary.profiled',
|
|
31
31
|
'subscription.changed',
|
|
32
32
|
'deepwork.changed',
|
|
33
|
-
'plan.changed'
|
|
33
|
+
'plan.changed',
|
|
34
|
+
'org.changed',
|
|
35
|
+
'staff.changed'
|
|
34
36
|
];
|
|
35
37
|
exports.NOTIFICATION_EVENT_TYPES = [
|
|
36
38
|
'notification.created',
|
|
@@ -67,6 +69,7 @@ exports.ENTITY_TYPES = [
|
|
|
67
69
|
'subscription',
|
|
68
70
|
'deepwork',
|
|
69
71
|
'plan',
|
|
72
|
+
'organisation',
|
|
70
73
|
'notification',
|
|
71
74
|
'email',
|
|
72
75
|
'aicomment',
|
package/dist/intents.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const intentPayloadSchemas: {
|
|
|
27
27
|
queueId: z.ZodString;
|
|
28
28
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
29
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
30
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
30
31
|
category: z.ZodOptional<z.ZodString>;
|
|
31
32
|
eventType: z.ZodOptional<z.ZodString>;
|
|
32
33
|
projectName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -50,6 +51,7 @@ export declare const intentPayloadSchemas: {
|
|
|
50
51
|
queueId: z.ZodString;
|
|
51
52
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
53
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
54
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
53
55
|
category: z.ZodOptional<z.ZodString>;
|
|
54
56
|
eventType: z.ZodOptional<z.ZodString>;
|
|
55
57
|
projectName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -73,6 +75,7 @@ export declare const intentPayloadSchemas: {
|
|
|
73
75
|
queueId: z.ZodString;
|
|
74
76
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
77
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
78
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
76
79
|
category: z.ZodOptional<z.ZodString>;
|
|
77
80
|
eventType: z.ZodOptional<z.ZodString>;
|
|
78
81
|
projectName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -97,6 +100,7 @@ export declare const intentPayloadSchemas: {
|
|
|
97
100
|
queueId: z.ZodString;
|
|
98
101
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
102
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
103
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
100
104
|
category: z.ZodOptional<z.ZodString>;
|
|
101
105
|
subCategory: z.ZodOptional<z.ZodString>;
|
|
102
106
|
eventType: z.ZodOptional<z.ZodString>;
|
|
@@ -123,6 +127,7 @@ export declare const intentPayloadSchemas: {
|
|
|
123
127
|
queueId: z.ZodString;
|
|
124
128
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
129
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
130
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
126
131
|
category: z.ZodOptional<z.ZodString>;
|
|
127
132
|
subCategory: z.ZodOptional<z.ZodString>;
|
|
128
133
|
eventType: z.ZodOptional<z.ZodString>;
|
|
@@ -149,6 +154,7 @@ export declare const intentPayloadSchemas: {
|
|
|
149
154
|
queueId: z.ZodString;
|
|
150
155
|
idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
156
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
157
|
+
createRow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
152
158
|
category: z.ZodOptional<z.ZodString>;
|
|
153
159
|
subCategory: z.ZodOptional<z.ZodString>;
|
|
154
160
|
eventType: z.ZodOptional<z.ZodString>;
|
package/dist/intents.js
CHANGED
|
@@ -31,6 +31,11 @@ const queueId = zod_1.z.string().min(1);
|
|
|
31
31
|
const idempotencyKey = zod_1.z.string().nullable().optional();
|
|
32
32
|
/** core-ts drops the content of an intent over 256 KiB and sets this. */
|
|
33
33
|
const truncated = zod_1.z.literal(true).optional();
|
|
34
|
+
/**
|
|
35
|
+
* core-ts wrote no queue row for a handed-over command: the consumer
|
|
36
|
+
* creates it from this intent, which then always carries its content.
|
|
37
|
+
*/
|
|
38
|
+
const createRow = zod_1.z.literal(true).optional();
|
|
34
39
|
/**
|
|
35
40
|
* Intent payloads. A consumer needs only `queueId` to claim the row, so that
|
|
36
41
|
* is the one required field; the content is a convenience and may be absent
|
|
@@ -42,6 +47,7 @@ exports.intentPayloadSchemas = {
|
|
|
42
47
|
queueId,
|
|
43
48
|
idempotencyKey,
|
|
44
49
|
truncated,
|
|
50
|
+
createRow,
|
|
45
51
|
category: zod_1.z.string().optional(),
|
|
46
52
|
eventType: zod_1.z.string().optional(),
|
|
47
53
|
projectName: zod_1.z.string().nullable().optional(),
|
|
@@ -66,6 +72,7 @@ exports.intentPayloadSchemas = {
|
|
|
66
72
|
queueId,
|
|
67
73
|
idempotencyKey,
|
|
68
74
|
truncated,
|
|
75
|
+
createRow,
|
|
69
76
|
category: zod_1.z.string().optional(),
|
|
70
77
|
subCategory: zod_1.z.string().optional(),
|
|
71
78
|
eventType: zod_1.z.string().optional(),
|
package/dist/notifications.d.ts
CHANGED
|
@@ -31,5 +31,14 @@ export declare const notificationGroupOf: (eventType: string, queue?: "notificat
|
|
|
31
31
|
* rules must.
|
|
32
32
|
*/
|
|
33
33
|
export declare const HANDED_OVER_FIELD = "handedOver";
|
|
34
|
+
/**
|
|
35
|
+
* The name on core-ts's NOTIFICATIONS_HANDED_OVER for the commands: every
|
|
36
|
+
* queue row type no group owns (the digest, an OTP, billing mail). core-ts
|
|
37
|
+
* still decides who gets one and what it says; handed over, it sends that
|
|
38
|
+
* as the intent alone and notification-ts writes the row.
|
|
39
|
+
*/
|
|
40
|
+
export declare const HANDOVER_COMMANDS = "commands";
|
|
41
|
+
/** On an intent's payload: core-ts wrote no queue row, create it from this. */
|
|
42
|
+
export declare const INTENT_CREATE_ROW_FIELD = "createRow";
|
|
34
43
|
/** The groups an event's `data` says core-ts had handed over. */
|
|
35
44
|
export declare function handedOverGroups(data: unknown): NotificationGroup[];
|
package/dist/notifications.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HANDED_OVER_FIELD = exports.notificationGroupOf = exports.NOTIFICATION_GROUP_OF = exports.EMAIL_TYPE_PREFIX = exports.isNotificationGroup = exports.NOTIFICATION_GROUPS = void 0;
|
|
3
|
+
exports.INTENT_CREATE_ROW_FIELD = exports.HANDOVER_COMMANDS = exports.HANDED_OVER_FIELD = exports.notificationGroupOf = exports.NOTIFICATION_GROUP_OF = exports.EMAIL_TYPE_PREFIX = exports.isNotificationGroup = exports.NOTIFICATION_GROUPS = void 0;
|
|
4
4
|
exports.handedOverGroups = handedOverGroups;
|
|
5
5
|
/**
|
|
6
6
|
* Notification groups (notification-ts docs/RULES.md). core-ts's call sites
|
|
@@ -47,6 +47,7 @@ exports.NOTIFICATION_GROUP_OF = {
|
|
|
47
47
|
'Task-Changes-Requested': 'approvals',
|
|
48
48
|
'Task-Approvals-Reset': 'approvals',
|
|
49
49
|
'Approval-Needed': 'approvals',
|
|
50
|
+
'email:Approval-Needed': 'approvals',
|
|
50
51
|
// task-details
|
|
51
52
|
'Task-Title-Edited': 'task-details',
|
|
52
53
|
'Task-Description-Edited': 'task-details',
|
|
@@ -116,6 +117,15 @@ exports.notificationGroupOf = notificationGroupOf;
|
|
|
116
117
|
* rules must.
|
|
117
118
|
*/
|
|
118
119
|
exports.HANDED_OVER_FIELD = 'handedOver';
|
|
120
|
+
/**
|
|
121
|
+
* The name on core-ts's NOTIFICATIONS_HANDED_OVER for the commands: every
|
|
122
|
+
* queue row type no group owns (the digest, an OTP, billing mail). core-ts
|
|
123
|
+
* still decides who gets one and what it says; handed over, it sends that
|
|
124
|
+
* as the intent alone and notification-ts writes the row.
|
|
125
|
+
*/
|
|
126
|
+
exports.HANDOVER_COMMANDS = 'commands';
|
|
127
|
+
/** On an intent's payload: core-ts wrote no queue row, create it from this. */
|
|
128
|
+
exports.INTENT_CREATE_ROW_FIELD = 'createRow';
|
|
119
129
|
/** The groups an event's `data` says core-ts had handed over. */
|
|
120
130
|
function handedOverGroups(data) {
|
|
121
131
|
const value = data?.[exports.HANDED_OVER_FIELD];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livetronics/wocul-domain",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Shared Wocul domain contracts: realtime event and intent schemas, channel names, and Core API types generated from the OpenAPI spec",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|