@opencxh/domain 1.172.1 → 1.173.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/entities/activity/blocks.d.ts +30 -30
- package/dist/entities/activity/catalog.d.ts +63 -86
- package/dist/entities/activity/descriptor.d.ts +31 -32
- package/dist/entities/activity/index.d.ts +2 -2
- package/dist/entities/activity/preview.d.ts +7 -7
- package/dist/entities/activity/resolve.d.ts +37 -38
- package/dist/entities/activity/types.d.ts +64 -35
- package/dist/entities/ai-account/types.d.ts +3 -3
- package/dist/entities/ai-account/vendors.d.ts +25 -32
- package/dist/entities/ai-budget/types.d.ts +5 -5
- package/dist/entities/ai-conversation/types.d.ts +12 -12
- package/dist/entities/ai-profile/types.d.ts +14 -21
- package/dist/entities/ai-settings/types.d.ts +12 -13
- package/dist/entities/analytics/index.d.ts +4 -4
- package/dist/entities/analytics/source.d.ts +1 -1
- package/dist/entities/analytics/usage.d.ts +23 -28
- package/dist/entities/artifact/blocks.d.ts +54 -69
- package/dist/entities/artifact/markdown.d.ts +2 -3
- package/dist/entities/artifact/types.d.ts +46 -54
- package/dist/entities/assignment/types.d.ts +76 -90
- package/dist/entities/channel/index.d.ts +1 -1
- package/dist/entities/channel/signature.d.ts +8 -9
- package/dist/entities/communication/index.d.ts +1 -1
- package/dist/entities/contact/index.d.ts +1 -1
- package/dist/entities/custom-field-def/types.d.ts +14 -14
- package/dist/entities/external-identity/types.d.ts +45 -50
- package/dist/entities/interaction/index.d.ts +1 -1
- package/dist/entities/interaction/types.d.ts +44 -47
- package/dist/entities/live-lens/types.d.ts +39 -44
- package/dist/entities/mcp/types.d.ts +53 -57
- package/dist/entities/memory/alias.d.ts +7 -7
- package/dist/entities/memory/browse.d.ts +21 -21
- package/dist/entities/memory/ingest.d.ts +24 -28
- package/dist/entities/memory/item.d.ts +53 -58
- package/dist/entities/memory/kind.d.ts +25 -25
- package/dist/entities/memory/query.d.ts +49 -51
- package/dist/entities/playbook/actor.d.ts +17 -17
- package/dist/entities/playbook/assignment.d.ts +54 -63
- package/dist/entities/playbook/index.d.ts +2 -2
- package/dist/entities/playbook/labels.d.ts +4 -4
- package/dist/entities/playbook/trigger-vars.d.ts +17 -15
- package/dist/entities/playbook/types.d.ts +174 -303
- package/dist/entities/resource-reminder/types.d.ts +8 -9
- package/dist/entities/time-entry/duration.d.ts +11 -11
- package/dist/entities/time-entry/types.d.ts +59 -59
- package/dist/entities/time-entry/work-type.d.ts +21 -24
- package/dist/entities/topic/examples.d.ts +26 -27
- package/dist/entities/topic/scope.d.ts +11 -12
- package/dist/entities/topic/types.d.ts +26 -28
- package/dist/entities/user/types.d.ts +24 -28
- package/dist/entities/webhook/types.d.ts +6 -6
- package/dist/entities/work/activity.d.ts +36 -0
- package/dist/entities/work/index.d.ts +1 -0
- package/dist/entities/work/keys.d.ts +25 -26
- package/dist/entities/work/ladder.d.ts +48 -52
- package/dist/entities/work/types.d.ts +108 -114
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +29 -28
- package/dist/index.js +1416 -1258
- package/dist/platform/account.d.ts +34 -38
- package/dist/platform/ai-tools.d.ts +48 -52
- package/dist/platform/api.d.ts +9 -10
- package/dist/platform/author.d.ts +7 -9
- package/dist/platform/capabilities.d.ts +3 -3
- package/dist/platform/communication.d.ts +163 -204
- package/dist/platform/context.d.ts +8 -8
- package/dist/platform/identity.d.ts +16 -19
- package/dist/platform/kernel.d.ts +1 -1
- package/dist/platform/manifest.d.ts +2 -2
- package/dist/platform/media.d.ts +13 -15
- package/dist/platform/permission.d.ts +39 -0
- package/dist/platform/permission.test.d.ts +1 -0
- package/dist/platform/presence.d.ts +30 -30
- package/dist/platform/provider.d.ts +14 -15
- package/dist/platform/resource-source.d.ts +43 -45
- package/dist/platform/resource.d.ts +17 -23
- package/dist/platform/scope.d.ts +35 -61
- package/dist/platform/services.d.ts +4 -4
- package/dist/platform/storage.d.ts +1 -1
- package/dist/platform/sync-source.d.ts +196 -216
- package/dist/platform/transcript-cadence.d.ts +37 -41
- package/dist/platform/ui.d.ts +6 -6
- package/dist/text/endpoint.d.ts +11 -27
- package/package.json +3 -2
|
@@ -1,58 +1,56 @@
|
|
|
1
1
|
import { OwnerScope } from '../scope/types';
|
|
2
2
|
/**
|
|
3
|
-
* Work management —
|
|
3
|
+
* Work management — one entity for everything that is *work*.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Task, subtask, case, project, phase, deal and campaign are rows in the same model here. What
|
|
6
|
+
* distinguishes them is configuration, not code: the **project** carries the workflow, the field
|
|
7
|
+
* selection and the access, and `typeKey` is no more than an icon with a label.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The rule that bounds this model, in three questions:
|
|
10
10
|
*
|
|
11
|
-
* 1. *
|
|
12
|
-
*
|
|
13
|
-
* 2. *
|
|
14
|
-
*
|
|
15
|
-
* 3. *
|
|
16
|
-
*
|
|
11
|
+
* 1. *Who decides the status transition?* Our users → a `WorkItem`. An external system (Shopify,
|
|
12
|
+
* the accounting package) → mirrored by the source app, at most a `WorkLink` here.
|
|
13
|
+
* 2. *Own lifetime, or does it hang off something?* Own → an item. Hangs off it (hours, notes,
|
|
14
|
+
* attributes, memory) → an annotation on a `scopeKey`, never a row here.
|
|
15
|
+
* 3. *Different behaviour, or different words?* Only different words → a `WorkProject` with other
|
|
16
|
+
* statuses. Code is added only for different behaviour.
|
|
17
17
|
*
|
|
18
|
-
* Test 3 is
|
|
18
|
+
* Test 3 is why "Case", "Project" and "Deal" are not three entities.
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* The three categories every status falls into.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* geïndexeerd doen.
|
|
23
|
+
* Fixed, while the status name is free per project ("Offerte", "Wacht op cliënt"). This is the
|
|
24
|
+
* question *every* consumer asks — the list, the counter, the reporting — and if it had to read
|
|
25
|
+
* the project configuration to answer it, no query could do it from an index.
|
|
27
26
|
*/
|
|
28
27
|
export type WorkStatusCategory = "todo" | "in_progress" | "done";
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
29
|
+
* One step in a project's workflow.
|
|
31
30
|
*
|
|
32
|
-
* `key` is **org-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* de werksoorten uit het label geslugd en bij botsing opgehoogd.
|
|
31
|
+
* `key` is **org-unique and not project-unique**, a deliberate burden on the admin screen in
|
|
32
|
+
* exchange for something important: the item carries only `statusKey`, so "all my open work across
|
|
33
|
+
* every project" is one `{ statusKey: anyOf(openKeys) }`. If two projects could each have a `done`
|
|
34
|
+
* with a different category, that same query would silently give the wrong answer. So the key is
|
|
35
|
+
* slugged from the label and bumped on collision, as with the work types.
|
|
38
36
|
*
|
|
39
|
-
* `label` is
|
|
37
|
+
* `label` is free to rename; `key` is fixed once items sit on it.
|
|
40
38
|
*/
|
|
41
39
|
export interface WorkStatus {
|
|
42
40
|
key: string;
|
|
43
41
|
label: string;
|
|
44
42
|
category: WorkStatusCategory;
|
|
45
43
|
order: number;
|
|
46
|
-
/**
|
|
44
|
+
/** Optional accent colour for the dots in the list and the admin screen. */
|
|
47
45
|
color?: string;
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
50
|
-
*
|
|
48
|
+
* A resolution: *how* something ended, apart from where it sits.
|
|
51
49
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
50
|
+
* Deliberately a free label with no fixed meaning and no outcome flag. A law firm distinguishes
|
|
51
|
+
* "settled" from "judgment", a sales team "won" from "lost", and neither fits an enum we invent.
|
|
52
|
+
* The price is in the plan: nothing can compute how much ended well. If that question comes, a
|
|
53
|
+
* `positive?: boolean` belongs here.
|
|
56
54
|
*/
|
|
57
55
|
export interface WorkResolution {
|
|
58
56
|
key: string;
|
|
@@ -60,58 +58,57 @@ export interface WorkResolution {
|
|
|
60
58
|
order: number;
|
|
61
59
|
}
|
|
62
60
|
/**
|
|
63
|
-
*
|
|
61
|
+
* A project: the carrier of a work process.
|
|
64
62
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
63
|
+
* This is where Jira has its schemes and we do not. Workflow, field selection and access hang
|
|
64
|
+
* directly off the project instead of off three linkable configuration objects — which saves the
|
|
65
|
+
* three screens Jira makes you visit to change one status.
|
|
68
66
|
*/
|
|
69
67
|
export interface WorkProject {
|
|
70
68
|
id: string;
|
|
71
69
|
organizationId: string;
|
|
72
70
|
/**
|
|
73
|
-
* Org-
|
|
74
|
-
*
|
|
75
|
-
*
|
|
71
|
+
* Org-unique, uppercase: `"SAL"`. Forms the prefix of every item key (`SAL-142`), and is
|
|
72
|
+
* therefore fixed once items exist — changing it would rename every key, including the ones
|
|
73
|
+
* people pasted into an email.
|
|
76
74
|
*/
|
|
77
75
|
key: string;
|
|
78
76
|
name: string;
|
|
79
77
|
description?: string;
|
|
80
|
-
/** Lucide
|
|
78
|
+
/** Lucide icon name. */
|
|
81
79
|
icon?: string;
|
|
82
80
|
color?: string;
|
|
83
81
|
ownerScope: OwnerScope;
|
|
84
|
-
/**
|
|
82
|
+
/** Members on top of `ownerScope` — who else may reach it. */
|
|
85
83
|
memberUserIds?: string[];
|
|
86
84
|
memberTeamIds?: string[];
|
|
87
85
|
/**
|
|
88
|
-
*
|
|
86
|
+
* The workflow, embedded instead of its own entity.
|
|
89
87
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
88
|
+
* Three reasons. Nothing ever queries a single status row: every item question is answered by
|
|
89
|
+
* the flat `statusKey` on the item. The read shape is always "the whole ladder at once", because
|
|
90
|
+
* a list renders all labels, colours and orders. And the admin screen edits the ladder as one
|
|
91
|
+
* reordering — this store has no transaction, so as separate rows "drag status 3 above status 1"
|
|
92
|
+
* would become N updates that can land halfway and leave two statuses on the same `order`. As an
|
|
93
|
+
* array it is one `$set`.
|
|
96
94
|
*
|
|
97
|
-
*
|
|
98
|
-
* `validateStatuses` in de app.
|
|
95
|
+
* The cost: uniqueness of `key` is not guarded by the store but by `validateStatuses` in the app.
|
|
99
96
|
*/
|
|
100
97
|
statuses: WorkStatus[];
|
|
101
|
-
/**
|
|
98
|
+
/** Resolutions, free per project. Empty = closing asks for no reason. */
|
|
102
99
|
resolutions?: WorkResolution[];
|
|
103
|
-
/**
|
|
100
|
+
/** Which item types this project offers. Empty = all of them. */
|
|
104
101
|
typeKeys?: string[];
|
|
105
|
-
/**
|
|
102
|
+
/** Keys of the `CustomFieldDef`s enabled on this project, in display order. */
|
|
106
103
|
fieldKeys?: string[];
|
|
107
|
-
/**
|
|
104
|
+
/** Where a new item starts. Absent = the first status in `order`. */
|
|
108
105
|
defaultStatusKey?: string;
|
|
109
106
|
/**
|
|
110
|
-
*
|
|
107
|
+
* Durable anchor for the key counter.
|
|
111
108
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
109
|
+
* The counter itself lives in `Bridge.kv`, but kv is a cache: it can start cold or be evicted.
|
|
110
|
+
* This field and the `(organizationId, projectId, sequenceNumber)` index are together the way
|
|
111
|
+
* back, so an empty kv does not reuse keys.
|
|
115
112
|
*/
|
|
116
113
|
lastSequence?: number;
|
|
117
114
|
archived?: boolean;
|
|
@@ -121,93 +118,92 @@ export interface WorkProject {
|
|
|
121
118
|
updatedAt?: number;
|
|
122
119
|
}
|
|
123
120
|
export type WorkPriority = "low" | "normal" | "high" | "urgent";
|
|
124
|
-
/**
|
|
121
|
+
/** Where an item came from — a person or something automatic. */
|
|
125
122
|
export interface WorkItemSource {
|
|
126
123
|
initiator: "user" | "system";
|
|
127
|
-
/**
|
|
124
|
+
/** Free-form reason with `system` ("missed_call", "stale_interaction"). */
|
|
128
125
|
systemReason?: string;
|
|
129
126
|
}
|
|
130
127
|
/**
|
|
131
|
-
*
|
|
128
|
+
* A work item.
|
|
132
129
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
130
|
+
* Note what is **not** here: no `interactionId`, no `contactId`, no `companyId`. Relations run
|
|
131
|
+
* through {@link WorkLink} plus the flattened {@link WorkItem.keys}, so "the items on this
|
|
132
|
+
* conversation" stays one indexed `$in` that combines with a status filter — which a detour past
|
|
133
|
+
* the link table does not.
|
|
137
134
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
135
|
+
* And no `value`/`currency`: amounts are custom fields in the generic attribute store. That makes
|
|
136
|
+
* sorting on them an in-memory operation; see the plan.
|
|
140
137
|
*/
|
|
141
138
|
export interface WorkItem {
|
|
142
139
|
id: string;
|
|
143
140
|
organizationId: string;
|
|
144
141
|
/**
|
|
145
|
-
*
|
|
146
|
-
* {@link LOOSE_STATUSES}.
|
|
147
|
-
*
|
|
148
|
-
*
|
|
142
|
+
* Absent = a **loose item**: no key, no project fields, and the fixed ladder from
|
|
143
|
+
* {@link LOOSE_STATUSES}. That is what a loose task is ("call back", a follow-up on a
|
|
144
|
+
* conversation), and it exists from day one so work arriving later from another app needs no
|
|
145
|
+
* model change.
|
|
149
146
|
*/
|
|
150
147
|
projectId?: string;
|
|
151
|
-
/** `SAL-142` / `SAL-142-1`.
|
|
148
|
+
/** `SAL-142` / `SAL-142-1`. Absent on a loose item. Org-unique where present. */
|
|
152
149
|
key?: string;
|
|
153
150
|
sequenceNumber?: number;
|
|
154
|
-
/**
|
|
151
|
+
/** Sequence number within the parent — the `-1` in `SAL-142-1`. */
|
|
155
152
|
subSequence?: number;
|
|
156
|
-
/**
|
|
153
|
+
/** Light classification: icon and which fields make sense. Never a workflow. */
|
|
157
154
|
typeKey: string;
|
|
158
155
|
ownerScope: OwnerScope;
|
|
159
156
|
title: string;
|
|
160
157
|
description?: string;
|
|
161
158
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
159
|
+
* A {@link WorkStatus.key} — the project's, or from the fixed ladder. Because the keys are
|
|
160
|
+
* org-unique the category can always be looked up unambiguously, which is why it is *not* a
|
|
161
|
+
* second column here.
|
|
165
162
|
*/
|
|
166
163
|
statusKey: string;
|
|
167
|
-
/** {@link WorkResolution.key}.
|
|
164
|
+
/** {@link WorkResolution.key}. Only meaningful when the status falls in category `done`. */
|
|
168
165
|
resolution?: string;
|
|
169
166
|
parentId?: string;
|
|
170
167
|
/**
|
|
171
|
-
*
|
|
172
|
-
* (`["work_item:program-1", "work_item:project-7"]`,
|
|
168
|
+
* The scopeKeys of *all* ancestors, flattened at write time
|
|
169
|
+
* (`["work_item:program-1", "work_item:project-7"]`, top to bottom).
|
|
173
170
|
*
|
|
174
|
-
*
|
|
175
|
-
* `$in`
|
|
176
|
-
*
|
|
177
|
-
*
|
|
171
|
+
* This is what makes unlimited depth affordable: "everything under this project" is one indexed
|
|
172
|
+
* `$in` instead of a recursive traversal, which this store cannot do. The price is on the write
|
|
173
|
+
* side — dragging an item means rewriting the `ancestorKeys` of its whole subtree, and that is a
|
|
174
|
+
* job, not a request.
|
|
178
175
|
*/
|
|
179
176
|
ancestorKeys?: string[];
|
|
180
|
-
/** UserIds
|
|
177
|
+
/** UserIds doing this. Empty = the team's pool. */
|
|
181
178
|
assignees?: string[];
|
|
182
|
-
/**
|
|
179
|
+
/** Who brought it in, apart from who does it. */
|
|
183
180
|
reporterId?: string;
|
|
184
181
|
watchers?: string[];
|
|
185
182
|
priority?: WorkPriority;
|
|
186
183
|
labels?: string[];
|
|
187
184
|
/**
|
|
188
|
-
*
|
|
185
|
+
* The parties, flat and without a role: `["company:123", "contact:456"]`.
|
|
189
186
|
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
187
|
+
* Derived from the {@link WorkLink}s at write time. Two shapes side by side because they answer
|
|
188
|
+
* two questions: the link knows *in which capacity* (client, opposing party), this column
|
|
189
|
+
* answers "every item this company is in" in one index hit — which over a link table would cost
|
|
190
|
+
* a second round.
|
|
194
191
|
*/
|
|
195
192
|
partyKeys: string[];
|
|
196
193
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* dit item terug.
|
|
194
|
+
* File keys — the `keys` convention from `platform/scope.ts`. Own key, project key, ancestors
|
|
195
|
+
* and parties. This is how hours, memory and attributes find this item back.
|
|
200
196
|
*/
|
|
201
197
|
keys: string[];
|
|
202
|
-
/**
|
|
198
|
+
/** References to external systems (`shopify_order:8842`). Never a copy. */
|
|
203
199
|
externalIds?: string[];
|
|
204
200
|
/** Epoch ms. */
|
|
205
201
|
startDate?: number;
|
|
206
202
|
dueDate?: number;
|
|
207
|
-
/**
|
|
203
|
+
/** Set as soon as the status moves to category `done`, cleared when it comes back. */
|
|
208
204
|
closedAt?: number;
|
|
209
205
|
estimateSeconds?: number;
|
|
210
|
-
/**
|
|
206
|
+
/** Default for hours booked on this; the time entry may differ. */
|
|
211
207
|
billable?: boolean;
|
|
212
208
|
source: WorkItemSource;
|
|
213
209
|
createdBy: string;
|
|
@@ -215,40 +211,38 @@ export interface WorkItem {
|
|
|
215
211
|
updatedAt?: number;
|
|
216
212
|
}
|
|
217
213
|
/**
|
|
218
|
-
*
|
|
214
|
+
* A typed link between a work item and anything at all.
|
|
219
215
|
*
|
|
220
|
-
* **
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* deze store kan niet recursief traverseren.
|
|
216
|
+
* **One hop, never traversed.** That is the agreement letting this table exist next to the `keys`
|
|
217
|
+
* convention instead of competing with it: context and membership run through `keys` (flattened at
|
|
218
|
+
* write time, one index hit), and this is the explicit, low-volume, one-level-deep relation
|
|
219
|
+
* between two things. A link table that starts answering the context question too is the
|
|
220
|
+
* beginning of the graph deliberately not built here — this store cannot traverse recursively.
|
|
226
221
|
*/
|
|
227
222
|
export interface WorkLink {
|
|
228
223
|
id: string;
|
|
229
224
|
organizationId: string;
|
|
230
|
-
/**
|
|
225
|
+
/** Always `work_item:<id>` on the outbound row. */
|
|
231
226
|
fromKey: string;
|
|
232
|
-
/**
|
|
227
|
+
/** Any scopeKey: another item, a conversation, a contact, an artifact. */
|
|
233
228
|
toKey: string;
|
|
234
229
|
/**
|
|
235
|
-
*
|
|
230
|
+
* The relation and the party role in one vocabulary: `client` · `opposing` · `context` ·
|
|
236
231
|
* `blocks` · `blocked_by` · `relates` · `duplicates` · `attachment`.
|
|
237
232
|
*
|
|
238
|
-
*
|
|
239
|
-
* is
|
|
233
|
+
* One field and no separate role column, because they are the same kind of statement: "this
|
|
234
|
+
* company is the client" and "this item blocks that item" are both a named arrow.
|
|
240
235
|
*/
|
|
241
236
|
type: string;
|
|
242
237
|
/**
|
|
243
|
-
*
|
|
238
|
+
* Shared by the outbound and the inbound row.
|
|
244
239
|
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* houdt ontkoppelen daarmee één handeling.
|
|
240
|
+
* Every link is written as **two** rows, so a lookup is one indexed query on `fromKey` instead
|
|
241
|
+
* of an `$or` across two columns — and so "which work hangs off `interaction:123`" is the same
|
|
242
|
+
* query as "what hangs off this item". This field keeps unlinking a single action.
|
|
249
243
|
*/
|
|
250
244
|
pairId: string;
|
|
251
|
-
/**
|
|
245
|
+
/** How the inbound row identifies itself, so the UI can show "is blocked by". */
|
|
252
246
|
inverse?: boolean;
|
|
253
247
|
createdBy: string;
|
|
254
248
|
createdAt?: number;
|