@oddington/sdk 0.1.81 → 0.1.83
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 +168 -40
- package/dist/index.js +4 -4
- package/dist/types/packages/sdk/src/public.d.ts +13 -6
- package/dist/types/packages/sdk/src/routine-reference-types.d.ts +1 -1
- package/dist/types/shared/inbox-contract.d.ts +165 -28
- package/dist/types/shared/inbox-member-types.d.ts +7 -0
- package/dist/types/shared/routine-queue-contract.d.ts +11 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskInput, DigestInput, PublicationRequest, PublishedAsk, PublishedDigest, ResolutionInput } from '../../../shared/inbox-contract.js';
|
|
1
|
+
import type { AskInput, DigestInput, PublicationRequest, PublishedAsk, PublishedDigest, ResolvedAsk, ResolutionInput } from '../../../shared/inbox-contract.js';
|
|
2
2
|
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineSchedule, RoutineCapabilities, SharedRoutineCapabilities, ResponseCapabilities, ResponseAction, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact, RoutineAI } from './routine-definition-types.js';
|
|
3
3
|
export declare const defineResponse: import('./routine-definition-types.js').DefineResponse;
|
|
4
4
|
export declare const defineRoutine: import('./routine-definition-types.js').DefineRoutine;
|
|
@@ -6,7 +6,7 @@ export declare const defineQuery: import('./query-definition-types.js').DefineQu
|
|
|
6
6
|
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
|
-
export type { QueueItem, QueueState, QueueSummary, QueryDescription, QueryExecution, QueryExecutionPage, RoutineListOptions, RoutineRunHandle, RoutineQueryReference, QueryExecutionHandle } from './routine-reference-types.js';
|
|
9
|
+
export type { QueueAskWait, QueueItem, QueueState, QueueSummary, QueryDescription, QueryExecution, QueryExecutionPage, RoutineListOptions, RoutineRunHandle, RoutineQueryReference, QueryExecutionHandle } from './routine-reference-types.js';
|
|
10
10
|
export type { QueryDefinition, QueryEntry, QueryRuntime, QueryTrigger, QueryTriggerContext } 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;
|
|
@@ -17,7 +17,7 @@ export type { RoutineErrorOptions } from '../../../shared/routine-error.js';
|
|
|
17
17
|
export type { RoutineAIOutputIssue } from '../../../shared/routine-ai-output-detail.js';
|
|
18
18
|
export type { RoutineAIErrorDetail } from '../../../shared/routine-ai-error-detail.js';
|
|
19
19
|
export { InboxContractError, asksBlock, continueAsk, defineHandler, fileBlock, question, recordBlock, recordsBlock, resolveAsk, respond, richTextBlock, selection, } from '../../../shared/inbox-contract.js';
|
|
20
|
-
export type { AskInput, AuthoredSource, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, QualifiedRecordRef, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordReference, RecordSource, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, LegacyResponseDefinition, LegacyQuestionResponse, RecordPickerSource, SelectionOptionInput, SelectionOption, SelectionDefinitionInput, SelectionDefinition, SelectionResponse, ResponseDefinitionInput, } from '../../../shared/inbox-contract.js';
|
|
20
|
+
export type { AskInput, AskAnswerFor, AskAnswers, AnsweredAskAnswer, AuthoredSource, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, QualifiedRecordRef, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordReference, RecordSource, ResolvedAsk, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, LegacyResponseDefinition, LegacyQuestionResponse, RecordPickerSource, SelectionOptionInput, SelectionOption, SelectionDefinitionInput, SelectionDefinition, SelectionResponse, UnansweredAskAnswer, ResponseDefinitionInput, } from '../../../shared/inbox-contract.js';
|
|
21
21
|
export { AirtableOperationError } from '../../../shared/airtable-contract.js';
|
|
22
22
|
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient } from '../../../shared/airtable-contract.js';
|
|
23
23
|
export type { XeroRuntimeConnection, GmailRuntimeConnection, AirtableRuntimeConnection, DropboxRuntimeConnection, OutlookRuntimeConnection, SharePointRuntimeConnection, RuntimeConnection, RuntimeConnectionFor } from '../../../shared/connection-runtime.js';
|
|
@@ -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, 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 } 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';
|
|
@@ -196,7 +196,7 @@ export type LocalRunActivity = {
|
|
|
196
196
|
export type StepDetail = {
|
|
197
197
|
id: string;
|
|
198
198
|
title: string;
|
|
199
|
-
status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
199
|
+
status: 'pending' | 'running' | 'waiting' | 'completed' | 'failed' | 'skipped';
|
|
200
200
|
startedAt?: string;
|
|
201
201
|
finishedAt?: string;
|
|
202
202
|
progress?: {
|
|
@@ -210,7 +210,7 @@ export type RunSummary = {
|
|
|
210
210
|
id: string;
|
|
211
211
|
routine: string;
|
|
212
212
|
placement: 'local' | 'remote';
|
|
213
|
-
status: 'queued' | 'running' | 'succeeded' | 'failed' | 'legacy';
|
|
213
|
+
status: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'legacy';
|
|
214
214
|
createdAt: string;
|
|
215
215
|
startedAt?: string;
|
|
216
216
|
finishedAt?: string;
|
|
@@ -219,6 +219,8 @@ export type RunSummary = {
|
|
|
219
219
|
}>;
|
|
220
220
|
result?: unknown;
|
|
221
221
|
failure?: RunFailure;
|
|
222
|
+
queueItemId?: string;
|
|
223
|
+
askWait?: import('../../../shared/routine-queue-contract.js').QueueAskWait;
|
|
222
224
|
local?: LocalRunActivity;
|
|
223
225
|
};
|
|
224
226
|
export type RunFailure = {
|
|
@@ -282,8 +284,13 @@ export type RoutinePublicationClientOptions = {
|
|
|
282
284
|
request?: InboxRequester;
|
|
283
285
|
};
|
|
284
286
|
export type RoutinePublicationClient = {
|
|
287
|
+
publishAsk<const Definition extends AskInput>(value: Definition, options: {
|
|
288
|
+
requestKey: string;
|
|
289
|
+
wait: true;
|
|
290
|
+
}): Promise<ResolvedAsk<Definition>>;
|
|
285
291
|
publishAsk(value: AskInput, options: {
|
|
286
292
|
requestKey: string;
|
|
293
|
+
wait?: false;
|
|
287
294
|
}): Promise<PublishedAsk>;
|
|
288
295
|
publishDigest(value: DigestInput, options: {
|
|
289
296
|
requestKey: string;
|
|
@@ -2,7 +2,7 @@ import type { RoutineSchema, RoutineSchemaValue } from './routine-definition-typ
|
|
|
2
2
|
import type { QueueItem, QueueState, QueueSummary } from '../../../shared/routine-queue-contract.js';
|
|
3
3
|
import type { QueryDescription, QueryExecution, QueryExecutionPage } from '../../../shared/routine-query-results.js';
|
|
4
4
|
import type { RunHandle, RunSummary, StepDetail } from './public.js';
|
|
5
|
-
export type { QueueItem, QueueState, QueueSummary } from '../../../shared/routine-queue-contract.js';
|
|
5
|
+
export type { QueueAskWait, QueueItem, QueueState, QueueSummary } from '../../../shared/routine-queue-contract.js';
|
|
6
6
|
export type { QueryDescription, QueryExecution, QueryExecutionPage } from '../../../shared/routine-query-results.js';
|
|
7
7
|
export type RoutineListOptions = {
|
|
8
8
|
limit?: number;
|
|
@@ -3,17 +3,18 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | JsonObj
|
|
|
3
3
|
export type JsonObject = {
|
|
4
4
|
[key: string]: JsonValue;
|
|
5
5
|
};
|
|
6
|
+
export type AuthoredChoice<Value extends string = string> = {
|
|
7
|
+
value: Value;
|
|
8
|
+
label: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
note?: {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
6
14
|
/** @deprecated Author new selections with per-option definitions. */
|
|
7
|
-
export type AuthoredSource = {
|
|
15
|
+
export type AuthoredSource<Options extends readonly AuthoredChoice[] = AuthoredChoice[]> = {
|
|
8
16
|
type: 'authored';
|
|
9
|
-
options:
|
|
10
|
-
value: string;
|
|
11
|
-
label: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
note?: {
|
|
14
|
-
placeholder: string;
|
|
15
|
-
};
|
|
16
|
-
}>;
|
|
17
|
+
options: Options;
|
|
17
18
|
suggestions?: string[];
|
|
18
19
|
search?: {
|
|
19
20
|
triggerLabel: string;
|
|
@@ -42,9 +43,9 @@ export type RecordSource = {
|
|
|
42
43
|
reason?: string;
|
|
43
44
|
}>;
|
|
44
45
|
};
|
|
45
|
-
export type LegacyResponseDefinition = {
|
|
46
|
+
export type LegacyResponseDefinition<Source extends AuthoredSource | RecordSource = AuthoredSource | RecordSource> = {
|
|
46
47
|
type: 'selection';
|
|
47
|
-
source:
|
|
48
|
+
source: Source;
|
|
48
49
|
};
|
|
49
50
|
export type LegacyQuestionResponse = {
|
|
50
51
|
selection: string | RecordReference;
|
|
@@ -80,9 +81,9 @@ export type SelectionOptionInput = {
|
|
|
80
81
|
export type SelectionOption = SelectionOptionInput & {
|
|
81
82
|
id: number;
|
|
82
83
|
};
|
|
83
|
-
export type SelectionDefinitionInput = {
|
|
84
|
+
export type SelectionDefinitionInput<Options extends readonly SelectionOptionInput[] = SelectionOptionInput[]> = {
|
|
84
85
|
type: 'selection';
|
|
85
|
-
options:
|
|
86
|
+
options: Options;
|
|
86
87
|
};
|
|
87
88
|
export type SelectionDefinition = {
|
|
88
89
|
type: 'selection';
|
|
@@ -102,16 +103,16 @@ export type HandlerReference = {
|
|
|
102
103
|
id: string;
|
|
103
104
|
input: JsonValue;
|
|
104
105
|
};
|
|
105
|
-
export type Question = {
|
|
106
|
-
id:
|
|
106
|
+
export type Question<Id extends string = string, Response extends ResponseDefinitionInput = ResponseDefinitionInput> = {
|
|
107
|
+
id: Id;
|
|
107
108
|
to: string;
|
|
108
109
|
allowedResponders: string[];
|
|
109
110
|
prompt: string;
|
|
110
111
|
instructions?: string;
|
|
111
|
-
response:
|
|
112
|
+
response: Response;
|
|
112
113
|
handler?: HandlerReference;
|
|
113
114
|
};
|
|
114
|
-
export type QuestionInput = Omit<Question, 'allowedResponders'> & {
|
|
115
|
+
export type QuestionInput<Id extends string = string, Response extends ResponseDefinitionInput = ResponseDefinitionInput> = Omit<Question<Id, Response>, 'allowedResponders'> & {
|
|
115
116
|
allowedResponders?: string[];
|
|
116
117
|
};
|
|
117
118
|
export type PublishedView = {
|
|
@@ -317,13 +318,87 @@ export declare function asksBlock(value: Omit<Extract<InboxBlock, {
|
|
|
317
318
|
}>, 'kind'>): Extract<InboxBlock, {
|
|
318
319
|
kind: 'asks';
|
|
319
320
|
}>;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
type ExactAuthorShape<Value, Shape> = Value extends Shape ? Value & Record<Exclude<keyof Value, keyof Shape>, never> : never;
|
|
322
|
+
type ExactAuthoredChoice<Value> = ExactAuthorShape<Value, AuthoredChoice> & (Value extends {
|
|
323
|
+
note: infer Note;
|
|
324
|
+
} ? {
|
|
325
|
+
note: ExactAuthorShape<Note, {
|
|
326
|
+
placeholder: string;
|
|
327
|
+
}>;
|
|
328
|
+
} : {});
|
|
329
|
+
type ExactAuthoredSource<Value> = ExactAuthorShape<Value, AuthoredSource> & (Value extends {
|
|
330
|
+
options: infer Options extends readonly unknown[];
|
|
331
|
+
} ? {
|
|
332
|
+
options: {
|
|
333
|
+
[Index in keyof Options]: ExactAuthoredChoice<Options[Index]>;
|
|
334
|
+
};
|
|
335
|
+
} : never) & (Value extends {
|
|
336
|
+
search: infer Search;
|
|
337
|
+
} ? {
|
|
338
|
+
search: ExactAuthorShape<Search, NonNullable<AuthoredSource['search']>>;
|
|
339
|
+
} : {});
|
|
340
|
+
type ExactRecordReference<Value> = ExactAuthorShape<Value, RecordReference>;
|
|
341
|
+
type ExactRecordSource<Value> = ExactAuthorShape<Value, RecordSource> & (Value extends {
|
|
342
|
+
collection: infer Collection;
|
|
343
|
+
} ? {
|
|
344
|
+
collection: ExactAuthorShape<Collection, RecordSource['collection']>;
|
|
345
|
+
} : never) & (Value extends {
|
|
346
|
+
display: infer Display;
|
|
347
|
+
} ? {
|
|
348
|
+
display: ExactAuthorShape<Display, RecordSource['display']>;
|
|
349
|
+
} : never) & (Value extends {
|
|
350
|
+
suggestions: infer Suggestions extends readonly unknown[];
|
|
351
|
+
} ? {
|
|
352
|
+
suggestions: {
|
|
353
|
+
[Index in keyof Suggestions]: Suggestions[Index] extends {
|
|
354
|
+
record: infer Record;
|
|
355
|
+
} ? ExactAuthorShape<Suggestions[Index], NonNullable<RecordSource['suggestions']>[number]> & {
|
|
356
|
+
record: ExactRecordReference<Record>;
|
|
357
|
+
} : never;
|
|
358
|
+
};
|
|
359
|
+
} : {});
|
|
360
|
+
type ExactSelectionOption<Value> = Value extends {
|
|
361
|
+
type: infer Type;
|
|
362
|
+
} ? Type extends SelectionOptionInput['type'] ? ExactAuthorShape<Value, Extract<SelectionOptionInput, {
|
|
363
|
+
type: Type;
|
|
364
|
+
}>> & (Type extends 'choice' ? Value extends {
|
|
365
|
+
note: infer Note;
|
|
366
|
+
} ? {
|
|
367
|
+
note: ExactAuthorShape<Note, {
|
|
368
|
+
placeholder: string;
|
|
369
|
+
}>;
|
|
370
|
+
} : {} : Type extends 'record' ? Value extends {
|
|
371
|
+
value: infer Record;
|
|
372
|
+
} ? {
|
|
373
|
+
value: ExactRecordReference<Record>;
|
|
374
|
+
} : never : Value extends {
|
|
375
|
+
source: infer Source;
|
|
376
|
+
} ? {
|
|
377
|
+
source: ExactAuthorShape<Source, RecordPickerSource> & (Source extends {
|
|
378
|
+
collection: infer Collection;
|
|
379
|
+
} ? {
|
|
380
|
+
collection: ExactAuthorShape<Collection, RecordPickerSource['collection']>;
|
|
381
|
+
} : never) & (Source extends {
|
|
382
|
+
suggestions: infer Suggestions extends readonly unknown[];
|
|
383
|
+
} ? {
|
|
384
|
+
suggestions: {
|
|
385
|
+
[Index in keyof Suggestions]: ExactRecordReference<Suggestions[Index]>;
|
|
386
|
+
};
|
|
387
|
+
} : {});
|
|
388
|
+
} : never) : never : never;
|
|
389
|
+
type ExactSelectionOptions<Options extends readonly unknown[]> = {
|
|
390
|
+
[Index in keyof Options]: ExactSelectionOption<Options[Index]>;
|
|
391
|
+
};
|
|
392
|
+
type MutableSelectionOptions<Options extends readonly SelectionOptionInput[]> = {
|
|
393
|
+
-readonly [Index in keyof Options]: Options[Index];
|
|
394
|
+
};
|
|
395
|
+
export declare function selection<const Options extends readonly SelectionOptionInput[]>(value: {
|
|
396
|
+
options: Options & ExactSelectionOptions<Options>;
|
|
397
|
+
}): SelectionDefinitionInput<MutableSelectionOptions<Options>>;
|
|
323
398
|
/** @deprecated Use options; retained for existing routine authoring. */
|
|
324
|
-
export declare function selection(value: {
|
|
325
|
-
source: AuthoredSource
|
|
326
|
-
}): LegacyResponseDefinition
|
|
399
|
+
export declare function selection<const Source extends AuthoredSource | RecordSource>(value: {
|
|
400
|
+
source: Source & (Source extends AuthoredSource ? ExactAuthoredSource<Source> : ExactRecordSource<Source>);
|
|
401
|
+
}): LegacyResponseDefinition<Source>;
|
|
327
402
|
export declare function validateRecordReference(value: unknown): RecordReference;
|
|
328
403
|
export declare function validateRecordPickerSource(value: unknown): RecordPickerSource;
|
|
329
404
|
export declare function validateRecordSource(value: unknown): RecordSource;
|
|
@@ -338,7 +413,7 @@ export declare function defineHandler<Input extends JsonValue, const Id extends
|
|
|
338
413
|
id: Id;
|
|
339
414
|
};
|
|
340
415
|
export declare function respond<Input extends JsonValue>(handler: Handler<Input>, input: Input): HandlerReference;
|
|
341
|
-
export declare function question(value: QuestionInput): Question
|
|
416
|
+
export declare function question<const Id extends string, const Response extends ResponseDefinitionInput>(value: QuestionInput<Id, Response>): Question<Id, Response>;
|
|
342
417
|
/** Structural validation is shared. Registered view/handler availability,
|
|
343
418
|
* people, repository/file access, and provenance MUST be checked by publication too. */
|
|
344
419
|
export declare function validatePublication(value: unknown): Publication;
|
|
@@ -353,9 +428,10 @@ export declare function validateHandlerTransition(value: unknown, state: {
|
|
|
353
428
|
hasOtherViableWork: boolean;
|
|
354
429
|
}): HandlerTransition;
|
|
355
430
|
export declare function validateResolution(value: unknown): ResolutionInput;
|
|
431
|
+
export type AskPublicationRequestItem = Omit<AskPublication, 'tags' | 'recordRefs'> & Pick<AskInput, 'tags' | 'recordRefs'>;
|
|
356
432
|
export type PublicationRequest = {
|
|
357
433
|
requestKey: string;
|
|
358
|
-
item: DigestPublication |
|
|
434
|
+
item: DigestPublication | AskPublicationRequestItem;
|
|
359
435
|
};
|
|
360
436
|
export type PublishedAsk = {
|
|
361
437
|
id: string;
|
|
@@ -364,9 +440,63 @@ export type PublishedAsk = {
|
|
|
364
440
|
export type PublishedDigest = {
|
|
365
441
|
id: string;
|
|
366
442
|
};
|
|
443
|
+
export type UnansweredAskAnswer = {
|
|
444
|
+
answered: false;
|
|
445
|
+
value?: undefined;
|
|
446
|
+
option?: undefined;
|
|
447
|
+
note?: undefined;
|
|
448
|
+
};
|
|
449
|
+
export type AnsweredAskAnswer<Value, Numbered extends boolean> = {
|
|
450
|
+
answered: true;
|
|
451
|
+
value: Value;
|
|
452
|
+
note?: string;
|
|
453
|
+
} & (Numbered extends true ? {
|
|
454
|
+
option: number;
|
|
455
|
+
} : {
|
|
456
|
+
option?: undefined;
|
|
457
|
+
});
|
|
458
|
+
type SelectionValue<Response> = Response extends {
|
|
459
|
+
options: readonly (infer Option)[];
|
|
460
|
+
} ? Option extends {
|
|
461
|
+
type: 'record-picker';
|
|
462
|
+
} ? RecordReference : Option extends {
|
|
463
|
+
value: infer Value;
|
|
464
|
+
} ? Value : never : Response extends {
|
|
465
|
+
source: {
|
|
466
|
+
type: 'authored';
|
|
467
|
+
options: readonly (infer Option)[];
|
|
468
|
+
};
|
|
469
|
+
} ? Option extends {
|
|
470
|
+
value: infer Value;
|
|
471
|
+
} ? Value : never : Response extends {
|
|
472
|
+
source: {
|
|
473
|
+
type: 'records';
|
|
474
|
+
};
|
|
475
|
+
} ? RecordReference : never;
|
|
476
|
+
export type AskAnswerFor<Response extends ResponseDefinitionInput> = UnansweredAskAnswer | AnsweredAskAnswer<SelectionValue<Response>, Response extends {
|
|
477
|
+
options: readonly SelectionOptionInput[];
|
|
478
|
+
} ? true : false>;
|
|
479
|
+
type AuthoredQuestion<Definition extends AskInput> = NonNullable<Definition['questions']>[number];
|
|
480
|
+
export type AskAnswers<Definition extends AskInput> = {
|
|
481
|
+
[Entry in AuthoredQuestion<Definition> as Entry['id']]: AskAnswerFor<Entry['response']>;
|
|
482
|
+
};
|
|
483
|
+
export type ResolvedAsk<Definition extends AskInput = AskInput> = {
|
|
484
|
+
id: string;
|
|
485
|
+
number: number;
|
|
486
|
+
revision: number;
|
|
487
|
+
title: string;
|
|
488
|
+
outcome: string;
|
|
489
|
+
answers: AskAnswers<Definition>;
|
|
490
|
+
};
|
|
491
|
+
export type WaitingAskPublicationRequest = {
|
|
492
|
+
requestKey: string;
|
|
493
|
+
wait: true;
|
|
494
|
+
item: AskPublicationRequestItem;
|
|
495
|
+
};
|
|
367
496
|
/** The server verifies workspace membership and optional trusted run provenance. */
|
|
368
497
|
export interface InboxPublicationTransport {
|
|
369
498
|
publish(request: PublicationRequest): Promise<PublishedAsk | PublishedDigest>;
|
|
499
|
+
wait?(request: WaitingAskPublicationRequest): Promise<unknown>;
|
|
370
500
|
resolve(request: {
|
|
371
501
|
askId: string;
|
|
372
502
|
resolution: ResolutionInput;
|
|
@@ -377,9 +507,16 @@ export declare function digestPublicationRequest(value: DigestInput, options: {
|
|
|
377
507
|
requestKey: string;
|
|
378
508
|
}): PublicationRequest;
|
|
379
509
|
export declare function createInboxPublisher(transport: InboxPublicationTransport): {
|
|
380
|
-
publishAsk
|
|
381
|
-
|
|
382
|
-
|
|
510
|
+
publishAsk: {
|
|
511
|
+
<const Definition extends AskInput>(value: Definition, options: {
|
|
512
|
+
requestKey: string;
|
|
513
|
+
wait: true;
|
|
514
|
+
}): Promise<ResolvedAsk<Definition>>;
|
|
515
|
+
(value: AskInput, options: {
|
|
516
|
+
requestKey: string;
|
|
517
|
+
wait?: false;
|
|
518
|
+
}): Promise<PublishedAsk>;
|
|
519
|
+
};
|
|
383
520
|
publishDigest(value: DigestInput, options: {
|
|
384
521
|
requestKey: string;
|
|
385
522
|
}): Promise<PublishedDigest>;
|
|
@@ -89,6 +89,11 @@ export type LinkedAskSnapshot = {
|
|
|
89
89
|
state: 'unavailable';
|
|
90
90
|
done: boolean;
|
|
91
91
|
};
|
|
92
|
+
export type QueueContinuation = {
|
|
93
|
+
routineId: string;
|
|
94
|
+
itemId: string;
|
|
95
|
+
runId: string;
|
|
96
|
+
};
|
|
92
97
|
interface InboxItemSnapshot {
|
|
93
98
|
canonicalRoutineId?: string | null;
|
|
94
99
|
id: string;
|
|
@@ -98,6 +103,8 @@ interface InboxItemSnapshot {
|
|
|
98
103
|
description: string;
|
|
99
104
|
author: string;
|
|
100
105
|
apiClientId?: string | null;
|
|
106
|
+
/** Present only on Ask snapshots; the member decoder rejects it on Digests. */
|
|
107
|
+
queueContinuation?: QueueContinuation;
|
|
101
108
|
revision: number;
|
|
102
109
|
publishedAt: string;
|
|
103
110
|
outcome: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Safe member queue results shared by HTTP and installed transports. */
|
|
2
|
-
export declare const queueStates: readonly ['pending', 'running', 'failed', 'succeeded', 'removed'];
|
|
2
|
+
export declare const queueStates: readonly ['pending', 'running', 'waiting', 'failed', 'succeeded', 'removed'];
|
|
3
3
|
export type QueueState = typeof queueStates[number];
|
|
4
4
|
export type QueueSummary = {
|
|
5
5
|
routineId: string;
|
|
@@ -7,6 +7,14 @@ export type QueueSummary = {
|
|
|
7
7
|
counts: Record<QueueState, number>;
|
|
8
8
|
activeRunId?: string;
|
|
9
9
|
};
|
|
10
|
+
export type QueueAskWait = {
|
|
11
|
+
runId: string;
|
|
12
|
+
ask: {
|
|
13
|
+
id: string;
|
|
14
|
+
number: number;
|
|
15
|
+
title: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
10
18
|
export type QueueItem = {
|
|
11
19
|
id: string;
|
|
12
20
|
input: unknown;
|
|
@@ -16,6 +24,7 @@ export type QueueItem = {
|
|
|
16
24
|
associatedRunIds: string[];
|
|
17
25
|
createdAt: string;
|
|
18
26
|
updatedAt: string;
|
|
27
|
+
askWait?: QueueAskWait;
|
|
19
28
|
failureId?: string;
|
|
20
29
|
failure?: {
|
|
21
30
|
message: string;
|
|
@@ -25,6 +34,7 @@ export type QueuePage = {
|
|
|
25
34
|
items: QueueItem[];
|
|
26
35
|
next?: string;
|
|
27
36
|
};
|
|
37
|
+
export declare function parseQueueAskWait(value: unknown): QueueAskWait;
|
|
28
38
|
export declare function parseQueueSummary(value: unknown): QueueSummary;
|
|
29
39
|
export declare function parseQueueItem(value: unknown): QueueItem;
|
|
30
40
|
export declare function parseQueuePage(value: unknown): QueuePage;
|