@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,60 @@
|
|
|
1
|
+
export function encode(value) {
|
|
2
|
+
return serializeDates(value);
|
|
3
|
+
}
|
|
4
|
+
export function decode(value) {
|
|
5
|
+
return parseDates(value);
|
|
6
|
+
}
|
|
7
|
+
function serializeDates(json) {
|
|
8
|
+
if (typeof json !== 'object' || isDate(json)) {
|
|
9
|
+
return json;
|
|
10
|
+
}
|
|
11
|
+
const obj = copyRoot(json);
|
|
12
|
+
for (const k in obj) {
|
|
13
|
+
const value = obj[k];
|
|
14
|
+
if (value && isDate(value)) {
|
|
15
|
+
obj[k] = stringifyDate(value);
|
|
16
|
+
}
|
|
17
|
+
else if (typeof obj[k] === 'object' && obj[k] !== null) {
|
|
18
|
+
obj[k] = serializeDates(obj[k]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
function isDate(obj) {
|
|
24
|
+
if (Object.prototype.toString.call(obj) !== '[object Date]') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return !isNaN(obj.getTime());
|
|
28
|
+
}
|
|
29
|
+
function isDateString(value) {
|
|
30
|
+
return isNaN(value) && !isNaN(new Date(value).getDate());
|
|
31
|
+
}
|
|
32
|
+
function parseDates(json) {
|
|
33
|
+
if (typeof json !== 'object' || isDate(json)) {
|
|
34
|
+
return json;
|
|
35
|
+
}
|
|
36
|
+
const obj = copyRoot(json);
|
|
37
|
+
for (const k in obj) {
|
|
38
|
+
if (obj[k] && obj[k].$date && isDateString(obj[k].$date)) {
|
|
39
|
+
obj[k] = new Date(obj[k].$date);
|
|
40
|
+
}
|
|
41
|
+
else if (typeof obj[k] === 'object' && obj[k] !== null) {
|
|
42
|
+
obj[k] = parseDates(obj[k]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
function stringifyDate(d) {
|
|
48
|
+
return {
|
|
49
|
+
$date: d.toJSON(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function copyRoot(obj) {
|
|
53
|
+
if (Array.isArray(obj)) {
|
|
54
|
+
return [...obj];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return { ...obj };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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((ele) => hasField(ele, fieldNamePredicate));
|
|
7
|
+
}
|
|
8
|
+
if (typeof object === 'object') {
|
|
9
|
+
const keys = Object.keys(object);
|
|
10
|
+
return keys.some((k) => fieldNamePredicate(k) || hasField(object[k], fieldNamePredicate));
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=field-key-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-key-utils.js","sourceRoot":"","sources":["../../../src/utils/field-key-utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CACtB,MAAW,EACX,kBAA0C;IAE1C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAA;KACb;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAA;KAC/D;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChC,OAAO,IAAI,CAAC,IAAI,CACd,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CACxE,CAAA;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { encode, decode } from './codec';
|
|
2
|
+
import { isObject, isArray, isDate, isNumber, isBoolean, isString, isFunction, typeForDisplay, isUndefined, isNull, } from './type-utils';
|
|
3
|
+
import { clone } from './clone';
|
|
4
|
+
import { hasField } from './field-key-utils';
|
|
5
|
+
import base64url from './base64url';
|
|
6
|
+
export { encode, decode, isObject, isArray, isDate, isNumber, isBoolean, isString, isFunction, typeForDisplay, isUndefined, isNull, clone, hasField, base64url, };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,GACV,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import getKind from 'kind-of';
|
|
2
|
+
export function isObject(obj) {
|
|
3
|
+
return getKind(obj) === 'object';
|
|
4
|
+
}
|
|
5
|
+
export function isArray(arr) {
|
|
6
|
+
return getKind(arr) === 'array';
|
|
7
|
+
}
|
|
8
|
+
export function isDate(obj) {
|
|
9
|
+
return getKind(obj) === 'date';
|
|
10
|
+
}
|
|
11
|
+
export function isNumber(obj) {
|
|
12
|
+
return getKind(obj) === 'number';
|
|
13
|
+
}
|
|
14
|
+
export function isBoolean(obj) {
|
|
15
|
+
return getKind(obj) === 'boolean';
|
|
16
|
+
}
|
|
17
|
+
export function isString(obj) {
|
|
18
|
+
return getKind(obj) === 'string';
|
|
19
|
+
}
|
|
20
|
+
export function isFunction(obj) {
|
|
21
|
+
return getKind(obj) === 'function';
|
|
22
|
+
}
|
|
23
|
+
export function typeForDisplay(obj) {
|
|
24
|
+
return upperCaseFirst(getKind(obj));
|
|
25
|
+
}
|
|
26
|
+
export function isUndefined(obj) {
|
|
27
|
+
return getKind(obj) === 'undefined';
|
|
28
|
+
}
|
|
29
|
+
export function isNull(obj) {
|
|
30
|
+
return getKind(obj) === 'null';
|
|
31
|
+
}
|
|
32
|
+
function upperCaseFirst(str) {
|
|
33
|
+
if (!isString(str)) {
|
|
34
|
+
return str;
|
|
35
|
+
}
|
|
36
|
+
const first = str.slice(0, 1).toUpperCase();
|
|
37
|
+
const rest = str.slice(1, str.length);
|
|
38
|
+
return first + rest;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=type-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../../../src/utils/type-utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAQ;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAQ;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,CAAA;AACnC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,UAAU,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAQ;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAQ;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAA;AAChC,CAAC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAClB,OAAO,GAAG,CAAA;KACX;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;IAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrC,OAAO,KAAK,GAAG,IAAI,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RequestInterceptor, Request, HttpApiClientFactory } from '../types/api';
|
|
2
|
+
import { AggregateDataItemsRequest, AggregateDataItemsResponse, BulkInsertDataItemReferencesRequest, BulkInsertDataItemReferencesResponse, BulkInsertDataItemsRequest, BulkInsertDataItemsResponse, BulkPatchDataItemsRequest, BulkPatchDataItemsResponse, BulkRemoveDataItemReferencesRequest, BulkRemoveDataItemReferencesResponse, BulkRemoveDataItemsRequest, BulkRemoveDataItemsResponse, BulkSaveDataItemsRequest, BulkSaveDataItemsResponse, BulkUpdateDataItemsRequest, BulkUpdateDataItemsResponse, CountDataItemsRequest, CountDataItemsResponse, GetDataItemRequest, GetDataItemResponse, InsertDataItemRequest, InsertDataItemResponse, IsReferencedDataItemRequest, IsReferencedDataItemResponse, PatchDataItemRequest, PatchDataItemResponse, QueryDataItemsRequest, QueryDataItemsResponse, QueryDistinctValuesRequest, QueryDistinctValuesResponse, QueryReferencedDataItemsRequest, QueryReferencedDataItemsResponse, RemoveDataItemRequest, RemoveDataItemResponse, ReplaceDataItemReferencesRequest, ReplaceDataItemReferencesResponse, SaveDataItemRequest, SaveDataItemResponse, TruncateDataItemsRequest, TruncateDataItemsResponse, UpdateDataItemRequest, UpdateDataItemResponse } from '../types/data-item-types';
|
|
3
|
+
export declare function apiRequestInterceptor<R extends Request>(allowGet: boolean): RequestInterceptor<R>;
|
|
4
|
+
export declare class ApiClient {
|
|
5
|
+
private httpApiClient;
|
|
6
|
+
constructor(clientFactory: HttpApiClientFactory<any>, allowGet: boolean);
|
|
7
|
+
getDataItem(r: GetDataItemRequest): Promise<GetDataItemResponse>;
|
|
8
|
+
insertDataItem(r: InsertDataItemRequest): Promise<InsertDataItemResponse>;
|
|
9
|
+
saveDataItem(r: SaveDataItemRequest): Promise<SaveDataItemResponse>;
|
|
10
|
+
updateDataItem(r: UpdateDataItemRequest): Promise<UpdateDataItemResponse>;
|
|
11
|
+
patchDataItem(r: PatchDataItemRequest): Promise<PatchDataItemResponse>;
|
|
12
|
+
bulkPatchDataItems(r: BulkPatchDataItemsRequest): Promise<BulkPatchDataItemsResponse>;
|
|
13
|
+
removeDataItem(r: RemoveDataItemRequest): Promise<RemoveDataItemResponse>;
|
|
14
|
+
countDataItems(r: CountDataItemsRequest): Promise<CountDataItemsResponse>;
|
|
15
|
+
queryDistinctValues(r: QueryDistinctValuesRequest): Promise<QueryDistinctValuesResponse>;
|
|
16
|
+
queryDataItems(r: QueryDataItemsRequest): Promise<QueryDataItemsResponse>;
|
|
17
|
+
aggregateDataItems(r: AggregateDataItemsRequest): Promise<AggregateDataItemsResponse>;
|
|
18
|
+
bulkInsertDataItems(r: BulkInsertDataItemsRequest): Promise<BulkInsertDataItemsResponse>;
|
|
19
|
+
bulkUpdateDataItems(r: BulkUpdateDataItemsRequest): Promise<BulkUpdateDataItemsResponse>;
|
|
20
|
+
bulkSaveDataItems(r: BulkSaveDataItemsRequest): Promise<BulkSaveDataItemsResponse>;
|
|
21
|
+
bulkRemoveDataItems(r: BulkRemoveDataItemsRequest): Promise<BulkRemoveDataItemsResponse>;
|
|
22
|
+
queryReferencedDataItems(r: QueryReferencedDataItemsRequest): Promise<QueryReferencedDataItemsResponse>;
|
|
23
|
+
bulkInsertDataItemReferences(r: BulkInsertDataItemReferencesRequest): Promise<BulkInsertDataItemReferencesResponse>;
|
|
24
|
+
replaceDataItemReferences(r: ReplaceDataItemReferencesRequest): Promise<ReplaceDataItemReferencesResponse>;
|
|
25
|
+
bulkRemoveDataItemReferences(r: BulkRemoveDataItemReferencesRequest): Promise<BulkRemoveDataItemReferencesResponse>;
|
|
26
|
+
isReferencedDataItem(r: IsReferencedDataItemRequest): Promise<IsReferencedDataItemResponse>;
|
|
27
|
+
truncateDataItems(r: TruncateDataItemsRequest): Promise<TruncateDataItemsResponse>;
|
|
28
|
+
private withErrorHandling;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiClient.d.ts","sourceRoot":"","sources":["../../../src/api/ApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,OAAO,EACP,oBAAoB,EACrB,MAAM,cAAc,CAAA;AASrB,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,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C5B,OAAO,CAAC,2BAA2B,CAAC;IAOjC,cAAc,CAClB,CAAC,EAAE,qBAAqB,GACvB,OAAO,CAAC,sBAAsB,CAAC;IAO5B,kBAAkB,CACtB,CAAC,EAAE,yBAAyB,GAC3B,OAAO,CAAC,0BAA0B,CAAC;IAOhC,mBAAmB,CACvB,CAAC,EAAE,0BAA0B,GAC5B,OAAO,CAAC,2BAA2B,CAAC;IAOjC,mBAAmB,CACvB,CAAC,EAAE,0BAA0B,GAC5B,OAAO,CAAC,2BAA2B,CAAC;IAOjC,iBAAiB,CACrB,CAAC,EAAE,wBAAwB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;IAO/B,mBAAmB,CACvB,CAAC,EAAE,0BAA0B,GAC5B,OAAO,CAAC,2BAA2B,CAAC;IAOjC,wBAAwB,CAC5B,CAAC,EAAE,+BAA+B,GACjC,OAAO,CAAC,gCAAgC,CAAC;IAOtC,4BAA4B,CAChC,CAAC,EAAE,mCAAmC,GACrC,OAAO,CAAC,oCAAoC,CAAC;IAO1C,yBAAyB,CAC7B,CAAC,EAAE,gCAAgC,GAClC,OAAO,CAAC,iCAAiC,CAAC;IAOvC,4BAA4B,CAChC,CAAC,EAAE,mCAAmC,GACrC,OAAO,CAAC,oCAAoC,CAAC;IAO1C,oBAAoB,CACxB,CAAC,EAAE,2BAA2B,GAC7B,OAAO,CAAC,4BAA4B,CAAC;IAOlC,iBAAiB,CACrB,CAAC,EAAE,wBAAwB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;YAOvB,iBAAiB;CAmBhC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { WithFilter, PlatformizedFilterBuilder, FilterTree } from '../filter';
|
|
2
|
+
import { Sort } from '../sort/sortMixin';
|
|
3
|
+
export declare abstract class QueryBase<Self extends WithFilter<Self>> implements WithFilter<Self> {
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
protected readonly filterBuilder: PlatformizedFilterBuilder;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
protected readonly sort: Sort;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
readonly collectionName: string;
|
|
16
|
+
protected constructor(origin: {
|
|
17
|
+
collectionName: string;
|
|
18
|
+
filterBuilder?: PlatformizedFilterBuilder;
|
|
19
|
+
sort?: Sort;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
protected abstract copy(params: {
|
|
25
|
+
filterBuilder?: PlatformizedFilterBuilder;
|
|
26
|
+
sort?: Sort;
|
|
27
|
+
}): Self;
|
|
28
|
+
abstract get invalidArguments(): string[];
|
|
29
|
+
get filterTree(): Record<string, any>;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
setFilterModel(filterTree: Record<string, any>): Self;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
getFilterModel(): FilterTree;
|
|
38
|
+
private withFilter;
|
|
39
|
+
eq: WithFilter<Self>['eq'];
|
|
40
|
+
ne: WithFilter<Self>['ne'];
|
|
41
|
+
ge: WithFilter<Self>['ge'];
|
|
42
|
+
gt: WithFilter<Self>['gt'];
|
|
43
|
+
gte: WithFilter<Self>['gte'];
|
|
44
|
+
le: WithFilter<Self>['le'];
|
|
45
|
+
lt: WithFilter<Self>['lt'];
|
|
46
|
+
lte: WithFilter<Self>['lte'];
|
|
47
|
+
isNotEmpty: WithFilter<Self>['isNotEmpty'];
|
|
48
|
+
isEmpty: WithFilter<Self>['isEmpty'];
|
|
49
|
+
startsWith: WithFilter<Self>['startsWith'];
|
|
50
|
+
endsWith: WithFilter<Self>['endsWith'];
|
|
51
|
+
contains: WithFilter<Self>['contains'];
|
|
52
|
+
hasSome: WithFilter<Self>['hasSome'];
|
|
53
|
+
in: WithFilter<Self>['in'];
|
|
54
|
+
hasAll: WithFilter<Self>['hasAll'];
|
|
55
|
+
exists: WithFilter<Self>['exists'];
|
|
56
|
+
or: WithFilter<Self>['or'];
|
|
57
|
+
and: WithFilter<Self>['and'];
|
|
58
|
+
not: WithFilter<Self>['not'];
|
|
59
|
+
between: WithFilter<Self>['between'];
|
|
60
|
+
private extractFilter;
|
|
61
|
+
get orderBy(): {
|
|
62
|
+
[field: string]: 'asc' | 'desc';
|
|
63
|
+
}[];
|
|
64
|
+
/**
|
|
65
|
+
* Adds a sort to a query or sort, sorting by the specified properties in ascending order.
|
|
66
|
+
*
|
|
67
|
+
* The `ascending()` function refines this query in ascending order of the specified properties. If you specify more
|
|
68
|
+
* than one property, ascending() sorts the results in ascending order by each property in the order they are listed.
|
|
69
|
+
*
|
|
70
|
+
* You can sort the following types:
|
|
71
|
+
* - Number: Sorts numerically.
|
|
72
|
+
* - Date: Sorts by date and time.
|
|
73
|
+
* - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`.
|
|
74
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
75
|
+
*
|
|
76
|
+
* If a property contains a number as a String, that value will be sorted alphabetically and not numerically.
|
|
77
|
+
* Items that do not have a value for the specified sort property are ranked lowest.
|
|
78
|
+
* @public
|
|
79
|
+
* @documentationMaturity preview
|
|
80
|
+
* @param fields - The properties used in the sort.
|
|
81
|
+
* @requiredField fields
|
|
82
|
+
* @returns An object representing the refined query.
|
|
83
|
+
*/
|
|
84
|
+
ascending(...fields: string[]): Self;
|
|
85
|
+
ascending(fields: string[]): Self;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a sort to a query or sort, sorting by the specified properties in descending order.
|
|
88
|
+
*
|
|
89
|
+
* The `descending()` function refines this query to sort in descending order of the specified properties. If you
|
|
90
|
+
* specify more than one property, descending() sorts the results in descending order by each property in the order
|
|
91
|
+
* they are listed.
|
|
92
|
+
*
|
|
93
|
+
* You can sort the following types:
|
|
94
|
+
*
|
|
95
|
+
* Number: Sorts numerically.
|
|
96
|
+
* - Date: Sorts by date and time.
|
|
97
|
+
* - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`.
|
|
98
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
99
|
+
*
|
|
100
|
+
* If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items
|
|
101
|
+
* that do not have a value for the specified sort property are ranked lowest.
|
|
102
|
+
* @public
|
|
103
|
+
* @documentationMaturity preview
|
|
104
|
+
* @param fields - The properties used in the sort.
|
|
105
|
+
* @requiredField fields
|
|
106
|
+
* @returns An object representing the refined query.
|
|
107
|
+
*/
|
|
108
|
+
descending(...fields: string[]): Self;
|
|
109
|
+
descending(fields: string[]): Self;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=QueryBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryBase.d.ts","sourceRoot":"","sources":["../../../src/api/QueryBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,yBAAyB,EAEzB,UAAU,EACX,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGxC,8BAAsB,SAAS,CAAC,IAAI,SAAS,UAAU,CAAC,IAAI,CAAC,CAC3D,YAAW,UAAU,CAAC,IAAI,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,yBAAyB,CAAA;IAE3D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IAE7B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAE/B,SAAS,aAAa,MAAM,EAAE;QAC5B,cAAc,EAAE,MAAM,CAAA;QACtB,aAAa,CAAC,EAAE,yBAAyB,CAAA;QACzC,IAAI,CAAC,EAAE,IAAI,CAAA;KACZ;IAOD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE;QAC9B,aAA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E,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAElC;IACF,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAEzB;IACD,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAEjC;IACD,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAEjC;IACD,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAGzB;IACD,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAG3B;IACD,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAG3B;IACD,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAEnC;IAED,OAAO,CAAC,aAAa;IAMrB,IAAI,OAAO,IAAI;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;KAAE,EAAE,CAEnD;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IACpC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IAMjC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IACrC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;CAKnC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AggregatingValidator } from '../errors';
|
|
2
|
+
export declare class QueryValidator extends AggregatingValidator {
|
|
3
|
+
operatorName: any;
|
|
4
|
+
constructor(operatorName: string, previousInvalidArguments: string[]);
|
|
5
|
+
_isNumber(specifier: string, operand: any): this;
|
|
6
|
+
isPositiveNumber(operand: number): this;
|
|
7
|
+
isNonNegativeNumber(operand: number): this;
|
|
8
|
+
isInteger(operand: number): this;
|
|
9
|
+
notGreaterThan(operand: number, value: number): this;
|
|
10
|
+
nonEmptyString(operand: any): this;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=QueryValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryValidator.d.ts","sourceRoot":"","sources":["../../../src/api/QueryValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAY,MAAM,WAAW,CAAA;AAI1D,qBAAa,cAAe,SAAQ,oBAAoB;IACtD,YAAY,EAAE,GAAG,CAAA;gBAEL,YAAY,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE;IAKpE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAYzC,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAQhC,mBAAmB,CAAC,OAAO,EAAE,MAAM;IAWnC,SAAS,CAAC,OAAO,EAAE,MAAM;IAYzB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAY7C,cAAc,CAAC,OAAO,EAAE,GAAG;CAM5B"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { WixDataFilter } from './WixDataFilter';
|
|
2
|
+
import { WixDataReadOptions } from './types';
|
|
3
|
+
import { WixDataResult } from './WixDataResult';
|
|
4
|
+
/**
|
|
5
|
+
* @builder
|
|
6
|
+
*/
|
|
7
|
+
export interface WixDataAggregate {
|
|
8
|
+
/**
|
|
9
|
+
* Refines a `WixDataAggregate` to contain the sum from each aggregation group.
|
|
10
|
+
*
|
|
11
|
+
* The `sum()` function refines a `WixDataAggregate` to contain the sum of the
|
|
12
|
+
* values from the specified property for each aggregated group or from the
|
|
13
|
+
* whole collection if no group is defined.
|
|
14
|
+
*
|
|
15
|
+
* When the aggregation is `run()`, the returned `WixDataAggregateResult`
|
|
16
|
+
* object contains an item for each group with the following key:value pairs:
|
|
17
|
+
* - If a value was passed for the optional `projectedName`, the key is named
|
|
18
|
+
* using that value. Otherwise, the key is named using the following format:
|
|
19
|
+
* `"propertyNameSum"`, where `propertyName` is the name of the specified property.
|
|
20
|
+
* - The value is the sum of the values found in the specified property.
|
|
21
|
+
*
|
|
22
|
+
* Sums can only be calculated on properties of type Number.
|
|
23
|
+
*
|
|
24
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
25
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
26
|
+
* @public
|
|
27
|
+
* @documentationMaturity preview
|
|
28
|
+
* @param fieldName - The property in which to find the sum.
|
|
29
|
+
* @requiredField fieldName
|
|
30
|
+
* @param projectedField - The name of the property in the aggregation results containing the sum.
|
|
31
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
32
|
+
*/
|
|
33
|
+
sum(fieldName: string, projectedField?: string): WixDataAggregate;
|
|
34
|
+
/**
|
|
35
|
+
* Refines a `WixDataAggregate` to only contain the average value from each aggregation group.
|
|
36
|
+
*
|
|
37
|
+
* The `avg()` function refines a `WixDataAggregate` to contain the average
|
|
38
|
+
* value from the specified property for each aggregated group or from the
|
|
39
|
+
* whole collection if no group is defined.
|
|
40
|
+
*
|
|
41
|
+
* When the aggregation is `run()`, the returned `WixDataAggregateResult`
|
|
42
|
+
* object contains an item for each group with the following key:value pairs:
|
|
43
|
+
* - If a value was passed for the optional `projectedName`, the key is named
|
|
44
|
+
* using that value. Otherwise, the key is named using the following format:
|
|
45
|
+
* `"propertyNameAvg"`, where `propertyName` is the name of the specified property.
|
|
46
|
+
* - The value is the average of the values found in the specified property.
|
|
47
|
+
*
|
|
48
|
+
* Averages can only be calculated on properties of type Number.
|
|
49
|
+
*
|
|
50
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
51
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
52
|
+
* @public
|
|
53
|
+
* @documentationMaturity preview
|
|
54
|
+
* @param fieldName - The property in which to find the average value.
|
|
55
|
+
* @requiredField fieldName
|
|
56
|
+
* @param projectedField - The name of the property in the aggregation results containing the average value.
|
|
57
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
58
|
+
*/
|
|
59
|
+
avg(fieldName: string, projectedField?: string): WixDataAggregate;
|
|
60
|
+
/**
|
|
61
|
+
* Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.
|
|
62
|
+
*
|
|
63
|
+
* The `min()` function refines a `WixDataAggregate` to contain the minimum
|
|
64
|
+
* value from the specified property for each aggregated group or from the
|
|
65
|
+
* whole collection if no group is defined.
|
|
66
|
+
*
|
|
67
|
+
* When the aggregation is `run()`, the returned `WixDataAggregateResult`
|
|
68
|
+
* object contains an item for each group with the following key:value pairs:
|
|
69
|
+
* - If a value was passed for the optional `projectedName`, the key is named
|
|
70
|
+
* using that value. Otherwise, the key is named using the following format:
|
|
71
|
+
* `"propertyNameMin"`, where `propertyName` is the name of the specified property.
|
|
72
|
+
* - The value is the minimum value found in the specified property.
|
|
73
|
+
*
|
|
74
|
+
* The following types of properties can be compared to determine a minimum value:
|
|
75
|
+
* - Number: Compares numerically.
|
|
76
|
+
* - Date and Time: Compares JavaScript Date objects.
|
|
77
|
+
* - Text: Compares lexicographically, so `"text"` is greater than `"Text"`.
|
|
78
|
+
* - Rich Text: Compares HTML source as text.
|
|
79
|
+
* - URL: Compares as text.
|
|
80
|
+
* - Image: Compares image source as text.
|
|
81
|
+
* - Video: Compares video source as text.
|
|
82
|
+
* - Document: Compares document source as text.
|
|
83
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
84
|
+
*
|
|
85
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
86
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
87
|
+
* @public
|
|
88
|
+
* @documentationMaturity preview
|
|
89
|
+
* @param fieldName - The property in which to find the minimum value.
|
|
90
|
+
* @requiredField fieldName
|
|
91
|
+
* @param projectedField - The name of the property in the aggregation results containing the minimum value.
|
|
92
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
93
|
+
*/
|
|
94
|
+
min(fieldName: string, projectedField?: string): WixDataAggregate;
|
|
95
|
+
/**
|
|
96
|
+
* Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.
|
|
97
|
+
*
|
|
98
|
+
* The `max()` function refines a `WixDataAggregate` to contain the maximum
|
|
99
|
+
* value from the specified property for each aggregated group or from the
|
|
100
|
+
* whole collection if no group is defined.
|
|
101
|
+
*
|
|
102
|
+
* When the aggregation is `run()`, the returned `WixDataAggregateResult`
|
|
103
|
+
* object contains an item for each group with the following key:value pairs:
|
|
104
|
+
* - If a value was passed for the optional `projectedName`, the key is named
|
|
105
|
+
* using that value. Otherwise, the key is named using the following format:
|
|
106
|
+
* `"propertyNameMax"`, where `propertyName` is the name of the specified property.
|
|
107
|
+
* - The value is the maximum value found in the specified property.
|
|
108
|
+
*
|
|
109
|
+
* The following types of properties can be compared to determine a maximum value:
|
|
110
|
+
* - Number: Compares numerically.
|
|
111
|
+
* - Date and Time: Compares JavaScript Date objects.
|
|
112
|
+
* - Text: Compares lexicographically, so `"text"` is greater than `"Text"`.
|
|
113
|
+
* - Rich Text: Compares HTML source as text.
|
|
114
|
+
* - URL: Compares as text.
|
|
115
|
+
* - Image: Compares image source as text.
|
|
116
|
+
* - Video: Compares video source as text.
|
|
117
|
+
* - Document: Compares document source as text.
|
|
118
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
119
|
+
*
|
|
120
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
121
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
122
|
+
* @public
|
|
123
|
+
* @documentationMaturity preview
|
|
124
|
+
* @param fieldName - The property in which to find the maximum value.
|
|
125
|
+
* @requiredField fieldName
|
|
126
|
+
* @param projectedField - The name of the property in the aggregation results containing the maximum value.
|
|
127
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
128
|
+
*/
|
|
129
|
+
max(fieldName: string, projectedField?: string): WixDataAggregate;
|
|
130
|
+
/**
|
|
131
|
+
* Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.
|
|
132
|
+
*
|
|
133
|
+
* The `count()` function refines a `WixDataAggregate` to contain the item
|
|
134
|
+
* count in each of the aggregate's groups.
|
|
135
|
+
*
|
|
136
|
+
* When the aggregation is `run()`, the returned `WixDataAggregateResult`
|
|
137
|
+
* object contains items with the following additional key:value pair:
|
|
138
|
+
* - The key is named `"count"`.
|
|
139
|
+
* - The value is the count of items aggregated in the group.
|
|
140
|
+
*
|
|
141
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
142
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
143
|
+
* @public
|
|
144
|
+
* @documentationMaturity preview
|
|
145
|
+
* @param projectedField - The name of the property in the aggregation results containing the count value.
|
|
146
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
147
|
+
*/
|
|
148
|
+
count(projectedField?: string): WixDataAggregate;
|
|
149
|
+
/**
|
|
150
|
+
* Filters out items from being used in an aggregation.
|
|
151
|
+
*
|
|
152
|
+
* The `filter()` function refines a `WixDataAggregate` so that it only
|
|
153
|
+
* includes items from the aggregate's collection which match the specified
|
|
154
|
+
* filter criteria.
|
|
155
|
+
*
|
|
156
|
+
* To create a filter, use the wix-data `filter()` function.
|
|
157
|
+
*
|
|
158
|
+
* Filtering using `filter()` takes place before grouping is performed on the
|
|
159
|
+
* aggregation. To filter grouped results, use the `having()` function.
|
|
160
|
+
*
|
|
161
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
162
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
163
|
+
* @public
|
|
164
|
+
* @documentationMaturity preview
|
|
165
|
+
* @param filterBuilder - The filter to use to filter out items from being used in the aggregation.
|
|
166
|
+
* @requiredField filterBuilder
|
|
167
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
168
|
+
*/
|
|
169
|
+
filter(filterBuilder: WixDataFilter): WixDataAggregate;
|
|
170
|
+
/**
|
|
171
|
+
* Groups items together in an aggregation.
|
|
172
|
+
*
|
|
173
|
+
* The `group()` function refines a `WixDataAggregate` so that its items are
|
|
174
|
+
* grouped by the specified property or properties.
|
|
175
|
+
*
|
|
176
|
+
* You can perform aggregations on the groups using the following functions:
|
|
177
|
+
* - `avg()`
|
|
178
|
+
* - `count()`
|
|
179
|
+
* - `max()`
|
|
180
|
+
* - `min()`
|
|
181
|
+
* - `sum()`
|
|
182
|
+
*
|
|
183
|
+
* To filter grouped results, use the `having()` function.
|
|
184
|
+
*
|
|
185
|
+
* > **Notes:**
|
|
186
|
+
* > - Aggregations can only be used on collections you have created. They cannot be used on [Wix App Collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
|
|
187
|
+
* > - You can only call the `group()` function once per aggregate query.
|
|
188
|
+
* @public
|
|
189
|
+
* @documentationMaturity preview
|
|
190
|
+
* @param fieldName - The property or properties to group on.
|
|
191
|
+
* @requiredField fieldName
|
|
192
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
193
|
+
*/
|
|
194
|
+
group(...fieldName: string[]): WixDataAggregate;
|
|
195
|
+
/**
|
|
196
|
+
* Filters out groups from being returned from an aggregation.
|
|
197
|
+
*
|
|
198
|
+
* The `having()` function refines a `WixDataAggregate` so that it only
|
|
199
|
+
* includes groups from the aggregate's grouping which match the specified
|
|
200
|
+
* filter criteria.
|
|
201
|
+
*
|
|
202
|
+
* To create a filter, use the wix-data `filter()` function.
|
|
203
|
+
*
|
|
204
|
+
* Filtering using `having()` takes place after grouping is performed on the
|
|
205
|
+
* aggregation. To filter items before grouping, use the `filter()` function.
|
|
206
|
+
*
|
|
207
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
208
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
209
|
+
* @public
|
|
210
|
+
* @documentationMaturity preview
|
|
211
|
+
* @param filterBuilder - The filter to use to filter out groups from being returned from the aggregation.
|
|
212
|
+
* @requiredField filterBuilder
|
|
213
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
214
|
+
*/
|
|
215
|
+
having(filterBuilder: WixDataFilter): WixDataAggregate;
|
|
216
|
+
/**
|
|
217
|
+
* Limits the number of items or groups the aggregation returns.
|
|
218
|
+
*
|
|
219
|
+
* The `limit()` function defines the number of results an aggregation returns in each
|
|
220
|
+
* page. Only one page of results is retrieved at a time. The `next()`
|
|
221
|
+
* function is used to navigate the pages of a query result.
|
|
222
|
+
*
|
|
223
|
+
* By default, `limit` is set to `50`.
|
|
224
|
+
*
|
|
225
|
+
* The maximum value that `limit()` can accept is `1000`.
|
|
226
|
+
*
|
|
227
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
228
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
229
|
+
* @public
|
|
230
|
+
* @documentationMaturity preview
|
|
231
|
+
* @param limitNumber - The number of items or groups to return.
|
|
232
|
+
* @requiredField limitNumber
|
|
233
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
234
|
+
*/
|
|
235
|
+
limit(limitNumber: number): WixDataAggregate;
|
|
236
|
+
/**
|
|
237
|
+
* Sets the number of items or groups to skip before returning aggregation results.
|
|
238
|
+
*
|
|
239
|
+
* The `skip()` function defines the number of results to skip in the aggregation
|
|
240
|
+
* results before returning new aggregation results.
|
|
241
|
+
*
|
|
242
|
+
* For example, if you perform an aggregation on a collection and 10 groups match
|
|
243
|
+
* your aggregation, but you set `skip` to 3, the results returned will skip
|
|
244
|
+
* the first 3 groups that match and return the 4th through 10th items.
|
|
245
|
+
*
|
|
246
|
+
* By default, `skip` is set to 0.
|
|
247
|
+
*
|
|
248
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
249
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
250
|
+
* @public
|
|
251
|
+
* @documentationMaturity preview
|
|
252
|
+
* @param skipNumber - The number of items or groups to skip in the aggregation results before returning the results.
|
|
253
|
+
* @requiredField skipNumber
|
|
254
|
+
* @returns A `WixDataAggregate` object representing the refined aggregation.
|
|
255
|
+
*/
|
|
256
|
+
skip(skipNumber: number): WixDataAggregate;
|
|
257
|
+
/**
|
|
258
|
+
* Adds a sort to a query or sort, sorting by the specified properties in descending order.
|
|
259
|
+
*
|
|
260
|
+
* The `descending()` function refines this query to sort in descending order of the specified properties. If you
|
|
261
|
+
* specify more than one property, descending() sorts the results in descending order by each property in the order
|
|
262
|
+
* they are listed.
|
|
263
|
+
*
|
|
264
|
+
* You can sort the following types:
|
|
265
|
+
*
|
|
266
|
+
* Number: Sorts numerically.
|
|
267
|
+
* - Date: Sorts by date and time.
|
|
268
|
+
* - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`.
|
|
269
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
270
|
+
*
|
|
271
|
+
* If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items
|
|
272
|
+
* that do not have a value for the specified sort property are ranked lowest.
|
|
273
|
+
* @public
|
|
274
|
+
* @documentationMaturity preview
|
|
275
|
+
* @param fields - The properties used in the sort.
|
|
276
|
+
* @requiredField fields
|
|
277
|
+
* @returns An object representing the refined query.
|
|
278
|
+
*/
|
|
279
|
+
descending(...fields: string[]): WixDataAggregate;
|
|
280
|
+
descending(fields: string[]): WixDataAggregate;
|
|
281
|
+
descending(...fields: any): WixDataAggregate;
|
|
282
|
+
/**
|
|
283
|
+
* Adds a sort to a query or sort, sorting by the specified properties in ascending order.
|
|
284
|
+
*
|
|
285
|
+
* The `ascending()` function refines this query in ascending order of the specified properties. If you specify more
|
|
286
|
+
* than one property, ascending() sorts the results in ascending order by each property in the order they are listed.
|
|
287
|
+
*
|
|
288
|
+
* You can sort the following types:
|
|
289
|
+
* - Number: Sorts numerically.
|
|
290
|
+
* - Date: Sorts by date and time.
|
|
291
|
+
* - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`.
|
|
292
|
+
* - Reference: Compares by the ID of the referenced item as a String.
|
|
293
|
+
*
|
|
294
|
+
* If a property contains a number as a String, that value will be sorted alphabetically and not numerically.
|
|
295
|
+
* Items that do not have a value for the specified sort property are ranked lowest.
|
|
296
|
+
* @public
|
|
297
|
+
* @documentationMaturity preview
|
|
298
|
+
* @param fields - The properties used in the sort.
|
|
299
|
+
* @requiredField fields
|
|
300
|
+
* @returns An object representing the refined query.
|
|
301
|
+
*/
|
|
302
|
+
ascending(...fields: string[]): WixDataAggregate;
|
|
303
|
+
ascending(fields: string[]): WixDataAggregate;
|
|
304
|
+
ascending(...fields: any): WixDataAggregate;
|
|
305
|
+
/**
|
|
306
|
+
* Runs the aggregation and returns the results.
|
|
307
|
+
*
|
|
308
|
+
* The `run()` function returns a Promise that resolves to the results found
|
|
309
|
+
* by the aggregation and some information about the results.
|
|
310
|
+
*
|
|
311
|
+
* > **Note:** Aggregations can only be used on collections you have created. They cannot be
|
|
312
|
+
* > used on [Wix App Collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
|
|
313
|
+
* @public
|
|
314
|
+
* @documentationMaturity preview
|
|
315
|
+
* @param options - Options to use when running an aggregation.
|
|
316
|
+
* @returns A Promise that resolves to the results of the aggregation.
|
|
317
|
+
*/
|
|
318
|
+
run(options?: WixDataReadOptions): Promise<WixDataResult<Record<string, any>>>;
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=WixDataAggregate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
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