@webiny/api-headless-cms-ddb 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9
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/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +9 -94
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +4 -5
- package/definitions/group.js +9 -68
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +4 -5
- package/definitions/model.js +9 -90
- package/definitions/model.js.map +1 -1
- package/definitions/table.d.ts +4 -6
- package/definitions/table.js +8 -30
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +11 -20
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.d.ts +2 -0
- package/dynamoDb/path/locationFolderId.js +21 -0
- package/dynamoDb/path/locationFolderId.js.map +1 -0
- package/dynamoDb/path/plainObject.d.ts +1 -1
- package/dynamoDb/path/plainObject.js +13 -37
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js +27 -50
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +83 -139
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +5 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +42 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +18 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +0 -0
- package/operations/entry/dataLoaders.d.ts +14 -30
- package/operations/entry/dataLoaders.js +83 -314
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.d.ts +27 -0
- package/operations/entry/filtering/createExpressions.js +124 -0
- package/operations/entry/filtering/createExpressions.js.map +1 -0
- package/operations/entry/filtering/createFields.d.ts +16 -0
- package/operations/entry/filtering/createFields.js +93 -0
- package/operations/entry/filtering/createFields.js.map +1 -0
- package/operations/entry/filtering/extractSort.d.ts +17 -0
- package/operations/entry/filtering/extractSort.js +60 -0
- package/operations/entry/filtering/extractSort.js.map +1 -0
- package/operations/entry/filtering/filter.d.ts +16 -0
- package/operations/entry/filtering/filter.js +85 -0
- package/operations/entry/filtering/filter.js.map +1 -0
- package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
- package/operations/entry/filtering/fullTextSearch.js +25 -0
- package/operations/entry/filtering/fullTextSearch.js.map +1 -0
- package/operations/entry/filtering/getValue.d.ts +5 -0
- package/operations/entry/filtering/getValue.js +37 -0
- package/operations/entry/filtering/getValue.js.map +1 -0
- package/operations/entry/filtering/index.d.ts +2 -0
- package/operations/entry/filtering/index.js +2 -0
- package/operations/entry/filtering/mapPlugins.d.ts +8 -0
- package/operations/entry/filtering/mapPlugins.js +18 -0
- package/operations/entry/filtering/mapPlugins.js.map +1 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +33 -0
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/filtering/plugins/index.js +13 -0
- package/operations/entry/filtering/plugins/index.js.map +1 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.js +68 -0
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
- package/operations/entry/filtering/plugins/refFilterCreate.js +63 -0
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +49 -0
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
- package/operations/entry/filtering/sort.d.ts +12 -0
- package/operations/entry/filtering/sort.js +41 -0
- package/operations/entry/filtering/sort.js.map +1 -0
- package/operations/entry/filtering/systemFields.d.ts +2 -0
- package/operations/entry/filtering/systemFields.js +149 -0
- package/operations/entry/filtering/systemFields.js.map +1 -0
- package/operations/entry/filtering/transform.d.ts +6 -0
- package/operations/entry/filtering/transform.js +7 -0
- package/operations/entry/filtering/transform.js.map +1 -0
- package/operations/entry/filtering/types.d.ts +40 -0
- package/operations/entry/filtering/types.js +0 -0
- package/operations/entry/filtering/values.d.ts +2 -0
- package/operations/entry/filtering/values.js +15 -0
- package/operations/entry/filtering/values.js.map +1 -0
- package/operations/entry/filtering/where.d.ts +5 -0
- package/operations/entry/filtering/where.js +22 -0
- package/operations/entry/filtering/where.js.map +1 -0
- package/operations/entry/index.d.ts +5 -4
- package/operations/entry/index.js +931 -845
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +46 -2
- package/operations/entry/keys.js +53 -66
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.d.ts +4 -5
- package/operations/group/index.js +116 -187
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +3 -3
- package/operations/model/index.js +102 -158
- package/operations/model/index.js.map +1 -1
- package/package.json +34 -33
- package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +5 -4
- package/plugins/CmsEntryFieldFilterPathPlugin.js +25 -50
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
- package/plugins/CmsEntryFieldFilterPlugin.js +20 -0
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
- package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
- package/plugins/CmsEntryFieldSortingPlugin.js +20 -0
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js +19 -0
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +4 -1
- package/plugins/index.js +4 -18
- package/types.d.ts +28 -21
- package/types.js +8 -15
- package/types.js.map +1 -1
- package/definitions/settings.d.ts +0 -9
- package/definitions/settings.js +0 -58
- package/definitions/settings.js.map +0 -1
- package/definitions/system.d.ts +0 -9
- package/definitions/system.js +0 -46
- package/definitions/system.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -2
- package/dynamoDb/storage/date.js +0 -99
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -101
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -2
- package/dynamoDb/storage/richText.js +0 -113
- package/dynamoDb/storage/richText.js.map +0 -1
- package/operations/entry/systemFields.d.ts +0 -2
- package/operations/entry/systemFields.js +0 -74
- package/operations/entry/systemFields.js.map +0 -1
- package/operations/entry/utils.d.ts +0 -36
- package/operations/entry/utils.js +0 -680
- package/operations/entry/utils.js.map +0 -1
- package/operations/settings/index.d.ts +0 -7
- package/operations/settings/index.js +0 -135
- package/operations/settings/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -7
- package/operations/system/index.js +0 -99
- package/operations/system/index.js.map +0 -1
- package/plugins/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/systemFields.js","sources":["../../../../src/operations/entry/filtering/systemFields.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants.js\";\nimport lodashStartCase from \"lodash/startCase.js\";\nimport { createModelField } from \"@webiny/api-headless-cms\";\n\nexport const createSystemFields = (): CmsModelField[] => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\n id: fieldName,\n type: \"datetime\",\n storageId: fieldName,\n fieldId: fieldName,\n label: lodashStartCase(fieldName)\n });\n }\n );\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).map<CmsModelField>(\n fieldName => {\n return createModelField({\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\n return [\n createModelField({\n id: \"id\",\n type: \"text\",\n storageId: \"id\",\n fieldId: \"id\",\n label: \"ID\"\n }),\n createModelField({\n id: \"entryId\",\n type: \"text\",\n storageId: \"entryId\",\n fieldId: \"entryId\",\n label: \"Entry ID\"\n }),\n\n ...onMetaFields,\n ...byMetaFields,\n\n createModelField({\n id: \"meta\",\n type: \"plainObject\",\n storageId: \"meta\",\n fieldId: \"meta\",\n label: \"Meta\"\n }),\n createModelField({\n id: \"wbyAco_location\",\n type: \"object\",\n storageId: \"location\",\n label: \"Location\",\n fieldId: \"wbyAco_location\",\n settings: {\n fields: [\n createModelField({\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 createModelField({\n id: \"version\",\n type: \"number\",\n storageId: \"version\",\n fieldId: \"version\",\n label: \"Version\"\n }),\n createModelField({\n id: \"status\",\n type: \"text\",\n storageId: \"status\",\n fieldId: \"status\",\n label: \"Status\"\n }),\n createModelField({\n id: \"wbyDeleted\",\n type: \"boolean\",\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n label: \"Deleted\"\n }),\n createModelField({\n id: \"state\",\n type: \"object\",\n storageId: \"object@state\",\n fieldId: \"state\",\n label: \"State\",\n settings: {\n fields: [\n createModelField({\n id: \"stepId\",\n type: \"text\",\n fieldId: \"stepId\",\n label: \"Step ID\",\n storageId: \"stepId\"\n }),\n createModelField({\n id: \"stepName\",\n type: \"text\",\n fieldId: \"stepName\",\n label: \"Step Name\",\n storageId: \"stepName\"\n }),\n createModelField({\n id: \"state\",\n type: \"text\",\n fieldId: \"state\",\n label: \"State\",\n storageId: \"state\"\n })\n ]\n }\n }),\n createModelField({\n id: \"values\",\n type: \"object\",\n storageId: \"values\",\n fieldId: \"values\",\n label: \"Values\"\n }),\n createModelField({\n id: \"live\",\n type: \"object\",\n storageId: \"live\",\n fieldId: \"live\",\n label: \"Live\",\n settings: {\n fields: [\n createModelField({\n id: \"version\",\n type: \"number\",\n fieldId: \"version\",\n label: \"Version\",\n storageId: \"version\"\n })\n ]\n }\n })\n ];\n};\n"],"names":["createSystemFields","onMetaFields","ENTRY_META_FIELDS","isDateTimeEntryMetaField","fieldName","createModelField","lodashStartCase","byMetaFields","isIdentityEntryMetaField"],"mappings":";;;AASO,MAAMA,qBAAqB;IAC9B,MAAMC,eAAeC,kBAAkB,MAAM,CAACC,0BAA0B,GAAG,CACvEC,CAAAA,YACWC,iBAAiB;YACpB,IAAID;YACJ,MAAM;YACN,WAAWA;YACX,SAASA;YACT,OAAOE,UAAgBF;QAC3B;IAIR,MAAMG,eAAeL,kBAAkB,MAAM,CAACM,0BAA0B,GAAG,CACvEJ,CAAAA,YACWC,iBAAiB;YACpB,IAAID;YACJ,MAAM;YACN,WAAWA;YACX,SAASA;YACT,OAAOE,UAAgBF;YACvB,UAAU;gBACN,MAAM,GAAGA,UAAU,GAAG,CAAC;YAC3B;QACJ;IAIR,OAAO;QACHC,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;WAEGJ;WACAM;QAEHF,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,OAAO;YACP,SAAS;YACT,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;wBACX,UAAU;4BACN,MAAM;wBACV;oBACJ;iBACH;YACL;QACJ;QAEAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;YACP,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;oBACAA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;oBACAA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;iBACH;YACL;QACJ;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;QACX;QACAA,iBAAiB;YACb,IAAI;YACJ,MAAM;YACN,WAAW;YACX,SAAS;YACT,OAAO;YACP,UAAU;gBACN,QAAQ;oBACJA,iBAAiB;wBACb,IAAI;wBACJ,MAAM;wBACN,SAAS;wBACT,OAAO;wBACP,WAAW;oBACf;iBACH;YACL;QACJ;KACH;AACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/transform.js","sources":["../../../../src/operations/entry/filtering/transform.ts"],"sourcesContent":["import type { Field } from \"./types.js\";\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"],"names":["transformValue","value","transform","Array","v"],"mappings":"AAKO,MAAMA,iBAAiB,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAU;IACvD,IAAIC,MAAM,OAAO,CAACF,QACd,OAAOA,MAAM,GAAG,CAACG,CAAAA,IAAKF,UAAUE;IAEpC,OAAOF,UAAUD;AACrB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { CreatePathCallable } from "../../../plugins/index.js";
|
|
3
|
+
interface FieldValueTransform {
|
|
4
|
+
(value: any): any;
|
|
5
|
+
}
|
|
6
|
+
export interface FieldParent {
|
|
7
|
+
fieldId: string;
|
|
8
|
+
list?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface Field extends Partial<Omit<CmsModelField, "id" | "type" | "storageId" | "fieldId">>, Pick<CmsModelField, "id" | "type" | "storageId" | "fieldId"> {
|
|
11
|
+
/**
|
|
12
|
+
* A list od fieldId of all parents of the current field.
|
|
13
|
+
*
|
|
14
|
+
* This is used to check if we need to iterate through an array of parent values.
|
|
15
|
+
*/
|
|
16
|
+
parents: FieldParent[];
|
|
17
|
+
/**
|
|
18
|
+
* The method which creates a path for the filtering.
|
|
19
|
+
*
|
|
20
|
+
* Always exists. In most cases it will return some fixed value.
|
|
21
|
+
* When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.
|
|
22
|
+
*/
|
|
23
|
+
createPath: CreatePathCallable;
|
|
24
|
+
/**
|
|
25
|
+
* In most cases, return value of this method is what ever is the input.
|
|
26
|
+
*
|
|
27
|
+
* In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.
|
|
28
|
+
* For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.
|
|
29
|
+
*/
|
|
30
|
+
transform: FieldValueTransform;
|
|
31
|
+
/**
|
|
32
|
+
* Is the field a system field?
|
|
33
|
+
* System fields are built into the code and cannot be changed.
|
|
34
|
+
*/
|
|
35
|
+
system: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface FilterItemFromStorage {
|
|
38
|
+
<T = any>(field: CmsModelField, value: any): Promise<T>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
const getWhereValues = (value, condition)=>{
|
|
3
|
+
const values = value;
|
|
4
|
+
if (Array.isArray(values)) {
|
|
5
|
+
if (0 === values.length) throw new error(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
6
|
+
value
|
|
7
|
+
});
|
|
8
|
+
} else throw new error(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
9
|
+
value
|
|
10
|
+
});
|
|
11
|
+
return values;
|
|
12
|
+
};
|
|
13
|
+
export { getWhereValues };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/values.js","sources":["../../../../src/operations/entry/filtering/values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"names":["getWhereValues","value","condition","values","Array","WebinyError"],"mappings":";AAGO,MAAMA,iBAAiB,CAACC,OAAgBC;IAC3C,MAAMC,SAASF;IACf,IAAKG,MAAM,OAAO,CAACD,SAQZ;QAAA,IAAIA,AAAkB,MAAlBA,OAAO,MAAM,EACpB,MAAM,IAAIE,MACN,CAAC,8BAA8B,EAAEH,UAAU,qCAAqC,CAAC,EACjF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;YACID;QACJ;IAER,OAfI,MAAM,IAAII,MACN,CAAC,8BAA8B,EAAEH,UAAU,sCAAsC,CAAC,EAClF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;QACID;IACJ;IAWR,OAAOE;AACX"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const extractWhereParams = (key)=>{
|
|
2
|
+
const isWbyAco = null !== key.match("wbyAco_");
|
|
3
|
+
const result = key.replace("wbyAco_", "").split("_");
|
|
4
|
+
const fieldId = result.shift();
|
|
5
|
+
if (!fieldId) return null;
|
|
6
|
+
const rawOp = 0 === result.length ? "eq" : result.join("_");
|
|
7
|
+
if ("not" === rawOp) return {
|
|
8
|
+
fieldId,
|
|
9
|
+
operation: "eq",
|
|
10
|
+
negate: true
|
|
11
|
+
};
|
|
12
|
+
const negate = null !== rawOp.match("not_");
|
|
13
|
+
const operation = rawOp.replace("not_", "");
|
|
14
|
+
return {
|
|
15
|
+
fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,
|
|
16
|
+
operation,
|
|
17
|
+
negate
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { extractWhereParams };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=where.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/filtering/where.js","sources":["../../../../src/operations/entry/filtering/where.ts"],"sourcesContent":["export const extractWhereParams = (key: string) => {\n const isWbyAco = key.match(\"wbyAco_\") !== null;\n const result = key.replace(\"wbyAco_\", \"\").split(\"_\");\n const fieldId = result.shift();\n if (!fieldId) {\n return null;\n }\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n fieldId,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n fieldId: isWbyAco ? `wbyAco_${fieldId}` : fieldId,\n operation,\n negate\n };\n};\n"],"names":["extractWhereParams","key","isWbyAco","result","fieldId","rawOp","negate","operation"],"mappings":"AAAO,MAAMA,qBAAqB,CAACC;IAC/B,MAAMC,WAAWD,AAAyB,SAAzBA,IAAI,KAAK,CAAC;IAC3B,MAAME,SAASF,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC;IAChD,MAAMG,UAAUD,OAAO,KAAK;IAC5B,IAAI,CAACC,SACD,OAAO;IAEX,MAAMC,QAAQF,AAAkB,MAAlBA,OAAO,MAAM,GAAS,OAAOA,OAAO,IAAI,CAAC;IAIvD,IAAIE,AAAU,UAAVA,OACA,OAAO;QACHD;QACA,WAAW;QACX,QAAQ;IACZ;IAEJ,MAAME,SAASD,AAAwB,SAAxBA,MAAM,KAAK,CAAC;IAC3B,MAAME,YAAYF,MAAM,OAAO,CAAC,QAAQ;IACxC,OAAO;QACH,SAASH,WAAW,CAAC,OAAO,EAAEE,SAAS,GAAGA;QAC1CG;QACAD;IACJ;AACJ"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { CmsContext } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsEntryStorageOperations, IEntryEntity } from "../../types.js";
|
|
4
4
|
export interface CreateEntriesStorageOperationsParams {
|
|
5
|
-
entity:
|
|
5
|
+
entity: IEntryEntity;
|
|
6
|
+
container: CmsContext["container"];
|
|
6
7
|
plugins: PluginsContainer;
|
|
7
8
|
}
|
|
8
9
|
export declare const createEntriesStorageOperations: (params: CreateEntriesStorageOperationsParams) => CmsEntryStorageOperations;
|