@oddington/sdk 0.1.3 → 0.1.5
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,10 +13,23 @@ 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 } 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';
|
|
17
17
|
export declare const data: {
|
|
18
18
|
repository(name: string): import('../../../shared/data-contract.js').DataRepository;
|
|
19
19
|
};
|
|
20
|
+
export { FileOperationError } from '../../../shared/files-contract.js';
|
|
21
|
+
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode } from '../../../shared/files-contract.js';
|
|
22
|
+
export declare const files: {
|
|
23
|
+
create(input: import('../../../shared/files-contract.js').FileCreateInput, options?: import('../../../shared/files-contract.js').FileCreateOptions): Promise<import('../../../shared/files-contract.js').File>;
|
|
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>;
|
|
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
|
+
}>;
|
|
32
|
+
};
|
|
20
33
|
/** The host's existing refreshing session source; supplies identity, never membership. */
|
|
21
34
|
export type HostedSessionSource = {
|
|
22
35
|
getSession(): Promise<{
|
|
@@ -44,10 +44,38 @@ export type CollectionSchema = CollectionSummary & {
|
|
|
44
44
|
fields: PublicField[];
|
|
45
45
|
};
|
|
46
46
|
export type QueryScalar = string | number | boolean | null;
|
|
47
|
+
type LowerBound = {
|
|
48
|
+
$gt: number | string;
|
|
49
|
+
$gte?: never;
|
|
50
|
+
} | {
|
|
51
|
+
$gte: number | string;
|
|
52
|
+
$gt?: never;
|
|
53
|
+
};
|
|
54
|
+
type UpperBound = {
|
|
55
|
+
$lt: number | string;
|
|
56
|
+
$lte?: never;
|
|
57
|
+
} | {
|
|
58
|
+
$lte: number | string;
|
|
59
|
+
$lt?: never;
|
|
60
|
+
};
|
|
61
|
+
export type RangeCondition = ((LowerBound & {
|
|
62
|
+
$lt?: never;
|
|
63
|
+
$lte?: never;
|
|
64
|
+
}) | (UpperBound & {
|
|
65
|
+
$gt?: never;
|
|
66
|
+
$gte?: never;
|
|
67
|
+
}) | (LowerBound & UpperBound)) & {
|
|
68
|
+
$in?: never;
|
|
69
|
+
};
|
|
70
|
+
export type QueryCondition = QueryScalar | RangeCondition | {
|
|
71
|
+
$in: QueryScalar[];
|
|
72
|
+
$gt?: never;
|
|
73
|
+
$gte?: never;
|
|
74
|
+
$lt?: never;
|
|
75
|
+
$lte?: never;
|
|
76
|
+
};
|
|
47
77
|
export type SelectionOptions = {
|
|
48
|
-
where?: Record<string,
|
|
49
|
-
$in: QueryScalar[];
|
|
50
|
-
}>;
|
|
78
|
+
where?: Record<string, QueryCondition>;
|
|
51
79
|
fields?: string[];
|
|
52
80
|
order?: Record<string, 'asc' | 'desc'>;
|
|
53
81
|
limit?: number;
|
|
@@ -78,6 +106,28 @@ export type RecordsResult = {
|
|
|
78
106
|
$meta: SelectionMetadata;
|
|
79
107
|
[collection: string]: SelectedRecord[] | SelectionMetadata;
|
|
80
108
|
};
|
|
109
|
+
export type RecordIdentity = Pick<SelectedRecord, '$ref' | '$version'>;
|
|
110
|
+
export type RecordUpdateSet = Record<string, DataValue>;
|
|
111
|
+
export type RecordCreation = {
|
|
112
|
+
$ref: string;
|
|
113
|
+
$filing?: Record<string, string>;
|
|
114
|
+
$version?: never;
|
|
115
|
+
$path?: never;
|
|
116
|
+
[field: string]: DataValue | undefined;
|
|
117
|
+
};
|
|
118
|
+
export type DataPublication = {
|
|
119
|
+
version: string;
|
|
120
|
+
created: RecordIdentity[];
|
|
121
|
+
updated: RecordIdentity[];
|
|
122
|
+
deleted: RecordIdentity[];
|
|
123
|
+
};
|
|
124
|
+
export interface DataChangeSet {
|
|
125
|
+
create(record: RecordCreation): void;
|
|
126
|
+
update(record: RecordIdentity, set: RecordUpdateSet): void;
|
|
127
|
+
delete(record: RecordIdentity): void;
|
|
128
|
+
validate(): Promise<void>;
|
|
129
|
+
publish(): Promise<DataPublication>;
|
|
130
|
+
}
|
|
81
131
|
export interface DataRepository {
|
|
82
132
|
collections: {
|
|
83
133
|
list(): Promise<CollectionSummary[]>;
|
|
@@ -86,10 +136,15 @@ export interface DataRepository {
|
|
|
86
136
|
records: {
|
|
87
137
|
select(query: RecordsQuery): Promise<RecordsResult>;
|
|
88
138
|
};
|
|
139
|
+
changes(): DataChangeSet;
|
|
89
140
|
}
|
|
90
|
-
export type DataErrorCode = 'context_unavailable' | 'unauthenticated' | 'access_denied' | 'invalid_query' | 'request_too_large' | 'capacity' | 'unavailable';
|
|
141
|
+
export type DataErrorCode = 'context_unavailable' | 'unauthenticated' | 'access_denied' | 'invalid_query' | 'request_too_large' | 'capacity' | 'unavailable' | 'invalid_change' | 'conflict' | 'publication_pending';
|
|
142
|
+
export type DataEffect = 'unapplied' | 'uncertain' | 'applied';
|
|
91
143
|
export declare class DataOperationError extends Error {
|
|
92
144
|
readonly code: DataErrorCode;
|
|
93
145
|
readonly retryable: boolean;
|
|
94
|
-
|
|
146
|
+
readonly effect?: DataEffect | undefined;
|
|
147
|
+
readonly component?: string | undefined;
|
|
148
|
+
constructor(code: DataErrorCode, retryable?: boolean, effect?: DataEffect | undefined, component?: string | undefined);
|
|
95
149
|
}
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Provider-neutral authored contract. Registries and object locations stay server-side. */
|
|
2
|
+
export type FileStorage = 'local' | 'remote';
|
|
3
|
+
export type FileInput = Blob | Uint8Array | ReadableStream<Uint8Array>;
|
|
4
|
+
export type FileCsvHints = {
|
|
5
|
+
encoding?: 'utf-8' | 'windows-1252';
|
|
6
|
+
delimiter?: ',' | ';' | '\t';
|
|
7
|
+
headerRow?: number;
|
|
8
|
+
};
|
|
9
|
+
export type FileCreateInput = {
|
|
10
|
+
file: FileInput;
|
|
11
|
+
size?: number;
|
|
12
|
+
path?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
storage?: FileStorage;
|
|
15
|
+
csv?: FileCsvHints;
|
|
16
|
+
};
|
|
17
|
+
export type FileCreateOptions = {
|
|
18
|
+
requestKey?: string;
|
|
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
|
+
};
|
|
35
|
+
export type File = {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
path: string;
|
|
39
|
+
mediaType: string;
|
|
40
|
+
size: number;
|
|
41
|
+
sha256: string;
|
|
42
|
+
enrichments: Record<string, FileEnrichment>;
|
|
43
|
+
details: {
|
|
44
|
+
kind: 'csv';
|
|
45
|
+
encoding: 'utf-8' | 'windows-1252';
|
|
46
|
+
delimiter: ',' | ';' | '\t';
|
|
47
|
+
headerRow: number;
|
|
48
|
+
dataRows: number;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'pdf';
|
|
51
|
+
pages?: number;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'other';
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type FileErrorCode = 'invalid_input' | 'unsupported_context' | 'unauthenticated' | 'access_denied' | 'request_too_large' | 'conflict' | 'local_only' | 'integrity' | 'unavailable' | 'capacity' | 'method_not_allowed';
|
|
57
|
+
export declare class FileOperationError extends Error {
|
|
58
|
+
readonly code: FileErrorCode;
|
|
59
|
+
readonly status: number;
|
|
60
|
+
readonly retryable: boolean;
|
|
61
|
+
constructor(code: FileErrorCode, status: number, retryable?: boolean);
|
|
62
|
+
}
|
|
63
|
+
export declare const FILE_ID_PATTERN: RegExp;
|
|
64
|
+
/** Treat descriptor transport as untrusted; no provider fields escape the boundary. */
|
|
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;
|
|
75
|
+
export declare function safeFileName(value: unknown): value is string;
|
|
76
|
+
export declare function safeFilePath(value: unknown): value is string;
|
|
77
|
+
/** Private transport metadata: normalized material options exclude the request key and size declaration. */
|
|
78
|
+
export type FileCreateMetadata = {
|
|
79
|
+
name: string;
|
|
80
|
+
path: string;
|
|
81
|
+
storage?: FileStorage;
|
|
82
|
+
csv?: Required<FileCsvHints>;
|
|
83
|
+
size: number;
|
|
84
|
+
requestKey: string;
|
|
85
|
+
};
|
|
86
|
+
export declare function parseFileCreateMetadata(value: unknown, maxBytes: number): FileCreateMetadata;
|
|
@@ -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;
|