@wix/wix-data-items-common 1.0.52
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 +8 -0
- package/dist/cjs/api/ApiClient.js +186 -0
- package/dist/cjs/api/ApiClient.js.map +1 -0
- package/dist/cjs/api/QueryBase.js +200 -0
- package/dist/cjs/api/QueryBase.js.map +1 -0
- package/dist/cjs/api/QueryValidator.js +36 -0
- package/dist/cjs/api/QueryValidator.js.map +1 -0
- package/dist/cjs/api/WixDataAggregate.js +4 -0
- package/dist/cjs/api/WixDataAggregate.js.map +1 -0
- package/dist/cjs/api/WixDataApi.js +800 -0
- package/dist/cjs/api/WixDataApi.js.map +1 -0
- package/dist/cjs/api/WixDataFilter.js +2 -0
- package/dist/cjs/api/WixDataFilter.js.map +1 -0
- package/dist/cjs/api/WixDataPatch.js +139 -0
- package/dist/cjs/api/WixDataPatch.js.map +1 -0
- package/dist/cjs/api/WixDataQuery.js +4 -0
- package/dist/cjs/api/WixDataQuery.js.map +1 -0
- package/dist/cjs/api/WixDataResult.js +4 -0
- package/dist/cjs/api/WixDataResult.js.map +1 -0
- package/dist/cjs/api/common.js +14 -0
- package/dist/cjs/api/common.js.map +1 -0
- package/dist/cjs/api/errors.js +67 -0
- package/dist/cjs/api/errors.js.map +1 -0
- package/dist/cjs/api/impl/WixDataAggregateImpl.js +193 -0
- package/dist/cjs/api/impl/WixDataAggregateImpl.js.map +1 -0
- package/dist/cjs/api/impl/WixDataQueryImpl.js +116 -0
- package/dist/cjs/api/impl/WixDataQueryImpl.js.map +1 -0
- package/dist/cjs/api/impl/WixDataResultImpl.js +111 -0
- package/dist/cjs/api/impl/WixDataResultImpl.js.map +1 -0
- package/dist/cjs/api/index.js +32 -0
- package/dist/cjs/api/index.js.map +1 -0
- package/dist/cjs/api/types.js +2 -0
- package/dist/cjs/api/types.js.map +1 -0
- package/dist/cjs/errors/base-validator.js +92 -0
- package/dist/cjs/errors/base-validator.js.map +1 -0
- package/dist/cjs/errors/errors.js +155 -0
- package/dist/cjs/errors/errors.js.map +1 -0
- package/dist/cjs/errors/index.js +15 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/errors/validations.js +91 -0
- package/dist/cjs/errors/validations.js.map +1 -0
- package/dist/cjs/external-types.d.js +2 -0
- package/dist/cjs/external-types.d.js.map +1 -0
- package/dist/cjs/filter/FilterTree.js +154 -0
- package/dist/cjs/filter/FilterTree.js.map +1 -0
- package/dist/cjs/filter/WithFilter.js +2 -0
- package/dist/cjs/filter/WithFilter.js.map +1 -0
- package/dist/cjs/filter/filterBuilder.js +53 -0
- package/dist/cjs/filter/filterBuilder.js.map +1 -0
- package/dist/cjs/filter/filterMixin.js +144 -0
- package/dist/cjs/filter/filterMixin.js.map +1 -0
- package/dist/cjs/filter/index.js +16 -0
- package/dist/cjs/filter/index.js.map +1 -0
- package/dist/cjs/index.js +120 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/sort/sortMixin.js +79 -0
- package/dist/cjs/sort/sortMixin.js.map +1 -0
- package/dist/cjs/test-types.d.js +2 -0
- package/dist/cjs/test-types.d.js.map +1 -0
- package/dist/cjs/types/api.js +4 -0
- package/dist/cjs/types/api.js.map +1 -0
- package/dist/cjs/types/data-item-types.js +46 -0
- package/dist/cjs/types/data-item-types.js.map +1 -0
- package/dist/cjs/types/error.js +2 -0
- package/dist/cjs/types/error.js.map +1 -0
- package/dist/cjs/types/index.js +16 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/base64url.js +51 -0
- package/dist/cjs/utils/base64url.js.map +1 -0
- package/dist/cjs/utils/clone.js +21 -0
- package/dist/cjs/utils/clone.js.map +1 -0
- package/dist/cjs/utils/codec.js +64 -0
- package/dist/cjs/utils/codec.js.map +1 -0
- package/dist/cjs/utils/field-key-utils.js +18 -0
- package/dist/cjs/utils/field-key-utils.js.map +1 -0
- package/dist/cjs/utils/index.js +25 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/type-utils.js +54 -0
- package/dist/cjs/utils/type-utils.js.map +1 -0
- package/dist/esm/api/ApiClient.js +174 -0
- package/dist/esm/api/ApiClient.js.map +1 -0
- package/dist/esm/api/QueryBase.js +117 -0
- package/dist/esm/api/QueryBase.js.map +1 -0
- package/dist/esm/api/QueryValidator.js +32 -0
- package/dist/esm/api/QueryValidator.js.map +1 -0
- package/dist/esm/api/WixDataAggregate.js +2 -0
- package/dist/esm/api/WixDataAggregate.js.map +1 -0
- package/dist/esm/api/WixDataApi.js +829 -0
- package/dist/esm/api/WixDataApi.js.map +1 -0
- package/dist/esm/api/WixDataFilter.js +2 -0
- package/dist/esm/api/WixDataFilter.js.map +1 -0
- package/dist/esm/api/WixDataPatch.js +134 -0
- package/dist/esm/api/WixDataPatch.js.map +1 -0
- package/dist/esm/api/WixDataQuery.js +2 -0
- package/dist/esm/api/WixDataQuery.js.map +1 -0
- package/dist/esm/api/WixDataResult.js +2 -0
- package/dist/esm/api/WixDataResult.js.map +1 -0
- package/dist/esm/api/common.js +10 -0
- package/dist/esm/api/common.js.map +1 -0
- package/dist/esm/api/errors.js +52 -0
- package/dist/esm/api/errors.js.map +1 -0
- package/dist/esm/api/impl/WixDataAggregateImpl.js +214 -0
- package/dist/esm/api/impl/WixDataAggregateImpl.js.map +1 -0
- package/dist/esm/api/impl/WixDataQueryImpl.js +119 -0
- package/dist/esm/api/impl/WixDataQueryImpl.js.map +1 -0
- package/dist/esm/api/impl/WixDataResultImpl.js +100 -0
- package/dist/esm/api/impl/WixDataResultImpl.js.map +1 -0
- package/dist/esm/api/index.js +5 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/api/types.js +2 -0
- package/dist/esm/api/types.js.map +1 -0
- package/dist/esm/errors/base-validator.js +71 -0
- package/dist/esm/errors/base-validator.js.map +1 -0
- package/dist/esm/errors/errors.js +147 -0
- package/dist/esm/errors/errors.js.map +1 -0
- package/dist/esm/errors/index.js +5 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/errors/validations.js +114 -0
- package/dist/esm/errors/validations.js.map +1 -0
- package/dist/esm/filter/FilterTree.js +148 -0
- package/dist/esm/filter/FilterTree.js.map +1 -0
- package/dist/esm/filter/WithFilter.js +2 -0
- package/dist/esm/filter/WithFilter.js.map +1 -0
- package/dist/esm/filter/filterBuilder.js +43 -0
- package/dist/esm/filter/filterBuilder.js.map +1 -0
- package/dist/esm/filter/filterMixin.js +137 -0
- package/dist/esm/filter/filterMixin.js.map +1 -0
- package/dist/esm/filter/index.js +5 -0
- package/dist/esm/filter/index.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/sort/sortMixin.js +74 -0
- package/dist/esm/sort/sortMixin.js.map +1 -0
- package/dist/esm/types/api.js +2 -0
- package/dist/esm/types/api.js.map +1 -0
- package/dist/esm/types/data-item-types.js +35 -0
- package/dist/esm/types/data-item-types.js.map +1 -0
- package/dist/esm/types/error.js +2 -0
- package/dist/esm/types/error.js.map +1 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/utils/base64url.js +57 -0
- package/dist/esm/utils/base64url.js.map +1 -0
- package/dist/esm/utils/clone.js +18 -0
- package/dist/esm/utils/clone.js.map +1 -0
- package/dist/esm/utils/codec.js +60 -0
- package/dist/esm/utils/codec.js.map +1 -0
- package/dist/esm/utils/field-key-utils.js +14 -0
- package/dist/esm/utils/field-key-utils.js.map +1 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/type-utils.js +40 -0
- package/dist/esm/utils/type-utils.js.map +1 -0
- package/dist/types/api/ApiClient.d.ts +30 -0
- package/dist/types/api/ApiClient.d.ts.map +1 -0
- package/dist/types/api/QueryBase.d.ts +111 -0
- package/dist/types/api/QueryBase.d.ts.map +1 -0
- package/dist/types/api/QueryValidator.d.ts +12 -0
- package/dist/types/api/QueryValidator.d.ts.map +1 -0
- package/dist/types/api/WixDataAggregate.d.ts +320 -0
- package/dist/types/api/WixDataAggregate.d.ts.map +1 -0
- package/dist/types/api/WixDataApi.d.ts +52 -0
- package/dist/types/api/WixDataApi.d.ts.map +1 -0
- package/dist/types/api/WixDataFilter.d.ts +424 -0
- package/dist/types/api/WixDataFilter.d.ts.map +1 -0
- package/dist/types/api/WixDataPatch.d.ts +80 -0
- package/dist/types/api/WixDataPatch.d.ts.map +1 -0
- package/dist/types/api/WixDataQuery.d.ts +702 -0
- package/dist/types/api/WixDataQuery.d.ts.map +1 -0
- package/dist/types/api/WixDataResult.d.ts +144 -0
- package/dist/types/api/WixDataResult.d.ts.map +1 -0
- package/dist/types/api/common.d.ts +3 -0
- package/dist/types/api/common.d.ts.map +1 -0
- package/dist/types/api/errors.d.ts +12 -0
- package/dist/types/api/errors.d.ts.map +1 -0
- package/dist/types/api/impl/WixDataAggregateImpl.d.ts +76 -0
- package/dist/types/api/impl/WixDataAggregateImpl.d.ts.map +1 -0
- package/dist/types/api/impl/WixDataQueryImpl.d.ts +72 -0
- package/dist/types/api/impl/WixDataQueryImpl.d.ts.map +1 -0
- package/dist/types/api/impl/WixDataResultImpl.d.ts +34 -0
- package/dist/types/api/impl/WixDataResultImpl.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +11 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +163 -0
- package/dist/types/api/types.d.ts.map +1 -0
- package/dist/types/errors/base-validator.d.ts +28 -0
- package/dist/types/errors/base-validator.d.ts.map +1 -0
- package/dist/types/errors/errors.d.ts +108 -0
- package/dist/types/errors/errors.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +5 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/errors/validations.d.ts +25 -0
- package/dist/types/errors/validations.d.ts.map +1 -0
- package/dist/types/filter/FilterTree.d.ts +56 -0
- package/dist/types/filter/FilterTree.d.ts.map +1 -0
- package/dist/types/filter/WithFilter.d.ts +470 -0
- package/dist/types/filter/WithFilter.d.ts.map +1 -0
- package/dist/types/filter/filterBuilder.d.ts +105 -0
- package/dist/types/filter/filterBuilder.d.ts.map +1 -0
- package/dist/types/filter/filterMixin.d.ts +61 -0
- package/dist/types/filter/filterMixin.d.ts.map +1 -0
- package/dist/types/filter/index.d.ts +8 -0
- package/dist/types/filter/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/sort/sortMixin.d.ts +46 -0
- package/dist/types/sort/sortMixin.d.ts.map +1 -0
- package/dist/types/types/api.d.ts +36 -0
- package/dist/types/types/api.d.ts.map +1 -0
- package/dist/types/types/data-item-types.d.ts +1448 -0
- package/dist/types/types/data-item-types.d.ts.map +1 -0
- package/dist/types/types/error.d.ts +23 -0
- package/dist/types/types/error.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/base64url.d.ts +2 -0
- package/dist/types/utils/base64url.d.ts.map +1 -0
- package/dist/types/utils/clone.d.ts +2 -0
- package/dist/types/utils/clone.d.ts.map +1 -0
- package/dist/types/utils/codec.d.ts +3 -0
- package/dist/types/utils/codec.d.ts.map +1 -0
- package/dist/types/utils/field-key-utils.d.ts +2 -0
- package/dist/types/utils/field-key-utils.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/type-utils.d.ts +11 -0
- package/dist/types/utils/type-utils.d.ts.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.SortOrder = exports.Environment = exports.BulkActionType = exports.Action = exports.ACTION = void 0;
|
|
5
|
+
let Environment = exports.Environment = /*#__PURE__*/function (Environment) {
|
|
6
|
+
Environment["LIVE"] = "LIVE";
|
|
7
|
+
Environment["SANDBOX"] = "SANDBOX";
|
|
8
|
+
Environment["SANDBOX_PREFERRED"] = "SANDBOX_PREFERRED";
|
|
9
|
+
return Environment;
|
|
10
|
+
}({});
|
|
11
|
+
/** @oneof */
|
|
12
|
+
let ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
13
|
+
ACTION["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
|
|
14
|
+
ACTION["SET_FIELD"] = "SET_FIELD";
|
|
15
|
+
ACTION["REMOVE_FIELD"] = "REMOVE_FIELD";
|
|
16
|
+
ACTION["INCREMENT_FIELD"] = "INCREMENT_FIELD";
|
|
17
|
+
ACTION["APPEND_TO_ARRAY"] = "APPEND_TO_ARRAY";
|
|
18
|
+
ACTION["REMOVE_FROM_ARRAY"] = "REMOVE_FROM_ARRAY";
|
|
19
|
+
return ACTION;
|
|
20
|
+
}({});
|
|
21
|
+
let BulkActionType = exports.BulkActionType = /*#__PURE__*/function (BulkActionType) {
|
|
22
|
+
BulkActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
|
|
23
|
+
BulkActionType["INSERT"] = "INSERT";
|
|
24
|
+
BulkActionType["UPDATE"] = "UPDATE";
|
|
25
|
+
BulkActionType["DELETE"] = "DELETE";
|
|
26
|
+
BulkActionType["PATCH"] = "PATCH";
|
|
27
|
+
return BulkActionType;
|
|
28
|
+
}({});
|
|
29
|
+
let Action = exports.Action = /*#__PURE__*/function (Action) {
|
|
30
|
+
Action["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
|
|
31
|
+
Action["INSERTED"] = "INSERTED";
|
|
32
|
+
Action["UPDATED"] = "UPDATED";
|
|
33
|
+
return Action;
|
|
34
|
+
}({});
|
|
35
|
+
/** @oneof */
|
|
36
|
+
let SortOrder = exports.SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
37
|
+
SortOrder["ASC"] = "ASC";
|
|
38
|
+
SortOrder["DESC"] = "DESC";
|
|
39
|
+
return SortOrder;
|
|
40
|
+
}({});
|
|
41
|
+
/** @oneof */
|
|
42
|
+
/** @oneof */
|
|
43
|
+
/** @oneof */
|
|
44
|
+
/** @oneof */
|
|
45
|
+
/** @oneof */
|
|
46
|
+
//# sourceMappingURL=data-item-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Environment","exports","ACTION","BulkActionType","Action","SortOrder"],"sources":["../../../src/types/data-item-types.ts"],"sourcesContent":["export interface DataItem {\n /** Data item ID. */\n id?: string\n /**\n * ID of the collection this item belongs to\n * @readonly\n */\n dataCollectionId?: string\n /**\n * Data item contents.\n *\n * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:\n *\n * + `_id`: Item ID.\n * + `_createdDate`: Date and time the item was added to the collection.\n * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.\n * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.\n */\n data?: Record<string, any> | null\n}\n\nexport interface InsertDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to insert the item. */\n dataCollectionId: string\n /** Item to insert. */\n dataItem: DataItem\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * If true, referenced items will be included.\n * @internal\n */\n includeReferencedItems?: boolean\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport enum Environment {\n LIVE = 'LIVE',\n SANDBOX = 'SANDBOX',\n SANDBOX_PREFERRED = 'SANDBOX_PREFERRED',\n}\n\nexport interface Options {\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: PublishPluginOptions\n}\n\nexport interface PublishPluginOptions {\n showDraftItems?: boolean\n}\n\nexport interface InsertDataItemResponse {\n /** Inserted data item. */\n dataItem?: DataItem\n}\n\nexport interface PatchDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the existing item. */\n dataCollectionId: string\n /** Patch set applied during item update. */\n patchSet: PatchSet\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface PatchSet {\n /** Data item ID. */\n dataItemId?: string\n /** Set of field updates to be applied */\n fieldUpdates?: FieldUpdate[]\n}\n\nexport interface FieldUpdate extends FieldUpdateActionOptionsOneOf {\n setField?: SetField\n incrementField?: IncrementField\n appendToArray?: AppendToArray\n removeFromArray?: RemoveFromArray\n /** Field key to be patched. For ex \"title\", \"address.street\" */\n fieldPath?: string\n /** Action to be applied */\n action?: ACTION\n}\n\n/** @oneof */\nexport interface FieldUpdateActionOptionsOneOf {\n setField?: SetField\n incrementField?: IncrementField\n appendToArray?: AppendToArray\n removeFromArray?: RemoveFromArray\n}\n\nexport enum ACTION {\n UNKNOWN_ACTION = 'UNKNOWN_ACTION',\n SET_FIELD = 'SET_FIELD',\n REMOVE_FIELD = 'REMOVE_FIELD',\n INCREMENT_FIELD = 'INCREMENT_FIELD',\n APPEND_TO_ARRAY = 'APPEND_TO_ARRAY',\n REMOVE_FROM_ARRAY = 'REMOVE_FROM_ARRAY',\n}\n\nexport interface SetField {\n value?: any\n}\n\nexport interface IncrementField {\n value?: number\n}\n\nexport interface AppendToArray {\n value?: any\n}\n\nexport interface RemoveFromArray {\n value?: any\n}\n\nexport interface DataPublishPluginOptions {\n includeDraftItems?: boolean\n}\n\nexport interface PatchDataItemResponse {\n /** Updated data item. */\n dataItem?: DataItem\n}\n\nexport interface BulkPatchDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to update items. */\n dataCollectionId: string\n /** Patch sets to apply. */\n patchSets: PatchSet[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to return the updated data items.\n * When `true`, the `results` objects contain a `dataItem` field.\n *\n * Default: `false`\n */\n returnEntity?: boolean\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface BulkPatchDataItemsResponse {\n /** Information about the updated items. */\n results?: BulkDataItemResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface BulkDataItemResult {\n /** The action attempted for the data item. */\n action?: BulkActionType\n /** Metadata related to the data item for which the action was attempted. */\n itemMetadata?: ItemMetadata\n /** The data item for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */\n dataItem?: DataItem\n}\n\nexport enum BulkActionType {\n UNKNOWN_ACTION_TYPE = 'UNKNOWN_ACTION_TYPE',\n INSERT = 'INSERT',\n UPDATE = 'UPDATE',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport interface ItemMetadata {\n /** Item ID. This field doesn't appear if there is no item ID, for example, when item creation fails. */\n id?: string | null\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean\n /** Details about the error in case of failure. */\n error?: ApplicationError\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string\n /** Description of the error. */\n description?: string\n /** Data related to the error. */\n data?: Record<string, any> | null\n}\n\nexport interface BulkActionMetadata {\n /** Number of items successfully processed. */\n totalSuccesses?: number\n /** Number of items that couldn't be processed. */\n totalFailures?: number\n}\n\nexport interface UpdateDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the existing item. */\n dataCollectionId: string\n /** Updated data item content. The existing data item's content is replaced entirely. */\n dataItem: DataItem\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * If true, referenced items will be included.\n * @internal\n */\n includeReferencedItems?: boolean\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface UpdateDataItemResponse {\n /** Updated data item. */\n dataItem?: DataItem\n}\n\nexport interface SaveDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to insert or update the item. */\n dataCollectionId: string\n /** Data item to insert or update. */\n dataItem: DataItem\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * If true, referenced items will be included.\n * @internal\n */\n includeReferencedItems?: boolean\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface SaveDataItemResponse {\n /**\n * The action carried out for the item.\n *\n * + `INSERTED`: A new item was added to the collection.\n * + `UPDATED`: An existing item in the collection was updated.\n */\n action?: Action\n /** Inserted or updated data item. */\n dataItem?: DataItem\n}\n\nexport enum Action {\n UNKNOWN_ACTION = 'UNKNOWN_ACTION',\n INSERTED = 'INSERTED',\n UPDATED = 'UPDATED',\n}\n\nexport interface GetDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection from which to retrieve the data item. */\n dataCollectionId: string\n /** ID of the data item to retrieve. */\n dataItemId: string\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /**\n * Fields to return for the item. Only fields specified in the array are included in the response. If the array is empty, all fields are returned.\n * **Note:** The `_id` system field is always returned.\n */\n fields?: string[]\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface GetDataItemResponse {\n /** Retrieved item. */\n dataItem?: DataItem\n}\n\nexport interface RemoveDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection from which to remove the item. */\n dataCollectionId: string\n /** ID of the item to remove. */\n dataItemId: string\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface RemoveDataItemResponse {\n /** Removed item. */\n dataItem?: DataItem\n}\n\nexport interface TruncateDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection to truncate. */\n dataCollectionId: string\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n}\n\nexport interface TruncateDataItemsResponse {}\n\nexport interface QueryDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection to query. */\n dataCollectionId: string\n /** Query preferences. For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). */\n query?: QueryV2\n /**\n * Whether to return the total count in the response for a query with offset paging.\n * When `true`, the `pagingMetadata` object in the response contains a `total` field.\n *\n * Default: `false`\n */\n returnTotalCount?: boolean\n /**\n * Properties for which to include referenced items in the query's results.\n * Up to 50 referenced items can be included for each item that matches the query.\n * @deprecated\n * @replacedBy referenced_item_options\n * @removalDate 2025-08-01\n */\n includeReferencedItems?: string[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /**\n * Request information about this collection caching\n * @internal\n */\n requestCachingInfo?: boolean\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n /** Options for retrieving referenced items. */\n referencedItemOptions?: ReferencedItemOptions[]\n}\n\nexport interface QueryV2 extends QueryV2PagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n /**\n * Filter object in the following format:\n *\n * `\"filter\" : {\n * \"fieldName1\": \"value1\",\n * \"fieldName2\":{\"$operator\":\"value2\"}\n * }`\n *\n * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`\n *\n * **Note:** The values you provide for each field must adhere to that field's type. For example, when filtering by a field whose type is Date and Time, use an object in the following format: `\"someDateAndTimeFieldKey\": { \"$date\": \"YYYY-MM-DDTHH:mm:ss.sssZ\"}`. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/data-types-in-wix-data).\n */\n filter?: Record<string, any> | null\n /**\n * Sort object in the following format:\n * `[{\"fieldName\":\"sortField1\",\"order\":\"ASC\"},{\"fieldName\":\"sortField2\",\"order\":\"DESC\"}]`\n */\n sort?: Sorting[]\n /**\n * Fields to return for each item. Only fields specified in the array are included in the response. If the array is empty, all fields are returned.\n * **Note:** The `_id` system field is always returned.\n */\n fields?: string[]\n}\n\n/** @oneof */\nexport interface QueryV2PagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n}\n\nexport interface Sorting {\n /** Name of the field to sort by. */\n fieldName?: string\n /** Sort order. */\n order?: SortOrder\n}\n\nexport enum SortOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface Paging {\n /** Number of items to load. */\n limit?: number | null\n /** Number of items to skip in the current sort order. */\n offset?: number | null\n}\n\nexport interface CursorPaging {\n /** Number of items to load. */\n limit?: number | null\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * You can get the relevant cursor token\n * from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n */\n cursor?: string | null\n}\n\nexport interface ReferencedItemOptions {\n /** Field containing references in the queried item. */\n fieldName?: string\n /** Maximum number of referenced items to include for each queried item. */\n limit?: number | null\n}\n\nexport interface QueryDataItemsResponse {\n /** Retrieved items. */\n dataItems?: DataItem[]\n /**\n * Caching info, returned if `request_caching_info` is set and caching is allowed\n * @internal\n */\n cachingInfo?: CachingInfo\n /** Paging information. */\n pagingMetadata?: PagingMetadataV2\n}\n\nexport interface CachingInfo {\n /** Caching tags for this collection */\n tags?: string[]\n /** max caching time if set */\n maxAge?: number | null\n}\n\nexport interface PagingMetadataV2 {\n /** Number of items returned in the response. */\n count?: number | null\n /** Offset that was requested. */\n offset?: number | null\n /** Total number of items that match the query. Returned if offset paging is used, `returnTotalCount` is `true` in the request, and `tooManyToCount` is false. */\n total?: number | null\n /** Whether the server failed to calculate the `total` field. */\n tooManyToCount?: boolean | null\n /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */\n cursors?: Cursors\n /**\n * Indicates if there are more results after the current page.\n * If `true`, another page of results can be retrieved.\n * If `false`, this is the last page.\n * @internal\n */\n hasNext?: boolean | null\n}\n\nexport interface Cursors {\n /** Cursor pointing to next page in the list of results. */\n next?: string | null\n /** Cursor pointing to previous page in the list of results. */\n prev?: string | null\n}\n\nexport interface AggregateDataItemsRequest\n extends AggregateDataItemsRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection on which to run the aggregation. */\n dataCollectionId: string\n /**\n * Filter applied to the collection's data prior to running the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object.\n *\n * **Note:** The values you provide for each filter field must adhere to that field's type. For example, when filtering by a field whose type is Date and Time, use an object in the following format: `\"someDateAndTimeFieldKey\": { \"$date\": \"YYYY-MM-DDTHH:mm:ss.sssZ\"}`. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/data-types-in-wix-data).\n */\n initialFilter?: Record<string, any> | null\n /** Aggregation applied to the data. */\n aggregation?: Aggregation\n /**\n * Filter applied to the processed data following the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object.\n * **Note:** The values you provide for each filter field must adhere to that field's type. For example, when filtering by a field whose type is Date and Time, use an object in the following format: `\"someDateAndTimeFieldKey\": { \"$date\": \"YYYY-MM-DDTHH:mm:ss.sssZ\"}`. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/data-types-in-wix-data).\n */\n finalFilter?: Record<string, any> | null\n /**\n * Sort object in the following format:\n * `[{\"fieldName\":\"sortField1\",\"order\":\"ASC\"},{\"fieldName\":\"sortField2\",\"order\":\"DESC\"}]`\n */\n sort?: Sorting[]\n /**\n * Whether to return the total count in the response for a query with offset paging.\n * When `true`, the `pagingMetadata` object in the response contains a `total` field.\n *\n * Default: `false`\n */\n returnTotalCount?: boolean\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\n/** @oneof */\nexport interface AggregateDataItemsRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n}\n\nexport interface Average {\n /** Name of the field for which to calculate the average value. */\n itemFieldName?: string\n}\n\nexport interface Min {\n /** Name of the field for which to calculate the minimum value. */\n itemFieldName?: string\n}\n\nexport interface Max {\n /** Name of the field for which to calculate the maximum value. */\n itemFieldName?: string\n}\n\nexport interface Sum {\n /** Name of the field for which to calculate the sum. */\n itemFieldName?: string\n}\n\nexport interface Count {}\n\nexport interface Operation extends OperationCalculateOneOf {\n /** Calculate the average value of a specified field for all items in the grouping. */\n average?: Average\n /** Calculate the minimum value of a specified field for all items in the grouping. */\n min?: Min\n /** Calculate the maximum value of a specified field for all items in the grouping. */\n max?: Max\n /** Calculate the sum of values of a specified field for all items in the grouping. */\n sum?: Sum\n /** Calculate the number of items in the grouping. */\n itemCount?: Count\n /** Name of the field containing results of the operation. */\n resultFieldName?: string\n}\n\n/** @oneof */\nexport interface OperationCalculateOneOf {\n /** Calculate the average value of a specified field for all items in the grouping. */\n average?: Average\n /** Calculate the minimum value of a specified field for all items in the grouping. */\n min?: Min\n /** Calculate the maximum value of a specified field for all items in the grouping. */\n max?: Max\n /** Calculate the sum of values of a specified field for all items in the grouping. */\n sum?: Sum\n /** Calculate the number of items in the grouping. */\n itemCount?: Count\n}\n\nexport interface Aggregation {\n /** Fields by which to group items for the aggregation. If empty, the aggregation is carried out on all items in the collection. */\n groupingFields?: string[]\n /** Operations to carry out on the data in each grouping. */\n operations?: Operation[]\n}\n\nexport interface AggregateDataItemsResponse {\n /** Aggregation results. */\n results?: Record<string, any>[] | null\n /** Paging information. */\n pagingMetadata?: PagingMetadataV2\n}\n\nexport interface CountDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection for which to count query results. */\n dataCollectionId: string\n /**\n * Filter object in the following format:\n *\n * `\"filter\" : {\n * \"fieldName1\": \"value1\",\n * \"fieldName2\":{\"$operator\":\"value2\"}\n * }`.\n *\n * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.\n *\n * **Note:** The values you provide for each field must adhere to that field's type. For example, when filtering by a field whose type is Date and Time, use an object in the following format: `\"someDateAndTimeFieldKey\": { \"$date\": \"YYYY-MM-DDTHH:mm:ss.sssZ\"}`. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/data-types-in-wix-data).\n */\n filter?: Record<string, any> | null\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface CountDataItemsResponse {\n /** Number of items matching the query. */\n totalCount?: number\n}\n\nexport interface QueryDistinctValuesRequest\n extends QueryDistinctValuesRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection to query. */\n dataCollectionId: string\n /** Item field name for which to return all distinct values. */\n fieldName?: string\n /**\n * Filter object in the following format:\n *\n * `\"filter\" : {\n * \"fieldName1\": \"value1\",\n * \"fieldName2\":{\"$operator\":\"value2\"}\n * }`.\n *\n * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.\n *\n * **Note:** The values you provide for each field must adhere to that field's type. For example, when filtering by a field whose type is Date and Time, use an object in the following format: `\"someDateAndTimeFieldKey\": { \"$date\": \"YYYY-MM-DDTHH:mm:ss.sssZ\"}`. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/data-types-in-wix-data).\n */\n filter?: Record<string, any> | null\n /** Sort order. */\n order?: SortOrder\n /**\n * Whether to return the total count in the response for a query with offset paging.\n * When `true`, the `pagingMetadata` object in the response contains a `total` field.\n *\n * Default: `false`\n */\n returnTotalCount?: boolean\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\n/** @oneof */\nexport interface QueryDistinctValuesRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n}\n\nexport interface QueryDistinctValuesResponse {\n /** List of distinct values contained in the field specified in `fieldName`. */\n distinctValues?: any[]\n /** Paging information. */\n pagingMetadata?: PagingMetadataV2\n}\n\nexport interface BulkInsertDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to insert the items. */\n dataCollectionId: string\n /** Data items to insert. */\n dataItems: DataItem[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options.\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to return the inserted data items.\n * When `true`, the `results` objects contain a `dataItem` field.\n *\n * Default: `false`\n */\n returnEntity?: boolean\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface BulkInsertDataItemsResponse {\n /** Information about the inserted items. */\n results?: BulkDataItemResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface BulkUpdateDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to update items. */\n dataCollectionId: string\n /** Data items to update. */\n dataItems: DataItem[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to return the updated data items.\n * When `true`, the `results` objects contain a `dataItem` field.\n *\n * Default: `false`\n */\n returnEntity?: boolean\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface BulkUpdateDataItemsResponse {\n /** Information about the updated items. */\n results?: BulkDataItemResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface BulkSaveDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to insert or update the items. */\n dataCollectionId: string\n /** Data items to insert or update. */\n dataItems: DataItem[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to return the saved data item.\n * When `true`, the `results` objects contain a `dataItem` field.\n *\n * Default: `false`\n */\n returnEntity?: boolean\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface BulkSaveDataItemsResponse {\n /** Information about the saved items. */\n results?: BulkDataItemResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface BulkRemoveDataItemsRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection from which to remove the item. */\n dataCollectionId: string\n /** IDs of data items to remove. */\n dataItemIds: string[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Should hooks execution be suppressed.\n * This option can only be used with Corvid backend\n * code identity.\n * @internal\n */\n suppressHooks?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\nexport interface BulkRemoveDataItemsResponse {\n /** Information about the removed data items. */\n results?: BulkDataItemResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface QueryReferencedDataItemsRequest\n extends QueryReferencedDataItemsRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring item. */\n dataCollectionId: string\n /** ID of the referring item. */\n referringItemId?: string\n /** Field containing references in the referring item. */\n referringItemFieldName?: string\n /** Order of the returned referenced items. Sorted by the date each item was referenced. */\n order?: SortOrder\n /**\n * Whether to return the total count in the response.\n * When `true`, the `pagingMetadata` object in the response contains a `total` field.\n *\n * Default: `false`\n */\n returnTotalCount?: boolean\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /**\n * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.\n * If provided, the result text is returned in the specified language.\n * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).\n *\n * If not provided, result text is not translated.\n */\n language?: string | null\n /**\n * Fields to return for each referenced item. Only fields specified in the array are included in the response. If the array is empty, all fields are returned.\n * **Note:** The `_id` system field is always returned.\n */\n fields?: string[]\n /** @internal */\n appOptions?: Record<string, any> | null\n /** @internal */\n publishPluginOptions?: DataPublishPluginOptions\n}\n\n/** @oneof */\nexport interface QueryReferencedDataItemsRequestPagingMethodOneOf {\n /** Paging options to limit and skip the number of items. */\n paging?: Paging\n /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */\n cursorPaging?: CursorPaging\n}\n\nexport interface QueryReferencedDataItemsResponse {\n /** Referenced items and/or IDs. For successfully resolved references, the referenced data item is returned. For references that can't be resolved, the ID is returned. */\n results?: ReferencedResult[]\n /** Paging information. */\n pagingMetadata?: PagingMetadataV2\n}\n\nexport interface UnresolvedReference {\n /** ID of the referring item. */\n referringItemId?: string\n /** Field specified to query for references. */\n referringItemFieldName?: string\n}\n\nexport interface ReferencedResult extends ReferencedResultEntityOneOf {\n /** Data item referenced. */\n dataItem?: DataItem\n /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */\n unresolvedReference?: UnresolvedReference\n}\n\n/** @oneof */\nexport interface ReferencedResultEntityOneOf {\n /** Data item referenced. */\n dataItem?: DataItem\n /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */\n unresolvedReference?: UnresolvedReference\n}\n\nexport interface IsReferencedDataItemRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring data item. */\n dataCollectionId: string\n /** Field to check for a reference to the item that may be referenced. */\n referringItemFieldName: string\n /** ID of the referring item. */\n referringItemId: string\n /** ID of the item that may be referenced. */\n referencedItemId: string\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to retrieve data from the primary database instance.\n * This decreases performance but ensures data retrieved is up to date even immediately after an update.\n * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).\n *\n * Default: `false`\n */\n consistentRead?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface IsReferencedDataItemResponse {\n /** Whether the specified reference exists. */\n isReferenced?: boolean\n}\n\nexport interface InsertDataItemReferenceRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection in which to insert the reference. */\n dataCollectionId: string\n /** Reference to insert */\n dataItemReference?: DataItemReference\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface DataItemReference {\n /** Referring item field containing the references to the referenced items. */\n referringItemFieldName?: string\n /** ID of the referring item. */\n referringItemId?: string\n /** ID of the referenced item. */\n referencedItemId?: string\n}\n\nexport interface InsertDataItemReferenceResponse {\n /** Inserted reference. */\n dataItemReference?: DataItemReference\n}\n\nexport interface RemoveDataItemReferenceRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring item. */\n dataCollectionId: string\n /** Reference to remove. */\n dataItemReference: DataItemReference\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface RemoveDataItemReferenceResponse {\n /** Removed reference. */\n dataItemReference?: DataItemReference\n}\n\nexport interface BulkInsertDataItemReferencesRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring items. */\n dataCollectionId: string\n /** References to insert. */\n dataItemReferences: DataItemReference[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /**\n * Whether to return the inserted data item references.\n * When `true`, the `results` objects contain a `dataItemReference` field.\n *\n * Default: `false`\n */\n returnEntity?: boolean\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface BulkInsertDataItemReferencesResponse {\n /** Information about the inserted references. */\n results?: BulkDataItemReferenceResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface BulkDataItemReferenceResult {\n /** The action attempted for the reference. */\n action?: BulkActionType\n /** Metadata related to the reference for which the action was attempted. */\n referenceMetadata?: ItemMetadata\n /** The reference for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */\n dataItemReference?: DataItemReference\n}\n\nexport interface BulkRemoveDataItemReferencesRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring items. */\n dataCollectionId: string\n /** References to remove. */\n dataItemReferences: DataItemReference[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface BulkRemoveDataItemReferencesResponse {\n /** Information about the removed references. */\n results?: BulkDataItemReferenceResult[]\n /** Bulk action metadata. */\n bulkActionMetadata?: BulkActionMetadata\n}\n\nexport interface ReplaceDataItemReferencesRequest {\n /**\n * Environment: LIVE or SANDBOX\n * @internal\n */\n environment?: Environment\n /** ID of the collection containing the referring item. */\n dataCollectionId: string\n /** Field containing references in the referring item. */\n referringItemFieldName: string\n /** ID of the referring item. */\n referringItemId: string\n /** List of new referenced item IDs to replace the existing ones. */\n newReferencedItemIds?: string[]\n /**\n * Grid app id. Optional in Live segment.\n * @internal\n */\n appId?: string | null\n /**\n * Data access options\n * @internal\n * @deprecated\n * @replacedBy inlined\n * @removalDate 2024-07-12\n */\n options?: Options\n /** @internal */\n appOptions?: Record<string, any> | null\n}\n\nexport interface ReplaceDataItemReferencesResponse {\n /** Updated references. */\n dataItemReferences?: DataItemReference[]\n}\n"],"mappings":";;;;IA4DYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAmFvB;AAAA,IAQYE,MAAM,GAAAD,OAAA,CAAAC,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IA6FNC,cAAc,GAAAF,OAAA,CAAAE,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IAsIdC,MAAM,GAAAH,OAAA,CAAAG,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AA8OlB;AAAA,IAeYC,SAAS,GAAAJ,OAAA,CAAAI,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAuJrB;AA6CA;AAsKA;AAgRA;AA6BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/error.ts"],"sourcesContent":["export interface ServerError {\n message?: string\n details?: Details\n}\n\nexport interface Details {\n applicationError?: ApplicationError\n validationError?: ValidationError\n}\nexport interface ApplicationError {\n code?: string\n description?: string\n data?: { [key: string]: any }\n}\n\nexport interface FieldViolation {\n field?: string\n description?: string\n}\n\nexport interface ValidationError {\n fieldViolations?: FieldViolation[]\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _api = require("./api");
|
|
5
|
+
Object.keys(_api).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _api[key]) return;
|
|
8
|
+
exports[key] = _api[key];
|
|
9
|
+
});
|
|
10
|
+
var _dataItemTypes = require("./data-item-types");
|
|
11
|
+
Object.keys(_dataItemTypes).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _dataItemTypes[key]) return;
|
|
14
|
+
exports[key] = _dataItemTypes[key];
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_api","require","Object","keys","forEach","key","exports","_dataItemTypes"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export * from './api'\nexport type { HttpApiClientFactory, RequestInterceptor } from './api'\nexport * from './data-item-types'\n"],"mappings":";;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,IAAA,CAAAK,GAAA;AAAA;AAEA,IAAAE,cAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,cAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAE,cAAA,CAAAF,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAE,cAAA,CAAAF,GAAA;AAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = base64url;
|
|
5
|
+
/* eslint-disable no-control-regex */
|
|
6
|
+
|
|
7
|
+
function base64url(data) {
|
|
8
|
+
if (typeof data !== 'string') {
|
|
9
|
+
data = JSON.stringify(data);
|
|
10
|
+
}
|
|
11
|
+
return toBase64(data).replace(/[+/]/g, c => subst[c]).replace(/={1,3}$/, '');
|
|
12
|
+
}
|
|
13
|
+
function toBase64(str) {
|
|
14
|
+
if (isBtoaPatched()) {
|
|
15
|
+
return btoa(str);
|
|
16
|
+
}
|
|
17
|
+
return btoa(toBinary(str));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Importing certain packages in Velo (for example 'wix-bookings-backend')
|
|
21
|
+
// patches btoa.
|
|
22
|
+
// https://wix.slack.com/archives/CA5PUAXL5/p1718090111259899
|
|
23
|
+
function isBtoaPatched() {
|
|
24
|
+
try {
|
|
25
|
+
return btoa('🦄') === '8J+mhA==';
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const subst = {
|
|
31
|
+
'+': '-',
|
|
32
|
+
'/': '_'
|
|
33
|
+
};
|
|
34
|
+
function toBinary(s) {
|
|
35
|
+
if (typeof TextEncoder === 'function') {
|
|
36
|
+
const bytes = new TextEncoder().encode(s);
|
|
37
|
+
return Array.from(bytes, byte => String.fromCodePoint(byte)).join('');
|
|
38
|
+
}
|
|
39
|
+
return s.replace(nonAsciiRegex, toBytes);
|
|
40
|
+
}
|
|
41
|
+
const nonAsciiRegex = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
42
|
+
const fromCode = code => String.fromCharCode(code);
|
|
43
|
+
function toBytes(c) {
|
|
44
|
+
if (c.length < 2) {
|
|
45
|
+
const cc = c.charCodeAt(0);
|
|
46
|
+
return cc < 0x80 ? c : cc < 0x800 ? fromCode(0xc0 | cc >>> 6) + fromCode(0x80 | cc & 0x3f) : fromCode(0xe0 | cc >>> 12 & 0x0f) + fromCode(0x80 | cc >>> 6 & 0x3f) + fromCode(0x80 | cc & 0x3f);
|
|
47
|
+
}
|
|
48
|
+
const cc = 0x10000 + (c.charCodeAt(0) - 0xd800) * 0x400 + (c.charCodeAt(1) - 0xdc00);
|
|
49
|
+
return fromCode(0xf0 | cc >>> 18 & 0x07) + fromCode(0x80 | cc >>> 12 & 0x3f) + fromCode(0x80 | cc >>> 6 & 0x3f) + fromCode(0x80 | cc & 0x3f);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=base64url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["base64url","data","JSON","stringify","toBase64","replace","c","subst","str","isBtoaPatched","btoa","toBinary","e","s","TextEncoder","bytes","encode","Array","from","byte","String","fromCodePoint","join","nonAsciiRegex","toBytes","fromCode","code","fromCharCode","length","cc","charCodeAt"],"sources":["../../../src/utils/base64url.ts"],"sourcesContent":["/* eslint-disable no-control-regex */\n\nexport default function base64url(data: any): string {\n if (typeof data !== 'string') {\n data = JSON.stringify(data)\n }\n\n return toBase64(data)\n .replace(/[+/]/g, (c) => subst[c])\n .replace(/={1,3}$/, '')\n}\n\nfunction toBase64(str: string): string {\n if (isBtoaPatched()) {\n return btoa(str)\n }\n return btoa(toBinary(str))\n}\n\n// Importing certain packages in Velo (for example 'wix-bookings-backend')\n// patches btoa.\n// https://wix.slack.com/archives/CA5PUAXL5/p1718090111259899\nfunction isBtoaPatched() {\n try {\n return btoa('🦄') === '8J+mhA=='\n } catch (e) {\n return false\n }\n}\n\nconst subst: Record<string, string> = {\n '+': '-',\n '/': '_',\n}\n\nfunction toBinary(s: string) {\n if (typeof TextEncoder === 'function') {\n const bytes = new TextEncoder().encode(s)\n return Array.from(bytes, (byte) => String.fromCodePoint(byte)).join('')\n }\n\n return s.replace(nonAsciiRegex, toBytes)\n}\n\nconst nonAsciiRegex = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFFF]|[^\\x00-\\x7F]/g\n\nconst fromCode = (code: number) => String.fromCharCode(code)\n\nfunction toBytes(c: string) {\n if (c.length < 2) {\n const cc = c.charCodeAt(0)\n return cc < 0x80\n ? c\n : cc < 0x800\n ? fromCode(0xc0 | (cc >>> 6)) + fromCode(0x80 | (cc & 0x3f))\n : fromCode(0xe0 | ((cc >>> 12) & 0x0f)) +\n fromCode(0x80 | ((cc >>> 6) & 0x3f)) +\n fromCode(0x80 | (cc & 0x3f))\n }\n const cc =\n 0x10000 + (c.charCodeAt(0) - 0xd800) * 0x400 + (c.charCodeAt(1) - 0xdc00)\n return (\n fromCode(0xf0 | ((cc >>> 18) & 0x07)) +\n fromCode(0x80 | ((cc >>> 12) & 0x3f)) +\n fromCode(0x80 | ((cc >>> 6) & 0x3f)) +\n fromCode(0x80 | (cc & 0x3f))\n )\n}\n"],"mappings":";;;;AAAA;;AAEe,SAASA,SAASA,CAACC,IAAS,EAAU;EACnD,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5BA,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;EAC7B;EAEA,OAAOG,QAAQ,CAACH,IAAI,CAAC,CAClBI,OAAO,CAAC,OAAO,EAAGC,CAAC,IAAKC,KAAK,CAACD,CAAC,CAAC,CAAC,CACjCD,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;AAC3B;AAEA,SAASD,QAAQA,CAACI,GAAW,EAAU;EACrC,IAAIC,aAAa,CAAC,CAAC,EAAE;IACnB,OAAOC,IAAI,CAACF,GAAG,CAAC;EAClB;EACA,OAAOE,IAAI,CAACC,QAAQ,CAACH,GAAG,CAAC,CAAC;AAC5B;;AAEA;AACA;AACA;AACA,SAASC,aAAaA,CAAA,EAAG;EACvB,IAAI;IACF,OAAOC,IAAI,CAAC,IAAI,CAAC,KAAK,UAAU;EAClC,CAAC,CAAC,OAAOE,CAAC,EAAE;IACV,OAAO,KAAK;EACd;AACF;AAEA,MAAML,KAA6B,GAAG;EACpC,GAAG,EAAE,GAAG;EACR,GAAG,EAAE;AACP,CAAC;AAED,SAASI,QAAQA,CAACE,CAAS,EAAE;EAC3B,IAAI,OAAOC,WAAW,KAAK,UAAU,EAAE;IACrC,MAAMC,KAAK,GAAG,IAAID,WAAW,CAAC,CAAC,CAACE,MAAM,CAACH,CAAC,CAAC;IACzC,OAAOI,KAAK,CAACC,IAAI,CAACH,KAAK,EAAGI,IAAI,IAAKC,MAAM,CAACC,aAAa,CAACF,IAAI,CAAC,CAAC,CAACG,IAAI,CAAC,EAAE,CAAC;EACzE;EAEA,OAAOT,CAAC,CAACR,OAAO,CAACkB,aAAa,EAAEC,OAAO,CAAC;AAC1C;AAEA,MAAMD,aAAa,GAAG,+CAA+C;AAErE,MAAME,QAAQ,GAAIC,IAAY,IAAKN,MAAM,CAACO,YAAY,CAACD,IAAI,CAAC;AAE5D,SAASF,OAAOA,CAAClB,CAAS,EAAE;EAC1B,IAAIA,CAAC,CAACsB,MAAM,GAAG,CAAC,EAAE;IAChB,MAAMC,EAAE,GAAGvB,CAAC,CAACwB,UAAU,CAAC,CAAC,CAAC;IAC1B,OAAOD,EAAE,GAAG,IAAI,GACZvB,CAAC,GACDuB,EAAE,GAAG,KAAK,GACVJ,QAAQ,CAAC,IAAI,GAAII,EAAE,KAAK,CAAE,CAAC,GAAGJ,QAAQ,CAAC,IAAI,GAAII,EAAE,GAAG,IAAK,CAAC,GAC1DJ,QAAQ,CAAC,IAAI,GAAKI,EAAE,KAAK,EAAE,GAAI,IAAK,CAAC,GACrCJ,QAAQ,CAAC,IAAI,GAAKI,EAAE,KAAK,CAAC,GAAI,IAAK,CAAC,GACpCJ,QAAQ,CAAC,IAAI,GAAII,EAAE,GAAG,IAAK,CAAC;EAClC;EACA,MAAMA,EAAE,GACN,OAAO,GAAG,CAACvB,CAAC,CAACwB,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,IAAIxB,CAAC,CAACwB,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;EAC3E,OACEL,QAAQ,CAAC,IAAI,GAAKI,EAAE,KAAK,EAAE,GAAI,IAAK,CAAC,GACrCJ,QAAQ,CAAC,IAAI,GAAKI,EAAE,KAAK,EAAE,GAAI,IAAK,CAAC,GACrCJ,QAAQ,CAAC,IAAI,GAAKI,EAAE,KAAK,CAAC,GAAI,IAAK,CAAC,GACpCJ,QAAQ,CAAC,IAAI,GAAII,EAAE,GAAG,IAAK,CAAC;AAEhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.clone = clone;
|
|
5
|
+
var _typeUtils = require("./type-utils");
|
|
6
|
+
function clone(obj) {
|
|
7
|
+
if (obj == null || typeof obj !== 'object') {
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
let temp = null;
|
|
11
|
+
if ((0, _typeUtils.isDate)(obj)) {
|
|
12
|
+
temp = new Date(obj.getTime());
|
|
13
|
+
} else {
|
|
14
|
+
temp = obj.constructor();
|
|
15
|
+
for (const key in obj) {
|
|
16
|
+
temp[key] = clone(obj[key]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return temp;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_typeUtils","require","clone","obj","temp","isDate","Date","getTime","constructor","key"],"sources":["../../../src/utils/clone.ts"],"sourcesContent":["import { isDate } from './type-utils'\n\nexport function clone(obj: any) {\n if (obj == null || typeof obj !== 'object') {\n return obj\n }\n\n let temp: any = null\n\n if (isDate(obj)) {\n temp = new Date(obj.getTime())\n } else {\n temp = obj.constructor()\n for (const key in obj) {\n temp[key] = clone(obj[key])\n }\n }\n\n return temp\n}\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,SAASC,KAAKA,CAACC,GAAQ,EAAE;EAC9B,IAAIA,GAAG,IAAI,IAAI,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC1C,OAAOA,GAAG;EACZ;EAEA,IAAIC,IAAS,GAAG,IAAI;EAEpB,IAAI,IAAAC,iBAAM,EAACF,GAAG,CAAC,EAAE;IACfC,IAAI,GAAG,IAAIE,IAAI,CAACH,GAAG,CAACI,OAAO,CAAC,CAAC,CAAC;EAChC,CAAC,MAAM;IACLH,IAAI,GAAGD,GAAG,CAACK,WAAW,CAAC,CAAC;IACxB,KAAK,MAAMC,GAAG,IAAIN,GAAG,EAAE;MACrBC,IAAI,CAACK,GAAG,CAAC,GAAGP,KAAK,CAACC,GAAG,CAACM,GAAG,CAAC,CAAC;IAC7B;EACF;EAEA,OAAOL,IAAI;AACb"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.decode = decode;
|
|
5
|
+
exports.encode = encode;
|
|
6
|
+
function encode(value) {
|
|
7
|
+
return serializeDates(value);
|
|
8
|
+
}
|
|
9
|
+
function decode(value) {
|
|
10
|
+
return parseDates(value);
|
|
11
|
+
}
|
|
12
|
+
function serializeDates(json) {
|
|
13
|
+
if (typeof json !== 'object' || isDate(json)) {
|
|
14
|
+
return json;
|
|
15
|
+
}
|
|
16
|
+
const obj = copyRoot(json);
|
|
17
|
+
for (const k in obj) {
|
|
18
|
+
const value = obj[k];
|
|
19
|
+
if (value && isDate(value)) {
|
|
20
|
+
obj[k] = stringifyDate(value);
|
|
21
|
+
} else if (typeof obj[k] === 'object' && obj[k] !== null) {
|
|
22
|
+
obj[k] = serializeDates(obj[k]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function isDate(obj) {
|
|
28
|
+
if (Object.prototype.toString.call(obj) !== '[object Date]') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return !isNaN(obj.getTime());
|
|
32
|
+
}
|
|
33
|
+
function isDateString(value) {
|
|
34
|
+
return isNaN(value) && !isNaN(new Date(value).getDate());
|
|
35
|
+
}
|
|
36
|
+
function parseDates(json) {
|
|
37
|
+
if (typeof json !== 'object' || isDate(json)) {
|
|
38
|
+
return json;
|
|
39
|
+
}
|
|
40
|
+
const obj = copyRoot(json);
|
|
41
|
+
for (const k in obj) {
|
|
42
|
+
if (obj[k] && obj[k].$date && isDateString(obj[k].$date)) {
|
|
43
|
+
obj[k] = new Date(obj[k].$date);
|
|
44
|
+
} else if (typeof obj[k] === 'object' && obj[k] !== null) {
|
|
45
|
+
obj[k] = parseDates(obj[k]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
function stringifyDate(d) {
|
|
51
|
+
return {
|
|
52
|
+
$date: d.toJSON()
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function copyRoot(obj) {
|
|
56
|
+
if (Array.isArray(obj)) {
|
|
57
|
+
return [...obj];
|
|
58
|
+
} else {
|
|
59
|
+
return {
|
|
60
|
+
...obj
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["encode","value","serializeDates","decode","parseDates","json","isDate","obj","copyRoot","k","stringifyDate","Object","prototype","toString","call","isNaN","getTime","isDateString","Date","getDate","$date","d","toJSON","Array","isArray"],"sources":["../../../src/utils/codec.ts"],"sourcesContent":["export function encode(value: any): any {\n return serializeDates(value)\n}\n\nexport function decode(value: any): any {\n return parseDates(value)\n}\n\nfunction serializeDates(json: any) {\n if (typeof json !== 'object' || isDate(json)) {\n return json\n }\n\n const obj = copyRoot(json)\n for (const k in obj) {\n const value = obj[k]\n if (value && isDate(value)) {\n obj[k] = stringifyDate(value)\n } else if (typeof obj[k] === 'object' && obj[k] !== null) {\n obj[k] = serializeDates(obj[k])\n }\n }\n return obj\n}\n\nfunction isDate(obj: object): obj is Date {\n if (Object.prototype.toString.call(obj) !== '[object Date]') {\n return false\n }\n return !isNaN((obj as Date).getTime())\n}\n\nfunction isDateString(value: any) {\n return isNaN(value) && !isNaN(new Date(value).getDate())\n}\n\nfunction parseDates(json: any) {\n if (typeof json !== 'object' || isDate(json)) {\n return json\n }\n\n const obj = copyRoot(json)\n for (const k in obj) {\n if (obj[k] && obj[k].$date && isDateString(obj[k].$date)) {\n obj[k] = new Date(obj[k].$date)\n } else if (typeof obj[k] === 'object' && obj[k] !== null) {\n obj[k] = parseDates(obj[k])\n }\n }\n return obj\n}\n\nfunction stringifyDate(d: Date) {\n return {\n $date: d.toJSON(),\n }\n}\n\nfunction copyRoot(obj: any) {\n if (Array.isArray(obj)) {\n return [...obj]\n } else {\n return { ...obj }\n }\n}\n"],"mappings":";;;;;AAAO,SAASA,MAAMA,CAACC,KAAU,EAAO;EACtC,OAAOC,cAAc,CAACD,KAAK,CAAC;AAC9B;AAEO,SAASE,MAAMA,CAACF,KAAU,EAAO;EACtC,OAAOG,UAAU,CAACH,KAAK,CAAC;AAC1B;AAEA,SAASC,cAAcA,CAACG,IAAS,EAAE;EACjC,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIC,MAAM,CAACD,IAAI,CAAC,EAAE;IAC5C,OAAOA,IAAI;EACb;EAEA,MAAME,GAAG,GAAGC,QAAQ,CAACH,IAAI,CAAC;EAC1B,KAAK,MAAMI,CAAC,IAAIF,GAAG,EAAE;IACnB,MAAMN,KAAK,GAAGM,GAAG,CAACE,CAAC,CAAC;IACpB,IAAIR,KAAK,IAAIK,MAAM,CAACL,KAAK,CAAC,EAAE;MAC1BM,GAAG,CAACE,CAAC,CAAC,GAAGC,aAAa,CAACT,KAAK,CAAC;IAC/B,CAAC,MAAM,IAAI,OAAOM,GAAG,CAACE,CAAC,CAAC,KAAK,QAAQ,IAAIF,GAAG,CAACE,CAAC,CAAC,KAAK,IAAI,EAAE;MACxDF,GAAG,CAACE,CAAC,CAAC,GAAGP,cAAc,CAACK,GAAG,CAACE,CAAC,CAAC,CAAC;IACjC;EACF;EACA,OAAOF,GAAG;AACZ;AAEA,SAASD,MAAMA,CAACC,GAAW,EAAe;EACxC,IAAII,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACP,GAAG,CAAC,KAAK,eAAe,EAAE;IAC3D,OAAO,KAAK;EACd;EACA,OAAO,CAACQ,KAAK,CAAER,GAAG,CAAUS,OAAO,CAAC,CAAC,CAAC;AACxC;AAEA,SAASC,YAAYA,CAAChB,KAAU,EAAE;EAChC,OAAOc,KAAK,CAACd,KAAK,CAAC,IAAI,CAACc,KAAK,CAAC,IAAIG,IAAI,CAACjB,KAAK,CAAC,CAACkB,OAAO,CAAC,CAAC,CAAC;AAC1D;AAEA,SAASf,UAAUA,CAACC,IAAS,EAAE;EAC7B,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIC,MAAM,CAACD,IAAI,CAAC,EAAE;IAC5C,OAAOA,IAAI;EACb;EAEA,MAAME,GAAG,GAAGC,QAAQ,CAACH,IAAI,CAAC;EAC1B,KAAK,MAAMI,CAAC,IAAIF,GAAG,EAAE;IACnB,IAAIA,GAAG,CAACE,CAAC,CAAC,IAAIF,GAAG,CAACE,CAAC,CAAC,CAACW,KAAK,IAAIH,YAAY,CAACV,GAAG,CAACE,CAAC,CAAC,CAACW,KAAK,CAAC,EAAE;MACxDb,GAAG,CAACE,CAAC,CAAC,GAAG,IAAIS,IAAI,CAACX,GAAG,CAACE,CAAC,CAAC,CAACW,KAAK,CAAC;IACjC,CAAC,MAAM,IAAI,OAAOb,GAAG,CAACE,CAAC,CAAC,KAAK,QAAQ,IAAIF,GAAG,CAACE,CAAC,CAAC,KAAK,IAAI,EAAE;MACxDF,GAAG,CAACE,CAAC,CAAC,GAAGL,UAAU,CAACG,GAAG,CAACE,CAAC,CAAC,CAAC;IAC7B;EACF;EACA,OAAOF,GAAG;AACZ;AAEA,SAASG,aAAaA,CAACW,CAAO,EAAE;EAC9B,OAAO;IACLD,KAAK,EAAEC,CAAC,CAACC,MAAM,CAAC;EAClB,CAAC;AACH;AAEA,SAASd,QAAQA,CAACD,GAAQ,EAAE;EAC1B,IAAIgB,KAAK,CAACC,OAAO,CAACjB,GAAG,CAAC,EAAE;IACtB,OAAO,CAAC,GAAGA,GAAG,CAAC;EACjB,CAAC,MAAM;IACL,OAAO;MAAE,GAAGA;IAAI,CAAC;EACnB;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.hasField = hasField;
|
|
5
|
+
function hasField(object, fieldNamePredicate) {
|
|
6
|
+
if (!object) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(object)) {
|
|
10
|
+
return object.some(ele => hasField(ele, fieldNamePredicate));
|
|
11
|
+
}
|
|
12
|
+
if (typeof object === 'object') {
|
|
13
|
+
const keys = Object.keys(object);
|
|
14
|
+
return keys.some(k => fieldNamePredicate(k) || hasField(object[k], fieldNamePredicate));
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=field-key-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasField","object","fieldNamePredicate","Array","isArray","some","ele","keys","Object","k"],"sources":["../../../src/utils/field-key-utils.ts"],"sourcesContent":["export function hasField(\n object: any,\n fieldNamePredicate: (s: string) => boolean\n): boolean {\n if (!object) {\n return false\n }\n if (Array.isArray(object)) {\n return object.some((ele) => hasField(ele, fieldNamePredicate))\n }\n if (typeof object === 'object') {\n const keys = Object.keys(object)\n return keys.some(\n (k) => fieldNamePredicate(k) || hasField(object[k], fieldNamePredicate)\n )\n }\n return false\n}\n"],"mappings":";;;;AAAO,SAASA,QAAQA,CACtBC,MAAW,EACXC,kBAA0C,EACjC;EACT,IAAI,CAACD,MAAM,EAAE;IACX,OAAO,KAAK;EACd;EACA,IAAIE,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,EAAE;IACzB,OAAOA,MAAM,CAACI,IAAI,CAAEC,GAAG,IAAKN,QAAQ,CAACM,GAAG,EAAEJ,kBAAkB,CAAC,CAAC;EAChE;EACA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;IAC9B,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAC;IAChC,OAAOM,IAAI,CAACF,IAAI,CACbI,CAAC,IAAKP,kBAAkB,CAACO,CAAC,CAAC,IAAIT,QAAQ,CAACC,MAAM,CAACQ,CAAC,CAAC,EAAEP,kBAAkB,CACxE,CAAC;EACH;EACA,OAAO,KAAK;AACd"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
var _codec = require("./codec");
|
|
6
|
+
exports.encode = _codec.encode;
|
|
7
|
+
exports.decode = _codec.decode;
|
|
8
|
+
var _typeUtils = require("./type-utils");
|
|
9
|
+
exports.isObject = _typeUtils.isObject;
|
|
10
|
+
exports.isArray = _typeUtils.isArray;
|
|
11
|
+
exports.isDate = _typeUtils.isDate;
|
|
12
|
+
exports.isNumber = _typeUtils.isNumber;
|
|
13
|
+
exports.isBoolean = _typeUtils.isBoolean;
|
|
14
|
+
exports.isString = _typeUtils.isString;
|
|
15
|
+
exports.isFunction = _typeUtils.isFunction;
|
|
16
|
+
exports.typeForDisplay = _typeUtils.typeForDisplay;
|
|
17
|
+
exports.isUndefined = _typeUtils.isUndefined;
|
|
18
|
+
exports.isNull = _typeUtils.isNull;
|
|
19
|
+
var _clone = require("./clone");
|
|
20
|
+
exports.clone = _clone.clone;
|
|
21
|
+
var _fieldKeyUtils = require("./field-key-utils");
|
|
22
|
+
exports.hasField = _fieldKeyUtils.hasField;
|
|
23
|
+
var _base64url = _interopRequireDefault(require("./base64url"));
|
|
24
|
+
exports.base64url = _base64url.default;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codec","require","exports","encode","decode","_typeUtils","isObject","isArray","isDate","isNumber","isBoolean","isString","isFunction","typeForDisplay","isUndefined","isNull","_clone","clone","_fieldKeyUtils","hasField","_base64url","_interopRequireDefault","base64url","default"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["import { encode, decode } from './codec'\nimport {\n isObject,\n isArray,\n isDate,\n isNumber,\n isBoolean,\n isString,\n isFunction,\n typeForDisplay,\n isUndefined,\n isNull,\n} from './type-utils'\nimport { clone } from './clone'\nimport { hasField } from './field-key-utils'\nimport base64url from './base64url'\n\nexport {\n encode,\n decode,\n isObject,\n isArray,\n isDate,\n isNumber,\n isBoolean,\n isString,\n isFunction,\n typeForDisplay,\n isUndefined,\n isNull,\n clone,\n hasField,\n base64url,\n}\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAwCC,OAAA,CAAAC,MAAA,GAAAH,MAAA,CAAAG,MAAA;AAAAD,OAAA,CAAAE,MAAA,GAAAJ,MAAA,CAAAI,MAAA;AACxC,IAAAC,UAAA,GAAAJ,OAAA;AAWqBC,OAAA,CAAAI,QAAA,GAAAD,UAAA,CAAAC,QAAA;AAAAJ,OAAA,CAAAK,OAAA,GAAAF,UAAA,CAAAE,OAAA;AAAAL,OAAA,CAAAM,MAAA,GAAAH,UAAA,CAAAG,MAAA;AAAAN,OAAA,CAAAO,QAAA,GAAAJ,UAAA,CAAAI,QAAA;AAAAP,OAAA,CAAAQ,SAAA,GAAAL,UAAA,CAAAK,SAAA;AAAAR,OAAA,CAAAS,QAAA,GAAAN,UAAA,CAAAM,QAAA;AAAAT,OAAA,CAAAU,UAAA,GAAAP,UAAA,CAAAO,UAAA;AAAAV,OAAA,CAAAW,cAAA,GAAAR,UAAA,CAAAQ,cAAA;AAAAX,OAAA,CAAAY,WAAA,GAAAT,UAAA,CAAAS,WAAA;AAAAZ,OAAA,CAAAa,MAAA,GAAAV,UAAA,CAAAU,MAAA;AACrB,IAAAC,MAAA,GAAAf,OAAA;AAA+BC,OAAA,CAAAe,KAAA,GAAAD,MAAA,CAAAC,KAAA;AAC/B,IAAAC,cAAA,GAAAjB,OAAA;AAA4CC,OAAA,CAAAiB,QAAA,GAAAD,cAAA,CAAAC,QAAA;AAC5C,IAAAC,UAAA,GAAAC,sBAAA,CAAApB,OAAA;AAAmCC,OAAA,CAAAoB,SAAA,GAAAF,UAAA,CAAAG,OAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.isArray = isArray;
|
|
6
|
+
exports.isBoolean = isBoolean;
|
|
7
|
+
exports.isDate = isDate;
|
|
8
|
+
exports.isFunction = isFunction;
|
|
9
|
+
exports.isNull = isNull;
|
|
10
|
+
exports.isNumber = isNumber;
|
|
11
|
+
exports.isObject = isObject;
|
|
12
|
+
exports.isString = isString;
|
|
13
|
+
exports.isUndefined = isUndefined;
|
|
14
|
+
exports.typeForDisplay = typeForDisplay;
|
|
15
|
+
var _kindOf = _interopRequireDefault(require("kind-of"));
|
|
16
|
+
function isObject(obj) {
|
|
17
|
+
return (0, _kindOf.default)(obj) === 'object';
|
|
18
|
+
}
|
|
19
|
+
function isArray(arr) {
|
|
20
|
+
return (0, _kindOf.default)(arr) === 'array';
|
|
21
|
+
}
|
|
22
|
+
function isDate(obj) {
|
|
23
|
+
return (0, _kindOf.default)(obj) === 'date';
|
|
24
|
+
}
|
|
25
|
+
function isNumber(obj) {
|
|
26
|
+
return (0, _kindOf.default)(obj) === 'number';
|
|
27
|
+
}
|
|
28
|
+
function isBoolean(obj) {
|
|
29
|
+
return (0, _kindOf.default)(obj) === 'boolean';
|
|
30
|
+
}
|
|
31
|
+
function isString(obj) {
|
|
32
|
+
return (0, _kindOf.default)(obj) === 'string';
|
|
33
|
+
}
|
|
34
|
+
function isFunction(obj) {
|
|
35
|
+
return (0, _kindOf.default)(obj) === 'function';
|
|
36
|
+
}
|
|
37
|
+
function typeForDisplay(obj) {
|
|
38
|
+
return upperCaseFirst((0, _kindOf.default)(obj));
|
|
39
|
+
}
|
|
40
|
+
function isUndefined(obj) {
|
|
41
|
+
return (0, _kindOf.default)(obj) === 'undefined';
|
|
42
|
+
}
|
|
43
|
+
function isNull(obj) {
|
|
44
|
+
return (0, _kindOf.default)(obj) === 'null';
|
|
45
|
+
}
|
|
46
|
+
function upperCaseFirst(str) {
|
|
47
|
+
if (!isString(str)) {
|
|
48
|
+
return str;
|
|
49
|
+
}
|
|
50
|
+
const first = str.slice(0, 1).toUpperCase();
|
|
51
|
+
const rest = str.slice(1, str.length);
|
|
52
|
+
return first + rest;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=type-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_kindOf","_interopRequireDefault","require","isObject","obj","getKind","isArray","arr","isDate","isNumber","isBoolean","isString","isFunction","typeForDisplay","upperCaseFirst","isUndefined","isNull","str","first","slice","toUpperCase","rest","length"],"sources":["../../../src/utils/type-utils.ts"],"sourcesContent":["import getKind from 'kind-of'\n\nexport function isObject(obj: any): obj is Record<keyof any, any> {\n return getKind(obj) === 'object'\n}\n\nexport function isArray(arr: any): arr is any[] {\n return getKind(arr) === 'array'\n}\n\nexport function isDate(obj: any) {\n return getKind(obj) === 'date'\n}\n\nexport function isNumber(obj: any) {\n return getKind(obj) === 'number'\n}\n\nexport function isBoolean(obj: any) {\n return getKind(obj) === 'boolean'\n}\n\nexport function isString(obj: any) {\n return getKind(obj) === 'string'\n}\n\nexport function isFunction(obj: any) {\n return getKind(obj) === 'function'\n}\n\nexport function typeForDisplay(obj: any) {\n return upperCaseFirst(getKind(obj))\n}\n\nexport function isUndefined(obj: any) {\n return getKind(obj) === 'undefined'\n}\n\nexport function isNull(obj: any) {\n return getKind(obj) === 'null'\n}\n\nfunction upperCaseFirst(str: any) {\n if (!isString(str)) {\n return str\n }\n const first = str.slice(0, 1).toUpperCase()\n const rest = str.slice(1, str.length)\n return first + rest\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,SAASC,QAAQA,CAACC,GAAQ,EAAiC;EAChE,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,QAAQ;AAClC;AAEO,SAASE,OAAOA,CAACC,GAAQ,EAAgB;EAC9C,OAAO,IAAAF,eAAO,EAACE,GAAG,CAAC,KAAK,OAAO;AACjC;AAEO,SAASC,MAAMA,CAACJ,GAAQ,EAAE;EAC/B,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,MAAM;AAChC;AAEO,SAASK,QAAQA,CAACL,GAAQ,EAAE;EACjC,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,QAAQ;AAClC;AAEO,SAASM,SAASA,CAACN,GAAQ,EAAE;EAClC,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,SAAS;AACnC;AAEO,SAASO,QAAQA,CAACP,GAAQ,EAAE;EACjC,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,QAAQ;AAClC;AAEO,SAASQ,UAAUA,CAACR,GAAQ,EAAE;EACnC,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,UAAU;AACpC;AAEO,SAASS,cAAcA,CAACT,GAAQ,EAAE;EACvC,OAAOU,cAAc,CAAC,IAAAT,eAAO,EAACD,GAAG,CAAC,CAAC;AACrC;AAEO,SAASW,WAAWA,CAACX,GAAQ,EAAE;EACpC,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,WAAW;AACrC;AAEO,SAASY,MAAMA,CAACZ,GAAQ,EAAE;EAC/B,OAAO,IAAAC,eAAO,EAACD,GAAG,CAAC,KAAK,MAAM;AAChC;AAEA,SAASU,cAAcA,CAACG,GAAQ,EAAE;EAChC,IAAI,CAACN,QAAQ,CAACM,GAAG,CAAC,EAAE;IAClB,OAAOA,GAAG;EACZ;EACA,MAAMC,KAAK,GAAGD,GAAG,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAC3C,MAAMC,IAAI,GAAGJ,GAAG,CAACE,KAAK,CAAC,CAAC,EAAEF,GAAG,CAACK,MAAM,CAAC;EACrC,OAAOJ,KAAK,GAAGG,IAAI;AACrB"}
|