@oddington/sdk 0.1.5 → 0.1.7
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 +119 -2
- package/dist/index.js +1419 -344
- package/dist/types/packages/sdk/src/public.d.ts +66 -2
- package/dist/types/shared/data-contract.d.ts +14 -0
- package/dist/types/shared/files-contract.d.ts +2 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export { AirtableOperationError } from '../../../shared/airtable-contract.js';
|
|
|
13
13
|
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient, Connections } from '../../../shared/airtable-contract.js';
|
|
14
14
|
export declare const connections: import('../../../shared/airtable-contract.js').Connections;
|
|
15
15
|
export { DataOperationError } from '../../../shared/data-contract.js';
|
|
16
|
-
export type { DataRepository, DataErrorCode, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, RecordsResult, RecordIdentity, RecordCreation, RecordUpdateSet, DataPublication, DataChangeSet, DataEffect } from '../../../shared/data-contract.js';
|
|
16
|
+
export type { DataRepository, DataErrorCode, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, RecordsResult, RecordsSearchOptions, RecordsSearchResult, RecordIdentity, RecordCreation, RecordUpdateSet, DataPublication, DataChangeSet, DataEffect } from '../../../shared/data-contract.js';
|
|
17
17
|
export declare const data: {
|
|
18
18
|
repository(name: string): import('../../../shared/data-contract.js').DataRepository;
|
|
19
19
|
};
|
|
@@ -58,12 +58,76 @@ export type HostedSessionSource = {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
/** OS-owned
|
|
61
|
+
/** OS-owned hosted or exact-origin local browser bootstrap. Reinitialization replaces the context. */
|
|
62
62
|
export declare const os: {
|
|
63
63
|
init(options: {
|
|
64
64
|
auth: HostedSessionSource;
|
|
65
65
|
}): void;
|
|
66
66
|
};
|
|
67
|
+
/** Customer-owned module augmentation supplies types, never runtime authority. */
|
|
68
|
+
export interface AppRoutineTypes {
|
|
69
|
+
}
|
|
70
|
+
export type AppRoutineErrorReason = 'authority_unavailable' | 'execution_unavailable' | 'invalid_input';
|
|
71
|
+
export declare class AppRoutineError extends Error {
|
|
72
|
+
readonly reason: AppRoutineErrorReason;
|
|
73
|
+
constructor(reason: AppRoutineErrorReason);
|
|
74
|
+
}
|
|
75
|
+
export type AppRoutineEvent<Result, Steps> = {
|
|
76
|
+
type: 'started';
|
|
77
|
+
} | {
|
|
78
|
+
[Key in Extract<keyof Steps, string>]: {
|
|
79
|
+
type: 'step';
|
|
80
|
+
id: Key;
|
|
81
|
+
} & (Steps[Key] extends undefined ? {
|
|
82
|
+
summary?: undefined;
|
|
83
|
+
} : {
|
|
84
|
+
summary: Steps[Key];
|
|
85
|
+
});
|
|
86
|
+
}[Extract<keyof Steps, string>] | ({
|
|
87
|
+
type: 'finished';
|
|
88
|
+
state: 'succeeded';
|
|
89
|
+
} & ([Result] extends [undefined] ? {
|
|
90
|
+
result?: undefined;
|
|
91
|
+
} : {
|
|
92
|
+
result: Result;
|
|
93
|
+
})) | {
|
|
94
|
+
type: 'finished';
|
|
95
|
+
state: 'failed';
|
|
96
|
+
error: 'execution_failed';
|
|
97
|
+
} | {
|
|
98
|
+
type: 'finished';
|
|
99
|
+
state: 'cancelled';
|
|
100
|
+
};
|
|
101
|
+
export type AppRoutineHandle<Result, Steps> = {
|
|
102
|
+
events(): AsyncIterable<AppRoutineEvent<Result, Steps>>;
|
|
103
|
+
cancel(): Promise<void>;
|
|
104
|
+
};
|
|
105
|
+
export type AppRoutineBinding<Input, Result, Steps> = {
|
|
106
|
+
availability(): Promise<{
|
|
107
|
+
available: true;
|
|
108
|
+
steps: Extract<keyof Steps, string>[];
|
|
109
|
+
} | {
|
|
110
|
+
available: false;
|
|
111
|
+
reason: 'authority_unavailable' | 'execution_unavailable';
|
|
112
|
+
}>;
|
|
113
|
+
run(input: Input): Promise<AppRoutineHandle<Result, Steps>>;
|
|
114
|
+
recover(): Promise<AppRoutineHandle<Result, Steps>[]>;
|
|
115
|
+
};
|
|
116
|
+
export declare const app: {
|
|
117
|
+
routines: AppRoutineTypes;
|
|
118
|
+
};
|
|
119
|
+
/** A declared stage without a summary takes no second argument. */
|
|
120
|
+
export type AppRunContext<Input, Result, Steps> = {
|
|
121
|
+
readonly input: AppRunInput<Input>;
|
|
122
|
+
step<Key extends Extract<keyof Steps, string>>(id: Key, ...summary: Steps[Key] extends undefined ? [] : [summary: Steps[Key]]): Promise<void>;
|
|
123
|
+
finish(...result: [Result] extends [undefined] ? [] : [result: Result]): Promise<void>;
|
|
124
|
+
};
|
|
125
|
+
export type AppRunInput<Value> = Value extends object ? {
|
|
126
|
+
readonly [Key in keyof Value]: AppRunInput<Value[Key]>;
|
|
127
|
+
} : Value;
|
|
128
|
+
export declare const appRun: {
|
|
129
|
+
current<Input = unknown, Result = undefined, Steps = Record<string, undefined>>(): AppRunContext<Input, Result, Steps> | undefined;
|
|
130
|
+
};
|
|
67
131
|
export type InboxRequester = (path: string, init?: RequestInit) => Promise<Response>;
|
|
68
132
|
export type RoutinePublicationClientOptions = {
|
|
69
133
|
workspace?: string;
|
|
@@ -107,6 +107,19 @@ export type RecordsResult = {
|
|
|
107
107
|
[collection: string]: SelectedRecord[] | SelectionMetadata;
|
|
108
108
|
};
|
|
109
109
|
export type RecordIdentity = Pick<SelectedRecord, '$ref' | '$version'>;
|
|
110
|
+
export type RecordsSearchOptions = {
|
|
111
|
+
collections?: string[];
|
|
112
|
+
limit?: number;
|
|
113
|
+
};
|
|
114
|
+
export type RecordsSearchResult = {
|
|
115
|
+
$meta: {
|
|
116
|
+
version: string;
|
|
117
|
+
};
|
|
118
|
+
matches: Array<{
|
|
119
|
+
collection: string;
|
|
120
|
+
record: SelectedRecord;
|
|
121
|
+
}>;
|
|
122
|
+
};
|
|
110
123
|
export type RecordUpdateSet = Record<string, DataValue>;
|
|
111
124
|
export type RecordCreation = {
|
|
112
125
|
$ref: string;
|
|
@@ -135,6 +148,7 @@ export interface DataRepository {
|
|
|
135
148
|
};
|
|
136
149
|
records: {
|
|
137
150
|
select(query: RecordsQuery): Promise<RecordsResult>;
|
|
151
|
+
search(query: string, options?: RecordsSearchOptions): Promise<RecordsSearchResult>;
|
|
138
152
|
};
|
|
139
153
|
changes(): DataChangeSet;
|
|
140
154
|
}
|
|
@@ -61,6 +61,8 @@ export declare class FileOperationError extends Error {
|
|
|
61
61
|
constructor(code: FileErrorCode, status: number, retryable?: boolean);
|
|
62
62
|
}
|
|
63
63
|
export declare const FILE_ID_PATTERN: RegExp;
|
|
64
|
+
/** Descriptor admission is independent of each runtime's supported writes. */
|
|
65
|
+
export declare const FILE_ORIGINAL_MAX_BYTES: number;
|
|
64
66
|
/** Treat descriptor transport as untrusted; no provider fields escape the boundary. */
|
|
65
67
|
export declare function parseFileDescriptor(value: unknown): File;
|
|
66
68
|
export declare function parseEnrichmentDescriptor(value: unknown): FileEnrichment;
|