@webiny/api-headless-cms-ddb 6.3.0 → 6.4.0-beta.1
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/definitions/entry.js +7 -9
- package/definitions/entry.js.map +1 -1
- package/definitions/group.js +7 -9
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +7 -9
- package/definitions/model.js.map +1 -1
- package/definitions/table.js +6 -7
- package/definitions/table.js.map +1 -1
- package/definitions/types.d.ts +1 -0
- package/definitions/types.js +0 -3
- package/dynamoDb/index.js +6 -1
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/path/locationFolderId.js +16 -29
- package/dynamoDb/path/locationFolderId.js.map +1 -1
- package/dynamoDb/path/plainObject.js +11 -21
- package/dynamoDb/path/plainObject.js.map +1 -1
- package/dynamoDb/transformValue/datetime.js +21 -32
- package/dynamoDb/transformValue/datetime.js.map +1 -1
- package/index.js +67 -77
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -1
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +31 -41
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.js +33 -47
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.js +8 -9
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.js +0 -3
- package/operations/entry/dataLoaders.js +81 -99
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/filtering/createExpressions.js +109 -157
- package/operations/entry/filtering/createExpressions.js.map +1 -1
- package/operations/entry/filtering/createFields.js +83 -96
- package/operations/entry/filtering/createFields.js.map +1 -1
- package/operations/entry/filtering/extractSort.js +50 -74
- package/operations/entry/filtering/extractSort.js.map +1 -1
- package/operations/entry/filtering/filter.js +72 -140
- package/operations/entry/filtering/filter.js.map +1 -1
- package/operations/entry/filtering/fullTextSearch.js +21 -38
- package/operations/entry/filtering/fullTextSearch.js.map +1 -1
- package/operations/entry/filtering/getValue.js +31 -53
- package/operations/entry/filtering/getValue.js.map +1 -1
- package/operations/entry/filtering/index.js +0 -2
- package/operations/entry/filtering/mapPlugins.js +15 -22
- package/operations/entry/filtering/mapPlugins.js.map +1 -1
- package/operations/entry/filtering/plugins/defaultFilterCreate.js +29 -33
- package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/index.js +7 -3
- package/operations/entry/filtering/plugins/index.js.map +1 -1
- package/operations/entry/filtering/plugins/objectFilterCreate.js +60 -76
- package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/refFilterCreate.js +55 -66
- package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +43 -56
- package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
- package/operations/entry/filtering/sort.js +34 -60
- package/operations/entry/filtering/sort.js.map +1 -1
- package/operations/entry/filtering/systemFields.js +144 -126
- package/operations/entry/filtering/systemFields.js.map +1 -1
- package/operations/entry/filtering/transform.js +4 -8
- package/operations/entry/filtering/transform.js.map +1 -1
- package/operations/entry/filtering/types.js +0 -3
- package/operations/entry/filtering/values.js +11 -12
- package/operations/entry/filtering/values.js.map +1 -1
- package/operations/entry/filtering/where.js +17 -23
- package/operations/entry/filtering/where.js.map +1 -1
- package/operations/entry/index.js +894 -1148
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +54 -77
- package/operations/entry/keys.js.map +1 -1
- package/operations/group/index.js +113 -134
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +100 -121
- package/operations/model/index.js.map +1 -1
- package/package.json +16 -16
- package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
- package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldFilterPlugin.js +16 -17
- package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
- package/plugins/CmsEntryFieldSortingPlugin.js +16 -15
- package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
- package/plugins/CmsFieldFilterValueTransformPlugin.js +15 -12
- package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
- package/plugins/index.js +0 -2
- package/types.js +6 -5
- package/types.js.map +1 -1
- package/definitions/types.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/filtering/index.js.map +0 -1
- package/operations/entry/filtering/types.js.map +0 -1
- package/plugins/index.js.map +0 -1
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import error from "@webiny/error";
|
|
2
2
|
import { Plugin } from "@webiny/plugins/Plugin.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
// @ts-expect-error
|
|
16
|
-
this.name = `${this.constructor.type}-${this.config.fieldType}`;
|
|
17
|
-
}
|
|
18
|
-
canUse(field, parents) {
|
|
19
|
-
if (field.type !== this.config.fieldType) {
|
|
20
|
-
return false;
|
|
21
|
-
} else if (this.config.canUse) {
|
|
22
|
-
return this.config.canUse(field, parents);
|
|
3
|
+
class CmsEntryFieldFilterPathPlugin extends Plugin {
|
|
4
|
+
static{
|
|
5
|
+
this.type = "cms-field-filter-path";
|
|
6
|
+
}
|
|
7
|
+
get fieldType() {
|
|
8
|
+
return this.config.fieldType;
|
|
9
|
+
}
|
|
10
|
+
constructor(config){
|
|
11
|
+
super();
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.name = `${this.constructor.type}-${this.config.fieldType}`;
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
canUse(field, parents) {
|
|
16
|
+
if (field.type !== this.config.fieldType) return false;
|
|
17
|
+
if (this.config.canUse) return this.config.canUse(field, parents);
|
|
18
|
+
const fieldId = this.config.fieldId;
|
|
19
|
+
if (!fieldId || false === Array.isArray(fieldId) || 0 === fieldId.length) return true;
|
|
20
|
+
return fieldId.includes(field.fieldId);
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return this.config.path(params);
|
|
33
|
-
} else if (typeof this.config.path === "string") {
|
|
34
|
-
return this.config.path;
|
|
22
|
+
createPath(params) {
|
|
23
|
+
if ("function" == typeof this.config.path) return this.config.path(params);
|
|
24
|
+
if ("string" == typeof this.config.path) return this.config.path;
|
|
25
|
+
throw new error(`Missing path in "${this.name}" plugin.`);
|
|
35
26
|
}
|
|
36
|
-
throw new WebinyError(`Missing path in "${this.name}" plugin.`);
|
|
37
|
-
}
|
|
38
27
|
}
|
|
28
|
+
export { CmsEntryFieldFilterPathPlugin };
|
|
39
29
|
|
|
40
30
|
//# sourceMappingURL=CmsEntryFieldFilterPathPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/CmsEntryFieldFilterPathPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface CreatePathCallableParams {\n field: Partial<CmsModelField> & Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\">;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n canUse?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents?: string[]) => boolean;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n /**\n * We expect error here because we know that `this.constructor.type` is defined, but TS does not.\n */\n // @ts-expect-error\n this.name = `${this.constructor.type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents: string[]): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n } else if (this.config.canUse) {\n return this.config.canUse(field, parents);\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"names":["CmsEntryFieldFilterPathPlugin","Plugin","config","field","parents","fieldId","Array","params","WebinyError"],"mappings":";;AAiBO,MAAMA,sCAAsCC;;aACf,IAAI,GAAW;;IAI/C,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAA2C,CAAE;QAC5D,KAAK;QAEL,IAAI,CAAC,MAAM,GAAGA;QAMd,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;IACnE;IAEO,OAAOC,KAA8C,EAAEC,OAAiB,EAAW;QACtF,IAAID,MAAM,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,EACpC,OAAO;QACJ,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EACzB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA,OAAOC;QAErC,MAAMC,UAAU,IAAI,CAAC,MAAM,CAAC,OAAO;QACnC,IAAI,CAACA,WAAWC,AAA2B,UAA3BA,MAAM,OAAO,CAACD,YAAsBA,AAAmB,MAAnBA,QAAQ,MAAM,EAC9D,OAAO;QAEX,OAAOA,QAAQ,QAAQ,CAACF,MAAM,OAAO;IACzC;IAEO,WAAWI,MAAgC,EAAU;QACxD,IAAI,AAA4B,cAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;QACrB,IAAI,AAA4B,YAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;QAE3B,MAAM,IAAIC,MAAY,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAClE;AACJ"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return this.config.create(params);
|
|
18
|
-
}
|
|
2
|
+
class CmsEntryFieldFilterPlugin extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "cms.dynamodb.entry.field.filter";
|
|
5
|
+
}
|
|
6
|
+
static{
|
|
7
|
+
this.ALL = "*";
|
|
8
|
+
}
|
|
9
|
+
constructor(config){
|
|
10
|
+
super();
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.fieldType = this.config.fieldType;
|
|
13
|
+
}
|
|
14
|
+
create(params) {
|
|
15
|
+
return this.config.create(params);
|
|
16
|
+
}
|
|
19
17
|
}
|
|
18
|
+
export { CmsEntryFieldFilterPlugin };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=CmsEntryFieldFilterPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/CmsEntryFieldFilterPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-dynamodb/feature/ValueFilter/index.js\";\n\n/**\n * This plugin is used to create the filter.\n * Internally we have default one + the one for the reference field - because it is actually an object when filtering.\n */\n\ninterface CmsEntryFieldFilterPluginParams<T = any> {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams<T>\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams<T = any> {\n key: string;\n value: T;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterRegistry: ValueFilterRegistry.Interface;\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport interface CmsEntryFieldFilterPluginCreateResponse {\n field: Field;\n path: string;\n fieldPathId: string;\n filter: ValueFilterRegistry.Filter;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin<T = any> extends Plugin {\n public static override readonly type: string = \"cms.dynamodb.entry.field.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFieldFilterPluginParams<T>;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams<T>) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams<T>) {\n return this.config.create(params);\n }\n}\n"],"names":["CmsEntryFieldFilterPlugin","Plugin","config","params"],"mappings":";AAyCO,MAAMA,kCAA2CC;;aACpB,IAAI,GAAW;;;aACxB,GAAG,GAAW;;IAMrC,YAAmBC,MAA0C,CAAE;QAC3D,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;QACd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;IAC1C;IAEO,OAAOC,MAAgD,EAAE;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;AACJ"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
class CmsEntryFieldSortingPlugin extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "cms.entry.field.sorting";
|
|
5
|
+
}
|
|
6
|
+
constructor(config){
|
|
7
|
+
super();
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
canUse(params) {
|
|
11
|
+
return this.config.canUse(params);
|
|
12
|
+
}
|
|
13
|
+
createSort(params) {
|
|
14
|
+
return this.config.createSort(params);
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
17
|
+
const createCmsEntryFieldSortingPlugin = (config)=>new CmsEntryFieldSortingPlugin(config);
|
|
18
|
+
export { CmsEntryFieldSortingPlugin, createCmsEntryFieldSortingPlugin };
|
|
18
19
|
|
|
19
20
|
//# sourceMappingURL=CmsEntryFieldSortingPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/CmsEntryFieldSortingPlugin.js","sources":["../../src/plugins/CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface CmsEntryFieldSortingPluginCanUseParams {\n model: CmsModel;\n field?: Field;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n /**\n * Combination of fieldId and sortBy\n *\n * example: id_ASC or createdBy_DESC\n */\n sortBy: string;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortParams {\n model: CmsModel;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n sortBy: string;\n fields: Record<string, Field>;\n field?: Field;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortResult {\n valuePath: string;\n reverse: boolean;\n fieldId: string;\n field: Field;\n}\n\ninterface CmsEntryFieldSortingPluginConfig {\n createSort: (\n params: CmsEntryFieldSortingPluginCreateSortParams\n ) => CmsEntryFieldSortingPluginCreateSortResult;\n canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;\n}\n\nexport class CmsEntryFieldSortingPlugin extends Plugin {\n public static override readonly type: string = \"cms.entry.field.sorting\";\n private readonly config: CmsEntryFieldSortingPluginConfig;\n\n public constructor(config: CmsEntryFieldSortingPluginConfig) {\n super();\n this.config = config;\n }\n\n public canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean {\n return this.config.canUse(params);\n }\n\n public createSort(\n params: CmsEntryFieldSortingPluginCreateSortParams\n ): CmsEntryFieldSortingPluginCreateSortResult {\n return this.config.createSort(params);\n }\n}\n\nexport const createCmsEntryFieldSortingPlugin = (config: CmsEntryFieldSortingPluginConfig) => {\n return new CmsEntryFieldSortingPlugin(config);\n};\n"],"names":["CmsEntryFieldSortingPlugin","Plugin","config","params","createCmsEntryFieldSortingPlugin"],"mappings":";AAwCO,MAAMA,mCAAmCC;;aACZ,IAAI,GAAW;;IAG/C,YAAmBC,MAAwC,CAAE;QACzD,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEO,OAAOC,MAA8C,EAAW;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;IAEO,WACHA,MAAkD,EACR;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAACA;IAClC;AACJ;AAEO,MAAMC,mCAAmC,CAACF,SACtC,IAAIF,2BAA2BE"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
class CmsFieldFilterValueTransformPlugin extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "cms-field-filter-value-transform";
|
|
5
|
+
}
|
|
6
|
+
get fieldType() {
|
|
7
|
+
return this.config.fieldType;
|
|
8
|
+
}
|
|
9
|
+
get transform() {
|
|
10
|
+
return this.config.transform;
|
|
11
|
+
}
|
|
12
|
+
constructor(config){
|
|
13
|
+
super();
|
|
14
|
+
this.config = config;
|
|
15
|
+
}
|
|
14
16
|
}
|
|
17
|
+
export { CmsFieldFilterValueTransformPlugin };
|
|
15
18
|
|
|
16
19
|
//# sourceMappingURL=CmsFieldFilterValueTransformPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/CmsFieldFilterValueTransformPlugin.js","sources":["../../src/plugins/CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types.js\";\n\ntype CmsFieldFilterValueTransformPluginParams = Omit<\n CmsFieldFilterValueTransformPluginInterface,\n \"type\"\n>;\nexport class CmsFieldFilterValueTransformPlugin\n extends Plugin\n implements Omit<CmsFieldFilterValueTransformPluginInterface, \"type\">\n{\n public static override type = \"cms-field-filter-value-transform\";\n\n private config: CmsFieldFilterValueTransformPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public get transform(): CmsFieldFilterValueTransformPluginParams[\"transform\"] {\n return this.config.transform;\n }\n\n public constructor(config: CmsFieldFilterValueTransformPluginParams) {\n super();\n this.config = config;\n }\n}\n"],"names":["CmsFieldFilterValueTransformPlugin","Plugin","config"],"mappings":";AAOO,MAAMA,2CACDC;;aAGe,IAAI,GAAG;;IAI9B,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,IAAW,YAAmE;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAAgD,CAAE;QACjE,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;AACJ"}
|
package/plugins/index.js
CHANGED
package/types.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var types_ENTITIES = /*#__PURE__*/ function(ENTITIES) {
|
|
2
|
+
ENTITIES["GROUPS"] = "CmsGroups";
|
|
3
|
+
ENTITIES["MODELS"] = "CmsModels";
|
|
4
|
+
ENTITIES["ENTRIES"] = "CmsEntries";
|
|
5
|
+
return ENTITIES;
|
|
6
6
|
}({});
|
|
7
|
+
export { types_ENTITIES as ENTITIES };
|
|
7
8
|
|
|
8
9
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { type Plugin, PluginsContainer } from \"@webiny/plugins/types.js\";\nimport type {\n CmsContext,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\n\nexport type { CmsContext };\n\nexport type { IGroupEntity, IModelEntity, IEntryEntity };\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"storageId\" | \"fieldId\" | \"settings\">;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n table?: string;\n plugins: PluginsContainer;\n container: CmsContext[\"container\"];\n}\n\nexport interface IHeadlessCmsStorageOperationsGetEntitiesResult {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => ITable;\n getEntities: () => IHeadlessCmsStorageOperationsGetEntitiesResult;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\">;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AAwCO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;WAARA"}
|
package/definitions/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type {\n CmsEntryStatus,\n CmsGroup,\n CmsIdentity,\n ICmsEntryLive,\n ICmsEntryLocation,\n ICmsEntrySystem,\n StorageCmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface IEntryEntityAttributesData {\n id: string;\n entryId: string;\n modelId: string;\n\n tenant: string;\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: string;\n revisionModifiedOn: string | null;\n revisionSavedOn: string;\n revisionDeletedOn: string | null;\n revisionRestoredOn: string | null;\n revisionFirstPublishedOn: string | null;\n revisionLastPublishedOn: string | null;\n revisionCreatedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionSavedBy: CmsIdentity;\n revisionDeletedBy: CmsIdentity | null;\n revisionRestoredBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n deletedOn: string | null;\n restoredOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n modifiedBy: CmsIdentity | null;\n savedBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n restoredBy: CmsIdentity | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * The rest. 👇\n */\n version: number;\n locked: boolean;\n status: CmsEntryStatus;\n location?: ICmsEntryLocation;\n wbyDeleted?: boolean | null;\n binOriginalFolderId?: string;\n values: GenericRecord;\n meta?: GenericRecord;\n system?: ICmsEntrySystem;\n live: ICmsEntryLive | null;\n}\n\nexport type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;\n\nexport type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;\nexport type IGroupEntity = IEntity<IStandardEntityAttributes<CmsGroup>>;\nexport type IEntryEntity = IEntity<IEntryEntityAttributes>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { IEntryEntity } from \"~/definitions/types.js\";\n\nexport interface IDataLoaderParams {\n entity: IEntryEntity;\n tenant: string;\n modelId: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["filter","sort"],"sources":["index.ts"],"sourcesContent":["export { filter } from \"./filter.js\";\nexport { sort } from \"./sort.js\";\n"],"mappings":"AAAA,SAASA,MAAM;AACf,SAASC,IAAI","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CreatePathCallable } from \"~/plugins/index.js\";\n\ninterface FieldValueTransform {\n (value: any): any;\n}\n\nexport interface FieldParent {\n fieldId: string;\n list?: boolean;\n}\n\nexport interface Field\n extends\n Partial<Omit<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\">>,\n Pick<CmsModelField, \"id\" | \"type\" | \"storageId\" | \"fieldId\"> {\n /**\n * A list od fieldId of all parents of the current field.\n *\n * This is used to check if we need to iterate through an array of parent values.\n */\n parents: FieldParent[];\n /**\n * The method which creates a path for the filtering.\n *\n * Always exists. In most cases it will return some fixed value.\n * When having a CmsEntryFieldFilterPathPlugin then it is executed to create a path.\n */\n createPath: CreatePathCallable;\n /**\n * In most cases, return value of this method is what ever is the input.\n *\n * In some cases there might be a CmsFieldFilterValueTransformPlugin, which transforms value to a comparable one.\n * For example, time in format 15:45:58 is not comparable, so we transform it into the seconds and then compare.\n */\n transform: FieldValueTransform;\n /**\n * Is the field a system field?\n * System fields are built into the code and cannot be changed.\n */\n system: boolean;\n}\n\nexport interface FilterItemFromStorage {\n <T = any>(field: CmsModelField, value: any): Promise<T>;\n}\n"],"mappings":"","ignoreList":[]}
|
package/plugins/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryFieldFilterPathPlugin.js\";\nexport * from \"./CmsEntryFieldSortingPlugin.js\";\nexport * from \"./CmsEntryFieldFilterPlugin.js\";\nexport * from \"./CmsFieldFilterValueTransformPlugin.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
|