@webiny/api-headless-cms-ddb 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e
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 +6 -20
- package/abstractions/CmsDdbDataLoaders.d.ts +5 -0
- package/abstractions/CmsDdbDataLoaders.js +5 -0
- package/abstractions/CmsDdbDataLoaders.js.map +1 -0
- package/abstractions/CmsDdbEntryEntity.d.ts +5 -0
- package/abstractions/CmsDdbEntryEntity.js +5 -0
- package/abstractions/CmsDdbEntryEntity.js.map +1 -0
- package/abstractions/CmsDdbGroupEntity.d.ts +5 -0
- package/abstractions/CmsDdbGroupEntity.js +5 -0
- package/abstractions/CmsDdbGroupEntity.js.map +1 -0
- package/abstractions/CmsDdbModelEntity.d.ts +5 -0
- package/abstractions/CmsDdbModelEntity.js +5 -0
- package/abstractions/CmsDdbModelEntity.js.map +1 -0
- package/abstractions/CmsDdbTable.d.ts +5 -0
- package/abstractions/CmsDdbTable.js +5 -0
- package/abstractions/CmsDdbTable.js.map +1 -0
- package/definitions/entry.d.ts +4 -6
- package/definitions/entry.js +8 -185
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +4 -6
- package/definitions/group.js +8 -63
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +4 -6
- package/definitions/model.js +8 -107
- package/definitions/model.js.map +1 -1
- package/definitions/table.d.ts +3 -5
- package/definitions/table.js +6 -29
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/index.d.ts +17 -3
- package/index.js +36 -123
- package/index.js.map +1 -1
- package/operations/entry/DdbCreateEntry.d.ts +16 -0
- package/operations/entry/DdbCreateEntry.js +77 -0
- package/operations/entry/DdbCreateEntry.js.map +1 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/DdbDeleteEntry.d.ts +16 -0
- package/operations/entry/DdbDeleteEntry.js +65 -0
- package/operations/entry/DdbDeleteEntry.js.map +1 -0
- package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
- package/operations/entry/DdbDeleteEntryRevision.js +91 -0
- package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
- package/operations/entry/DdbDeleteMultipleEntries.js +59 -0
- package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetEntriesByIds.js +31 -0
- package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetEntry.d.ts +14 -0
- package/operations/entry/DdbGetEntry.js +27 -0
- package/operations/entry/DdbGetEntry.js.map +1 -0
- package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
- package/operations/entry/DdbGetPreviousRevision.js +53 -0
- package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetRevisionById.d.ts +14 -0
- package/operations/entry/DdbGetRevisionById.js +34 -0
- package/operations/entry/DdbGetRevisionById.js.map +1 -0
- package/operations/entry/DdbGetRevisions.d.ts +14 -0
- package/operations/entry/DdbGetRevisions.js +33 -0
- package/operations/entry/DdbGetRevisions.js.map +1 -0
- package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
- package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
- package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbListEntries.d.ts +28 -0
- package/operations/entry/DdbListEntries.js +124 -0
- package/operations/entry/DdbListEntries.js.map +1 -0
- package/operations/entry/DdbMoveEntry.d.ts +14 -0
- package/operations/entry/DdbMoveEntry.js +57 -0
- package/operations/entry/DdbMoveEntry.js.map +1 -0
- package/operations/entry/DdbMoveToBin.d.ts +16 -0
- package/operations/entry/DdbMoveToBin.js +77 -0
- package/operations/entry/DdbMoveToBin.js.map +1 -0
- package/operations/entry/DdbPublishEntry.d.ts +18 -0
- package/operations/entry/DdbPublishEntry.js +162 -0
- package/operations/entry/DdbPublishEntry.js.map +1 -0
- package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
- package/operations/entry/DdbRestoreFromBin.js +78 -0
- package/operations/entry/DdbRestoreFromBin.js.map +1 -0
- package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
- package/operations/entry/DdbUnpublishEntry.js +112 -0
- package/operations/entry/DdbUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbUpdateEntry.d.ts +17 -0
- package/operations/entry/DdbUpdateEntry.js +105 -0
- package/operations/entry/DdbUpdateEntry.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +36 -52
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +36 -52
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +38 -58
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +3 -3
- package/operations/entry/dataLoader/index.js +13 -35
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +4 -4
- package/operations/entry/dataLoader/types.js +0 -7
- package/operations/entry/dataLoaders.d.ts +13 -13
- package/operations/entry/dataLoaders.js +92 -110
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +53 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/keys.d.ts +46 -2
- package/operations/entry/keys.js +52 -49
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/storageEntryUtils.d.ts +8 -0
- package/operations/entry/storageEntryUtils.js +25 -0
- package/operations/entry/storageEntryUtils.js.map +1 -0
- package/operations/group/DdbCreateGroup.d.ts +12 -0
- package/operations/group/DdbCreateGroup.js +35 -0
- package/operations/group/DdbCreateGroup.js.map +1 -0
- package/operations/group/DdbDeleteGroup.d.ts +12 -0
- package/operations/group/DdbDeleteGroup.js +31 -0
- package/operations/group/DdbDeleteGroup.js.map +1 -0
- package/operations/group/DdbGetGroup.d.ts +12 -0
- package/operations/group/DdbGetGroup.js +31 -0
- package/operations/group/DdbGetGroup.js.map +1 -0
- package/operations/group/DdbListGroups.d.ts +14 -0
- package/operations/group/DdbListGroups.js +52 -0
- package/operations/group/DdbListGroups.js.map +1 -0
- package/operations/group/DdbUpdateGroup.d.ts +12 -0
- package/operations/group/DdbUpdateGroup.js +35 -0
- package/operations/group/DdbUpdateGroup.js.map +1 -0
- package/operations/group/feature.d.ts +4 -0
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/group/keys.d.ts +15 -0
- package/operations/group/keys.js +17 -0
- package/operations/group/keys.js.map +1 -0
- package/operations/model/DdbCreateModel.d.ts +12 -0
- package/operations/model/DdbCreateModel.js +37 -0
- package/operations/model/DdbCreateModel.js.map +1 -0
- package/operations/model/DdbDeleteModel.d.ts +12 -0
- package/operations/model/DdbDeleteModel.js +31 -0
- package/operations/model/DdbDeleteModel.js.map +1 -0
- package/operations/model/DdbGetModel.d.ts +12 -0
- package/operations/model/DdbGetModel.js +30 -0
- package/operations/model/DdbGetModel.js.map +1 -0
- package/operations/model/DdbListModels.d.ts +12 -0
- package/operations/model/DdbListModels.js +36 -0
- package/operations/model/DdbListModels.js.map +1 -0
- package/operations/model/DdbUpdateModel.d.ts +12 -0
- package/operations/model/DdbUpdateModel.js +36 -0
- package/operations/model/DdbUpdateModel.js.map +1 -0
- package/operations/model/feature.d.ts +4 -0
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/operations/model/keys.d.ts +15 -0
- package/operations/model/keys.js +16 -0
- package/operations/model/keys.js.map +1 -0
- package/package.json +27 -25
- package/requestFeature.d.ts +17 -0
- package/requestFeature.js +19 -0
- package/requestFeature.js.map +1 -0
- package/types.d.ts +11 -51
- package/types.js +6 -12
- package/types.js.map +1 -1
- package/definitions/system.d.ts +0 -10
- package/definitions/system.js +0 -42
- package/definitions/system.js.map +0 -1
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -15
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/path/locationFolderId.d.ts +0 -2
- package/dynamoDb/path/locationFolderId.js +0 -43
- package/dynamoDb/path/locationFolderId.js.map +0 -1
- package/dynamoDb/path/plainObject.d.ts +0 -2
- package/dynamoDb/path/plainObject.js +0 -35
- package/dynamoDb/path/plainObject.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -94
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -2
- package/dynamoDb/storage/richText.js +0 -61
- package/dynamoDb/storage/richText.js.map +0 -1
- package/dynamoDb/transformValue/datetime.d.ts +0 -5
- package/dynamoDb/transformValue/datetime.js +0 -47
- package/dynamoDb/transformValue/datetime.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/filtering/createExpressions.d.ts +0 -26
- package/operations/entry/filtering/createExpressions.js +0 -178
- package/operations/entry/filtering/createExpressions.js.map +0 -1
- package/operations/entry/filtering/createFields.d.ts +0 -16
- package/operations/entry/filtering/createFields.js +0 -108
- package/operations/entry/filtering/createFields.js.map +0 -1
- package/operations/entry/filtering/extractSort.d.ts +0 -17
- package/operations/entry/filtering/extractSort.js +0 -69
- package/operations/entry/filtering/extractSort.js.map +0 -1
- package/operations/entry/filtering/filter.d.ts +0 -15
- package/operations/entry/filtering/filter.js +0 -158
- package/operations/entry/filtering/filter.js.map +0 -1
- package/operations/entry/filtering/fullTextSearch.d.ts +0 -14
- package/operations/entry/filtering/fullTextSearch.js +0 -50
- package/operations/entry/filtering/fullTextSearch.js.map +0 -1
- package/operations/entry/filtering/getValue.d.ts +0 -5
- package/operations/entry/filtering/getValue.js +0 -66
- package/operations/entry/filtering/getValue.js.map +0 -1
- package/operations/entry/filtering/index.d.ts +0 -2
- package/operations/entry/filtering/index.js +0 -21
- package/operations/entry/filtering/index.js.map +0 -1
- package/operations/entry/filtering/mapPlugins.d.ts +0 -8
- package/operations/entry/filtering/mapPlugins.js +0 -33
- package/operations/entry/filtering/mapPlugins.js.map +0 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -45
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/index.d.ts +0 -1
- package/operations/entry/filtering/plugins/index.js +0 -16
- package/operations/entry/filtering/plugins/index.js.map +0 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -90
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +0 -3
- package/operations/entry/filtering/plugins/refFilterCreate.js +0 -80
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +0 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +0 -2
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +0 -65
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +0 -1
- package/operations/entry/filtering/sort.d.ts +0 -12
- package/operations/entry/filtering/sort.js +0 -71
- package/operations/entry/filtering/sort.js.map +0 -1
- package/operations/entry/filtering/systemFields.d.ts +0 -4
- package/operations/entry/filtering/systemFields.js +0 -90
- package/operations/entry/filtering/systemFields.js.map +0 -1
- package/operations/entry/filtering/transform.d.ts +0 -6
- package/operations/entry/filtering/transform.js +0 -18
- package/operations/entry/filtering/transform.js.map +0 -1
- package/operations/entry/filtering/types.d.ts +0 -40
- package/operations/entry/filtering/types.js +0 -7
- package/operations/entry/filtering/types.js.map +0 -1
- package/operations/entry/filtering/values.d.ts +0 -2
- package/operations/entry/filtering/values.js +0 -24
- package/operations/entry/filtering/values.js.map +0 -1
- package/operations/entry/filtering/where.d.ts +0 -5
- package/operations/entry/filtering/where.js +0 -35
- package/operations/entry/filtering/where.js.map +0 -1
- package/operations/entry/index.d.ts +0 -8
- package/operations/entry/index.js +0 -1306
- package/operations/entry/index.js.map +0 -1
- package/operations/group/index.d.ts +0 -9
- package/operations/group/index.js +0 -174
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -7
- package/operations/model/index.js +0 -150
- package/operations/model/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -7
- package/operations/system/index.js +0 -94
- package/operations/system/index.js.map +0 -1
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +0 -23
- package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -48
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +0 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +0 -43
- package/plugins/CmsEntryFieldFilterPlugin.js +0 -27
- package/plugins/CmsEntryFieldFilterPlugin.js.map +0 -1
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +0 -42
- package/plugins/CmsEntryFieldSortingPlugin.js +0 -27
- package/plugins/CmsEntryFieldSortingPlugin.js.map +0 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +0 -11
- package/plugins/CmsFieldFilterValueTransformPlugin.js +0 -23
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -4
- package/plugins/index.js +0 -51
- package/plugins/index.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createDefaultFilterCreate = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
-
const createDefaultFilterCreate = () => {
|
|
11
|
-
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
12
|
-
fieldType: _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin.ALL,
|
|
13
|
-
create: params => {
|
|
14
|
-
const {
|
|
15
|
-
negate,
|
|
16
|
-
transformValue,
|
|
17
|
-
field,
|
|
18
|
-
compareValue,
|
|
19
|
-
valueFilterPlugins
|
|
20
|
-
} = params;
|
|
21
|
-
const plugin = valueFilterPlugins[params.operation];
|
|
22
|
-
if (!plugin) {
|
|
23
|
-
throw new _error.default(`Missing ValueFilterPlugin for operation "${params.operation}".`, "MISSING_OPERATION_PLUGIN", {
|
|
24
|
-
operation: params.operation
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
negate,
|
|
29
|
-
transformValue,
|
|
30
|
-
field,
|
|
31
|
-
compareValue,
|
|
32
|
-
fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join("."),
|
|
33
|
-
path: field.createPath({
|
|
34
|
-
field
|
|
35
|
-
}),
|
|
36
|
-
plugin
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
plugin.name = `headless-cms.ddb.filter.default`;
|
|
41
|
-
return plugin;
|
|
42
|
-
};
|
|
43
|
-
exports.createDefaultFilterCreate = createDefaultFilterCreate;
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=defaultFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","createDefaultFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","ALL","create","params","negate","transformValue","field","compareValue","valueFilterPlugins","operation","WebinyError","fieldPathId","parents","map","f","fieldId","join","path","createPath","name","exports"],"sources":["defaultFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\n\nexport const createDefaultFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: CmsEntryFieldFilterPlugin.ALL,\n create: params => {\n const { negate, transformValue, field, compareValue, valueFilterPlugins } = params;\n const plugin = valueFilterPlugins[params.operation];\n if (!plugin) {\n throw new WebinyError(\n `Missing ValueFilterPlugin for operation \"${params.operation}\".`,\n \"MISSING_OPERATION_PLUGIN\",\n {\n operation: params.operation\n }\n );\n }\n return {\n negate,\n transformValue,\n field,\n compareValue,\n fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join(\".\"),\n path: field.createPath({\n field\n }),\n plugin\n };\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAED,oDAAyB,CAACE,GAAG;IACxCC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,MAAM;QAAEC,cAAc;QAAEC,KAAK;QAAEC,YAAY;QAAEC;MAAmB,CAAC,GAAGL,MAAM;MAClF,MAAML,MAAM,GAAGU,kBAAkB,CAACL,MAAM,CAACM,SAAS,CAAC;MACnD,IAAI,CAACX,MAAM,EAAE;QACT,MAAM,IAAIY,cAAW,CACjB,4CAA4CP,MAAM,CAACM,SAAS,IAAI,EAChE,0BAA0B,EAC1B;UACIA,SAAS,EAAEN,MAAM,CAACM;QACtB,CACJ,CAAC;MACL;MACA,OAAO;QACHL,MAAM;QACNC,cAAc;QACdC,KAAK;QACLC,YAAY;QACZI,WAAW,EAAE,CAAC,GAAGL,KAAK,CAACM,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,EAAET,KAAK,CAACS,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;QAC5EC,IAAI,EAAEX,KAAK,CAACY,UAAU,CAAC;UACnBZ;QACJ,CAAC,CAAC;QACFR;MACJ,CAAC;IACL;EACJ,CAAC,CAAC;EAEFA,MAAM,CAACqB,IAAI,GAAG,iCAAiC;EAE/C,OAAOrB,MAAM;AACjB,CAAC;AAACsB,OAAA,CAAAvB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createFilterCreatePlugins: () => import("../../../..").CmsEntryFieldFilterPlugin<import("@webiny/api/types").GenericRecord | null | undefined>[];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createFilterCreatePlugins = void 0;
|
|
7
|
-
var _defaultFilterCreate = require("./defaultFilterCreate");
|
|
8
|
-
var _refFilterCreate = require("./refFilterCreate");
|
|
9
|
-
var _objectFilterCreate = require("./objectFilterCreate");
|
|
10
|
-
var _searchableJsonFilterCreate = require("./searchableJsonFilterCreate");
|
|
11
|
-
const createFilterCreatePlugins = () => {
|
|
12
|
-
return [(0, _defaultFilterCreate.createDefaultFilterCreate)(), (0, _refFilterCreate.createRefFilterCreate)(), (0, _objectFilterCreate.objectFilterCreate)(), (0, _searchableJsonFilterCreate.searchableJsonFilterCreate)()];
|
|
13
|
-
};
|
|
14
|
-
exports.createFilterCreatePlugins = createFilterCreatePlugins;
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_defaultFilterCreate","require","_refFilterCreate","_objectFilterCreate","_searchableJsonFilterCreate","createFilterCreatePlugins","createDefaultFilterCreate","createRefFilterCreate","objectFilterCreate","searchableJsonFilterCreate","exports"],"sources":["index.ts"],"sourcesContent":["import { createDefaultFilterCreate } from \"./defaultFilterCreate\";\nimport { createRefFilterCreate } from \"./refFilterCreate\";\nimport { objectFilterCreate } from \"./objectFilterCreate\";\nimport { searchableJsonFilterCreate } from \"./searchableJsonFilterCreate\";\n\nexport const createFilterCreatePlugins = () => {\n return [\n createDefaultFilterCreate(),\n createRefFilterCreate(),\n objectFilterCreate(),\n searchableJsonFilterCreate()\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAEO,MAAMI,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,CACH,IAAAC,8CAAyB,EAAC,CAAC,EAC3B,IAAAC,sCAAqB,EAAC,CAAC,EACvB,IAAAC,sCAAkB,EAAC,CAAC,EACpB,IAAAC,sDAA0B,EAAC,CAAC,CAC/B;AACL,CAAC;AAACC,OAAA,CAAAL,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.objectFilterCreate = void 0;
|
|
8
|
-
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
9
|
-
var _where = require("../where");
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
var _transform = require("../transform");
|
|
12
|
-
const objectFilterCreate = () => {
|
|
13
|
-
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
14
|
-
fieldType: "object",
|
|
15
|
-
create: params => {
|
|
16
|
-
const {
|
|
17
|
-
value: objectValue,
|
|
18
|
-
valueFilterPlugins,
|
|
19
|
-
transformValuePlugins,
|
|
20
|
-
getFilterCreatePlugin,
|
|
21
|
-
field: parentField,
|
|
22
|
-
fields
|
|
23
|
-
} = params;
|
|
24
|
-
const filters = [];
|
|
25
|
-
for (const key in objectValue) {
|
|
26
|
-
const value = objectValue[key];
|
|
27
|
-
if (value === undefined) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
const whereParams = (0, _where.extractWhereParams)(key);
|
|
31
|
-
if (!whereParams) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
const {
|
|
35
|
-
negate,
|
|
36
|
-
fieldId,
|
|
37
|
-
operation
|
|
38
|
-
} = whereParams;
|
|
39
|
-
const fieldPath = parentField.parents.map(p => p.fieldId).concat([parentField.fieldId, fieldId]).join(".");
|
|
40
|
-
const field = fields[fieldPath];
|
|
41
|
-
if (!field) {
|
|
42
|
-
throw new _error.default(`There is no field with the field path "${fieldPath}".`, "FIELD_ERROR", {
|
|
43
|
-
fieldId
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const filterCreatePlugin = getFilterCreatePlugin(field.type);
|
|
47
|
-
const transformValuePlugin = transformValuePlugins[field.type];
|
|
48
|
-
const transformValueCallable = value => {
|
|
49
|
-
if (!transformValuePlugin) {
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
return transformValuePlugin.transform({
|
|
53
|
-
field,
|
|
54
|
-
value
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
const result = filterCreatePlugin.create({
|
|
58
|
-
key,
|
|
59
|
-
value,
|
|
60
|
-
valueFilterPlugins,
|
|
61
|
-
transformValuePlugins,
|
|
62
|
-
getFilterCreatePlugin,
|
|
63
|
-
operation,
|
|
64
|
-
negate,
|
|
65
|
-
field,
|
|
66
|
-
fields,
|
|
67
|
-
compareValue: (0, _transform.transformValue)({
|
|
68
|
-
value,
|
|
69
|
-
transform: transformValueCallable
|
|
70
|
-
}),
|
|
71
|
-
transformValue: transformValueCallable
|
|
72
|
-
});
|
|
73
|
-
if (!result) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (Array.isArray(result)) {
|
|
77
|
-
filters.push(...result);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
filters.push(result);
|
|
81
|
-
}
|
|
82
|
-
return filters;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
plugin.name = `headless-cms.ddb.filter.object`;
|
|
86
|
-
return plugin;
|
|
87
|
-
};
|
|
88
|
-
exports.objectFilterCreate = objectFilterCreate;
|
|
89
|
-
|
|
90
|
-
//# sourceMappingURL=objectFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_CmsEntryFieldFilterPlugin","require","_where","_error","_interopRequireDefault","_transform","objectFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","value","objectValue","valueFilterPlugins","transformValuePlugins","getFilterCreatePlugin","field","parentField","fields","filters","key","undefined","whereParams","extractWhereParams","negate","fieldId","operation","fieldPath","parents","map","p","concat","join","WebinyError","filterCreatePlugin","type","transformValuePlugin","transformValueCallable","transform","result","compareValue","transformValue","Array","isArray","push","name","exports"],"sources":["objectFilterCreate.ts"],"sourcesContent":["import { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { transformValue } from \"~/operations/entry/filtering/transform\";\n\nexport const objectFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"object\",\n create: params => {\n const {\n value: objectValue,\n valueFilterPlugins,\n transformValuePlugins,\n getFilterCreatePlugin,\n field: parentField,\n fields\n } = params;\n\n const filters = [];\n\n for (const key in objectValue) {\n const value = objectValue[key];\n if (value === undefined) {\n continue;\n }\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n const { negate, fieldId, operation } = whereParams;\n\n const fieldPath = parentField.parents\n .map(p => p.fieldId)\n .concat([parentField.fieldId, fieldId])\n .join(\".\");\n\n const field = fields[fieldPath];\n if (!field) {\n throw new WebinyError(\n `There is no field with the field path \"${fieldPath}\".`,\n \"FIELD_ERROR\",\n {\n fieldId\n }\n );\n }\n\n const filterCreatePlugin = getFilterCreatePlugin(field.type);\n\n const transformValuePlugin: CmsFieldFilterValueTransformPlugin =\n transformValuePlugins[field.type];\n\n const transformValueCallable = (value: any) => {\n if (!transformValuePlugin) {\n return value;\n }\n return transformValuePlugin.transform({\n field,\n value\n });\n };\n\n const result = filterCreatePlugin.create({\n key,\n value,\n valueFilterPlugins,\n transformValuePlugins,\n getFilterCreatePlugin,\n operation,\n negate,\n field,\n fields,\n compareValue: transformValue({\n value,\n transform: transformValueCallable\n }),\n transformValue: transformValueCallable\n });\n if (!result) {\n continue;\n }\n if (Array.isArray(result)) {\n filters.push(...result);\n continue;\n }\n\n filters.push(result);\n }\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.object`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEO,MAAMK,kBAAkB,GAAGA,CAAA,KAAM;EACpC,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAE,QAAQ;IACnBC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QACFC,KAAK,EAAEC,WAAW;QAClBC,kBAAkB;QAClBC,qBAAqB;QACrBC,qBAAqB;QACrBC,KAAK,EAAEC,WAAW;QAClBC;MACJ,CAAC,GAAGR,MAAM;MAEV,MAAMS,OAAO,GAAG,EAAE;MAElB,KAAK,MAAMC,GAAG,IAAIR,WAAW,EAAE;QAC3B,MAAMD,KAAK,GAAGC,WAAW,CAACQ,GAAG,CAAC;QAC9B,IAAIT,KAAK,KAAKU,SAAS,EAAE;UACrB;QACJ;QACA,MAAMC,WAAW,GAAG,IAAAC,yBAAkB,EAACH,GAAG,CAAC;QAC3C,IAAI,CAACE,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,MAAM;UAAEC,OAAO;UAAEC;QAAU,CAAC,GAAGJ,WAAW;QAElD,MAAMK,SAAS,GAAGV,WAAW,CAACW,OAAO,CAChCC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACL,OAAO,CAAC,CACnBM,MAAM,CAAC,CAACd,WAAW,CAACQ,OAAO,EAAEA,OAAO,CAAC,CAAC,CACtCO,IAAI,CAAC,GAAG,CAAC;QAEd,MAAMhB,KAAK,GAAGE,MAAM,CAACS,SAAS,CAAC;QAC/B,IAAI,CAACX,KAAK,EAAE;UACR,MAAM,IAAIiB,cAAW,CACjB,0CAA0CN,SAAS,IAAI,EACvD,aAAa,EACb;YACIF;UACJ,CACJ,CAAC;QACL;QAEA,MAAMS,kBAAkB,GAAGnB,qBAAqB,CAACC,KAAK,CAACmB,IAAI,CAAC;QAE5D,MAAMC,oBAAwD,GAC1DtB,qBAAqB,CAACE,KAAK,CAACmB,IAAI,CAAC;QAErC,MAAME,sBAAsB,GAAI1B,KAAU,IAAK;UAC3C,IAAI,CAACyB,oBAAoB,EAAE;YACvB,OAAOzB,KAAK;UAChB;UACA,OAAOyB,oBAAoB,CAACE,SAAS,CAAC;YAClCtB,KAAK;YACLL;UACJ,CAAC,CAAC;QACN,CAAC;QAED,MAAM4B,MAAM,GAAGL,kBAAkB,CAACzB,MAAM,CAAC;UACrCW,GAAG;UACHT,KAAK;UACLE,kBAAkB;UAClBC,qBAAqB;UACrBC,qBAAqB;UACrBW,SAAS;UACTF,MAAM;UACNR,KAAK;UACLE,MAAM;UACNsB,YAAY,EAAE,IAAAC,yBAAc,EAAC;YACzB9B,KAAK;YACL2B,SAAS,EAAED;UACf,CAAC,CAAC;UACFI,cAAc,EAAEJ;QACpB,CAAC,CAAC;QACF,IAAI,CAACE,MAAM,EAAE;UACT;QACJ;QACA,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,EAAE;UACvBpB,OAAO,CAACyB,IAAI,CAAC,GAAGL,MAAM,CAAC;UACvB;QACJ;QAEApB,OAAO,CAACyB,IAAI,CAACL,MAAM,CAAC;MACxB;MACA,OAAOpB,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFb,MAAM,CAACuC,IAAI,GAAG,gCAAgC;EAE9C,OAAOvC,MAAM;AACjB,CAAC;AAACwC,OAAA,CAAAzC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createRefFilterCreate = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
-
var _where = require("../where");
|
|
11
|
-
var _transform = require("../transform");
|
|
12
|
-
const createRefFilterCreate = () => {
|
|
13
|
-
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
14
|
-
fieldType: "ref",
|
|
15
|
-
create: params => {
|
|
16
|
-
const {
|
|
17
|
-
valueFilterPlugins,
|
|
18
|
-
transformValuePlugins,
|
|
19
|
-
field
|
|
20
|
-
} = params;
|
|
21
|
-
let value = params.value;
|
|
22
|
-
if (!value) {
|
|
23
|
-
value = {
|
|
24
|
-
entryId: null
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const propertyFilters = Object.keys(value);
|
|
28
|
-
if (propertyFilters.length === 0) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const filters = [];
|
|
32
|
-
for (const propertyFilter of propertyFilters) {
|
|
33
|
-
const whereParams = (0, _where.extractWhereParams)(propertyFilter);
|
|
34
|
-
if (!whereParams) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const {
|
|
38
|
-
fieldId: propertyId,
|
|
39
|
-
operation: propertyOperation,
|
|
40
|
-
negate
|
|
41
|
-
} = whereParams;
|
|
42
|
-
const transformValuePlugin = transformValuePlugins[field.type];
|
|
43
|
-
const transformValueCallable = value => {
|
|
44
|
-
if (!transformValuePlugin) {
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
return transformValuePlugin.transform({
|
|
48
|
-
field,
|
|
49
|
-
value
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
const filterPlugin = valueFilterPlugins[propertyOperation];
|
|
53
|
-
if (!filterPlugin) {
|
|
54
|
-
throw new _error.default(`Missing operation filter for "${propertyOperation}".`, "MISSING_OPERATION_FILTER");
|
|
55
|
-
}
|
|
56
|
-
const paths = [field.createPath({
|
|
57
|
-
field
|
|
58
|
-
}), propertyId];
|
|
59
|
-
filters.push({
|
|
60
|
-
field,
|
|
61
|
-
path: paths.join("."),
|
|
62
|
-
fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join("."),
|
|
63
|
-
plugin: filterPlugin,
|
|
64
|
-
negate,
|
|
65
|
-
compareValue: (0, _transform.transformValue)({
|
|
66
|
-
value: value[propertyFilter],
|
|
67
|
-
transform: transformValueCallable
|
|
68
|
-
}),
|
|
69
|
-
transformValue: transformValueCallable
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return filters;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
plugin.name = `headless-cms.ddb.filter.ref`;
|
|
76
|
-
return plugin;
|
|
77
|
-
};
|
|
78
|
-
exports.createRefFilterCreate = createRefFilterCreate;
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=refFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","_where","_transform","createRefFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","valueFilterPlugins","transformValuePlugins","field","value","entryId","propertyFilters","Object","keys","length","filters","propertyFilter","whereParams","extractWhereParams","fieldId","propertyId","operation","propertyOperation","negate","transformValuePlugin","type","transformValueCallable","transform","filterPlugin","WebinyError","paths","createPath","push","path","join","fieldPathId","parents","map","f","compareValue","transformValue","name","exports"],"sources":["refFilterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\nimport { transformValue } from \"~/operations/entry/filtering/transform\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport const createRefFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin<GenericRecord | null | undefined>({\n fieldType: \"ref\",\n create: params => {\n const { valueFilterPlugins, transformValuePlugins, field } = params;\n let value = params.value;\n if (!value) {\n value = {\n entryId: null\n };\n }\n const propertyFilters = Object.keys(value);\n if (propertyFilters.length === 0) {\n return null;\n }\n const filters: CmsEntryFieldFilterPluginCreateResponse[] = [];\n\n for (const propertyFilter of propertyFilters) {\n const whereParams = extractWhereParams(propertyFilter);\n if (!whereParams) {\n continue;\n }\n const { fieldId: propertyId, operation: propertyOperation, negate } = whereParams;\n\n const transformValuePlugin = transformValuePlugins[field.type];\n\n const transformValueCallable = (value: any) => {\n if (!transformValuePlugin) {\n return value;\n }\n return transformValuePlugin.transform({\n field,\n value\n });\n };\n\n const filterPlugin = valueFilterPlugins[propertyOperation];\n if (!filterPlugin) {\n throw new WebinyError(\n `Missing operation filter for \"${propertyOperation}\".`,\n \"MISSING_OPERATION_FILTER\"\n );\n }\n\n const paths = [\n field.createPath({\n field\n }),\n propertyId\n ];\n\n filters.push({\n field,\n path: paths.join(\".\"),\n fieldPathId: [...field.parents.map(f => f.fieldId), field.fieldId].join(\".\"),\n plugin: filterPlugin,\n negate,\n compareValue: transformValue({\n value: value[propertyFilter],\n transform: transformValueCallable\n }),\n transformValue: transformValueCallable\n });\n }\n\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.ref`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAGO,MAAMI,qBAAqB,GAAGA,CAAA,KAAM;EACvC,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAmC;IAC3EC,SAAS,EAAE,KAAK;IAChBC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,kBAAkB;QAAEC,qBAAqB;QAAEC;MAAM,CAAC,GAAGH,MAAM;MACnE,IAAII,KAAK,GAAGJ,MAAM,CAACI,KAAK;MACxB,IAAI,CAACA,KAAK,EAAE;QACRA,KAAK,GAAG;UACJC,OAAO,EAAE;QACb,CAAC;MACL;MACA,MAAMC,eAAe,GAAGC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC;MAC1C,IAAIE,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI;MACf;MACA,MAAMC,OAAkD,GAAG,EAAE;MAE7D,KAAK,MAAMC,cAAc,IAAIL,eAAe,EAAE;QAC1C,MAAMM,WAAW,GAAG,IAAAC,yBAAkB,EAACF,cAAc,CAAC;QACtD,IAAI,CAACC,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,OAAO,EAAEC,UAAU;UAAEC,SAAS,EAAEC,iBAAiB;UAAEC;QAAO,CAAC,GAAGN,WAAW;QAEjF,MAAMO,oBAAoB,GAAGjB,qBAAqB,CAACC,KAAK,CAACiB,IAAI,CAAC;QAE9D,MAAMC,sBAAsB,GAAIjB,KAAU,IAAK;UAC3C,IAAI,CAACe,oBAAoB,EAAE;YACvB,OAAOf,KAAK;UAChB;UACA,OAAOe,oBAAoB,CAACG,SAAS,CAAC;YAClCnB,KAAK;YACLC;UACJ,CAAC,CAAC;QACN,CAAC;QAED,MAAMmB,YAAY,GAAGtB,kBAAkB,CAACgB,iBAAiB,CAAC;QAC1D,IAAI,CAACM,YAAY,EAAE;UACf,MAAM,IAAIC,cAAW,CACjB,iCAAiCP,iBAAiB,IAAI,EACtD,0BACJ,CAAC;QACL;QAEA,MAAMQ,KAAK,GAAG,CACVtB,KAAK,CAACuB,UAAU,CAAC;UACbvB;QACJ,CAAC,CAAC,EACFY,UAAU,CACb;QAEDL,OAAO,CAACiB,IAAI,CAAC;UACTxB,KAAK;UACLyB,IAAI,EAAEH,KAAK,CAACI,IAAI,CAAC,GAAG,CAAC;UACrBC,WAAW,EAAE,CAAC,GAAG3B,KAAK,CAAC4B,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACnB,OAAO,CAAC,EAAEX,KAAK,CAACW,OAAO,CAAC,CAACe,IAAI,CAAC,GAAG,CAAC;UAC5EjC,MAAM,EAAE2B,YAAY;UACpBL,MAAM;UACNgB,YAAY,EAAE,IAAAC,yBAAc,EAAC;YACzB/B,KAAK,EAAEA,KAAK,CAACO,cAAc,CAAC;YAC5BW,SAAS,EAAED;UACf,CAAC,CAAC;UACFc,cAAc,EAAEd;QACpB,CAAC,CAAC;MACN;MAEA,OAAOX,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFd,MAAM,CAACwC,IAAI,GAAG,6BAA6B;EAE3C,OAAOxC,MAAM;AACjB,CAAC;AAACyC,OAAA,CAAA1C,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.searchableJsonFilterCreate = void 0;
|
|
8
|
-
var _dotObject = _interopRequireDefault(require("dot-object"));
|
|
9
|
-
var _CmsEntryFieldFilterPlugin = require("../../../../plugins/CmsEntryFieldFilterPlugin");
|
|
10
|
-
var _where = require("../where");
|
|
11
|
-
const searchableJsonFilterCreate = () => {
|
|
12
|
-
const plugin = new _CmsEntryFieldFilterPlugin.CmsEntryFieldFilterPlugin({
|
|
13
|
-
fieldType: "searchable-json",
|
|
14
|
-
create: params => {
|
|
15
|
-
const {
|
|
16
|
-
value: objectValue,
|
|
17
|
-
valueFilterPlugins,
|
|
18
|
-
field: parentField
|
|
19
|
-
} = params;
|
|
20
|
-
const filters = [];
|
|
21
|
-
const accessPatterns = _dotObject.default.dot(objectValue);
|
|
22
|
-
for (const key in accessPatterns) {
|
|
23
|
-
const value = accessPatterns[key];
|
|
24
|
-
if (value === undefined) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const whereParams = (0, _where.extractWhereParams)(key);
|
|
28
|
-
if (!whereParams) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const {
|
|
32
|
-
negate,
|
|
33
|
-
operation
|
|
34
|
-
} = whereParams;
|
|
35
|
-
const transformValueCallable = value => {
|
|
36
|
-
return value;
|
|
37
|
-
};
|
|
38
|
-
const fieldId = `${parentField.fieldId}.${whereParams.fieldId ?? key}`;
|
|
39
|
-
const result = {
|
|
40
|
-
field: parentField,
|
|
41
|
-
path: `values.${fieldId}`,
|
|
42
|
-
fieldPathId: `values.${fieldId}`,
|
|
43
|
-
negate,
|
|
44
|
-
plugin: valueFilterPlugins[operation],
|
|
45
|
-
compareValue: value,
|
|
46
|
-
transformValue: transformValueCallable
|
|
47
|
-
};
|
|
48
|
-
if (!result) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(result)) {
|
|
52
|
-
filters.push(...result);
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
filters.push(result);
|
|
56
|
-
}
|
|
57
|
-
return filters;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
plugin.name = `headless-cms.ddb.filter.searchable-json`;
|
|
61
|
-
return plugin;
|
|
62
|
-
};
|
|
63
|
-
exports.searchableJsonFilterCreate = searchableJsonFilterCreate;
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=searchableJsonFilterCreate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_dotObject","_interopRequireDefault","require","_CmsEntryFieldFilterPlugin","_where","searchableJsonFilterCreate","plugin","CmsEntryFieldFilterPlugin","fieldType","create","params","value","objectValue","valueFilterPlugins","field","parentField","filters","accessPatterns","dot","key","undefined","whereParams","extractWhereParams","negate","operation","transformValueCallable","fieldId","result","path","fieldPathId","compareValue","transformValue","Array","isArray","push","name","exports"],"sources":["searchableJsonFilterCreate.ts"],"sourcesContent":["import dot from \"dot-object\";\nimport type { CmsEntryFieldFilterPluginCreateResponse } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { CmsEntryFieldFilterPlugin } from \"~/plugins/CmsEntryFieldFilterPlugin\";\nimport { extractWhereParams } from \"~/operations/entry/filtering/where\";\n\nexport const searchableJsonFilterCreate = () => {\n const plugin = new CmsEntryFieldFilterPlugin({\n fieldType: \"searchable-json\",\n create: params => {\n const { value: objectValue, valueFilterPlugins, field: parentField } = params;\n\n const filters = [];\n\n const accessPatterns = dot.dot(objectValue);\n\n for (const key in accessPatterns) {\n const value = accessPatterns[key];\n if (value === undefined) {\n continue;\n }\n\n const whereParams = extractWhereParams(key);\n if (!whereParams) {\n continue;\n }\n const { negate, operation } = whereParams;\n\n const transformValueCallable = (value: any) => {\n return value;\n };\n\n const fieldId = `${parentField.fieldId}.${whereParams.fieldId ?? key}`;\n\n const result: CmsEntryFieldFilterPluginCreateResponse = {\n field: parentField,\n path: `values.${fieldId}`,\n fieldPathId: `values.${fieldId}`,\n negate,\n plugin: valueFilterPlugins[operation],\n compareValue: value,\n transformValue: transformValueCallable\n };\n\n if (!result) {\n continue;\n }\n if (Array.isArray(result)) {\n filters.push(...result);\n continue;\n }\n\n filters.push(result);\n }\n return filters;\n }\n });\n\n plugin.name = `headless-cms.ddb.filter.searchable-json`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,0BAA0B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,MAAM,GAAG,IAAIC,oDAAyB,CAAC;IACzCC,SAAS,EAAE,iBAAiB;IAC5BC,MAAM,EAAEC,MAAM,IAAI;MACd,MAAM;QAAEC,KAAK,EAAEC,WAAW;QAAEC,kBAAkB;QAAEC,KAAK,EAAEC;MAAY,CAAC,GAAGL,MAAM;MAE7E,MAAMM,OAAO,GAAG,EAAE;MAElB,MAAMC,cAAc,GAAGC,kBAAG,CAACA,GAAG,CAACN,WAAW,CAAC;MAE3C,KAAK,MAAMO,GAAG,IAAIF,cAAc,EAAE;QAC9B,MAAMN,KAAK,GAAGM,cAAc,CAACE,GAAG,CAAC;QACjC,IAAIR,KAAK,KAAKS,SAAS,EAAE;UACrB;QACJ;QAEA,MAAMC,WAAW,GAAG,IAAAC,yBAAkB,EAACH,GAAG,CAAC;QAC3C,IAAI,CAACE,WAAW,EAAE;UACd;QACJ;QACA,MAAM;UAAEE,MAAM;UAAEC;QAAU,CAAC,GAAGH,WAAW;QAEzC,MAAMI,sBAAsB,GAAId,KAAU,IAAK;UAC3C,OAAOA,KAAK;QAChB,CAAC;QAED,MAAMe,OAAO,GAAG,GAAGX,WAAW,CAACW,OAAO,IAAIL,WAAW,CAACK,OAAO,IAAIP,GAAG,EAAE;QAEtE,MAAMQ,MAA+C,GAAG;UACpDb,KAAK,EAAEC,WAAW;UAClBa,IAAI,EAAE,UAAUF,OAAO,EAAE;UACzBG,WAAW,EAAE,UAAUH,OAAO,EAAE;UAChCH,MAAM;UACNjB,MAAM,EAAEO,kBAAkB,CAACW,SAAS,CAAC;UACrCM,YAAY,EAAEnB,KAAK;UACnBoB,cAAc,EAAEN;QACpB,CAAC;QAED,IAAI,CAACE,MAAM,EAAE;UACT;QACJ;QACA,IAAIK,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,EAAE;UACvBX,OAAO,CAACkB,IAAI,CAAC,GAAGP,MAAM,CAAC;UACvB;QACJ;QAEAX,OAAO,CAACkB,IAAI,CAACP,MAAM,CAAC;MACxB;MACA,OAAOX,OAAO;IAClB;EACJ,CAAC,CAAC;EAEFV,MAAM,CAAC6B,IAAI,GAAG,yCAAyC;EAEvD,OAAO7B,MAAM;AACjB,CAAC;AAAC8B,OAAA,CAAA/B,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import type { Field } from "./types";
|
|
3
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
interface Params {
|
|
5
|
-
model: CmsModel;
|
|
6
|
-
items: CmsEntry[];
|
|
7
|
-
sort?: string[];
|
|
8
|
-
fields: Record<string, Field>;
|
|
9
|
-
plugins: PluginsContainer;
|
|
10
|
-
}
|
|
11
|
-
export declare const sort: (params: Params) => CmsEntry[];
|
|
12
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.sort = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _dotProp = _interopRequireDefault(require("dot-prop"));
|
|
10
|
-
var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
|
|
11
|
-
var _extractSort = require("./extractSort");
|
|
12
|
-
const sort = params => {
|
|
13
|
-
const {
|
|
14
|
-
model,
|
|
15
|
-
items,
|
|
16
|
-
sort = [],
|
|
17
|
-
fields,
|
|
18
|
-
plugins
|
|
19
|
-
} = params;
|
|
20
|
-
if (items.length <= 1) {
|
|
21
|
-
return items;
|
|
22
|
-
} else if (sort.length === 0) {
|
|
23
|
-
sort.push("savedOn_DESC");
|
|
24
|
-
} else if (sort.length > 1) {
|
|
25
|
-
throw new _error.default("Sorting is limited to a single field on DynamoDB only system.", "SORT_MULTIPLE_FIELDS_ERROR", {
|
|
26
|
-
sort
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
const [firstSort] = sort;
|
|
30
|
-
if (!firstSort) {
|
|
31
|
-
throw new _error.default("Empty sort array item.", "SORT_EMPTY_ERROR", {
|
|
32
|
-
sort
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const {
|
|
36
|
-
fieldId,
|
|
37
|
-
field,
|
|
38
|
-
valuePath,
|
|
39
|
-
reverse
|
|
40
|
-
} = (0, _extractSort.extractSort)({
|
|
41
|
-
model,
|
|
42
|
-
sortBy: firstSort,
|
|
43
|
-
fields,
|
|
44
|
-
plugins
|
|
45
|
-
});
|
|
46
|
-
const itemsToSort = items.map(item => {
|
|
47
|
-
return {
|
|
48
|
-
id: item.id,
|
|
49
|
-
value: field.transform(_dotProp.default.get(item, valuePath))
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
const sortedItems = (0, _sortBy.default)(itemsToSort, "value");
|
|
53
|
-
const newItems = sortedItems.map(s => {
|
|
54
|
-
const item = items.find(i => i.id === s.id);
|
|
55
|
-
if (item) {
|
|
56
|
-
return item;
|
|
57
|
-
}
|
|
58
|
-
throw new _error.default("Could not find item by given id after the sorting.", "SORTING_ITEMS_ERROR", {
|
|
59
|
-
id: s.id,
|
|
60
|
-
sortingBy: fieldId,
|
|
61
|
-
reverse
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
if (!reverse) {
|
|
65
|
-
return newItems;
|
|
66
|
-
}
|
|
67
|
-
return newItems.reverse();
|
|
68
|
-
};
|
|
69
|
-
exports.sort = sort;
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_dotProp","_sortBy","_extractSort","sort","params","model","items","fields","plugins","length","push","WebinyError","firstSort","fieldId","field","valuePath","reverse","extractSort","sortBy","itemsToSort","map","item","id","value","transform","dotProp","get","sortedItems","lodashSortBy","newItems","s","find","i","sortingBy","exports"],"sources":["sort.ts"],"sourcesContent":["import type { CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport dotProp from \"dot-prop\";\nimport lodashSortBy from \"lodash/sortBy\";\nimport { extractSort } from \"./extractSort\";\nimport type { Field } from \"./types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\ninterface Params {\n model: CmsModel;\n items: CmsEntry[];\n sort?: string[];\n fields: Record<string, Field>;\n plugins: PluginsContainer;\n}\n\ninterface SortedItem {\n id: string;\n value: any;\n}\n\nexport const sort = (params: Params): CmsEntry[] => {\n const { model, items, sort = [], fields, plugins } = params;\n if (items.length <= 1) {\n return items;\n } else if (sort.length === 0) {\n sort.push(\"savedOn_DESC\");\n } else if (sort.length > 1) {\n throw new WebinyError(\n \"Sorting is limited to a single field on DynamoDB only system.\",\n \"SORT_MULTIPLE_FIELDS_ERROR\",\n {\n sort\n }\n );\n }\n const [firstSort] = sort;\n if (!firstSort) {\n throw new WebinyError(\"Empty sort array item.\", \"SORT_EMPTY_ERROR\", {\n sort\n });\n }\n\n const { fieldId, field, valuePath, reverse } = extractSort({\n model,\n sortBy: firstSort,\n fields,\n plugins\n });\n\n const itemsToSort = items.map(item => {\n return {\n id: item.id,\n value: field.transform(dotProp.get(item, valuePath))\n };\n });\n const sortedItems: SortedItem[] = lodashSortBy(itemsToSort, \"value\");\n const newItems = sortedItems.map(s => {\n const item = items.find(i => i.id === s.id);\n if (item) {\n return item;\n }\n throw new WebinyError(\n \"Could not find item by given id after the sorting.\",\n \"SORTING_ITEMS_ERROR\",\n {\n id: s.id,\n sortingBy: fieldId,\n reverse\n }\n );\n });\n if (!reverse) {\n return newItems;\n }\n return newItems.reverse();\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAiBO,MAAMI,IAAI,GAAIC,MAAc,IAAiB;EAChD,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEH,IAAI,GAAG,EAAE;IAAEI,MAAM;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC3D,IAAIE,KAAK,CAACG,MAAM,IAAI,CAAC,EAAE;IACnB,OAAOH,KAAK;EAChB,CAAC,MAAM,IAAIH,IAAI,CAACM,MAAM,KAAK,CAAC,EAAE;IAC1BN,IAAI,CAACO,IAAI,CAAC,cAAc,CAAC;EAC7B,CAAC,MAAM,IAAIP,IAAI,CAACM,MAAM,GAAG,CAAC,EAAE;IACxB,MAAM,IAAIE,cAAW,CACjB,+DAA+D,EAC/D,4BAA4B,EAC5B;MACIR;IACJ,CACJ,CAAC;EACL;EACA,MAAM,CAACS,SAAS,CAAC,GAAGT,IAAI;EACxB,IAAI,CAACS,SAAS,EAAE;IACZ,MAAM,IAAID,cAAW,CAAC,wBAAwB,EAAE,kBAAkB,EAAE;MAChER;IACJ,CAAC,CAAC;EACN;EAEA,MAAM;IAAEU,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAG,IAAAC,wBAAW,EAAC;IACvDZ,KAAK;IACLa,MAAM,EAAEN,SAAS;IACjBL,MAAM;IACNC;EACJ,CAAC,CAAC;EAEF,MAAMW,WAAW,GAAGb,KAAK,CAACc,GAAG,CAACC,IAAI,IAAI;IAClC,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,KAAK,EAAET,KAAK,CAACU,SAAS,CAACC,gBAAO,CAACC,GAAG,CAACL,IAAI,EAAEN,SAAS,CAAC;IACvD,CAAC;EACL,CAAC,CAAC;EACF,MAAMY,WAAyB,GAAG,IAAAC,eAAY,EAACT,WAAW,EAAE,OAAO,CAAC;EACpE,MAAMU,QAAQ,GAAGF,WAAW,CAACP,GAAG,CAACU,CAAC,IAAI;IAClC,MAAMT,IAAI,GAAGf,KAAK,CAACyB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACV,EAAE,KAAKQ,CAAC,CAACR,EAAE,CAAC;IAC3C,IAAID,IAAI,EAAE;MACN,OAAOA,IAAI;IACf;IACA,MAAM,IAAIV,cAAW,CACjB,oDAAoD,EACpD,qBAAqB,EACrB;MACIW,EAAE,EAAEQ,CAAC,CAACR,EAAE;MACRW,SAAS,EAAEpB,OAAO;MAClBG;IACJ,CACJ,CAAC;EACL,CAAC,CAAC;EACF,IAAI,CAACA,OAAO,EAAE;IACV,OAAOa,QAAQ;EACnB;EACA,OAAOA,QAAQ,CAACb,OAAO,CAAC,CAAC;AAC7B,CAAC;AAACkB,OAAA,CAAA/B,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createSystemFields = void 0;
|
|
8
|
-
var _constants = require("@webiny/api-headless-cms/constants");
|
|
9
|
-
var _startCase = _interopRequireDefault(require("lodash/startCase"));
|
|
10
|
-
const createSystemFields = () => {
|
|
11
|
-
const onMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isDateTimeEntryMetaField).map(fieldName => {
|
|
12
|
-
return {
|
|
13
|
-
id: fieldName,
|
|
14
|
-
type: "datetime",
|
|
15
|
-
storageId: fieldName,
|
|
16
|
-
fieldId: fieldName,
|
|
17
|
-
label: (0, _startCase.default)(fieldName)
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
const byMetaFields = _constants.ENTRY_META_FIELDS.filter(_constants.isIdentityEntryMetaField).map(fieldName => {
|
|
21
|
-
return {
|
|
22
|
-
id: fieldName,
|
|
23
|
-
type: "plainObject",
|
|
24
|
-
storageId: fieldName,
|
|
25
|
-
fieldId: fieldName,
|
|
26
|
-
label: (0, _startCase.default)(fieldName),
|
|
27
|
-
settings: {
|
|
28
|
-
path: `${fieldName}.id`
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
return [{
|
|
33
|
-
id: "id",
|
|
34
|
-
type: "text",
|
|
35
|
-
storageId: "id",
|
|
36
|
-
fieldId: "id",
|
|
37
|
-
label: "ID"
|
|
38
|
-
}, {
|
|
39
|
-
id: "entryId",
|
|
40
|
-
type: "text",
|
|
41
|
-
storageId: "entryId",
|
|
42
|
-
fieldId: "entryId",
|
|
43
|
-
label: "Entry ID"
|
|
44
|
-
}, ...onMetaFields, ...byMetaFields, {
|
|
45
|
-
id: "meta",
|
|
46
|
-
type: "plainObject",
|
|
47
|
-
storageId: "meta",
|
|
48
|
-
fieldId: "meta",
|
|
49
|
-
label: "Meta"
|
|
50
|
-
}, {
|
|
51
|
-
id: "wbyAco_location",
|
|
52
|
-
type: "object",
|
|
53
|
-
storageId: "location",
|
|
54
|
-
label: "Location",
|
|
55
|
-
fieldId: "wbyAco_location",
|
|
56
|
-
settings: {
|
|
57
|
-
fields: [{
|
|
58
|
-
id: "folderId",
|
|
59
|
-
type: "text",
|
|
60
|
-
fieldId: "folderId",
|
|
61
|
-
label: "Folder ID",
|
|
62
|
-
storageId: "folderId",
|
|
63
|
-
settings: {
|
|
64
|
-
path: "location.folderId"
|
|
65
|
-
}
|
|
66
|
-
}]
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
id: "version",
|
|
70
|
-
type: "number",
|
|
71
|
-
storageId: "version",
|
|
72
|
-
fieldId: "version",
|
|
73
|
-
label: "Version"
|
|
74
|
-
}, {
|
|
75
|
-
id: "status",
|
|
76
|
-
type: "text",
|
|
77
|
-
storageId: "status",
|
|
78
|
-
fieldId: "status",
|
|
79
|
-
label: "Status"
|
|
80
|
-
}, {
|
|
81
|
-
id: "wbyDeleted",
|
|
82
|
-
type: "boolean",
|
|
83
|
-
storageId: "wbyDeleted",
|
|
84
|
-
fieldId: "wbyDeleted",
|
|
85
|
-
label: "Deleted"
|
|
86
|
-
}];
|
|
87
|
-
};
|
|
88
|
-
exports.createSystemFields = createSystemFields;
|
|
89
|
-
|
|
90
|
-
//# sourceMappingURL=systemFields.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","_startCase","_interopRequireDefault","createSystemFields","onMetaFields","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","fieldName","id","type","storageId","fieldId","label","lodashStartCase","byMetaFields","isIdentityEntryMetaField","settings","path","fields","exports"],"sources":["systemFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants\";\nimport lodashStartCase from \"lodash/startCase\";\n\ntype Field = Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\" | \"settings\" | \"label\">;\n\nexport const createSystemFields = (): Field[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map(fieldName => {\n return {\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n };\n });\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map(fieldName => {\n return {\n id: fieldName,\n type: \"plainObject\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName),\n settings: {\n path: `${fieldName}.id`\n }\n };\n });\n\n return [\n {\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n },\n {\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n },\n\n ...onMetaFields,\n ...byMetaFields,\n\n {\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n },\n {\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n {\n id: \"folderId\",\n type: \"text\",\n fieldId: \"folderId\",\n label: \"Folder ID\",\n storageId: \"folderId\",\n settings: {\n path: \"location.folderId\"\n }\n }\n ]\n }\n },\n\n {\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n },\n {\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n },\n {\n id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }\n ];\n};\n"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIO,MAAMG,kBAAkB,GAAGA,CAAA,KAAe;EAC7C,MAAMC,YAAY,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,CAACC,GAAG,CAACC,SAAS,IAAI;IACrF,OAAO;MACHC,EAAE,EAAED,SAAS;MACbE,IAAI,EAAE,UAAU;MAChBC,SAAS,EAAEH,SAAS;MACpBI,OAAO,EAAEJ,SAAS;MAClBK,KAAK,EAAE,IAAAC,kBAAe,EAACN,SAAS;IACpC,CAAC;EACL,CAAC,CAAC;EAEF,MAAMO,YAAY,GAAGX,4BAAiB,CAACC,MAAM,CAACW,mCAAwB,CAAC,CAACT,GAAG,CAACC,SAAS,IAAI;IACrF,OAAO;MACHC,EAAE,EAAED,SAAS;MACbE,IAAI,EAAE,aAAa;MACnBC,SAAS,EAAEH,SAAS;MACpBI,OAAO,EAAEJ,SAAS;MAClBK,KAAK,EAAE,IAAAC,kBAAe,EAACN,SAAS,CAAC;MACjCS,QAAQ,EAAE;QACNC,IAAI,EAAE,GAAGV,SAAS;MACtB;IACJ,CAAC;EACL,CAAC,CAAC;EAEF,OAAO,CACH;IACIC,EAAE,EAAE,IAAI;IACRC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,IAAI;IACfC,OAAO,EAAE,IAAI;IACbC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EAED,GAAGV,YAAY,EACf,GAAGY,YAAY,EAEf;IACIN,EAAE,EAAE,MAAM;IACVC,IAAI,EAAE,aAAa;IACnBC,SAAS,EAAE,MAAM;IACjBC,OAAO,EAAE,MAAM;IACfC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,iBAAiB;IACrBC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,UAAU;IACrBE,KAAK,EAAE,UAAU;IACjBD,OAAO,EAAE,iBAAiB;IAC1BK,QAAQ,EAAE;MACNE,MAAM,EAAE,CACJ;QACIV,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,MAAM;QACZE,OAAO,EAAE,UAAU;QACnBC,KAAK,EAAE,WAAW;QAClBF,SAAS,EAAE,UAAU;QACrBM,QAAQ,EAAE;UACNC,IAAI,EAAE;QACV;MACJ,CAAC;IAET;EACJ,CAAC,EAED;IACIT,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,SAAS;IACpBC,OAAO,EAAE,SAAS;IAClBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE,QAAQ;IACjBC,KAAK,EAAE;EACX,CAAC,EACD;IACIJ,EAAE,EAAE,YAAY;IAChBC,IAAI,EAAE,SAAS;IACfC,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,YAAY;IACrBC,KAAK,EAAE;EACX,CAAC,CACJ;AACL,CAAC;AAACO,OAAA,CAAAlB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformValue = void 0;
|
|
7
|
-
const transformValue = ({
|
|
8
|
-
value,
|
|
9
|
-
transform
|
|
10
|
-
}) => {
|
|
11
|
-
if (Array.isArray(value)) {
|
|
12
|
-
return value.map(v => transform(v));
|
|
13
|
-
}
|
|
14
|
-
return transform(value);
|
|
15
|
-
};
|
|
16
|
-
exports.transformValue = transformValue;
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["transformValue","value","transform","Array","isArray","map","v","exports"],"sources":["transform.ts"],"sourcesContent":["import type { Field } from \"./types\";\n\ninterface Params extends Pick<Field, \"transform\"> {\n value: any;\n}\nexport const transformValue = ({ value, transform }: Params): any => {\n if (Array.isArray(value)) {\n return value.map(v => transform(v));\n }\n return transform(value);\n};\n"],"mappings":";;;;;;AAKO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAkB,CAAC,KAAU;EACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACI,GAAG,CAACC,CAAC,IAAIJ,SAAS,CAACI,CAAC,CAAC,CAAC;EACvC;EACA,OAAOJ,SAAS,CAACD,KAAK,CAAC;AAC3B,CAAC;AAACM,OAAA,CAAAP,cAAA,GAAAA,cAAA","ignoreList":[]}
|