@oddington/sdk 0.1.84 → 0.1.86
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/browser.js +491 -356
- package/dist/index.js +10 -10
- package/dist/types/packages/sdk/src/public.d.ts +2 -2
- package/dist/types/packages/sdk/src/query-definition-types.d.ts +3 -10
- package/dist/types/shared/inbox-contract.d.ts +7 -1
- package/dist/types/shared/inbox-member-contract.d.ts +10 -4
- package/dist/types/shared/inbox-member-types.d.ts +21 -0
- package/dist/types/shared/routine-query-contract.d.ts +16 -3
- package/dist/types/shared/routine-query-results.d.ts +3 -10
- package/dist/types/shared/routine-webhook-contract.d.ts +26 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ export declare const routines: import('./routine-reference-types.js').Routines;
|
|
|
7
7
|
export { RoutineOperationError } from '../../../shared/routine-operation-error.js';
|
|
8
8
|
export type { RoutineOperationCode } from '../../../shared/routine-operation-error.js';
|
|
9
9
|
export type { QueueAskWait, QueueItem, QueueState, QueueSummary, QueryDescription, QueryExecution, QueryExecutionPage, RoutineListOptions, RoutineRunHandle, RoutineQueryReference, QueryExecutionHandle } from './routine-reference-types.js';
|
|
10
|
-
export type { QueryDefinition, QueryEntry, QueryRuntime, QueryTrigger, QueryTriggerContext } from './query-definition-types.js';
|
|
10
|
+
export type { QueryDefinition, QueryEntry, QueryRuntime, QueryTrigger, QueryTriggerContext, WebhookEvent, XeroWebhookEvent } from './query-definition-types.js';
|
|
11
11
|
export type { RoutineReference, RoutineQueueReference } from './routine-reference-types.js';
|
|
12
12
|
export declare const schema: import('./routine-definition-types.js').RoutineSchemaBuilders;
|
|
13
13
|
export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
|
|
@@ -73,7 +73,7 @@ export { FileOperationError } from '../../../shared/files-contract.js';
|
|
|
73
73
|
export { source } from './source.js';
|
|
74
74
|
export type { SourceLocation, OsSourceLocation, GmailSourceLocation, DropboxSourceLocation, OutlookSourceLocation, SharePointSourceLocation } from './source.js';
|
|
75
75
|
export { InboxOperationError } from '../../../shared/inbox-member-contract.js';
|
|
76
|
-
export type { InboxMember, InboxBootstrap, InboxItemHydration, InboxCurrent, InboxItem, QuestionWork, QuestionStatus, ActionStatus, QuestionSnapshot, QuestionAvailability, QuestionUnavailableReason, ResponseConsequence, LinkedAskSnapshot, QueueContinuation, AskUpdate, DigestReadConfirmation, RecipientCandidate, RecipientAddition, ResponseAcceptance, InboxAnswerInput, InboxRecordOptionsInput } from '../../../shared/inbox-member-types.js';
|
|
76
|
+
export type { InboxMember, InboxBootstrap, InboxItemHydration, InboxCurrent, InboxItem, QuestionWork, QuestionStatus, ActionStatus, QuestionSnapshot, QuestionAvailability, QuestionUnavailableReason, ResponseConsequence, LinkedAskSnapshot, QueueContinuation, AskUpdate, DigestReadConfirmation, RecipientCandidate, RecipientAddition, ResponseAcceptance, InboxAnswerInput, InboxRecordOptionsInput, AssignmentCandidate, QuestionAssignment, QuestionAssignmentInput } from '../../../shared/inbox-member-types.js';
|
|
77
77
|
export type { RecordOptionCatalogue } from '../../../shared/record-selection.js';
|
|
78
78
|
export declare const inbox: import('../../../shared/inbox-member-types.js').InboxMember;
|
|
79
79
|
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileUpdate, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode, FileErrorDetail } from '../../../shared/files-contract.js';
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import type { RoutineAccess, RoutineInput, SharedRoutineCapabilities } from './routine-definition-types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { QueryTrigger, QueryTriggerContext } from '../../../shared/routine-query-contract.js';
|
|
3
3
|
import type { RoutineQueueReference } from './routine-reference-types.js';
|
|
4
|
-
export type QueryTrigger
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
export type QueryTriggerContext = {
|
|
8
|
-
readonly type: 'manual';
|
|
9
|
-
} | {
|
|
10
|
-
readonly type: 'schedule';
|
|
11
|
-
readonly scheduledAt: string;
|
|
12
|
-
};
|
|
4
|
+
export type { QueryTrigger, QueryTriggerContext } from '../../../shared/routine-query-contract.js';
|
|
5
|
+
export type { WebhookEvent, XeroWebhookEvent } from '../../../shared/routine-webhook-contract.js';
|
|
13
6
|
export type QueryEntry<Input = unknown> = {
|
|
14
7
|
readonly idempotencyKey: string;
|
|
15
8
|
readonly input: RoutineInput<Input>;
|
|
@@ -76,6 +76,10 @@ export type SelectionOptionInput = {
|
|
|
76
76
|
type: 'record-picker';
|
|
77
77
|
label: string;
|
|
78
78
|
source: RecordPickerSource;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'assign';
|
|
81
|
+
label: string;
|
|
82
|
+
assignee?: string;
|
|
79
83
|
};
|
|
80
84
|
/** Publication supplies scoped IDs and preserves authored presentation. */
|
|
81
85
|
export type SelectionOption = SelectionOptionInput & {
|
|
@@ -371,7 +375,7 @@ type ExactSelectionOption<Value> = Value extends {
|
|
|
371
375
|
value: infer Record;
|
|
372
376
|
} ? {
|
|
373
377
|
value: ExactRecordReference<Record>;
|
|
374
|
-
} : never : Value extends {
|
|
378
|
+
} : never : Type extends 'assign' ? {} : Value extends {
|
|
375
379
|
source: infer Source;
|
|
376
380
|
} ? {
|
|
377
381
|
source: ExactAuthorShape<Source, RecordPickerSource> & (Source extends {
|
|
@@ -458,6 +462,8 @@ export type AnsweredAskAnswer<Value, Numbered extends boolean> = {
|
|
|
458
462
|
type SelectionValue<Response> = Response extends {
|
|
459
463
|
options: readonly (infer Option)[];
|
|
460
464
|
} ? Option extends {
|
|
465
|
+
type: 'assign';
|
|
466
|
+
} ? never : Option extends {
|
|
461
467
|
type: 'record-picker';
|
|
462
468
|
} ? RecordReference : Option extends {
|
|
463
469
|
value: infer Value;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { InboxBootstrap, InboxCurrent, InboxItem, QuestionWork, QuestionStatus, ResponseAcceptance, QuestionAvailability, QuestionUnavailableReason } from './inbox-member-types.js';
|
|
1
|
+
import type { InboxBootstrap, InboxCurrent, InboxItem, QuestionWork, QuestionStatus, ResponseAcceptance, QuestionAvailability, QuestionUnavailableReason, QuestionAssignment, QuestionAssignmentInput, AssignmentCandidate } from './inbox-member-types.js';
|
|
2
2
|
export declare class InboxOperationError extends Error {
|
|
3
3
|
readonly status: number;
|
|
4
|
-
readonly reason: 'invalid_input' | 'access_denied' | 'authority_unavailable' | 'conflict' | 'unavailable' | 'client_update_required' | 'action_processing' | 'action_failed' | QuestionUnavailableReason;
|
|
5
|
-
constructor(status: number, reason: 'invalid_input' | 'access_denied' | 'authority_unavailable' | 'conflict' | 'unavailable' | 'client_update_required' | 'action_processing' | 'action_failed' | QuestionUnavailableReason);
|
|
4
|
+
readonly reason: 'invalid_input' | 'access_denied' | 'authority_unavailable' | 'conflict' | 'unavailable' | 'client_update_required' | 'action_processing' | 'action_failed' | 'question_unavailable' | 'assignment_denied' | 'assignee_unavailable' | QuestionUnavailableReason;
|
|
5
|
+
constructor(status: number, reason: 'invalid_input' | 'access_denied' | 'authority_unavailable' | 'conflict' | 'unavailable' | 'client_update_required' | 'action_processing' | 'action_failed' | 'question_unavailable' | 'assignment_denied' | 'assignee_unavailable' | QuestionUnavailableReason);
|
|
6
6
|
}
|
|
7
7
|
/** Private SQL detail maps to plain public errors, never a new Question state. */
|
|
8
8
|
export declare function parseInboxActionHold(value: unknown): InboxOperationError | undefined;
|
|
@@ -22,7 +22,10 @@ export declare const INBOX_LOCAL_INPUT_BYTES: number;
|
|
|
22
22
|
export declare const INBOX_QUESTION_CONTRACT: 'question-work-v2';
|
|
23
23
|
export type InboxQuestionContract = 'question-work-v1' | typeof INBOX_QUESTION_CONTRACT;
|
|
24
24
|
export declare const INBOX_UUID: RegExp;
|
|
25
|
-
export
|
|
25
|
+
export declare function isAssignmentTarget(value: unknown): value is string;
|
|
26
|
+
/** Only known diagnostics from the assignment SQL owners have public meaning. */
|
|
27
|
+
export declare function parseInboxAssignmentDiagnostic(value: unknown): InboxOperationError | undefined;
|
|
28
|
+
export type InboxOperation = 'current' | 'bootstrap' | 'live.connect' | 'items.list' | 'items.read' | 'items.readRecords' | 'items.see' | 'items.markDigestRead' | 'items.rename' | 'items.setLifecycle' | 'items.listRecipientCandidates' | 'items.addRecipient' | 'questions.list' | 'questions.answer' | 'questions.listRecordOptions' | 'questions.listAssignmentCandidates' | 'questions.assign';
|
|
26
29
|
export declare function isAppQuestionOperation(operation: InboxOperation): boolean;
|
|
27
30
|
/** Closed wire vocabulary; both placements require an explicit relevance filter. */
|
|
28
31
|
export declare function parseInboxRequest(value: unknown): {
|
|
@@ -38,4 +41,7 @@ export declare function parseQuestionWork(value: unknown, contract?: InboxQuesti
|
|
|
38
41
|
export declare function parseQuestionStatus(value: unknown): QuestionStatus;
|
|
39
42
|
export declare function parseInboxAcceptance(value: unknown): ResponseAcceptance;
|
|
40
43
|
export declare function parseInboxResult(operation: InboxOperation, value: unknown, contract?: InboxQuestionContract): unknown;
|
|
44
|
+
/** Correlation is separate from decoding so clients bind success to their request. */
|
|
45
|
+
export declare function assertInboxAssignmentMatches(result: QuestionAssignment, input: QuestionAssignmentInput): void;
|
|
46
|
+
export declare function assignmentTargetId(assignee: string, candidates: AssignmentCandidate[]): string;
|
|
41
47
|
export declare function parseInboxBootstrap(value: unknown): InboxBootstrap;
|
|
@@ -205,6 +205,23 @@ export type ItemRevision = {
|
|
|
205
205
|
itemId: string;
|
|
206
206
|
revision: number;
|
|
207
207
|
};
|
|
208
|
+
export type QuestionAssignmentInput = ItemRevision & {
|
|
209
|
+
questionId: string;
|
|
210
|
+
assignee: string;
|
|
211
|
+
};
|
|
212
|
+
export interface AssignmentCandidate {
|
|
213
|
+
id: string;
|
|
214
|
+
name: string;
|
|
215
|
+
email: string;
|
|
216
|
+
}
|
|
217
|
+
export interface QuestionAssignment {
|
|
218
|
+
item: InboxItem;
|
|
219
|
+
questionId: string;
|
|
220
|
+
previousAssigneeId: string;
|
|
221
|
+
assigneeId: string;
|
|
222
|
+
activityId: number | null;
|
|
223
|
+
assignedAt: string | null;
|
|
224
|
+
}
|
|
208
225
|
export type InboxAnswerInput = ItemRevision & {
|
|
209
226
|
questionId: string;
|
|
210
227
|
response: QuestionResponse;
|
|
@@ -259,6 +276,10 @@ export interface InboxMember {
|
|
|
259
276
|
}): Promise<RecipientAddition>;
|
|
260
277
|
};
|
|
261
278
|
questions: {
|
|
279
|
+
listAssignmentCandidates(input: ItemRevision & {
|
|
280
|
+
questionId: string;
|
|
281
|
+
}): Promise<AssignmentCandidate[]>;
|
|
282
|
+
assign(input: QuestionAssignmentInput): Promise<QuestionAssignment>;
|
|
262
283
|
list(input: InboxQuestionListInput): Promise<QuestionWork[]>;
|
|
263
284
|
answer(input: InboxAnswerInput): Promise<ResponseAcceptance>;
|
|
264
285
|
listRecordOptions(input: InboxRecordOptionsInput): Promise<RecordOptionCatalogue>;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { type RoutineAccess } from './routine-definition-contract.js';
|
|
2
2
|
import type { RoutineSchedule } from './routine-schedule.js';
|
|
3
|
+
import { type WebhookQueryTrigger, type WebhookEvent } from './routine-webhook-contract.js';
|
|
4
|
+
export type QueryTrigger = {
|
|
5
|
+
readonly schedule: RoutineSchedule;
|
|
6
|
+
} | WebhookQueryTrigger;
|
|
7
|
+
export type QueryTriggerContext = {
|
|
8
|
+
readonly type: 'manual';
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: 'schedule';
|
|
11
|
+
readonly scheduledAt: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly type: 'webhook';
|
|
14
|
+
readonly event: WebhookEvent;
|
|
15
|
+
};
|
|
16
|
+
export declare function parseQueryTriggers(value: unknown, access: RoutineAccess): QueryTrigger[];
|
|
17
|
+
export declare function parseQueryTriggerContext(value: unknown, query?: RoutineQueryContract): QueryTriggerContext;
|
|
3
18
|
export type RoutineQueryContract = {
|
|
4
19
|
id: string;
|
|
5
20
|
routineId: string;
|
|
6
21
|
access: RoutineAccess;
|
|
7
|
-
triggers: readonly
|
|
8
|
-
schedule: RoutineSchedule;
|
|
9
|
-
}[];
|
|
22
|
+
triggers: readonly QueryTrigger[];
|
|
10
23
|
};
|
|
11
24
|
export type DeployedRoutineQuery = RoutineQueryContract & {
|
|
12
25
|
entry: string;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { type RoutineAccess } from './routine-definition-contract.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type QueryTrigger, type QueryTriggerContext } from './routine-query-contract.js';
|
|
3
3
|
/** Safe retained member results; executable coordinates and authority stay private. */
|
|
4
4
|
export type QueryExecution = {
|
|
5
5
|
id: string;
|
|
6
6
|
queryId: string;
|
|
7
7
|
deploymentId: string;
|
|
8
|
-
trigger:
|
|
9
|
-
type: 'manual';
|
|
10
|
-
} | {
|
|
11
|
-
type: 'schedule';
|
|
12
|
-
scheduledAt: string;
|
|
13
|
-
};
|
|
8
|
+
trigger: QueryTriggerContext;
|
|
14
9
|
status: 'queued' | 'running' | 'succeeded' | 'failed';
|
|
15
10
|
acceptedAt: string;
|
|
16
11
|
startedAt?: string;
|
|
@@ -27,9 +22,7 @@ export type QueryDescription = {
|
|
|
27
22
|
id: string;
|
|
28
23
|
routineId: string;
|
|
29
24
|
access: RoutineAccess;
|
|
30
|
-
triggers:
|
|
31
|
-
schedule: RoutineSchedule;
|
|
32
|
-
}[];
|
|
25
|
+
triggers: QueryTrigger[];
|
|
33
26
|
latestExecution?: QueryExecution;
|
|
34
27
|
};
|
|
35
28
|
export type QueryExecutionPage = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type RoutineAccess } from './routine-definition-contract.js';
|
|
2
|
+
import type { JsonValue } from './inbox-contract.js';
|
|
3
|
+
export declare const XERO_WEBHOOK_KINDS: readonly ['invoice.created', 'invoice.updated', 'payment.created', 'payment.updated'];
|
|
4
|
+
export type XeroWebhookKind = typeof XERO_WEBHOOK_KINDS[number];
|
|
5
|
+
export type XeroWebhookEvent = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly provider: 'xero';
|
|
8
|
+
readonly connection: `xero/${string}`;
|
|
9
|
+
readonly kind: XeroWebhookKind;
|
|
10
|
+
readonly resource: {
|
|
11
|
+
readonly type: 'invoice' | 'payment';
|
|
12
|
+
readonly id: string;
|
|
13
|
+
};
|
|
14
|
+
readonly occurredAt?: string;
|
|
15
|
+
readonly receivedAt: string;
|
|
16
|
+
readonly detail?: JsonValue;
|
|
17
|
+
};
|
|
18
|
+
export type WebhookEvent = XeroWebhookEvent;
|
|
19
|
+
export type WebhookQueryTrigger = {
|
|
20
|
+
readonly webhook: {
|
|
21
|
+
readonly connection: `xero/${string}`;
|
|
22
|
+
readonly events: readonly XeroWebhookKind[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function parseWebhookQueryTrigger(value: unknown, access: RoutineAccess): WebhookQueryTrigger;
|
|
26
|
+
export declare function parseWebhookEvent(value: unknown): WebhookEvent;
|