@oddington/sdk 0.1.45 → 0.1.47
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 +79 -19
- package/dist/browser.js +273 -82
- package/dist/index.js +2 -2
- package/dist/types/packages/sdk/src/data-schema-types.d.ts +3 -3
- package/dist/types/shared/data-contract.d.ts +9 -22
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ type Targets<Schemas extends Catalogue, Link> = Link extends {
|
|
|
21
21
|
type: Type;
|
|
22
22
|
}> : never;
|
|
23
23
|
type Scalar<Value> = Value extends {
|
|
24
|
-
kind: 'string' | 'date' | 'link';
|
|
24
|
+
kind: 'string' | 'date' | 'datetime' | 'link';
|
|
25
25
|
} ? string : Value extends {
|
|
26
26
|
kind: 'integer' | 'number';
|
|
27
27
|
} ? number : Value extends {
|
|
@@ -54,7 +54,7 @@ type Cardinality<D, Item> = (D extends {
|
|
|
54
54
|
type Value<D> = Cardinality<D, SingleValue<D>>;
|
|
55
55
|
type FilterField<Schema extends Collection> = Extract<Fields<Schema>, {
|
|
56
56
|
many: false;
|
|
57
|
-
kind: 'string' | 'integer' | 'number' | 'boolean' | 'date' | 'enum' | 'const' | 'link';
|
|
57
|
+
kind: 'string' | 'integer' | 'number' | 'boolean' | 'date' | 'datetime' | 'enum' | 'const' | 'link';
|
|
58
58
|
}>;
|
|
59
59
|
type Lower<V> = {
|
|
60
60
|
$gt: V;
|
|
@@ -90,7 +90,7 @@ type Condition<F> = Scalar<F> | (F extends {
|
|
|
90
90
|
$lt?: never;
|
|
91
91
|
$lte?: never;
|
|
92
92
|
} | (F extends {
|
|
93
|
-
kind: 'integer' | 'number' | 'date';
|
|
93
|
+
kind: 'integer' | 'number' | 'date' | 'datetime';
|
|
94
94
|
} ? Range<Scalar<F>> : never);
|
|
95
95
|
type RefField = {
|
|
96
96
|
name: '$ref';
|
|
@@ -5,7 +5,7 @@ export type DataValueDefinition<Extra extends object = object> = {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
term?: string;
|
|
7
7
|
} & Extra & ({
|
|
8
|
-
kind: 'string' | 'integer' | 'boolean';
|
|
8
|
+
kind: 'string' | 'integer' | 'boolean' | 'datetime';
|
|
9
9
|
} | {
|
|
10
10
|
kind: 'number';
|
|
11
11
|
precision?: number;
|
|
@@ -95,6 +95,8 @@ export type SelectedRecord = {
|
|
|
95
95
|
$version: string;
|
|
96
96
|
[field: string]: DataValue;
|
|
97
97
|
} & {
|
|
98
|
+
/** Present only on an exact read that explicitly requests the body. */
|
|
99
|
+
$body?: string;
|
|
98
100
|
/** Present only on an expanded qualified link occurrence. */
|
|
99
101
|
$fragment?: string;
|
|
100
102
|
};
|
|
@@ -119,6 +121,9 @@ export type RecordsResult<Query extends RecordsQuery = RecordsQuery> = string ex
|
|
|
119
121
|
};
|
|
120
122
|
export type RecordIdentity = Pick<SelectedRecord, '$ref' | '$version'>;
|
|
121
123
|
export type RecordsReadInput = string | readonly string[];
|
|
124
|
+
export type RecordsReadOptions = {
|
|
125
|
+
body?: true;
|
|
126
|
+
};
|
|
122
127
|
export type RecordsReadResult = {
|
|
123
128
|
$meta: {
|
|
124
129
|
version: string;
|
|
@@ -216,27 +221,9 @@ export interface DataRepository {
|
|
|
216
221
|
all<Query extends RecordsQuery>(query: Query, options: {
|
|
217
222
|
maxRecords: number;
|
|
218
223
|
}): Promise<RecordsResult<Query>>;
|
|
219
|
-
read(ref: string, options:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
$body: string;
|
|
223
|
-
}) | null>;
|
|
224
|
-
read(refs: readonly string[], options: {
|
|
225
|
-
body: true;
|
|
226
|
-
}): Promise<Omit<RecordsReadResult, 'records'> & {
|
|
227
|
-
records: Array<(SelectedRecord & {
|
|
228
|
-
$body: string;
|
|
229
|
-
}) | null>;
|
|
230
|
-
}>;
|
|
231
|
-
read(ref: string, options?: {
|
|
232
|
-
body?: boolean;
|
|
233
|
-
}): Promise<SelectedRecord | null>;
|
|
234
|
-
read(refs: readonly string[], options?: {
|
|
235
|
-
body?: boolean;
|
|
236
|
-
}): Promise<RecordsReadResult>;
|
|
237
|
-
read(input: RecordsReadInput, options?: {
|
|
238
|
-
body?: boolean;
|
|
239
|
-
}): Promise<SelectedRecord | null | RecordsReadResult>;
|
|
224
|
+
read(ref: string, options?: RecordsReadOptions): Promise<SelectedRecord | null>;
|
|
225
|
+
read(refs: readonly string[], options?: RecordsReadOptions): Promise<RecordsReadResult>;
|
|
226
|
+
read(input: RecordsReadInput, options?: RecordsReadOptions): Promise<SelectedRecord | null | RecordsReadResult>;
|
|
240
227
|
search(query: string, options?: RecordsSearchOptions): Promise<RecordsSearchResult>;
|
|
241
228
|
};
|
|
242
229
|
history: {
|