@oddington/sdk 0.1.22 → 0.1.23
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 +259 -150
- package/dist/index.js +4 -4
- package/dist/types/packages/sdk/src/public.d.ts +3 -1
- package/dist/types/packages/sdk/src/routine-definition-types.d.ts +12 -2
- package/dist/types/shared/airtable-contract.d.ts +1 -0
- package/dist/types/shared/app-descriptor.d.ts +3 -0
- package/dist/types/shared/app-routine-contract.d.ts +1 -0
- package/dist/types/shared/connection-runtime.d.ts +20 -0
- package/dist/types/shared/inbox-contract.d.ts +9 -1
- package/dist/types/shared/inbox-member-types.d.ts +15 -2
- package/package.json +1 -1
|
@@ -14,7 +14,9 @@ export type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
|
14
14
|
export type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
15
15
|
export { RoutineRecordWriteError } from '../../../shared/record-write.js';
|
|
16
16
|
export { AirtableOperationError } from '../../../shared/airtable-contract.js';
|
|
17
|
-
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient
|
|
17
|
+
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient } from '../../../shared/airtable-contract.js';
|
|
18
|
+
export type { GmailRuntimeConnection, AirtableRuntimeConnection, RuntimeConnection } from '../../../shared/connection-runtime.js';
|
|
19
|
+
export type { Connections } from '../../../shared/airtable-contract.js';
|
|
18
20
|
export declare const connections: import('../../../shared/airtable-contract.js').Connections;
|
|
19
21
|
export { DataOperationError } from '../../../shared/data-contract.js';
|
|
20
22
|
export type { DataRepository, DataErrorCode, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, RecordsResult, RecordsSearchOptions, RecordsSearchResult, HistoryListOptions, HistoryEntry, HistoryChangesOptions, HistoryChange, HistoryChangesResult, RecordIdentity, RecordCreation, RecordUpdateSet, DataPublication, DataChangeSet, DataEffect } from '../../../shared/data-contract.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AppValueSchema } from '../../../shared/app-routine-contract.js';
|
|
2
2
|
import type { File } from '../../../shared/files-contract.js';
|
|
3
3
|
import type { Connections } from '../../../shared/airtable-contract.js';
|
|
4
|
+
import type { RuntimeConnectionFor } from '../../../shared/connection-runtime.js';
|
|
4
5
|
import type { DataRepository } from '../../../shared/data-contract.js';
|
|
5
6
|
import type { Handler } from '../../../shared/inbox-contract.js';
|
|
6
7
|
import type { files, RoutinePublicationClient } from './public.js';
|
|
@@ -59,11 +60,18 @@ export type RoutineCapabilities<Access extends RoutineAccess> = {
|
|
|
59
60
|
readonly files: Access['files'] extends 'read-write' ? typeof files : Access['files'] extends 'read' ? Pick<typeof files, 'get' | 'read'> : {};
|
|
60
61
|
readonly connections: {
|
|
61
62
|
airtable(name: ConnectionName<Access>): ReturnType<Connections['airtable']>;
|
|
63
|
+
get<Name extends Extract<NonNullable<Access['connections']>[number], string>>(name: Name): Promise<RuntimeConnectionFor<Name>>;
|
|
62
64
|
};
|
|
63
65
|
readonly inbox: Pick<RoutinePublicationClient, (Access['publish'] extends readonly string[] ? 'asks' extends Access['publish'][number] ? 'publishAsk' : never : never) | (Access['publish'] extends readonly string[] ? 'digests' extends Access['publish'][number] ? 'publishDigest' : never : never)>;
|
|
64
66
|
};
|
|
67
|
+
type RoutineStepCalls<Steps extends RoutineSteps> = {
|
|
68
|
+
[Key in keyof Steps]: {
|
|
69
|
+
input: Parameters<Steps[Key]['run']> extends [] ? [] : [input: RoutineInput<RoutineStepInput<Steps[Key]>>];
|
|
70
|
+
result: RoutineStepResult<Steps[Key]>;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
65
73
|
export type RoutineRuntime<Steps extends RoutineSteps, Access extends RoutineAccess = RoutineAccess> = RoutineCapabilities<Access> & {
|
|
66
|
-
step<Key extends Extract<keyof Steps, string>>(id: Key, ...input:
|
|
74
|
+
step<Key extends Extract<keyof Steps, string>>(id: Key, ...input: RoutineStepCalls<Steps>[Key]['input']): Promise<RoutineStepCalls<Steps>[Key]['result']>;
|
|
67
75
|
};
|
|
68
76
|
export type RoutineDefinition<Input extends RoutineSchema<unknown> | undefined = RoutineSchema<unknown> | undefined, Steps extends RoutineSteps = RoutineSteps, Result extends RoutineSchema<unknown> | undefined = RoutineSchema<unknown> | undefined, Access extends RoutineAccess = RoutineAccess, Responses extends readonly Handler<any>[] = readonly Handler<any>[], Id extends string = string> = {
|
|
69
77
|
readonly id: Id;
|
|
@@ -98,4 +106,6 @@ export type RoutineSchemaBuilders = {
|
|
|
98
106
|
}): RoutineSchema<number, false>;
|
|
99
107
|
boolean(): RoutineSchema<boolean, false>;
|
|
100
108
|
};
|
|
101
|
-
export type RoutineFileSchema = (
|
|
109
|
+
export type RoutineFileSchema = (options?: {
|
|
110
|
+
storage?: 'local' | 'remote';
|
|
111
|
+
}) => RoutineSchema<File, false>;
|
|
@@ -73,6 +73,7 @@ export interface AirtableClient {
|
|
|
73
73
|
}
|
|
74
74
|
export interface Connections {
|
|
75
75
|
airtable(name: string): AirtableClient;
|
|
76
|
+
get<Name extends string>(identity: Name): Promise<import('./connection-runtime.js').RuntimeConnectionFor<Name>>;
|
|
76
77
|
}
|
|
77
78
|
/** Safe provider failure. An uncertain or partial mutation must never be retried blindly. */
|
|
78
79
|
export declare class AirtableOperationError extends Error {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AppValueSchema } from './app-routine-contract.js';
|
|
2
|
+
import type { RoutineContract } from './routine-definition-contract.js';
|
|
2
3
|
/** Build-time structure only. Runtime readiness and availability belong to hosts. */
|
|
3
4
|
export type AppRoutineDescriptor = {
|
|
4
5
|
id: string;
|
|
@@ -19,3 +20,5 @@ export type AppRoutineDescriptor = {
|
|
|
19
20
|
export type AppDescriptor = {
|
|
20
21
|
routines: AppRoutineDescriptor[];
|
|
21
22
|
};
|
|
23
|
+
/** The shared safe projection for generated apps and deployed preparation. */
|
|
24
|
+
export declare function routineDefinitionDescriptor(contract: RoutineContract): AppRoutineDescriptor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Public values delivered only inside trusted routine or handler execution. */
|
|
2
|
+
export type GmailRuntimeConnection = {
|
|
3
|
+
id: `gmail/${string}`;
|
|
4
|
+
provider: 'gmail';
|
|
5
|
+
name: string;
|
|
6
|
+
accountEmail: string;
|
|
7
|
+
scopes: string[];
|
|
8
|
+
accessToken: string;
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
};
|
|
11
|
+
export type AirtableRuntimeConnection = {
|
|
12
|
+
id: `airtable/${string}`;
|
|
13
|
+
provider: 'airtable';
|
|
14
|
+
name: string;
|
|
15
|
+
baseId: string;
|
|
16
|
+
accessToken: string;
|
|
17
|
+
runExpiresAt: string;
|
|
18
|
+
};
|
|
19
|
+
export type RuntimeConnection = GmailRuntimeConnection | AirtableRuntimeConnection;
|
|
20
|
+
export type RuntimeConnectionFor<Name extends string> = string extends Name ? RuntimeConnection : Name extends `gmail/${string}` ? GmailRuntimeConnection : Name extends `airtable/${string}` ? AirtableRuntimeConnection : never;
|
|
@@ -138,9 +138,15 @@ type Presentation = {
|
|
|
138
138
|
body?: InboxBlock[];
|
|
139
139
|
notifyImmediately?: boolean;
|
|
140
140
|
};
|
|
141
|
+
export type AskRecordRef = {
|
|
142
|
+
repository: string;
|
|
143
|
+
id: string;
|
|
144
|
+
};
|
|
141
145
|
export type AskInput = Presentation & {
|
|
142
146
|
recipients?: string[];
|
|
143
147
|
questions?: QuestionInput[];
|
|
148
|
+
tags?: string[];
|
|
149
|
+
recordRefs?: AskRecordRef[];
|
|
144
150
|
};
|
|
145
151
|
export type DigestInput = Presentation & {
|
|
146
152
|
recipients: string[];
|
|
@@ -149,6 +155,8 @@ export type AskPublication = Presentation & {
|
|
|
149
155
|
kind: 'ask';
|
|
150
156
|
recipients: string[];
|
|
151
157
|
questions: Question[];
|
|
158
|
+
tags: string[];
|
|
159
|
+
recordRefs: AskRecordRef[];
|
|
152
160
|
};
|
|
153
161
|
export type DigestPublication = DigestInput & {
|
|
154
162
|
kind: 'digest';
|
|
@@ -333,7 +341,7 @@ export declare function validateHandlerTransition(value: unknown, state: {
|
|
|
333
341
|
export declare function validateResolution(value: unknown): ResolutionInput;
|
|
334
342
|
export type PublicationRequest = {
|
|
335
343
|
requestKey: string;
|
|
336
|
-
item:
|
|
344
|
+
item: DigestPublication | (Omit<AskPublication, 'tags' | 'recordRefs'> & Pick<AskInput, 'tags' | 'recordRefs'>);
|
|
337
345
|
};
|
|
338
346
|
export type PublishedAsk = {
|
|
339
347
|
id: string;
|
|
@@ -63,12 +63,11 @@ export type LinkedAskSnapshot = {
|
|
|
63
63
|
state: 'unavailable';
|
|
64
64
|
done: boolean;
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
interface InboxItemSnapshot {
|
|
67
67
|
canonicalRoutineId?: string | null;
|
|
68
68
|
id: string;
|
|
69
69
|
workspaceId: string;
|
|
70
70
|
number: number;
|
|
71
|
-
kind: 'ask' | 'digest';
|
|
72
71
|
title: string;
|
|
73
72
|
description: string;
|
|
74
73
|
author: string;
|
|
@@ -105,6 +104,18 @@ export interface InboxItem {
|
|
|
105
104
|
settledAt: string | null;
|
|
106
105
|
}[];
|
|
107
106
|
}
|
|
107
|
+
export type InboxItem = InboxItemSnapshot & ({
|
|
108
|
+
kind: 'ask';
|
|
109
|
+
tags: string[];
|
|
110
|
+
recordRefs: Array<{
|
|
111
|
+
repository: string;
|
|
112
|
+
id: string;
|
|
113
|
+
}>;
|
|
114
|
+
} | {
|
|
115
|
+
kind: 'digest';
|
|
116
|
+
tags?: never;
|
|
117
|
+
recordRefs?: never;
|
|
118
|
+
});
|
|
108
119
|
export interface DigestReadConfirmation {
|
|
109
120
|
readAt: string;
|
|
110
121
|
activityId: number;
|
|
@@ -127,6 +138,7 @@ export interface AnswerableQuestion {
|
|
|
127
138
|
instructions?: string;
|
|
128
139
|
response: ResponseDefinition;
|
|
129
140
|
answerable: boolean;
|
|
141
|
+
tags: string[];
|
|
130
142
|
recordRefs: Array<{
|
|
131
143
|
repository: string;
|
|
132
144
|
id: string;
|
|
@@ -194,3 +206,4 @@ export interface InboxMember {
|
|
|
194
206
|
}): Promise<Response>;
|
|
195
207
|
};
|
|
196
208
|
}
|
|
209
|
+
export {};
|