@oddington/sdk 0.1.4 → 0.1.6
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.
|
@@ -13,16 +13,22 @@ 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, 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
|
};
|
|
20
20
|
export { FileOperationError } from '../../../shared/files-contract.js';
|
|
21
|
-
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileErrorCode } from '../../../shared/files-contract.js';
|
|
21
|
+
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode } from '../../../shared/files-contract.js';
|
|
22
22
|
export declare const files: {
|
|
23
23
|
create(input: import('../../../shared/files-contract.js').FileCreateInput, options?: import('../../../shared/files-contract.js').FileCreateOptions): Promise<import('../../../shared/files-contract.js').File>;
|
|
24
24
|
get(id: string): Promise<import('../../../shared/files-contract.js').File>;
|
|
25
|
+
upload(id: string): Promise<import('../../../shared/files-contract.js').File>;
|
|
26
|
+
enrich(input: import('../../../shared/files-contract.js').FileEnrichOptions): Promise<import('../../../shared/files-contract.js').FileEnrichResult>;
|
|
25
27
|
read(id: string): Promise<Response>;
|
|
28
|
+
read(id: string, name: string): Promise<Response>;
|
|
29
|
+
read<const Names extends readonly string[]>(id: string, names: Names): Promise<{
|
|
30
|
+
[Name in Names[number]]: Response;
|
|
31
|
+
}>;
|
|
26
32
|
};
|
|
27
33
|
/** The host's existing refreshing session source; supplies identity, never membership. */
|
|
28
34
|
export type HostedSessionSource = {
|
|
@@ -107,15 +107,37 @@ 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>;
|
|
124
|
+
export type RecordCreation = {
|
|
125
|
+
$ref: string;
|
|
126
|
+
$filing?: Record<string, string>;
|
|
127
|
+
$version?: never;
|
|
128
|
+
$path?: never;
|
|
129
|
+
[field: string]: DataValue | undefined;
|
|
130
|
+
};
|
|
111
131
|
export type DataPublication = {
|
|
112
132
|
version: string;
|
|
113
|
-
created: [];
|
|
133
|
+
created: RecordIdentity[];
|
|
114
134
|
updated: RecordIdentity[];
|
|
115
|
-
deleted: [];
|
|
135
|
+
deleted: RecordIdentity[];
|
|
116
136
|
};
|
|
117
137
|
export interface DataChangeSet {
|
|
138
|
+
create(record: RecordCreation): void;
|
|
118
139
|
update(record: RecordIdentity, set: RecordUpdateSet): void;
|
|
140
|
+
delete(record: RecordIdentity): void;
|
|
119
141
|
validate(): Promise<void>;
|
|
120
142
|
publish(): Promise<DataPublication>;
|
|
121
143
|
}
|
|
@@ -126,6 +148,7 @@ export interface DataRepository {
|
|
|
126
148
|
};
|
|
127
149
|
records: {
|
|
128
150
|
select(query: RecordsQuery): Promise<RecordsResult>;
|
|
151
|
+
search(query: string, options?: RecordsSearchOptions): Promise<RecordsSearchResult>;
|
|
129
152
|
};
|
|
130
153
|
changes(): DataChangeSet;
|
|
131
154
|
}
|
|
@@ -135,6 +158,7 @@ export declare class DataOperationError extends Error {
|
|
|
135
158
|
readonly code: DataErrorCode;
|
|
136
159
|
readonly retryable: boolean;
|
|
137
160
|
readonly effect?: DataEffect | undefined;
|
|
138
|
-
|
|
161
|
+
readonly component?: string | undefined;
|
|
162
|
+
constructor(code: DataErrorCode, retryable?: boolean, effect?: DataEffect | undefined, component?: string | undefined);
|
|
139
163
|
}
|
|
140
164
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Provider-neutral authored contract. Registries and object locations stay server-side. */
|
|
2
|
-
export type FileStorage = 'local' | 'remote'
|
|
2
|
+
export type FileStorage = 'local' | 'remote';
|
|
3
3
|
export type FileInput = Blob | Uint8Array | ReadableStream<Uint8Array>;
|
|
4
4
|
export type FileCsvHints = {
|
|
5
5
|
encoding?: 'utf-8' | 'windows-1252';
|
|
@@ -17,6 +17,21 @@ export type FileCreateInput = {
|
|
|
17
17
|
export type FileCreateOptions = {
|
|
18
18
|
requestKey?: string;
|
|
19
19
|
};
|
|
20
|
+
export type FileEnrichment = {
|
|
21
|
+
mediaType: string;
|
|
22
|
+
size: number;
|
|
23
|
+
sha256: string;
|
|
24
|
+
};
|
|
25
|
+
export type FileEnrichOptions = {
|
|
26
|
+
file: string;
|
|
27
|
+
name: string;
|
|
28
|
+
content: string | Uint8Array;
|
|
29
|
+
mediaType?: string;
|
|
30
|
+
replace?: string;
|
|
31
|
+
};
|
|
32
|
+
export type FileEnrichResult = FileEnrichment & {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
20
35
|
export type File = {
|
|
21
36
|
id: string;
|
|
22
37
|
name: string;
|
|
@@ -24,11 +39,7 @@ export type File = {
|
|
|
24
39
|
mediaType: string;
|
|
25
40
|
size: number;
|
|
26
41
|
sha256: string;
|
|
27
|
-
enrichments: Record<string,
|
|
28
|
-
mediaType: string;
|
|
29
|
-
size: number;
|
|
30
|
-
sha256: string;
|
|
31
|
-
}>;
|
|
42
|
+
enrichments: Record<string, FileEnrichment>;
|
|
32
43
|
details: {
|
|
33
44
|
kind: 'csv';
|
|
34
45
|
encoding: 'utf-8' | 'windows-1252';
|
|
@@ -42,7 +53,7 @@ export type File = {
|
|
|
42
53
|
kind: 'other';
|
|
43
54
|
};
|
|
44
55
|
};
|
|
45
|
-
export type FileErrorCode = 'invalid_input' | 'unsupported_context' | 'unauthenticated' | 'access_denied' | 'request_too_large' | 'conflict' | 'integrity' | 'unavailable' | 'capacity' | 'method_not_allowed';
|
|
56
|
+
export type FileErrorCode = 'invalid_input' | 'unsupported_context' | 'unauthenticated' | 'access_denied' | 'request_too_large' | 'conflict' | 'local_only' | 'integrity' | 'unavailable' | 'capacity' | 'method_not_allowed';
|
|
46
57
|
export declare class FileOperationError extends Error {
|
|
47
58
|
readonly code: FileErrorCode;
|
|
48
59
|
readonly status: number;
|
|
@@ -52,13 +63,22 @@ export declare class FileOperationError extends Error {
|
|
|
52
63
|
export declare const FILE_ID_PATTERN: RegExp;
|
|
53
64
|
/** Treat descriptor transport as untrusted; no provider fields escape the boundary. */
|
|
54
65
|
export declare function parseFileDescriptor(value: unknown): File;
|
|
66
|
+
export declare function parseEnrichmentDescriptor(value: unknown): FileEnrichment;
|
|
67
|
+
export declare function safeEnrichmentName(value: unknown): value is string;
|
|
68
|
+
export type FileEnrichMetadata = {
|
|
69
|
+
name: string;
|
|
70
|
+
size: number;
|
|
71
|
+
mediaType?: string;
|
|
72
|
+
replace?: string;
|
|
73
|
+
};
|
|
74
|
+
export declare function parseFileEnrichMetadata(value: unknown, maxBytes: number): FileEnrichMetadata;
|
|
55
75
|
export declare function safeFileName(value: unknown): value is string;
|
|
56
76
|
export declare function safeFilePath(value: unknown): value is string;
|
|
57
77
|
/** Private transport metadata: normalized material options exclude the request key and size declaration. */
|
|
58
78
|
export type FileCreateMetadata = {
|
|
59
79
|
name: string;
|
|
60
80
|
path: string;
|
|
61
|
-
storage
|
|
81
|
+
storage?: FileStorage;
|
|
62
82
|
csv?: Required<FileCsvHints>;
|
|
63
83
|
size: number;
|
|
64
84
|
requestKey: string;
|
|
@@ -12,7 +12,11 @@ export type RecordDeleteRequest = {
|
|
|
12
12
|
repository: string;
|
|
13
13
|
records: RecordDelete[];
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type RecordChange = RecordWrite | RecordDelete;
|
|
16
|
+
export type RecordChangeRequest = {
|
|
17
|
+
repository: string;
|
|
18
|
+
records: RecordChange[];
|
|
19
|
+
};
|
|
16
20
|
export type RoutineRecordWriteRequest = {
|
|
17
21
|
input: RecordChangeRequest;
|
|
18
22
|
requestKey: string;
|