@wix/wix-data-items-sdk 1.0.540 → 1.0.542
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/build/cjs/src/data-v2-data-item-items.context.d.ts +109 -76
- package/build/cjs/src/data-v2-data-item-items.context.js +14 -7
- package/build/cjs/src/data-v2-data-item-items.context.js.map +1 -1
- package/build/es/src/data-v2-data-item-items.context.d.ts +109 -76
- package/build/es/src/data-v2-data-item-items.context.js +14 -7
- package/build/es/src/data-v2-data-item-items.context.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,69 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { truncate as publicTruncate, bulkRemove as publicBulkRemove, isReferenced as publicIsReferenced, insertReference as publicInsertReference, removeReference as publicRemoveReference, replaceReferences as publicReplaceReferences, bulkPatch as publicBulkPatch, asyncPatchByFilter as publicAsyncPatchByFilter, asyncRemoveByFilter as publicAsyncRemoveByFilter, getAsyncJobStatus as publicGetAsyncJobStatus, aggregate as publicAggregate, aggregatePipeline as publicAggregatePipeline, distinct as publicDistinct, count as publicCount, queryReferenced as publicQueryReferenced, queryReferencedItems as publicQueryReferencedItems, filter as publicFilter, withEnvironment as publicWithEnvironment, onDataItemCreated as publicOnDataItemCreated, onDataItemUpdated as publicOnDataItemUpdated, onDataItemDeleted as publicOnDataItemDeleted } from './data-v2-data-item-items.public';
|
|
2
2
|
import { BuildRESTFunction, HttpClient, MaybeContext } from '@wix/sdk-types';
|
|
3
3
|
import { createEventModule } from '@wix/sdk-runtime/event-definition-modules';
|
|
4
4
|
import type { WixDataItem, WixDataUpdateOptions, WixDataRemoveOptions, WixDataSaveOptions, WixDataOptions, WixDataInsertOptions, WixDataBulkUpdateOptions, WixDataBulkRemoveOptions, WixDataGetOptions, WixDataQueryRequest, WixDataQueryOptions, WixDataQueryResponse, WixDataSearchResponse, WixDataAggregateResponse, WixDataDistinctResponse, WixDataQueryReferencedItemsOptions, WixDataQueryReferencedItemsResponse, WixDataQuery, WixDataSearchRequest, WixDataSearchOptions, WixDataSearch, WixDataBulkResult, WixDataBulkSaveOptions, WixDataPatch, WixDataBulkPatch, WixDataPatchOptions, WixDataBulkPatchOptions, FieldModification, WixDataAsyncRemoveByFilterOptions, WixDataAsyncRemoveByFilterResponse, WixDataAsyncPatchByFilterOptions, WixDataAsyncPatchByFilterResponse, WixDataAsyncJobStatus, WixDataFilterInput, WixDataAggregate, AggregationPipeline, WixDataAggregateOptions, WixDataDistinctOptions, WixDataIsReferencedOptions, WithId } from './data-v2-data-item-items.universal';
|
|
5
5
|
export { WixDataAsyncJob } from './data-v2-data-item-items.universal';
|
|
6
6
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Per-collection type registry.
|
|
9
|
+
*
|
|
10
|
+
* Open and empty by default, so this file is a no-op for untyped projects.
|
|
11
|
+
* Codegen (`wix data generate-types`) augments it via declaration merging:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* declare module '@wix/wix-data-items-sdk' {
|
|
15
|
+
* interface WixDataCollectionRegistry {
|
|
16
|
+
* 'moto-fleet': { item: MotoFleetItem; insert: MotoFleetInsert }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Its behavior is tested in the `wix-data-items-sdk-consumer-tests` package,
|
|
22
|
+
* which consumes the built package through node_modules and augments the
|
|
23
|
+
* specifier above exactly as codegen does. The tests have to live outside this
|
|
24
|
+
* package: a test in here could only augment the relative module path, which
|
|
25
|
+
* would pass even if the published entrypoint stopped being augmentable.
|
|
12
26
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
export interface WixDataCollectionRegistry {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Registered collection ids. Resolves to `never` while the registry is empty,
|
|
31
|
+
* so `ItemOf`/`InsertOf` fall back to the open `WixDataItem` shapes and every
|
|
32
|
+
* signature below behaves exactly as it did before this feature.
|
|
33
|
+
*/
|
|
34
|
+
type RegisteredCollections = keyof WixDataCollectionRegistry;
|
|
35
|
+
/**
|
|
36
|
+
* Collection id accepted by the fallback/bulk overloads: known ids autocomplete
|
|
37
|
+
* while any string is still allowed (`string & {}` preserves literal suggestions).
|
|
38
|
+
*/
|
|
39
|
+
export type CollectionId = [RegisteredCollections] extends [never] ? string : // The `never` case is handled by the true branch above, so this union is
|
|
40
|
+
RegisteredCollections | (string & {});
|
|
41
|
+
/** Read shape for a collection (`_id` required). Falls back to the open `WixDataItem`. */
|
|
42
|
+
export type ItemOf<C> = C extends RegisteredCollections ? WixDataCollectionRegistry[C]['item'] : WixDataItem;
|
|
43
|
+
/** Write shape for a collection. Falls back to `Partial<WixDataItem>`. */
|
|
44
|
+
export type InsertOf<C> = C extends RegisteredCollections ? WixDataCollectionRegistry[C]['insert'] : Partial<WixDataItem>;
|
|
45
|
+
/**
|
|
46
|
+
* Below, each request/mutation function keeps ONE signature (no permissive
|
|
47
|
+
* fallback overload — a bad payload for a registered collection would silently
|
|
48
|
+
* match it), driven by these helpers:
|
|
49
|
+
*
|
|
50
|
+
* - `Explicit` is `never` when the caller passes no `<Item>` type argument.
|
|
51
|
+
* - When explicit, the caller's `Item` wins (back-compat with `insert<Product>`).
|
|
52
|
+
* - Otherwise the registry drives the type: strict for a registered id,
|
|
53
|
+
* permissive (`Partial<WixDataItem>` / `WixDataItem`) for any other string.
|
|
54
|
+
*
|
|
55
|
+
* `[T] extends [never]` is the standard empty/no-arg detector.
|
|
56
|
+
*/
|
|
57
|
+
type WriteInput<C, Explicit> = [Explicit] extends [never] ? InsertOf<C> : Explicit;
|
|
58
|
+
type ItemInput<C, Explicit> = [Explicit] extends [never] ? ItemOf<C> : Explicit;
|
|
59
|
+
type ResultOf<C, Explicit> = [Explicit] extends [never] ? ItemOf<C> : Explicit & WixDataItem;
|
|
60
|
+
/**
|
|
61
|
+
* Registry-aware signatures for the context exports.
|
|
62
|
+
*
|
|
63
|
+
* Each is defined ONLY in its curried `(httpClient) => Signature` form. In a
|
|
64
|
+
* contextual (elevated) client the SDK's `BuildRESTFunction` transform unwraps
|
|
65
|
+
* that to the bare `Signature` — a single signature with no permissive
|
|
66
|
+
* competitor, so `items.insert('moto-fleet', bad)` is strictly checked. The
|
|
67
|
+
* type parameters are `<Item, C>`: `C` is inferred from the id and drives the
|
|
68
|
+
* registry lookup; an explicit `insert<Product>(...)` sets `Item` and wins.
|
|
69
|
+
*/
|
|
70
|
+
type InsertSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<WriteInput<C, Item>>, options?: WixDataInsertOptions) => Promise<ResultOf<C, Item>>;
|
|
71
|
+
type InsertGeneric = (httpClient: HttpClient) => InsertSignature;
|
|
72
|
+
type UpdateSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<ItemInput<C, Item>>, options?: WixDataUpdateOptions) => Promise<ResultOf<C, Item>>;
|
|
73
|
+
type UpdateGeneric = (httpClient: HttpClient) => UpdateSignature;
|
|
74
|
+
type SaveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<WriteInput<C, Item>>, options?: WixDataSaveOptions) => Promise<ResultOf<C, Item>>;
|
|
75
|
+
type SaveGeneric = (httpClient: HttpClient) => SaveSignature;
|
|
76
|
+
type GetSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItemId: string, options?: WixDataGetOptions) => Promise<ResultOf<C, Item> | null>;
|
|
77
|
+
type GetGeneric = (httpClient: HttpClient) => GetSignature;
|
|
78
|
+
type RemoveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItemId: string, options?: WixDataRemoveOptions) => Promise<ResultOf<C, Item> | null>;
|
|
79
|
+
type RemoveGeneric = (httpClient: HttpClient) => RemoveSignature;
|
|
80
|
+
type BulkInsertSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<WriteInput<C, Item>>[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
|
|
81
|
+
type BulkInsertGeneric = (httpClient: HttpClient) => BulkInsertSignature;
|
|
82
|
+
type BulkUpdateSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<ItemInput<C, Item>>[], options?: WixDataBulkUpdateOptions) => Promise<WixDataBulkResult>;
|
|
83
|
+
type BulkUpdateGeneric = (httpClient: HttpClient) => BulkUpdateSignature;
|
|
84
|
+
type BulkSaveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<WriteInput<C, Item>>[], options?: WixDataBulkSaveOptions) => Promise<WixDataBulkResult>;
|
|
85
|
+
type BulkSaveGeneric = (httpClient: HttpClient) => BulkSaveSignature;
|
|
45
86
|
type BulkRemoveGeneric = {
|
|
46
87
|
(httpClient: HttpClient): ReturnType<typeof publicBulkRemove>;
|
|
47
|
-
(dataCollectionId:
|
|
88
|
+
(dataCollectionId: CollectionId, itemIds: string[], options?: WixDataBulkRemoveOptions): Promise<WixDataBulkResult>;
|
|
48
89
|
};
|
|
49
90
|
type IsReferencedGeneric = {
|
|
50
|
-
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
51
|
-
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
91
|
+
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string, options?: WixDataIsReferencedOptions) => Promise<boolean>;
|
|
92
|
+
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string, options?: WixDataIsReferencedOptions): Promise<boolean>;
|
|
52
93
|
};
|
|
53
94
|
type ReferenceMutationGeneric = {
|
|
54
|
-
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
55
|
-
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
56
|
-
};
|
|
57
|
-
type
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
type SearchGeneric =
|
|
63
|
-
(httpClient: HttpClient): (<Item = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions) => Promise<WixDataSearchResponse<Item & WixDataItem>>) & ((dataCollectionId: string) => WixDataSearch);
|
|
64
|
-
(dataCollectionId: string): WixDataSearch;
|
|
65
|
-
<Item = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions): Promise<WixDataSearchResponse<Item & WixDataItem>>;
|
|
66
|
-
};
|
|
95
|
+
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string | ItemRight[] | string[], options?: WixDataOptions) => Promise<void>;
|
|
96
|
+
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string | ItemRight[] | string[], options?: WixDataOptions): Promise<void>;
|
|
97
|
+
};
|
|
98
|
+
type QueryRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, queryRequest: WixDataQueryRequest, options?: WixDataQueryOptions) => Promise<WixDataQueryResponse<ResultOf<C, Item>>>;
|
|
99
|
+
type QueryFluentSignature = (dataCollectionId: string) => WixDataQuery;
|
|
100
|
+
type QueryGeneric = (httpClient: HttpClient) => QueryRequestSignature & QueryFluentSignature;
|
|
101
|
+
type SearchRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions) => Promise<WixDataSearchResponse<ResultOf<C, Item>>>;
|
|
102
|
+
type SearchFluentSignature = (dataCollectionId: string) => WixDataSearch;
|
|
103
|
+
type SearchGeneric = (httpClient: HttpClient) => SearchRequestSignature & SearchFluentSignature;
|
|
67
104
|
type QueryReferencedItemsGeneric = {
|
|
68
105
|
(httpClient: HttpClient): <Item = WixDataItem>(dataCollectionId: string, referringItem: WixDataItem | string | (WixDataItem | string)[], referringItemFieldName: string, options?: WixDataQueryReferencedItemsOptions) => Promise<WixDataQueryReferencedItemsResponse<Item>>;
|
|
69
106
|
<Item = WixDataItem>(dataCollectionId: string, referringItem: WixDataItem | string | (WixDataItem | string)[], referringItemFieldName: string, options?: WixDataQueryReferencedItemsOptions): Promise<WixDataQueryReferencedItemsResponse<Item>>;
|
|
@@ -73,21 +110,17 @@ type AggregateGeneric = {
|
|
|
73
110
|
(dataCollectionId: string): WixDataAggregate;
|
|
74
111
|
<Result = Record<string, any>>(dataCollectionId: string, pipeline: AggregationPipeline, options?: WixDataAggregateOptions): Promise<WixDataAggregateResponse<Result>>;
|
|
75
112
|
};
|
|
76
|
-
type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
(dataCollectionId: string, itemId: string): WixDataPatch;
|
|
82
|
-
<Item = WixDataItem>(dataCollectionId: string, itemId: string, fieldModifications: FieldModification[], options?: WixDataPatchOptions): Promise<Item | null>;
|
|
83
|
-
};
|
|
113
|
+
type PatchResultOf<C, Explicit> = ([Explicit] extends [never] ? ItemOf<C> : Explicit) | null;
|
|
114
|
+
type PatchRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, itemId: string, fieldModifications: FieldModification[], options?: WixDataPatchOptions) => Promise<PatchResultOf<C, Item>>;
|
|
115
|
+
type PatchBuilderSignature = (dataCollectionId: string, itemId: string) => WixDataPatch;
|
|
116
|
+
type PatchGeneric = (httpClient: HttpClient) => PatchRequestSignature & PatchBuilderSignature;
|
|
84
117
|
type BulkPatchGeneric = {
|
|
85
118
|
(httpClient: HttpClient): {
|
|
86
|
-
(dataCollectionId:
|
|
87
|
-
(dataCollectionId:
|
|
119
|
+
(dataCollectionId: CollectionId, itemIds: string[]): WixDataBulkPatch;
|
|
120
|
+
(dataCollectionId: CollectionId, itemIds: string[], fieldModifications: FieldModification[], options?: WixDataBulkPatchOptions): Promise<WixDataBulkResult>;
|
|
88
121
|
};
|
|
89
|
-
(dataCollectionId:
|
|
90
|
-
(dataCollectionId:
|
|
122
|
+
(dataCollectionId: CollectionId, itemIds: string[]): WixDataBulkPatch;
|
|
123
|
+
(dataCollectionId: CollectionId, itemIds: string[], fieldModifications: FieldModification[], options?: WixDataBulkPatchOptions): Promise<WixDataBulkResult>;
|
|
91
124
|
};
|
|
92
125
|
type AsyncPatchByFilterGeneric = {
|
|
93
126
|
(httpClient: HttpClient): (dataCollectionId: string, filter: WixDataFilterInput, fieldModifications?: FieldModification[], options?: WixDataAsyncPatchByFilterOptions) => Promise<WixDataAsyncPatchByFilterResponse>;
|
|
@@ -101,23 +134,23 @@ type GetAsyncJobStatusGeneric = {
|
|
|
101
134
|
(httpClient: HttpClient): (jobId: string) => Promise<WixDataAsyncJobStatus>;
|
|
102
135
|
(jobId: string): Promise<WixDataAsyncJobStatus>;
|
|
103
136
|
};
|
|
104
|
-
export declare const insert: MaybeContext<
|
|
105
|
-
export declare const update: MaybeContext<
|
|
106
|
-
export declare const save: MaybeContext<
|
|
107
|
-
export declare const get: MaybeContext<
|
|
108
|
-
export declare const remove: MaybeContext<
|
|
137
|
+
export declare const insert: MaybeContext<InsertGeneric>;
|
|
138
|
+
export declare const update: MaybeContext<UpdateGeneric>;
|
|
139
|
+
export declare const save: MaybeContext<SaveGeneric>;
|
|
140
|
+
export declare const get: MaybeContext<GetGeneric>;
|
|
141
|
+
export declare const remove: MaybeContext<RemoveGeneric>;
|
|
109
142
|
export declare const truncate: MaybeContext<BuildRESTFunction<typeof publicTruncate> & typeof publicTruncate>;
|
|
110
|
-
export declare const bulkInsert: MaybeContext<
|
|
111
|
-
export declare const bulkUpdate: MaybeContext<
|
|
112
|
-
export declare const bulkSave: MaybeContext<
|
|
143
|
+
export declare const bulkInsert: MaybeContext<BulkInsertGeneric>;
|
|
144
|
+
export declare const bulkUpdate: MaybeContext<BulkUpdateGeneric>;
|
|
145
|
+
export declare const bulkSave: MaybeContext<BulkSaveGeneric>;
|
|
113
146
|
export declare const bulkRemove: MaybeContext<BuildRESTFunction<typeof publicBulkRemove> & BulkRemoveGeneric>;
|
|
114
147
|
export declare const isReferenced: MaybeContext<BuildRESTFunction<typeof publicIsReferenced> & IsReferencedGeneric>;
|
|
115
148
|
export declare const insertReference: MaybeContext<BuildRESTFunction<typeof publicInsertReference> & ReferenceMutationGeneric>;
|
|
116
149
|
export declare const removeReference: MaybeContext<BuildRESTFunction<typeof publicRemoveReference> & ReferenceMutationGeneric>;
|
|
117
150
|
export declare const replaceReferences: MaybeContext<BuildRESTFunction<typeof publicReplaceReferences> & ReferenceMutationGeneric>;
|
|
118
|
-
export declare const query: MaybeContext<
|
|
119
|
-
export declare const search: MaybeContext<
|
|
120
|
-
export declare const patch: MaybeContext<
|
|
151
|
+
export declare const query: MaybeContext<QueryGeneric>;
|
|
152
|
+
export declare const search: MaybeContext<SearchGeneric>;
|
|
153
|
+
export declare const patch: MaybeContext<PatchGeneric>;
|
|
121
154
|
export declare const bulkPatch: MaybeContext<BuildRESTFunction<typeof publicBulkPatch> & BulkPatchGeneric>;
|
|
122
155
|
export declare const asyncPatchByFilter: MaybeContext<BuildRESTFunction<typeof publicAsyncPatchByFilter> & AsyncPatchByFilterGeneric>;
|
|
123
156
|
export declare const asyncRemoveByFilter: MaybeContext<BuildRESTFunction<typeof publicAsyncRemoveByFilter> & AsyncRemoveByFilterGeneric>;
|
|
@@ -19,22 +19,29 @@ exports.SearchParams = exports.SearchBuilder = exports.Sort = exports.Filter = e
|
|
|
19
19
|
const data_v2_data_item_items_public_1 = require("./data-v2-data-item-items.public");
|
|
20
20
|
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
21
21
|
const event_definition_modules_1 = require("@wix/sdk-runtime/event-definition-modules");
|
|
22
|
-
exports.insert =
|
|
23
|
-
|
|
22
|
+
exports.insert =
|
|
23
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.insert);
|
|
24
|
+
exports.update =
|
|
25
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.update);
|
|
24
26
|
exports.save = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.save);
|
|
25
27
|
exports.get = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.get);
|
|
26
|
-
exports.remove =
|
|
28
|
+
exports.remove =
|
|
29
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.remove);
|
|
27
30
|
exports.truncate = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.truncate);
|
|
28
|
-
exports.bulkInsert =
|
|
29
|
-
|
|
30
|
-
exports.
|
|
31
|
+
exports.bulkInsert =
|
|
32
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.bulkInsert);
|
|
33
|
+
exports.bulkUpdate =
|
|
34
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.bulkUpdate);
|
|
35
|
+
exports.bulkSave =
|
|
36
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.bulkSave);
|
|
31
37
|
exports.bulkRemove = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.bulkRemove);
|
|
32
38
|
exports.isReferenced = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.isReferenced);
|
|
33
39
|
exports.insertReference = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.insertReference);
|
|
34
40
|
exports.removeReference = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.removeReference);
|
|
35
41
|
exports.replaceReferences = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.replaceReferences);
|
|
36
42
|
exports.query = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.query);
|
|
37
|
-
exports.search =
|
|
43
|
+
exports.search =
|
|
44
|
+
/*#__PURE__*/ (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.search);
|
|
38
45
|
exports.patch = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.patch);
|
|
39
46
|
exports.bulkPatch = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.bulkPatch);
|
|
40
47
|
exports.asyncPatchByFilter = (0, rest_modules_1.createRESTModule)(data_v2_data_item_items_public_1.asyncPatchByFilter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-v2-data-item-items.context.js","sourceRoot":"","sources":["../../../src/data-v2-data-item-items.context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qFAiCyC;AAEzC,gEAAgE;AAChE,wFAA6E;
|
|
1
|
+
{"version":3,"file":"data-v2-data-item-items.context.js","sourceRoot":"","sources":["../../../src/data-v2-data-item-items.context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qFAiCyC;AAEzC,gEAAgE;AAChE,wFAA6E;AAyXhE,QAAA,MAAM;AACjB,aAAa,CAAC,IAAA,+BAAgB,EAC5B,uCAAY,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ACZ,yIAAA,oBAAoB,OAAA;AACpB,uIAAA,kBAAkB,OAAA;AAClB,2IAAA,sBAAsB,OAAA;AACtB,sIAAA,iBAAiB,OAAA;AACjB,wIAAA,mBAAmB,OAAA;AACnB,uJAAA,kCAAkC,OAAA;AAClC,4IAAA,uBAAuB,OAAA;AACvB,2IAAA,sBAAsB,OAAA;AACtB,wIAAA,mBAAmB,OAAA;AACnB,+IAAA,0BAA0B,OAAA;AAC1B,yIAAA,oBAAoB,OAAA;AACpB,yIAAA,oBAAoB,OAAA;AACpB,6IAAA,wBAAwB,OAAA;AACxB,6IAAA,wBAAwB,OAAA;AACxB,wIAAA,mBAAmB,OAAA;AACnB,4IAAA,uBAAuB,OAAA;AACvB,6IAAA,wBAAwB,OAAA;AACxB,yIAAA,oBAAoB,OAAA;AACpB,sJAAA,iCAAiC,OAAA;AACjC,qJAAA,gCAAgC,OAAA;AAChC,2HAAA,MAAM,OAAA;AACN,yHAAA,IAAI,OAAA;AAEJ,kIAAA,aAAa,OAAA;AACb,iIAAA,YAAY,OAAA;AAyBd,kEAA+C"}
|
|
@@ -1,69 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { truncate as publicTruncate, bulkRemove as publicBulkRemove, isReferenced as publicIsReferenced, insertReference as publicInsertReference, removeReference as publicRemoveReference, replaceReferences as publicReplaceReferences, bulkPatch as publicBulkPatch, asyncPatchByFilter as publicAsyncPatchByFilter, asyncRemoveByFilter as publicAsyncRemoveByFilter, getAsyncJobStatus as publicGetAsyncJobStatus, aggregate as publicAggregate, aggregatePipeline as publicAggregatePipeline, distinct as publicDistinct, count as publicCount, queryReferenced as publicQueryReferenced, queryReferencedItems as publicQueryReferencedItems, filter as publicFilter, withEnvironment as publicWithEnvironment, onDataItemCreated as publicOnDataItemCreated, onDataItemUpdated as publicOnDataItemUpdated, onDataItemDeleted as publicOnDataItemDeleted } from './data-v2-data-item-items.public';
|
|
2
2
|
import { BuildRESTFunction, HttpClient, MaybeContext } from '@wix/sdk-types';
|
|
3
3
|
import { createEventModule } from '@wix/sdk-runtime/event-definition-modules';
|
|
4
4
|
import type { WixDataItem, WixDataUpdateOptions, WixDataRemoveOptions, WixDataSaveOptions, WixDataOptions, WixDataInsertOptions, WixDataBulkUpdateOptions, WixDataBulkRemoveOptions, WixDataGetOptions, WixDataQueryRequest, WixDataQueryOptions, WixDataQueryResponse, WixDataSearchResponse, WixDataAggregateResponse, WixDataDistinctResponse, WixDataQueryReferencedItemsOptions, WixDataQueryReferencedItemsResponse, WixDataQuery, WixDataSearchRequest, WixDataSearchOptions, WixDataSearch, WixDataBulkResult, WixDataBulkSaveOptions, WixDataPatch, WixDataBulkPatch, WixDataPatchOptions, WixDataBulkPatchOptions, FieldModification, WixDataAsyncRemoveByFilterOptions, WixDataAsyncRemoveByFilterResponse, WixDataAsyncPatchByFilterOptions, WixDataAsyncPatchByFilterResponse, WixDataAsyncJobStatus, WixDataFilterInput, WixDataAggregate, AggregationPipeline, WixDataAggregateOptions, WixDataDistinctOptions, WixDataIsReferencedOptions, WithId } from './data-v2-data-item-items.universal';
|
|
5
5
|
export { WixDataAsyncJob } from './data-v2-data-item-items.universal';
|
|
6
6
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Per-collection type registry.
|
|
9
|
+
*
|
|
10
|
+
* Open and empty by default, so this file is a no-op for untyped projects.
|
|
11
|
+
* Codegen (`wix data generate-types`) augments it via declaration merging:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* declare module '@wix/wix-data-items-sdk' {
|
|
15
|
+
* interface WixDataCollectionRegistry {
|
|
16
|
+
* 'moto-fleet': { item: MotoFleetItem; insert: MotoFleetInsert }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Its behavior is tested in the `wix-data-items-sdk-consumer-tests` package,
|
|
22
|
+
* which consumes the built package through node_modules and augments the
|
|
23
|
+
* specifier above exactly as codegen does. The tests have to live outside this
|
|
24
|
+
* package: a test in here could only augment the relative module path, which
|
|
25
|
+
* would pass even if the published entrypoint stopped being augmentable.
|
|
12
26
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
export interface WixDataCollectionRegistry {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Registered collection ids. Resolves to `never` while the registry is empty,
|
|
31
|
+
* so `ItemOf`/`InsertOf` fall back to the open `WixDataItem` shapes and every
|
|
32
|
+
* signature below behaves exactly as it did before this feature.
|
|
33
|
+
*/
|
|
34
|
+
type RegisteredCollections = keyof WixDataCollectionRegistry;
|
|
35
|
+
/**
|
|
36
|
+
* Collection id accepted by the fallback/bulk overloads: known ids autocomplete
|
|
37
|
+
* while any string is still allowed (`string & {}` preserves literal suggestions).
|
|
38
|
+
*/
|
|
39
|
+
export type CollectionId = [RegisteredCollections] extends [never] ? string : // The `never` case is handled by the true branch above, so this union is
|
|
40
|
+
RegisteredCollections | (string & {});
|
|
41
|
+
/** Read shape for a collection (`_id` required). Falls back to the open `WixDataItem`. */
|
|
42
|
+
export type ItemOf<C> = C extends RegisteredCollections ? WixDataCollectionRegistry[C]['item'] : WixDataItem;
|
|
43
|
+
/** Write shape for a collection. Falls back to `Partial<WixDataItem>`. */
|
|
44
|
+
export type InsertOf<C> = C extends RegisteredCollections ? WixDataCollectionRegistry[C]['insert'] : Partial<WixDataItem>;
|
|
45
|
+
/**
|
|
46
|
+
* Below, each request/mutation function keeps ONE signature (no permissive
|
|
47
|
+
* fallback overload — a bad payload for a registered collection would silently
|
|
48
|
+
* match it), driven by these helpers:
|
|
49
|
+
*
|
|
50
|
+
* - `Explicit` is `never` when the caller passes no `<Item>` type argument.
|
|
51
|
+
* - When explicit, the caller's `Item` wins (back-compat with `insert<Product>`).
|
|
52
|
+
* - Otherwise the registry drives the type: strict for a registered id,
|
|
53
|
+
* permissive (`Partial<WixDataItem>` / `WixDataItem`) for any other string.
|
|
54
|
+
*
|
|
55
|
+
* `[T] extends [never]` is the standard empty/no-arg detector.
|
|
56
|
+
*/
|
|
57
|
+
type WriteInput<C, Explicit> = [Explicit] extends [never] ? InsertOf<C> : Explicit;
|
|
58
|
+
type ItemInput<C, Explicit> = [Explicit] extends [never] ? ItemOf<C> : Explicit;
|
|
59
|
+
type ResultOf<C, Explicit> = [Explicit] extends [never] ? ItemOf<C> : Explicit & WixDataItem;
|
|
60
|
+
/**
|
|
61
|
+
* Registry-aware signatures for the context exports.
|
|
62
|
+
*
|
|
63
|
+
* Each is defined ONLY in its curried `(httpClient) => Signature` form. In a
|
|
64
|
+
* contextual (elevated) client the SDK's `BuildRESTFunction` transform unwraps
|
|
65
|
+
* that to the bare `Signature` — a single signature with no permissive
|
|
66
|
+
* competitor, so `items.insert('moto-fleet', bad)` is strictly checked. The
|
|
67
|
+
* type parameters are `<Item, C>`: `C` is inferred from the id and drives the
|
|
68
|
+
* registry lookup; an explicit `insert<Product>(...)` sets `Item` and wins.
|
|
69
|
+
*/
|
|
70
|
+
type InsertSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<WriteInput<C, Item>>, options?: WixDataInsertOptions) => Promise<ResultOf<C, Item>>;
|
|
71
|
+
type InsertGeneric = (httpClient: HttpClient) => InsertSignature;
|
|
72
|
+
type UpdateSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<ItemInput<C, Item>>, options?: WixDataUpdateOptions) => Promise<ResultOf<C, Item>>;
|
|
73
|
+
type UpdateGeneric = (httpClient: HttpClient) => UpdateSignature;
|
|
74
|
+
type SaveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItem: NoInfer<WriteInput<C, Item>>, options?: WixDataSaveOptions) => Promise<ResultOf<C, Item>>;
|
|
75
|
+
type SaveGeneric = (httpClient: HttpClient) => SaveSignature;
|
|
76
|
+
type GetSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItemId: string, options?: WixDataGetOptions) => Promise<ResultOf<C, Item> | null>;
|
|
77
|
+
type GetGeneric = (httpClient: HttpClient) => GetSignature;
|
|
78
|
+
type RemoveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, dataItemId: string, options?: WixDataRemoveOptions) => Promise<ResultOf<C, Item> | null>;
|
|
79
|
+
type RemoveGeneric = (httpClient: HttpClient) => RemoveSignature;
|
|
80
|
+
type BulkInsertSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<WriteInput<C, Item>>[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
|
|
81
|
+
type BulkInsertGeneric = (httpClient: HttpClient) => BulkInsertSignature;
|
|
82
|
+
type BulkUpdateSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<ItemInput<C, Item>>[], options?: WixDataBulkUpdateOptions) => Promise<WixDataBulkResult>;
|
|
83
|
+
type BulkUpdateGeneric = (httpClient: HttpClient) => BulkUpdateSignature;
|
|
84
|
+
type BulkSaveSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, items: NoInfer<WriteInput<C, Item>>[], options?: WixDataBulkSaveOptions) => Promise<WixDataBulkResult>;
|
|
85
|
+
type BulkSaveGeneric = (httpClient: HttpClient) => BulkSaveSignature;
|
|
45
86
|
type BulkRemoveGeneric = {
|
|
46
87
|
(httpClient: HttpClient): ReturnType<typeof publicBulkRemove>;
|
|
47
|
-
(dataCollectionId:
|
|
88
|
+
(dataCollectionId: CollectionId, itemIds: string[], options?: WixDataBulkRemoveOptions): Promise<WixDataBulkResult>;
|
|
48
89
|
};
|
|
49
90
|
type IsReferencedGeneric = {
|
|
50
|
-
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
51
|
-
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
91
|
+
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string, options?: WixDataIsReferencedOptions) => Promise<boolean>;
|
|
92
|
+
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string, options?: WixDataIsReferencedOptions): Promise<boolean>;
|
|
52
93
|
};
|
|
53
94
|
type ReferenceMutationGeneric = {
|
|
54
|
-
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
55
|
-
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId:
|
|
56
|
-
};
|
|
57
|
-
type
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
type SearchGeneric =
|
|
63
|
-
(httpClient: HttpClient): (<Item = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions) => Promise<WixDataSearchResponse<Item & WixDataItem>>) & ((dataCollectionId: string) => WixDataSearch);
|
|
64
|
-
(dataCollectionId: string): WixDataSearch;
|
|
65
|
-
<Item = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions): Promise<WixDataSearchResponse<Item & WixDataItem>>;
|
|
66
|
-
};
|
|
95
|
+
(httpClient: HttpClient): <ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string | ItemRight[] | string[], options?: WixDataOptions) => Promise<void>;
|
|
96
|
+
<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: CollectionId, propertyName: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string | ItemRight[] | string[], options?: WixDataOptions): Promise<void>;
|
|
97
|
+
};
|
|
98
|
+
type QueryRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, queryRequest: WixDataQueryRequest, options?: WixDataQueryOptions) => Promise<WixDataQueryResponse<ResultOf<C, Item>>>;
|
|
99
|
+
type QueryFluentSignature = (dataCollectionId: string) => WixDataQuery;
|
|
100
|
+
type QueryGeneric = (httpClient: HttpClient) => QueryRequestSignature & QueryFluentSignature;
|
|
101
|
+
type SearchRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions) => Promise<WixDataSearchResponse<ResultOf<C, Item>>>;
|
|
102
|
+
type SearchFluentSignature = (dataCollectionId: string) => WixDataSearch;
|
|
103
|
+
type SearchGeneric = (httpClient: HttpClient) => SearchRequestSignature & SearchFluentSignature;
|
|
67
104
|
type QueryReferencedItemsGeneric = {
|
|
68
105
|
(httpClient: HttpClient): <Item = WixDataItem>(dataCollectionId: string, referringItem: WixDataItem | string | (WixDataItem | string)[], referringItemFieldName: string, options?: WixDataQueryReferencedItemsOptions) => Promise<WixDataQueryReferencedItemsResponse<Item>>;
|
|
69
106
|
<Item = WixDataItem>(dataCollectionId: string, referringItem: WixDataItem | string | (WixDataItem | string)[], referringItemFieldName: string, options?: WixDataQueryReferencedItemsOptions): Promise<WixDataQueryReferencedItemsResponse<Item>>;
|
|
@@ -73,21 +110,17 @@ type AggregateGeneric = {
|
|
|
73
110
|
(dataCollectionId: string): WixDataAggregate;
|
|
74
111
|
<Result = Record<string, any>>(dataCollectionId: string, pipeline: AggregationPipeline, options?: WixDataAggregateOptions): Promise<WixDataAggregateResponse<Result>>;
|
|
75
112
|
};
|
|
76
|
-
type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
(dataCollectionId: string, itemId: string): WixDataPatch;
|
|
82
|
-
<Item = WixDataItem>(dataCollectionId: string, itemId: string, fieldModifications: FieldModification[], options?: WixDataPatchOptions): Promise<Item | null>;
|
|
83
|
-
};
|
|
113
|
+
type PatchResultOf<C, Explicit> = ([Explicit] extends [never] ? ItemOf<C> : Explicit) | null;
|
|
114
|
+
type PatchRequestSignature = <Item = never, C extends CollectionId = CollectionId>(dataCollectionId: C, itemId: string, fieldModifications: FieldModification[], options?: WixDataPatchOptions) => Promise<PatchResultOf<C, Item>>;
|
|
115
|
+
type PatchBuilderSignature = (dataCollectionId: string, itemId: string) => WixDataPatch;
|
|
116
|
+
type PatchGeneric = (httpClient: HttpClient) => PatchRequestSignature & PatchBuilderSignature;
|
|
84
117
|
type BulkPatchGeneric = {
|
|
85
118
|
(httpClient: HttpClient): {
|
|
86
|
-
(dataCollectionId:
|
|
87
|
-
(dataCollectionId:
|
|
119
|
+
(dataCollectionId: CollectionId, itemIds: string[]): WixDataBulkPatch;
|
|
120
|
+
(dataCollectionId: CollectionId, itemIds: string[], fieldModifications: FieldModification[], options?: WixDataBulkPatchOptions): Promise<WixDataBulkResult>;
|
|
88
121
|
};
|
|
89
|
-
(dataCollectionId:
|
|
90
|
-
(dataCollectionId:
|
|
122
|
+
(dataCollectionId: CollectionId, itemIds: string[]): WixDataBulkPatch;
|
|
123
|
+
(dataCollectionId: CollectionId, itemIds: string[], fieldModifications: FieldModification[], options?: WixDataBulkPatchOptions): Promise<WixDataBulkResult>;
|
|
91
124
|
};
|
|
92
125
|
type AsyncPatchByFilterGeneric = {
|
|
93
126
|
(httpClient: HttpClient): (dataCollectionId: string, filter: WixDataFilterInput, fieldModifications?: FieldModification[], options?: WixDataAsyncPatchByFilterOptions) => Promise<WixDataAsyncPatchByFilterResponse>;
|
|
@@ -101,23 +134,23 @@ type GetAsyncJobStatusGeneric = {
|
|
|
101
134
|
(httpClient: HttpClient): (jobId: string) => Promise<WixDataAsyncJobStatus>;
|
|
102
135
|
(jobId: string): Promise<WixDataAsyncJobStatus>;
|
|
103
136
|
};
|
|
104
|
-
export declare const insert: MaybeContext<
|
|
105
|
-
export declare const update: MaybeContext<
|
|
106
|
-
export declare const save: MaybeContext<
|
|
107
|
-
export declare const get: MaybeContext<
|
|
108
|
-
export declare const remove: MaybeContext<
|
|
137
|
+
export declare const insert: MaybeContext<InsertGeneric>;
|
|
138
|
+
export declare const update: MaybeContext<UpdateGeneric>;
|
|
139
|
+
export declare const save: MaybeContext<SaveGeneric>;
|
|
140
|
+
export declare const get: MaybeContext<GetGeneric>;
|
|
141
|
+
export declare const remove: MaybeContext<RemoveGeneric>;
|
|
109
142
|
export declare const truncate: MaybeContext<BuildRESTFunction<typeof publicTruncate> & typeof publicTruncate>;
|
|
110
|
-
export declare const bulkInsert: MaybeContext<
|
|
111
|
-
export declare const bulkUpdate: MaybeContext<
|
|
112
|
-
export declare const bulkSave: MaybeContext<
|
|
143
|
+
export declare const bulkInsert: MaybeContext<BulkInsertGeneric>;
|
|
144
|
+
export declare const bulkUpdate: MaybeContext<BulkUpdateGeneric>;
|
|
145
|
+
export declare const bulkSave: MaybeContext<BulkSaveGeneric>;
|
|
113
146
|
export declare const bulkRemove: MaybeContext<BuildRESTFunction<typeof publicBulkRemove> & BulkRemoveGeneric>;
|
|
114
147
|
export declare const isReferenced: MaybeContext<BuildRESTFunction<typeof publicIsReferenced> & IsReferencedGeneric>;
|
|
115
148
|
export declare const insertReference: MaybeContext<BuildRESTFunction<typeof publicInsertReference> & ReferenceMutationGeneric>;
|
|
116
149
|
export declare const removeReference: MaybeContext<BuildRESTFunction<typeof publicRemoveReference> & ReferenceMutationGeneric>;
|
|
117
150
|
export declare const replaceReferences: MaybeContext<BuildRESTFunction<typeof publicReplaceReferences> & ReferenceMutationGeneric>;
|
|
118
|
-
export declare const query: MaybeContext<
|
|
119
|
-
export declare const search: MaybeContext<
|
|
120
|
-
export declare const patch: MaybeContext<
|
|
151
|
+
export declare const query: MaybeContext<QueryGeneric>;
|
|
152
|
+
export declare const search: MaybeContext<SearchGeneric>;
|
|
153
|
+
export declare const patch: MaybeContext<PatchGeneric>;
|
|
121
154
|
export declare const bulkPatch: MaybeContext<BuildRESTFunction<typeof publicBulkPatch> & BulkPatchGeneric>;
|
|
122
155
|
export declare const asyncPatchByFilter: MaybeContext<BuildRESTFunction<typeof publicAsyncPatchByFilter> & AsyncPatchByFilterGeneric>;
|
|
123
156
|
export declare const asyncRemoveByFilter: MaybeContext<BuildRESTFunction<typeof publicAsyncRemoveByFilter> & AsyncRemoveByFilterGeneric>;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { insert as publicInsert, update as publicUpdate, save as publicSave, get as publicGet, remove as publicRemove, truncate as publicTruncate, bulkInsert as publicBulkInsert, bulkUpdate as publicBulkUpdate, bulkSave as publicBulkSave, bulkRemove as publicBulkRemove, isReferenced as publicIsReferenced, insertReference as publicInsertReference, removeReference as publicRemoveReference, replaceReferences as publicReplaceReferences, query as publicQuery, search as publicSearch, patch as publicPatch, bulkPatch as publicBulkPatch, asyncPatchByFilter as publicAsyncPatchByFilter, asyncRemoveByFilter as publicAsyncRemoveByFilter, getAsyncJobStatus as publicGetAsyncJobStatus, aggregate as publicAggregate, aggregatePipeline as publicAggregatePipeline, distinct as publicDistinct, count as publicCount, queryReferenced as publicQueryReferenced, queryReferencedItems as publicQueryReferencedItems, filter as publicFilter, withEnvironment as publicWithEnvironment, onDataItemCreated as publicOnDataItemCreated, onDataItemUpdated as publicOnDataItemUpdated, onDataItemDeleted as publicOnDataItemDeleted, } from './data-v2-data-item-items.public';
|
|
2
2
|
import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
3
3
|
import { createEventModule } from '@wix/sdk-runtime/event-definition-modules';
|
|
4
|
-
export const insert =
|
|
5
|
-
|
|
4
|
+
export const insert =
|
|
5
|
+
/*#__PURE__*/ createRESTModule(publicInsert);
|
|
6
|
+
export const update =
|
|
7
|
+
/*#__PURE__*/ createRESTModule(publicUpdate);
|
|
6
8
|
export const save = /*#__PURE__*/ createRESTModule(publicSave);
|
|
7
9
|
export const get = /*#__PURE__*/ createRESTModule(publicGet);
|
|
8
|
-
export const remove =
|
|
10
|
+
export const remove =
|
|
11
|
+
/*#__PURE__*/ createRESTModule(publicRemove);
|
|
9
12
|
export const truncate = /*#__PURE__*/ createRESTModule(publicTruncate);
|
|
10
|
-
export const bulkInsert =
|
|
11
|
-
|
|
12
|
-
export const
|
|
13
|
+
export const bulkInsert =
|
|
14
|
+
/*#__PURE__*/ createRESTModule(publicBulkInsert);
|
|
15
|
+
export const bulkUpdate =
|
|
16
|
+
/*#__PURE__*/ createRESTModule(publicBulkUpdate);
|
|
17
|
+
export const bulkSave =
|
|
18
|
+
/*#__PURE__*/ createRESTModule(publicBulkSave);
|
|
13
19
|
export const bulkRemove = /*#__PURE__*/ createRESTModule(publicBulkRemove);
|
|
14
20
|
export const isReferenced = /*#__PURE__*/ createRESTModule(publicIsReferenced);
|
|
15
21
|
export const insertReference = /*#__PURE__*/ createRESTModule(publicInsertReference);
|
|
16
22
|
export const removeReference = /*#__PURE__*/ createRESTModule(publicRemoveReference);
|
|
17
23
|
export const replaceReferences = /*#__PURE__*/ createRESTModule(publicReplaceReferences);
|
|
18
24
|
export const query = /*#__PURE__*/ createRESTModule(publicQuery);
|
|
19
|
-
export const search =
|
|
25
|
+
export const search =
|
|
26
|
+
/*#__PURE__*/ createRESTModule(publicSearch);
|
|
20
27
|
export const patch = /*#__PURE__*/ createRESTModule(publicPatch);
|
|
21
28
|
export const bulkPatch = /*#__PURE__*/ createRESTModule(publicBulkPatch);
|
|
22
29
|
export const asyncPatchByFilter = /*#__PURE__*/ createRESTModule(publicAsyncPatchByFilter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-v2-data-item-items.context.js","sourceRoot":"","sources":["../../../src/data-v2-data-item-items.context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,GAAG,IAAI,SAAS,EAChB,MAAM,IAAI,YAAY,EACtB,QAAQ,IAAI,cAAc,EAC1B,UAAU,IAAI,gBAAgB,EAC9B,UAAU,IAAI,gBAAgB,EAC9B,QAAQ,IAAI,cAAc,EAC1B,UAAU,IAAI,gBAAgB,EAC9B,YAAY,IAAI,kBAAkB,EAClC,eAAe,IAAI,qBAAqB,EACxC,eAAe,IAAI,qBAAqB,EACxC,iBAAiB,IAAI,uBAAuB,EAC5C,KAAK,IAAI,WAAW,EACpB,MAAM,IAAI,YAAY,EACtB,KAAK,IAAI,WAAW,EACpB,SAAS,IAAI,eAAe,EAC5B,kBAAkB,IAAI,wBAAwB,EAC9C,mBAAmB,IAAI,yBAAyB,EAChD,iBAAiB,IAAI,uBAAuB,EAC5C,SAAS,IAAI,eAAe,EAC5B,iBAAiB,IAAI,uBAAuB,EAC5C,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,eAAe,IAAI,qBAAqB,EACxC,oBAAoB,IAAI,0BAA0B,EAClD,MAAM,IAAI,YAAY,EACtB,eAAe,IAAI,qBAAqB,EACxC,iBAAiB,IAAI,uBAAuB,EAC5C,iBAAiB,IAAI,uBAAuB,EAC5C,iBAAiB,IAAI,uBAAuB,GAC7C,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"data-v2-data-item-items.context.js","sourceRoot":"","sources":["../../../src/data-v2-data-item-items.context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,YAAY,E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AW,EAOX,yBAAyB,EAuBzB,eAAe,EACf,eAAe,EAkBf,MAAM,EACN,MAAM,EACN,WAAW,EACX,WAAW,EAoBX,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,iCAAiC,EACjC,gCAAgC,EAChC,MAAM,EACN,IAAI,EAEJ,aAAa,EACb,YAAY,GACb,MAAM,qCAAqC,CAAA;AAwB5C,cAAc,iCAAiC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/wix-data-items-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.542",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rimvydas Gimbutas",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@wix/sdk-runtime": "^0.7.0",
|
|
38
38
|
"@wix/sdk-types": "^1.17.9",
|
|
39
|
-
"@wix/wix-data-items-common": "1.0.
|
|
39
|
+
"@wix/wix-data-items-common": "1.0.323"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/js": "^9.39.1",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"wallaby": {
|
|
96
96
|
"autoDetect": true
|
|
97
97
|
},
|
|
98
|
-
"falconPackageHash": "
|
|
98
|
+
"falconPackageHash": "e48653d8e1d6570b977f242ecca761f2b898266c3906d7bd735d7642"
|
|
99
99
|
}
|