@proteos/sdk 0.79.0 → 0.81.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/index.cjs +80 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +310 -1
- package/dist/index.d.ts +310 -1
- package/dist/index.js +78 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +4 -0
- package/src/conversation/index.ts +12 -2
- package/src/conversation/types.ts +67 -0
- package/src/data/index.ts +21 -0
- package/src/data/record-drafts.ts +73 -0
- package/src/data/types.ts +162 -0
- package/src/index.ts +21 -0
- package/src/scheduling/types.ts +18 -0
package/package.json
CHANGED
|
@@ -47,6 +47,10 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
|
|
|
47
47
|
{ slug: 'modules', name: 'Modules' },
|
|
48
48
|
{ slug: 'variables', name: 'Variables' },
|
|
49
49
|
{ slug: 'deployments', name: 'Deployments' },
|
|
50
|
+
// Records (data-service): proposed record writes awaiting review. read =
|
|
51
|
+
// list/get drafts; write = propose, reject and (with the entity's own
|
|
52
|
+
// write/delete) approve.
|
|
53
|
+
{ slug: 'record-drafts', name: 'Record Drafts' },
|
|
50
54
|
// Storage (storage-service)
|
|
51
55
|
{ slug: 'files', name: 'Files' },
|
|
52
56
|
// Automation (function-service)
|
|
@@ -77,7 +77,6 @@ import type {
|
|
|
77
77
|
ListContactRecordLinksQuery,
|
|
78
78
|
ListContactsQuery,
|
|
79
79
|
ListConversationBriefsQuery,
|
|
80
|
-
ListMeetingBotsQuery,
|
|
81
80
|
ListConversationFilterEventsQuery,
|
|
82
81
|
ListConversationFiltersQuery,
|
|
83
82
|
ListConversationNotesQuery,
|
|
@@ -88,6 +87,7 @@ import type {
|
|
|
88
87
|
ListConversationTagsQuery,
|
|
89
88
|
ListConversationTypesQuery,
|
|
90
89
|
ListGlossaryTermsQuery,
|
|
90
|
+
ListMeetingBotsQuery,
|
|
91
91
|
ListMessagesQuery,
|
|
92
92
|
ListMistranscribedTermsQuery,
|
|
93
93
|
ListReactionsResponse,
|
|
@@ -99,9 +99,10 @@ import type {
|
|
|
99
99
|
ListToneProfilesQuery,
|
|
100
100
|
ListTranscriptionsQuery,
|
|
101
101
|
MaterializeTranscriptionRequest,
|
|
102
|
+
MeetingBot,
|
|
102
103
|
MergeContactsRequest,
|
|
103
104
|
Message,
|
|
104
|
-
|
|
105
|
+
MessageDraftVersions,
|
|
105
106
|
MintCallTokenRequest,
|
|
106
107
|
MistranscribedTerm,
|
|
107
108
|
PerformChannelActionRequest,
|
|
@@ -883,6 +884,8 @@ export interface MessageService {
|
|
|
883
884
|
* `draft_not_editable` once the draft was sent or rejected.
|
|
884
885
|
*/
|
|
885
886
|
updateDraft(messageId: string, request: UpdateDraftRequest): Promise<Message>
|
|
887
|
+
/** A draft's history, oldest first, plus what changed. Also readable after send. */
|
|
888
|
+
listDraftVersions(messageId: string): Promise<MessageDraftVersions>
|
|
886
889
|
/** Deliver a draft (draft → pending → sent/failed). 409 on a lost race. */
|
|
887
890
|
sendDraft(messageId: string): Promise<Message>
|
|
888
891
|
/** Decline a draft (draft → rejected, terminal). 409 on a lost race. */
|
|
@@ -943,6 +946,13 @@ class MessageServiceImpl implements MessageService {
|
|
|
943
946
|
)
|
|
944
947
|
}
|
|
945
948
|
|
|
949
|
+
listDraftVersions(messageId: string): Promise<MessageDraftVersions> {
|
|
950
|
+
return this.client.request(
|
|
951
|
+
'GET',
|
|
952
|
+
`${CONVERSATION_BASE_PATH}/messages/${encodeURIComponent(messageId)}/draft-versions`,
|
|
953
|
+
)
|
|
954
|
+
}
|
|
955
|
+
|
|
946
956
|
sendDraft(messageId: string): Promise<Message> {
|
|
947
957
|
return this.client.request(
|
|
948
958
|
'POST',
|
|
@@ -537,6 +537,18 @@ export interface Message {
|
|
|
537
537
|
connection_id: string
|
|
538
538
|
channel: Channel
|
|
539
539
|
direction: MessageDirection
|
|
540
|
+
/** A draft's edited subject, held until send. Absent means the conversation's; empty is a subject deliberately cleared on a new email. */
|
|
541
|
+
subject?: string
|
|
542
|
+
/** The tone profile this draft was written in, when known. May no longer resolve. */
|
|
543
|
+
tone_profile_id?: string
|
|
544
|
+
/** The reviewer took the quoted previous message off this reply. */
|
|
545
|
+
is_quote_removed?: boolean
|
|
546
|
+
/** The platform wrote this message (a send or a draft): its content is what the person wrote, without the quote the email carried. Absent on mail imported from the mailbox. */
|
|
547
|
+
is_sent_from_platform?: boolean
|
|
548
|
+
/** The newest entry in this draft's history; absent until its first change. */
|
|
549
|
+
draft_version?: number
|
|
550
|
+
/** On a single draft read: the quote its send would carry below the text. Never stored. */
|
|
551
|
+
quoted_text?: string
|
|
540
552
|
external_message_id: string
|
|
541
553
|
sender: ContactRef
|
|
542
554
|
/** Who the message was addressed to (To/Cc/Bcc), each tagged with its role. */
|
|
@@ -723,6 +735,8 @@ export interface InstallConnectionResponse {
|
|
|
723
735
|
}
|
|
724
736
|
|
|
725
737
|
export interface SendMessageRequest {
|
|
738
|
+
/** Records the tone a draft was written in. Stored by draft; send ignores it. */
|
|
739
|
+
tone_profile_id?: string
|
|
726
740
|
/** Reply mode: send into this existing conversation. */
|
|
727
741
|
conversation_id?: string
|
|
728
742
|
/**
|
|
@@ -781,6 +795,44 @@ export interface SendMessageRequest {
|
|
|
781
795
|
* the provided groups; omitting all three keeps the stored recipients. On any
|
|
782
796
|
* recipient edit, send all three groups.
|
|
783
797
|
*/
|
|
798
|
+
/** How a version of a draft came to be. */
|
|
799
|
+
export type MessageDraftVersionKind = 'drafted' | 'edited' | 'redrafted' | 'restored'
|
|
800
|
+
|
|
801
|
+
/** One step in a draft message's history. */
|
|
802
|
+
export interface MessageDraftVersion {
|
|
803
|
+
id: string
|
|
804
|
+
org_id: string
|
|
805
|
+
message_id: string
|
|
806
|
+
version: number
|
|
807
|
+
kind: MessageDraftVersionKind
|
|
808
|
+
/** The effective subject at this version, wherever it is stored. */
|
|
809
|
+
subject: string
|
|
810
|
+
recipients: MessageRecipient[]
|
|
811
|
+
content: ContentBlock[]
|
|
812
|
+
tone_profile_id?: string
|
|
813
|
+
/** The reviewer's redraft prompt (kind=redrafted). */
|
|
814
|
+
instruction?: string
|
|
815
|
+
/** The version a restore copied from (kind=restored). */
|
|
816
|
+
source_version?: number
|
|
817
|
+
created_at: string
|
|
818
|
+
created_by: UserRef
|
|
819
|
+
updated_at: string
|
|
820
|
+
updated_by: UserRef
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/** One field that differs between what was proposed and the latest version. */
|
|
824
|
+
export interface MessageDraftChange {
|
|
825
|
+
field: 'body' | 'subject' | 'to' | 'cc' | 'bcc'
|
|
826
|
+
from: unknown
|
|
827
|
+
to: unknown
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/** A draft's history, oldest first, plus what changed across it. */
|
|
831
|
+
export interface MessageDraftVersions {
|
|
832
|
+
data: MessageDraftVersion[]
|
|
833
|
+
changes: MessageDraftChange[]
|
|
834
|
+
}
|
|
835
|
+
|
|
784
836
|
export interface UpdateDraftRequest {
|
|
785
837
|
to?: SendRecipient[]
|
|
786
838
|
/** Email only. */
|
|
@@ -792,6 +844,21 @@ export interface UpdateDraftRequest {
|
|
|
792
844
|
content: ContentBlock[]
|
|
793
845
|
/** The complete attachment set to keep (omitting one removes its row). */
|
|
794
846
|
attachments?: FileRef[]
|
|
847
|
+
/**
|
|
848
|
+
* The `updated_at` the editor last saw. A draft that has moved on since fails
|
|
849
|
+
* with 409 `draft_conflict` instead of being overwritten. Omit for last write wins.
|
|
850
|
+
*/
|
|
851
|
+
expected_updated_at?: string
|
|
852
|
+
/** Takes the quoted previous message off (true) or puts it back on (false). */
|
|
853
|
+
is_quote_removed?: boolean
|
|
854
|
+
/** Replaces the tone recorded on the draft. Omit to keep it. */
|
|
855
|
+
tone_profile_id?: string
|
|
856
|
+
/** What this edit is in the draft's history. Defaults to `edited`. */
|
|
857
|
+
version_kind?: Exclude<MessageDraftVersionKind, 'drafted'>
|
|
858
|
+
/** The reviewer's prompt behind a redraft. */
|
|
859
|
+
instruction?: string
|
|
860
|
+
/** The version a restore copies from. */
|
|
861
|
+
source_version?: number
|
|
795
862
|
}
|
|
796
863
|
|
|
797
864
|
export interface CreateAgentListenerRequest {
|
package/src/data/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
2
|
import { type EntityIndexService, EntityIndexServiceImpl } from './entity-indexes.js'
|
|
3
3
|
import { type QueryService, QueryServiceImpl } from './queries.js'
|
|
4
|
+
import { type RecordDraftService, RecordDraftServiceImpl } from './record-drafts.js'
|
|
4
5
|
import {
|
|
5
6
|
type RecordDuplicateService,
|
|
6
7
|
RecordDuplicateServiceImpl,
|
|
@@ -26,12 +27,15 @@ export class DataClient {
|
|
|
26
27
|
readonly recordDuplicates: RecordDuplicateService
|
|
27
28
|
/** Per-entity indexes on the record table + the advisor's recommendations. */
|
|
28
29
|
readonly entityIndexes: EntityIndexService
|
|
30
|
+
/** Proposed record writes awaiting a human (or reviewing agent) verdict. */
|
|
31
|
+
readonly recordDrafts: RecordDraftService
|
|
29
32
|
|
|
30
33
|
constructor(client: ProteosClient) {
|
|
31
34
|
this.records = new RecordServiceImpl(client)
|
|
32
35
|
this.queries = new QueryServiceImpl(client)
|
|
33
36
|
this.recordDuplicates = new RecordDuplicateServiceImpl(client)
|
|
34
37
|
this.entityIndexes = new EntityIndexServiceImpl(client)
|
|
38
|
+
this.recordDrafts = new RecordDraftServiceImpl(client)
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -46,27 +50,41 @@ export type {
|
|
|
46
50
|
QueryValidateMeta,
|
|
47
51
|
QueryValidateResponse,
|
|
48
52
|
} from './queries.js'
|
|
53
|
+
export type { RecordDraftService } from './record-drafts.js'
|
|
49
54
|
export type { RecordDuplicateService, RecordService } from './records.js'
|
|
50
55
|
export type {
|
|
56
|
+
ApproveRecordDraftRequest,
|
|
51
57
|
BatchTransactionError,
|
|
52
58
|
BatchTransactionStatus,
|
|
53
59
|
BatchUpsertRecordsResponse,
|
|
54
60
|
BatchUpsertTransaction,
|
|
55
61
|
BatchUpsertTransactionResult,
|
|
56
62
|
CreateEntityIndexRequest,
|
|
63
|
+
CreateRecordDraftRequest,
|
|
57
64
|
EntityIndex,
|
|
58
65
|
EntityIndexSource,
|
|
59
66
|
EntityIndexState,
|
|
60
67
|
EntityIndexType,
|
|
61
68
|
IndexEvidence,
|
|
62
69
|
IndexRecommendation,
|
|
70
|
+
ListRecordDraftsQuery,
|
|
63
71
|
ListRecordDuplicatesQuery,
|
|
64
72
|
ListRecordsOptions,
|
|
65
73
|
PublishContactObservationsResponse,
|
|
66
74
|
RecordData,
|
|
75
|
+
RecordDraft,
|
|
76
|
+
RecordDraftChange,
|
|
77
|
+
RecordDraftChangeKind,
|
|
78
|
+
RecordDraftIntent,
|
|
79
|
+
RecordDraftItem,
|
|
80
|
+
RecordDraftItemError,
|
|
81
|
+
RecordDraftItemResult,
|
|
82
|
+
RecordDraftItemResultStatus,
|
|
83
|
+
RecordDraftStatus,
|
|
67
84
|
RecordDuplicate,
|
|
68
85
|
RecordDuplicateSource,
|
|
69
86
|
RecordDuplicateStatus,
|
|
87
|
+
RejectRecordDraftRequest,
|
|
70
88
|
} from './types.js'
|
|
71
89
|
|
|
72
90
|
// Re-export Zod schemas
|
|
@@ -75,4 +93,7 @@ export {
|
|
|
75
93
|
BatchUpsertRecordsResponseSchema,
|
|
76
94
|
BatchUpsertTransactionResultSchema,
|
|
77
95
|
BatchUpsertTransactionSchema,
|
|
96
|
+
RecordDraftChangeSchema,
|
|
97
|
+
RecordDraftItemResultSchema,
|
|
98
|
+
RecordDraftItemSchema,
|
|
78
99
|
} from './types.js'
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import type { ListResult } from '../types/common.js'
|
|
3
|
+
import type {
|
|
4
|
+
ApproveRecordDraftRequest,
|
|
5
|
+
CreateRecordDraftRequest,
|
|
6
|
+
ListRecordDraftsQuery,
|
|
7
|
+
RecordDraft,
|
|
8
|
+
RejectRecordDraftRequest,
|
|
9
|
+
} from './types.js'
|
|
10
|
+
|
|
11
|
+
const RECORD_DRAFTS_BASE_PATH = '/data/v1/record-drafts'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Proposed record writes awaiting a verdict. `create` needs
|
|
15
|
+
* `record-drafts:write`; `approve` additionally needs `write` (create / update /
|
|
16
|
+
* upsert) or `delete` (delete) on the entity, because the writes run as the
|
|
17
|
+
* caller. approved vs approved_with_changes is derived server-side.
|
|
18
|
+
*/
|
|
19
|
+
export interface RecordDraftService {
|
|
20
|
+
/** The org's drafts — `proposed` by default. */
|
|
21
|
+
list(query?: ListRecordDraftsQuery): Promise<ListResult<RecordDraft>>
|
|
22
|
+
get(id: string): Promise<RecordDraft>
|
|
23
|
+
create(request: CreateRecordDraftRequest): Promise<RecordDraft>
|
|
24
|
+
/**
|
|
25
|
+
* Applies the draft as the caller. No `items` = as proposed; `items` = the
|
|
26
|
+
* reviewer's edited proposal. Always 200 with the draft: `status` is
|
|
27
|
+
* `approved` / `approved_with_changes` when every item succeeded, else still
|
|
28
|
+
* `proposed` with per-item `results` to fix and re-approve. 409
|
|
29
|
+
* `record_draft_not_proposed` once resolved.
|
|
30
|
+
*/
|
|
31
|
+
approve(id: string, request?: ApproveRecordDraftRequest): Promise<RecordDraft>
|
|
32
|
+
/** Never applies the draft. 409 `record_draft_not_proposed` once resolved. */
|
|
33
|
+
reject(id: string, request?: RejectRecordDraftRequest): Promise<RecordDraft>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class RecordDraftServiceImpl implements RecordDraftService {
|
|
37
|
+
constructor(private readonly client: ProteosClient) {}
|
|
38
|
+
|
|
39
|
+
async list(query: ListRecordDraftsQuery = {}): Promise<ListResult<RecordDraft>> {
|
|
40
|
+
return this.client.requestWithQuery<ListResult<RecordDraft>>(
|
|
41
|
+
'GET',
|
|
42
|
+
RECORD_DRAFTS_BASE_PATH,
|
|
43
|
+
query,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async get(id: string): Promise<RecordDraft> {
|
|
48
|
+
return this.client.request<RecordDraft>(
|
|
49
|
+
'GET',
|
|
50
|
+
`${RECORD_DRAFTS_BASE_PATH}/${encodeURIComponent(id)}`,
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async create(request: CreateRecordDraftRequest): Promise<RecordDraft> {
|
|
55
|
+
return this.client.request<RecordDraft>('POST', RECORD_DRAFTS_BASE_PATH, request)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async approve(id: string, request: ApproveRecordDraftRequest = {}): Promise<RecordDraft> {
|
|
59
|
+
return this.client.request<RecordDraft>(
|
|
60
|
+
'POST',
|
|
61
|
+
`${RECORD_DRAFTS_BASE_PATH}/${encodeURIComponent(id)}/approve`,
|
|
62
|
+
request,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async reject(id: string, request: RejectRecordDraftRequest = {}): Promise<RecordDraft> {
|
|
67
|
+
return this.client.request<RecordDraft>(
|
|
68
|
+
'POST',
|
|
69
|
+
`${RECORD_DRAFTS_BASE_PATH}/${encodeURIComponent(id)}/reject`,
|
|
70
|
+
request,
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
}
|
package/src/data/types.ts
CHANGED
|
@@ -141,6 +141,168 @@ export interface ListRecordDuplicatesQuery {
|
|
|
141
141
|
page_size?: number
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// ── Record drafts ─────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
/** WHAT a draft proposes to do to the entity's records. Record-only, hence the
|
|
147
|
+
* short verbs; the page-button intent vocabulary (`create_record`, …) is mapped
|
|
148
|
+
* at the UI boundary. */
|
|
149
|
+
export type RecordDraftIntent = 'create' | 'update' | 'delete' | 'upsert'
|
|
150
|
+
|
|
151
|
+
/** The review lifecycle: `proposed` awaits a verdict; `approved` was applied
|
|
152
|
+
* exactly as proposed; `approved_with_changes` was edited, then applied
|
|
153
|
+
* (`changes` says what the reviewer altered); `rejected` was never applied.
|
|
154
|
+
* The last three are terminal. approved vs approved_with_changes is DERIVED by
|
|
155
|
+
* the server from `changes` — a resolver never names the outcome. */
|
|
156
|
+
export type RecordDraftStatus = 'proposed' | 'approved' | 'approved_with_changes' | 'rejected'
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* ONE proposed write, keyed like a batch transaction. Shape per intent —
|
|
160
|
+
* create: `data`, no `id` · update: `id` + `data` · delete: `id`, no `data` ·
|
|
161
|
+
* upsert: `data`, `id` optional (present ⇒ update, absent ⇒ create). `id` never
|
|
162
|
+
* rides inside `data`. Update/upsert `data` is a partial merge (only the keys
|
|
163
|
+
* present change).
|
|
164
|
+
*/
|
|
165
|
+
export interface RecordDraftItem {
|
|
166
|
+
transaction_id: string
|
|
167
|
+
id?: string
|
|
168
|
+
data?: Record<string, unknown>
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type RecordDraftItemResultStatus = 'success' | 'error'
|
|
172
|
+
|
|
173
|
+
/** The same facts the single-record endpoint would have answered with. */
|
|
174
|
+
export interface RecordDraftItemError {
|
|
175
|
+
code: string
|
|
176
|
+
message: string
|
|
177
|
+
status?: number
|
|
178
|
+
details?: Record<string, unknown>
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** The outcome of applying one item — the batch result minus the record. */
|
|
182
|
+
export interface RecordDraftItemResult {
|
|
183
|
+
transaction_id: string
|
|
184
|
+
status: RecordDraftItemResultStatus
|
|
185
|
+
record_id?: string
|
|
186
|
+
error?: RecordDraftItemError
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** ONE thing the reviewer altered before applying. */
|
|
190
|
+
export type RecordDraftChangeKind =
|
|
191
|
+
| 'item_dropped'
|
|
192
|
+
| 'attribute_changed'
|
|
193
|
+
| 'attribute_removed'
|
|
194
|
+
| 'attribute_added'
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* One entry of the reviewer's delta, diffed against the ORIGINAL proposal.
|
|
198
|
+
* `proposed` and `applied` are always present — `null` means "cleared".
|
|
199
|
+
* `current` is the record's value BEFORE the write, captured for existing
|
|
200
|
+
* targets (`has_current` says whether it was); it is STORED for the proposer
|
|
201
|
+
* to learn from but NOT yet exposed by the API — responses carry it redacted
|
|
202
|
+
* (`has_current: false`, `current: null`) because a draft reader may not be
|
|
203
|
+
* allowed to read the record or that attribute.
|
|
204
|
+
*/
|
|
205
|
+
export interface RecordDraftChange {
|
|
206
|
+
transaction_id: string
|
|
207
|
+
kind: RecordDraftChangeKind
|
|
208
|
+
attribute?: string
|
|
209
|
+
has_current: boolean
|
|
210
|
+
current: unknown
|
|
211
|
+
proposed: unknown
|
|
212
|
+
applied: unknown
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A PROPOSED record write awaiting a verdict — the record sibling of a draft
|
|
217
|
+
* message. `items` is the proposal (immutable); `applied_items` what the
|
|
218
|
+
* resolver actually sent; `results` the latest outcome per transaction_id (a
|
|
219
|
+
* re-approve after a partial failure re-sends only the items that have not
|
|
220
|
+
* succeeded); `changes` the reviewer's delta. `source` is caller-supplied
|
|
221
|
+
* provenance (`agent_key`, `session_id`, …); `created_by` is the acting user.
|
|
222
|
+
*/
|
|
223
|
+
export interface RecordDraft {
|
|
224
|
+
id: string
|
|
225
|
+
org_id: string
|
|
226
|
+
entity_slug: string
|
|
227
|
+
intent: RecordDraftIntent
|
|
228
|
+
status: RecordDraftStatus
|
|
229
|
+
summary: string
|
|
230
|
+
items: RecordDraftItem[]
|
|
231
|
+
applied_items?: RecordDraftItem[]
|
|
232
|
+
results?: RecordDraftItemResult[]
|
|
233
|
+
changes?: RecordDraftChange[]
|
|
234
|
+
source?: Record<string, unknown>
|
|
235
|
+
reason?: string
|
|
236
|
+
resolved_by?: { type: string; id: string }
|
|
237
|
+
resolved_at?: string
|
|
238
|
+
created_at: string
|
|
239
|
+
created_by: { type: string; id: string }
|
|
240
|
+
updated_at: string
|
|
241
|
+
updated_by: { type: string; id: string }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface CreateRecordDraftRequest {
|
|
245
|
+
entity_slug: string
|
|
246
|
+
intent: RecordDraftIntent
|
|
247
|
+
/** 1..200 items; a missing `transaction_id` becomes the 1-based index. */
|
|
248
|
+
items: RecordDraftItem[]
|
|
249
|
+
/** The proposer's one-line why — required. */
|
|
250
|
+
summary: string
|
|
251
|
+
source?: Record<string, unknown>
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** `items` absent = apply as proposed; present = the reviewer's edited
|
|
255
|
+
* proposal (values changed, fields removed/added, rows dropped — never new
|
|
256
|
+
* transaction_ids). */
|
|
257
|
+
export interface ApproveRecordDraftRequest {
|
|
258
|
+
items?: RecordDraftItem[]
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface RejectRecordDraftRequest {
|
|
262
|
+
reason?: string
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface ListRecordDraftsQuery {
|
|
266
|
+
entity_slug?: string
|
|
267
|
+
/** Defaults to `proposed` on the server. */
|
|
268
|
+
status?: RecordDraftStatus
|
|
269
|
+
intent?: RecordDraftIntent
|
|
270
|
+
/** Only drafts whose items name this record. */
|
|
271
|
+
record_id?: string
|
|
272
|
+
page?: number
|
|
273
|
+
page_size?: number
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export const RecordDraftItemSchema = z.object({
|
|
277
|
+
transaction_id: z.string(),
|
|
278
|
+
id: z.string().optional(),
|
|
279
|
+
data: z.record(z.string(), z.unknown()).optional(),
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
export const RecordDraftItemResultSchema = z.object({
|
|
283
|
+
transaction_id: z.string(),
|
|
284
|
+
status: z.enum(['success', 'error']),
|
|
285
|
+
record_id: z.string().optional(),
|
|
286
|
+
error: z
|
|
287
|
+
.object({
|
|
288
|
+
code: z.string(),
|
|
289
|
+
message: z.string(),
|
|
290
|
+
status: z.number().optional(),
|
|
291
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
292
|
+
})
|
|
293
|
+
.optional(),
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
export const RecordDraftChangeSchema = z.object({
|
|
297
|
+
transaction_id: z.string(),
|
|
298
|
+
kind: z.enum(['item_dropped', 'attribute_changed', 'attribute_removed', 'attribute_added']),
|
|
299
|
+
attribute: z.string().optional(),
|
|
300
|
+
has_current: z.boolean(),
|
|
301
|
+
current: z.unknown(),
|
|
302
|
+
proposed: z.unknown(),
|
|
303
|
+
applied: z.unknown(),
|
|
304
|
+
})
|
|
305
|
+
|
|
144
306
|
/** ONE page of an entity's records replayed as contact observations. */
|
|
145
307
|
export interface PublishContactObservationsResponse {
|
|
146
308
|
entity_slug: string
|
package/src/index.ts
CHANGED
|
@@ -461,6 +461,10 @@ export type {
|
|
|
461
461
|
MessageDelivery,
|
|
462
462
|
MessageDeliveryStatus,
|
|
463
463
|
MessageDirection,
|
|
464
|
+
MessageDraftChange,
|
|
465
|
+
MessageDraftVersion,
|
|
466
|
+
MessageDraftVersionKind,
|
|
467
|
+
MessageDraftVersions,
|
|
464
468
|
MessagePreview,
|
|
465
469
|
MessageRecipient,
|
|
466
470
|
MessageService,
|
|
@@ -545,12 +549,14 @@ export type {
|
|
|
545
549
|
// Conversation client (conversation-service)
|
|
546
550
|
export { ConversationClient } from './conversation/index.js'
|
|
547
551
|
export type {
|
|
552
|
+
ApproveRecordDraftRequest,
|
|
548
553
|
BatchTransactionError,
|
|
549
554
|
BatchTransactionStatus,
|
|
550
555
|
BatchUpsertRecordsResponse,
|
|
551
556
|
BatchUpsertTransaction,
|
|
552
557
|
BatchUpsertTransactionResult,
|
|
553
558
|
CreateEntityIndexRequest,
|
|
559
|
+
CreateRecordDraftRequest,
|
|
554
560
|
EntityIndex,
|
|
555
561
|
EntityIndexService,
|
|
556
562
|
EntityIndexSource,
|
|
@@ -558,6 +564,7 @@ export type {
|
|
|
558
564
|
EntityIndexType,
|
|
559
565
|
IndexEvidence,
|
|
560
566
|
IndexRecommendation,
|
|
567
|
+
ListRecordDraftsQuery,
|
|
561
568
|
ListRecordDuplicatesQuery,
|
|
562
569
|
ListRecordsOptions,
|
|
563
570
|
PublishContactObservationsResponse,
|
|
@@ -568,11 +575,22 @@ export type {
|
|
|
568
575
|
QueryValidateMeta,
|
|
569
576
|
QueryValidateResponse,
|
|
570
577
|
RecordData,
|
|
578
|
+
RecordDraft,
|
|
579
|
+
RecordDraftChange,
|
|
580
|
+
RecordDraftChangeKind,
|
|
581
|
+
RecordDraftIntent,
|
|
582
|
+
RecordDraftItem,
|
|
583
|
+
RecordDraftItemError,
|
|
584
|
+
RecordDraftItemResult,
|
|
585
|
+
RecordDraftItemResultStatus,
|
|
586
|
+
RecordDraftService,
|
|
587
|
+
RecordDraftStatus,
|
|
571
588
|
RecordDuplicate,
|
|
572
589
|
RecordDuplicateService,
|
|
573
590
|
RecordDuplicateSource,
|
|
574
591
|
RecordDuplicateStatus,
|
|
575
592
|
RecordService,
|
|
593
|
+
RejectRecordDraftRequest,
|
|
576
594
|
} from './data/index.js'
|
|
577
595
|
// Data client (data-service)
|
|
578
596
|
export {
|
|
@@ -581,6 +599,9 @@ export {
|
|
|
581
599
|
BatchUpsertTransactionResultSchema,
|
|
582
600
|
BatchUpsertTransactionSchema,
|
|
583
601
|
DataClient,
|
|
602
|
+
RecordDraftChangeSchema,
|
|
603
|
+
RecordDraftItemResultSchema,
|
|
604
|
+
RecordDraftItemSchema,
|
|
584
605
|
} from './data/index.js'
|
|
585
606
|
// Discovery types (discovery-service: the evidence users send Proteos —
|
|
586
607
|
// screenshots, recordings with ink-annotated frames, written feedback)
|
package/src/scheduling/types.ts
CHANGED
|
@@ -221,6 +221,10 @@ export interface CalendarEvent {
|
|
|
221
221
|
recurrence?: string[]
|
|
222
222
|
title: string
|
|
223
223
|
description?: string
|
|
224
|
+
/** What the booker wrote on a scheduling-link booking; sync never overwrites it (unlike description). */
|
|
225
|
+
notes?: string
|
|
226
|
+
/** On a booking that was moved: the event that replaced it. */
|
|
227
|
+
rescheduled_to_event_id?: string
|
|
224
228
|
start_at: string
|
|
225
229
|
end_at: string
|
|
226
230
|
is_all_day: boolean
|
|
@@ -286,6 +290,12 @@ export interface CalendarEventType {
|
|
|
286
290
|
/** Exclusive events of this type per host per day; 0 = no cap. */
|
|
287
291
|
max_per_day: number
|
|
288
292
|
location: EventLocation
|
|
293
|
+
/**
|
|
294
|
+
* Liquid template naming each booked event (the invite subject). Variables:
|
|
295
|
+
* type.name, type.key, link.name, link.key, contact.name, contact.email,
|
|
296
|
+
* host.display_name, host.headline. Empty = "{{ type.name }} — {{ contact.name }}".
|
|
297
|
+
*/
|
|
298
|
+
title_template?: string
|
|
289
299
|
/** Soft reference to conversation-service's conversation_type. */
|
|
290
300
|
conversation_type_key?: string
|
|
291
301
|
is_cancel_allowed: boolean
|
|
@@ -354,6 +364,8 @@ export interface PutCalendarEventTypeRequest {
|
|
|
354
364
|
scheduling_window_days?: number
|
|
355
365
|
max_per_day?: number
|
|
356
366
|
location?: EventLocation
|
|
367
|
+
/** See CalendarEventType.title_template; "" restores the default. */
|
|
368
|
+
title_template?: string
|
|
357
369
|
conversation_type_key?: string
|
|
358
370
|
/** Policy flags default to TRUE when absent; send false to switch one off. */
|
|
359
371
|
is_cancel_allowed?: boolean
|
|
@@ -375,6 +387,8 @@ export interface UpdateCalendarEventTypeRequest {
|
|
|
375
387
|
scheduling_window_days?: number
|
|
376
388
|
max_per_day?: number
|
|
377
389
|
location?: EventLocation
|
|
390
|
+
/** See CalendarEventType.title_template; "" restores the default. */
|
|
391
|
+
title_template?: string
|
|
378
392
|
conversation_type_key?: string
|
|
379
393
|
/** Policy flags default to TRUE when absent; send false to switch one off. */
|
|
380
394
|
is_cancel_allowed?: boolean
|
|
@@ -752,11 +766,15 @@ export interface PublicCalendarEvent {
|
|
|
752
766
|
status: EventStatus
|
|
753
767
|
location: EventLocation
|
|
754
768
|
join_url?: string
|
|
769
|
+
/** The service behind join_url (Teams, Meet). */
|
|
770
|
+
conferencing_provider?: ConferencingProvider
|
|
755
771
|
link: PublicSchedulingLink
|
|
756
772
|
host: PublicHost
|
|
757
773
|
contact: BookingContact
|
|
758
774
|
is_cancelled: boolean
|
|
759
775
|
deleted_at?: string
|
|
776
|
+
/** The live booking this one was moved to (same manage token); absent unless it was moved. */
|
|
777
|
+
rescheduled_to_event_id?: string
|
|
760
778
|
}
|
|
761
779
|
|
|
762
780
|
export interface PublicBookSchedulingLinkResponse extends PublicCalendarEvent {
|