@oddington/sdk 0.1.23 → 0.1.24

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.
@@ -19,7 +19,7 @@ export type { GmailRuntimeConnection, AirtableRuntimeConnection, RuntimeConnecti
19
19
  export type { Connections } from '../../../shared/airtable-contract.js';
20
20
  export declare const connections: import('../../../shared/airtable-contract.js').Connections;
21
21
  export { DataOperationError } from '../../../shared/data-contract.js';
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';
22
+ export type { DataRepository, DataErrorCode, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, RecordsResult, RecordsReadInput, RecordsReadResult, RecordsSearchOptions, RecordsSearchResult, HistoryListOptions, HistoryEntry, HistoryChangesOptions, HistoryChange, HistoryChangesResult, RecordIdentity, RecordCreation, RecordUpdateSet, DataPublication, DataChangeSet, DataEffect } from '../../../shared/data-contract.js';
23
23
  export declare const data: {
24
24
  repository(name: string): import('../../../shared/data-contract.js').DataRepository;
25
25
  };
@@ -185,6 +185,14 @@ export type AppRoutineBinding<Input, Result, Steps> = {
185
185
  };
186
186
  export declare const app: {
187
187
  listRoutines(): Promise<RoutineDescription[]>;
188
+ routine(id: string): {
189
+ describe(): Promise<RoutineDescription>;
190
+ run(input?: unknown): Promise<RunHandle>;
191
+ runs: {
192
+ list(): Promise<RunSummary[]>;
193
+ get(id: string): Promise<RunHandle>;
194
+ };
195
+ };
188
196
  routines: AppRoutineTypes;
189
197
  };
190
198
  /** A declared stage without a summary takes no second argument. */
@@ -66,7 +66,7 @@ export type RoutineCapabilities<Access extends RoutineAccess> = {
66
66
  };
67
67
  type RoutineStepCalls<Steps extends RoutineSteps> = {
68
68
  [Key in keyof Steps]: {
69
- input: Parameters<Steps[Key]['run']> extends [] ? [] : [input: RoutineInput<RoutineStepInput<Steps[Key]>>];
69
+ input: Parameters<Steps[Key]['run']> extends [] ? [] : [input: RoutineStepInput<Steps[Key]> | RoutineInput<RoutineStepInput<Steps[Key]>>];
70
70
  result: RoutineStepResult<Steps[Key]>;
71
71
  };
72
72
  };
@@ -102,11 +102,26 @@ export type SelectionMetadata = {
102
102
  next?: string;
103
103
  }>;
104
104
  };
105
- export type RecordsResult = {
105
+ type SelectedRecordFor<Selection extends RecordSelection> = string extends keyof Selection ? SelectedRecord : SelectedRecord & {
106
+ [Link in Exclude<keyof Selection, '$'>]?: SelectedLinkFor<Selection[Link]>;
107
+ };
108
+ type SelectedLinkFor<Selection> = Selection extends RecordSelection ? SelectedRecordFor<Selection> | SelectedRecordFor<Selection>[] | null : never;
109
+ export type RecordsResult<Query extends RecordsQuery = RecordsQuery> = string extends keyof Query ? {
106
110
  $meta: SelectionMetadata;
107
111
  [collection: string]: SelectedRecord[] | SelectionMetadata;
112
+ } : {
113
+ $meta: SelectionMetadata;
114
+ } & {
115
+ [Collection in keyof Query]: SelectedRecordFor<Query[Collection]>[];
108
116
  };
109
117
  export type RecordIdentity = Pick<SelectedRecord, '$ref' | '$version'>;
118
+ export type RecordsReadInput = string | readonly string[];
119
+ export type RecordsReadResult = {
120
+ $meta: {
121
+ version: string;
122
+ };
123
+ records: Array<SelectedRecord | null>;
124
+ };
110
125
  export type RecordsSearchOptions = {
111
126
  collections?: string[];
112
127
  limit?: number;
@@ -190,7 +205,14 @@ export interface DataRepository {
190
205
  schema(name: string): Promise<CollectionSchema>;
191
206
  };
192
207
  records: {
193
- select(query: RecordsQuery): Promise<RecordsResult>;
208
+ select<Query extends RecordsQuery>(query: Query): Promise<RecordsResult<Query>>;
209
+ pages<Query extends RecordsQuery>(query: Query): AsyncIterable<RecordsResult<Query>>;
210
+ all<Query extends RecordsQuery>(query: Query, options: {
211
+ maxRecords: number;
212
+ }): Promise<RecordsResult<Query>>;
213
+ read(ref: string): Promise<SelectedRecord | null>;
214
+ read(refs: readonly string[]): Promise<RecordsReadResult>;
215
+ read(input: RecordsReadInput): Promise<SelectedRecord | null | RecordsReadResult>;
194
216
  search(query: string, options?: RecordsSearchOptions): Promise<RecordsSearchResult>;
195
217
  };
196
218
  history: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.23",
4
- "description": "Oddington routine and response-handler SDK",
3
+ "version": "0.1.24",
4
+ "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
7
7
  "files": ["dist", "LICENSE", "README.md"],