@fabriktor/client 0.0.82 → 0.0.84
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/dist/src/core/col.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export type FieldOf<T> = Extract<keyof T, string>;
|
|
2
|
+
type NestedQueryRecord<T> = T extends readonly (infer Value)[] ? Value : T;
|
|
3
|
+
export type NestedFieldOf<T> = {
|
|
4
|
+
[Key in FieldOf<T>]: NonNullable<NestedQueryRecord<NonNullable<T[Key]>>> extends object ? readonly [
|
|
5
|
+
Key,
|
|
6
|
+
FieldOf<NonNullable<NestedQueryRecord<NonNullable<T[Key]>>>>
|
|
7
|
+
] : never;
|
|
8
|
+
}[FieldOf<T>];
|
|
2
9
|
export type QueryValue = string | number | boolean | undefined | null;
|
|
3
10
|
export type QueryInputValue = QueryValue | QueryValue[];
|
|
4
11
|
export type QueryOptions = Record<string, QueryInputValue>;
|
|
@@ -17,5 +24,7 @@ export declare function collectionPath(opts: CollectionPathOptions): string;
|
|
|
17
24
|
export declare function idPath(opts: IDPathOptions): string;
|
|
18
25
|
export declare function queryParam<T>(key: FieldOf<T>, value: QueryInputValue): QueryOptions;
|
|
19
26
|
export declare function queryParams<T>(query: TypedQueryOptions<T>): QueryOptions;
|
|
27
|
+
export declare function queryNestedParam<T>(path: NestedFieldOf<T>, value: QueryInputValue): QueryOptions;
|
|
20
28
|
export declare function mergeQueryOptions(...queries: Array<QueryOptions | undefined>): QueryOptions;
|
|
21
29
|
export declare function withQuery(path: string, opts?: BuildQueryOptions): string;
|
|
30
|
+
export {};
|
package/dist/src/core/col.js
CHANGED
|
@@ -23,6 +23,9 @@ export function queryParam(key, value) {
|
|
|
23
23
|
export function queryParams(query) {
|
|
24
24
|
return query;
|
|
25
25
|
}
|
|
26
|
+
export function queryNestedParam(path, value) {
|
|
27
|
+
return { [`${path[0]}.${path[1]}`]: value };
|
|
28
|
+
}
|
|
26
29
|
export function mergeQueryOptions(...queries) {
|
|
27
30
|
return Object.assign({}, ...queries);
|
|
28
31
|
}
|
package/dist/src/core/crud.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type ReplaceOneOptionsCRUD<In> = Pick<RequestOptions, "signal"> & {
|
|
|
32
32
|
export type DeleteOneOptionsCRUD = {
|
|
33
33
|
id: string;
|
|
34
34
|
};
|
|
35
|
-
export type SearchManyOptionsCRUD = {
|
|
35
|
+
export type SearchManyOptionsCRUD = Pick<RequestOptions, "signal"> & {
|
|
36
36
|
query?: QueryOptions;
|
|
37
37
|
};
|
|
38
38
|
export interface CRUDOperator<In, Out> {
|
package/dist/src/core/crud.js
CHANGED
|
@@ -17,7 +17,7 @@ export type UploadStorageOptions = RequestOptions & {
|
|
|
17
17
|
public_url?: boolean;
|
|
18
18
|
files: StorageUploadFile[];
|
|
19
19
|
};
|
|
20
|
-
export type DownloadStorageOptions = CompletePayload<PLStorageDownload>;
|
|
20
|
+
export type DownloadStorageOptions = CompletePayload<PLStorageDownload> & Pick<RequestOptions, "signal">;
|
|
21
21
|
export type StorageClientOptions = {
|
|
22
22
|
http: HTTPDoer;
|
|
23
23
|
base_url: string;
|
|
@@ -61,13 +61,15 @@ export class StorageClient {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
async download(col, opts) {
|
|
64
|
+
const { signal, ...body } = opts;
|
|
64
65
|
const token = await requiredToken(this.get_token);
|
|
65
66
|
return await this.http.do({
|
|
66
67
|
base_url: this.base_url,
|
|
67
68
|
path: storagePath(col, PathStorageDownload),
|
|
68
69
|
method: HTTPMethodPost,
|
|
69
70
|
token,
|
|
70
|
-
body
|
|
71
|
+
body,
|
|
72
|
+
signal,
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
async deleteOne(col, opts) {
|