@oddington/sdk 0.1.63 → 0.1.65
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 +26 -8
- package/dist/browser.js +374 -235
- package/dist/index.js +4 -4
- package/dist/types/packages/sdk/src/data-snapshot-history-types.d.ts +28 -0
- package/dist/types/packages/sdk/src/public.d.ts +3 -1
- package/dist/types/shared/data-snapshot-history.d.ts +40 -0
- package/dist/types/shared/inbox-member-contract.d.ts +4 -2
- package/dist/types/shared/inbox-member-types.d.ts +36 -6
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JsonObject } from '../../../shared/inbox-contract.js';
|
|
2
|
+
import type { SnapshotHistoryEvent } from '../../../shared/data-snapshot-history.js';
|
|
3
|
+
export type { SnapshotHistoryEvent, SnapshotHistorySlot } from '../../../shared/data-snapshot-history.js';
|
|
4
|
+
export type SnapshotHistoryRecord = {
|
|
5
|
+
$ref: string;
|
|
6
|
+
values: JsonObject;
|
|
7
|
+
};
|
|
8
|
+
export type SnapshotHistoryRecords = {
|
|
9
|
+
commit: string | null;
|
|
10
|
+
records: SnapshotHistoryRecord[];
|
|
11
|
+
};
|
|
12
|
+
export type SnapshotHistoryChange = {
|
|
13
|
+
commit: string;
|
|
14
|
+
authoredAt: string;
|
|
15
|
+
committedAt: string;
|
|
16
|
+
events: SnapshotHistoryEvent[];
|
|
17
|
+
};
|
|
18
|
+
export type SnapshotHistory = {
|
|
19
|
+
records(input: {
|
|
20
|
+
collection: string;
|
|
21
|
+
at: string;
|
|
22
|
+
}): Promise<SnapshotHistoryRecords>;
|
|
23
|
+
changes(input: {
|
|
24
|
+
collection: string;
|
|
25
|
+
ref?: string;
|
|
26
|
+
field?: string;
|
|
27
|
+
}): Promise<SnapshotHistoryChange[]>;
|
|
28
|
+
};
|
|
@@ -32,7 +32,9 @@ export type SnapshotRecordsAllOptions = {
|
|
|
32
32
|
maxRecords: number;
|
|
33
33
|
body?: true;
|
|
34
34
|
};
|
|
35
|
+
export type { SnapshotHistory, SnapshotHistoryRecord, SnapshotHistoryRecords, SnapshotHistoryChange, SnapshotHistoryEvent, SnapshotHistorySlot } from './data-snapshot-history-types.js';
|
|
35
36
|
export type DataSnapshot<Name extends string = string> = {
|
|
37
|
+
history: import('./data-snapshot-history-types.js').SnapshotHistory;
|
|
36
38
|
subscribe(listener: (update: {
|
|
37
39
|
records: boolean;
|
|
38
40
|
changes: boolean;
|
|
@@ -61,7 +63,7 @@ export { FileOperationError } from '../../../shared/files-contract.js';
|
|
|
61
63
|
export { source } from './source.js';
|
|
62
64
|
export type { SourceLocation, OsSourceLocation, GmailSourceLocation, DropboxSourceLocation, OutlookSourceLocation, SharePointSourceLocation } from './source.js';
|
|
63
65
|
export { InboxOperationError } from '../../../shared/inbox-member-contract.js';
|
|
64
|
-
export type { InboxMember, InboxCurrent, InboxItem,
|
|
66
|
+
export type { InboxMember, InboxCurrent, InboxItem, QuestionWork, QuestionSituation, ActionSituation, QuestionSnapshot, QuestionAvailability, QuestionUnavailableReason, ResponseConsequence, LinkedAskSnapshot, AskUpdate, DigestReadConfirmation, RecipientCandidate, RecipientAddition, ResponseAcceptance, InboxAnswerInput, InboxSearchInput } from '../../../shared/inbox-member-types.js';
|
|
65
67
|
export type { RecordSelectionResult } from '../../../shared/record-selection.js';
|
|
66
68
|
export declare const inbox: import('../../../shared/inbox-member-types.js').InboxMember;
|
|
67
69
|
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode, FileErrorDetail } from '../../../shared/files-contract.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from './inbox-contract.js';
|
|
2
|
+
/** Private canonical snapshot projection. Arrays retain first-parent order. */
|
|
3
|
+
export type SnapshotHistorySlot = {
|
|
4
|
+
present: false;
|
|
5
|
+
} | {
|
|
6
|
+
present: true;
|
|
7
|
+
value: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
export type SnapshotHistoryEvent = {
|
|
10
|
+
kind: 'create' | 'delete';
|
|
11
|
+
collection: string;
|
|
12
|
+
ref: string;
|
|
13
|
+
values: JsonObject;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'rename';
|
|
16
|
+
collection: string;
|
|
17
|
+
ref: string;
|
|
18
|
+
previousRef: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'update';
|
|
21
|
+
collection: string;
|
|
22
|
+
ref: string;
|
|
23
|
+
field: string;
|
|
24
|
+
before: SnapshotHistorySlot;
|
|
25
|
+
after: SnapshotHistorySlot;
|
|
26
|
+
};
|
|
27
|
+
export type SnapshotHistoryCommit = {
|
|
28
|
+
commit: string;
|
|
29
|
+
firstParent: string | null;
|
|
30
|
+
authoredAt: string;
|
|
31
|
+
committedAt: string;
|
|
32
|
+
events: SnapshotHistoryEvent[];
|
|
33
|
+
};
|
|
34
|
+
export type SnapshotHistoryProjection = {
|
|
35
|
+
fields: Record<string, {
|
|
36
|
+
fields: readonly string[];
|
|
37
|
+
}>;
|
|
38
|
+
through: string;
|
|
39
|
+
commits: SnapshotHistoryCommit[];
|
|
40
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InboxCurrent, InboxItem,
|
|
1
|
+
import type { InboxCurrent, InboxItem, QuestionWork, QuestionSituation, ResponseAcceptance, QuestionAvailability, QuestionUnavailableReason } from './inbox-member-types.js';
|
|
2
2
|
export declare class InboxOperationError extends Error {
|
|
3
3
|
readonly status: number;
|
|
4
4
|
readonly reason: 'invalid_input' | 'access_denied' | 'authority_unavailable' | 'conflict' | 'unavailable' | 'action_processing' | 'action_failed' | QuestionUnavailableReason;
|
|
@@ -30,6 +30,8 @@ export declare function parseInboxRequest(value: unknown): {
|
|
|
30
30
|
export declare function parseInboxCurrent(value: unknown): InboxCurrent;
|
|
31
31
|
export declare function parseInboxItem(value: unknown): InboxItem;
|
|
32
32
|
/** Exact app-facing vocabulary: an upstream snapshot cannot widen it. */
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function parseQuestionWork(value: unknown): QuestionWork;
|
|
34
|
+
/** Validate the owner's closed vocabulary; never classify infrastructure in a client. */
|
|
35
|
+
export declare function parseQuestionSituation(value: unknown): QuestionSituation;
|
|
34
36
|
export declare function parseInboxAcceptance(value: unknown): ResponseAcceptance;
|
|
35
37
|
export declare function parseInboxResult(operation: InboxOperation, value: unknown): unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InboxBlock, QuestionResponse, ResponseDefinition, RepositoryReceipt, RecordReference } from './inbox-contract.js';
|
|
2
|
+
import type { AirtableReceipt } from './airtable-contract.js';
|
|
2
3
|
import type { ResolvedView } from './inbox-views.js';
|
|
3
4
|
import type { RecordSelectionResult } from './record-selection.js';
|
|
4
5
|
export interface InboxCurrent {
|
|
@@ -15,13 +16,32 @@ export interface InboxCurrent {
|
|
|
15
16
|
email: string;
|
|
16
17
|
};
|
|
17
18
|
}
|
|
19
|
+
export type ActionSituation = {
|
|
20
|
+
state: 'queued';
|
|
21
|
+
label: 'Waiting to start';
|
|
22
|
+
} | {
|
|
23
|
+
state: 'running';
|
|
24
|
+
label: 'Working';
|
|
25
|
+
} | {
|
|
26
|
+
state: 'completed';
|
|
27
|
+
label: string;
|
|
28
|
+
} | {
|
|
29
|
+
state: 'could_not_start';
|
|
30
|
+
label: 'Couldn’t start';
|
|
31
|
+
reason: string;
|
|
32
|
+
} | {
|
|
33
|
+
state: 'needs_review';
|
|
34
|
+
label: 'Needs review';
|
|
35
|
+
reason?: string;
|
|
36
|
+
};
|
|
37
|
+
export type QuestionSituation = {
|
|
38
|
+
state: 'available';
|
|
39
|
+
label: string;
|
|
40
|
+
} | ActionSituation;
|
|
18
41
|
export interface ResponseConsequence {
|
|
19
|
-
state: 'pending' | 'running' | 'applied' | 'no-write' | 'stopped' | 'partial' | 'uncertain';
|
|
20
42
|
phase: 'loading' | 'invoking' | 'committing' | null;
|
|
21
43
|
updatedAt: string;
|
|
22
|
-
evidence: RepositoryReceipt
|
|
23
|
-
needsReconciliation: boolean;
|
|
24
|
-
reason: string | null;
|
|
44
|
+
evidence: Array<RepositoryReceipt | AirtableReceipt>;
|
|
25
45
|
}
|
|
26
46
|
export type QuestionUnavailableReason = 'handler_unavailable';
|
|
27
47
|
export interface QuestionAvailability {
|
|
@@ -35,6 +55,7 @@ export interface QuestionSnapshot extends QuestionAvailability {
|
|
|
35
55
|
response: ResponseDefinition;
|
|
36
56
|
allowedResponders: string[];
|
|
37
57
|
available: boolean;
|
|
58
|
+
situation: QuestionSituation;
|
|
38
59
|
acceptedResponse: {
|
|
39
60
|
id: string;
|
|
40
61
|
userId: string;
|
|
@@ -131,7 +152,7 @@ export interface ResponseAcceptance {
|
|
|
131
152
|
label?: string;
|
|
132
153
|
acceptanceOrder?: number;
|
|
133
154
|
}
|
|
134
|
-
export interface
|
|
155
|
+
export interface QuestionWork extends QuestionAvailability {
|
|
135
156
|
itemId: string;
|
|
136
157
|
/** Parent Ask's workspace-scoped Inbox number, stable across revisions. */
|
|
137
158
|
number: number;
|
|
@@ -144,6 +165,13 @@ export interface AnswerableQuestion extends QuestionAvailability {
|
|
|
144
165
|
instructions?: string;
|
|
145
166
|
response: ResponseDefinition;
|
|
146
167
|
answerable: boolean;
|
|
168
|
+
responsible: {
|
|
169
|
+
id: string;
|
|
170
|
+
name: string;
|
|
171
|
+
};
|
|
172
|
+
situation: Exclude<QuestionSituation, {
|
|
173
|
+
state: 'completed';
|
|
174
|
+
}>;
|
|
147
175
|
tags: string[];
|
|
148
176
|
recordRefs: Array<{
|
|
149
177
|
repository: string;
|
|
@@ -171,6 +199,8 @@ export type ItemRevision = {
|
|
|
171
199
|
export type InboxAnswerInput = ItemRevision & {
|
|
172
200
|
questionId: string;
|
|
173
201
|
response: QuestionResponse;
|
|
202
|
+
/** Reuse this key for the same submission after an uncertain acknowledgement. */
|
|
203
|
+
submissionKey: string;
|
|
174
204
|
/** Picker name for display only; the Record reference is the answer. */
|
|
175
205
|
label?: string;
|
|
176
206
|
};
|
|
@@ -207,7 +237,7 @@ export interface InboxMember {
|
|
|
207
237
|
}): Promise<RecipientAddition>;
|
|
208
238
|
};
|
|
209
239
|
questions: {
|
|
210
|
-
list(input: InboxQuestionListInput): Promise<
|
|
240
|
+
list(input: InboxQuestionListInput): Promise<QuestionWork[]>;
|
|
211
241
|
answer(input: InboxAnswerInput): Promise<ResponseAcceptance>;
|
|
212
242
|
searchRecords(input: InboxSearchInput): Promise<RecordSelectionResult>;
|
|
213
243
|
};
|