@webiny/api-headless-cms-ddb-es 6.4.0-beta.0 → 6.4.0-beta.2

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.
Files changed (28) hide show
  1. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +2 -1
  2. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +9 -4
  3. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -1
  4. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +0 -3
  5. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -1
  6. package/features/CmsEntryOpenSearchFieldIndex/feature.js +10 -8
  7. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -1
  8. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +5 -2
  9. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +12 -8
  10. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -1
  11. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +4 -2
  12. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +44 -50
  13. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -1
  14. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +14 -0
  15. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +39 -0
  16. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -0
  17. package/helpers/entryIndexHelpers.d.ts +1 -1
  18. package/helpers/entryIndexHelpers.js +1 -3
  19. package/helpers/entryIndexHelpers.js.map +1 -1
  20. package/operations/entry/index.js +0 -9
  21. package/operations/entry/index.js.map +1 -1
  22. package/operations/entry/transformations/index.d.ts +0 -2
  23. package/operations/entry/transformations/index.js +1 -2
  24. package/operations/entry/transformations/index.js.map +1 -1
  25. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -2
  26. package/operations/entry/transformations/transformEntryToIndex.js +1 -2
  27. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  28. package/package.json +23 -23
@@ -2,8 +2,9 @@ import { CmsEntryOpenSearchFieldIndexRegistry as Abstraction } from "./abstracti
2
2
  import { CmsEntryOpenSearchFieldIndex } from "./abstractions/CmsEntryOpenSearchFieldIndex.js";
3
3
  declare class CmsEntryOpenSearchFieldIndexRegistryImpl implements Abstraction.Interface {
4
4
  private readonly fieldIndexing;
5
+ private readonly cache;
5
6
  constructor(fieldIndexing: CmsEntryOpenSearchFieldIndex.Interface[]);
6
- get(type: string): CmsEntryOpenSearchFieldIndex.Interface | undefined;
7
+ get(fieldType: string): CmsEntryOpenSearchFieldIndex.Interface | undefined;
7
8
  getDefault(): CmsEntryOpenSearchFieldIndex.Interface;
8
9
  getAll(): CmsEntryOpenSearchFieldIndex.Interface[];
9
10
  }
@@ -5,12 +5,17 @@ import { FIELD_INDEXING_DEFAULT } from "./constants.js";
5
5
  class CmsEntryOpenSearchFieldIndexRegistryImpl {
6
6
  constructor(fieldIndexing){
7
7
  this.fieldIndexing = fieldIndexing;
8
+ this.cache = new Map();
8
9
  }
9
- get(type) {
10
- const fieldType = getBaseFieldType({
11
- type
10
+ get(fieldType) {
11
+ if (this.cache.has(fieldType)) return this.cache.get(fieldType);
12
+ let indexing = this.fieldIndexing.find((field)=>field.fieldType === fieldType);
13
+ const baseType = getBaseFieldType({
14
+ type: fieldType
12
15
  });
13
- return this.fieldIndexing.find((field)=>field.fieldType === fieldType);
16
+ if (!indexing && baseType !== fieldType) indexing = this.fieldIndexing.find((field)=>field.fieldType === baseType);
17
+ this.cache.set(fieldType, indexing);
18
+ return indexing;
14
19
  }
15
20
  getDefault() {
16
21
  const fieldIndex = this.fieldIndexing.find((field)=>field.fieldType === FIELD_INDEXING_DEFAULT);
@@ -1 +1 @@
1
- {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndexRegistry as Abstraction } from \"./abstractions/CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"./abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"./constants.js\";\n\nclass CmsEntryOpenSearchFieldIndexRegistryImpl implements Abstraction.Interface {\n public constructor(private readonly fieldIndexing: CmsEntryOpenSearchFieldIndex.Interface[]) {}\n\n public get(type: string): CmsEntryOpenSearchFieldIndex.Interface | undefined {\n const fieldType = getBaseFieldType({\n type\n });\n return this.fieldIndexing.find(field => field.fieldType === fieldType);\n }\n\n public getDefault(): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndex = this.fieldIndexing.find(\n field => field.fieldType === FIELD_INDEXING_DEFAULT\n );\n if (fieldIndex) {\n return fieldIndex;\n }\n /**\n * This should never happen, as the default field index plugin exists in our code. This can fail during testing.\n */\n throw new Error(\n `Missing default field index plugin. Please make sure to register a plugin with \"${FIELD_INDEXING_DEFAULT}\" field type.`\n );\n }\n\n public getAll(): CmsEntryOpenSearchFieldIndex.Interface[] {\n return this.fieldIndexing;\n }\n}\n\nexport const CmsEntryOpenSearchFieldIndexRegistry = Abstraction.createImplementation({\n implementation: CmsEntryOpenSearchFieldIndexRegistryImpl,\n dependencies: [[CmsEntryOpenSearchFieldIndex, { multiple: true }]]\n});\n"],"names":["CmsEntryOpenSearchFieldIndexRegistryImpl","fieldIndexing","type","fieldType","getBaseFieldType","field","fieldIndex","FIELD_INDEXING_DEFAULT","Error","CmsEntryOpenSearchFieldIndexRegistry","Abstraction","CmsEntryOpenSearchFieldIndex"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoCC,aAAuD,CAAE;aAAzDA,aAAa,GAAbA;IAA0D;IAEvF,IAAIC,IAAY,EAAsD;QACzE,MAAMC,YAAYC,iBAAiB;YAC/BF;QACJ;QACA,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAACG,CAAAA,QAASA,MAAM,SAAS,KAAKF;IAChE;IAEO,aAAqD;QACxD,MAAMG,aAAa,IAAI,CAAC,aAAa,CAAC,IAAI,CACtCD,CAAAA,QAASA,MAAM,SAAS,KAAKE;QAEjC,IAAID,YACA,OAAOA;QAKX,MAAM,IAAIE,MACN,CAAC,gFAAgF,EAAED,uBAAuB,aAAa,CAAC;IAEhI;IAEO,SAAmD;QACtD,OAAO,IAAI,CAAC,aAAa;IAC7B;AACJ;AAEO,MAAME,4EAAuCC,qCAAAA,oBAAgC,CAAC;IACjF,gBAAgBV;IAChB,cAAc;QAAC;YAACW;YAA8B;gBAAE,UAAU;YAAK;SAAE;KAAC;AACtE"}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndexRegistry as Abstraction } from \"./abstractions/CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"./abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"./constants.js\";\n\nclass CmsEntryOpenSearchFieldIndexRegistryImpl implements Abstraction.Interface {\n private readonly cache: Map<string, CmsEntryOpenSearchFieldIndex.Interface | undefined> =\n new Map();\n\n public constructor(private readonly fieldIndexing: CmsEntryOpenSearchFieldIndex.Interface[]) {}\n\n public get(fieldType: string): CmsEntryOpenSearchFieldIndex.Interface | undefined {\n if (this.cache.has(fieldType)) {\n return this.cache.get(fieldType);\n }\n\n let indexing = this.fieldIndexing.find(field => {\n return field.fieldType === fieldType;\n });\n const baseType = getBaseFieldType({\n type: fieldType\n });\n if (!indexing && baseType !== fieldType) {\n indexing = this.fieldIndexing.find(field => {\n return field.fieldType === baseType;\n });\n }\n this.cache.set(fieldType, indexing);\n return indexing;\n }\n\n public getDefault(): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndex = this.fieldIndexing.find(\n field => field.fieldType === FIELD_INDEXING_DEFAULT\n );\n if (fieldIndex) {\n return fieldIndex;\n }\n /**\n * This should never happen, as the default field index plugin exists in our code. This can fail during testing.\n */\n throw new Error(\n `Missing default field index plugin. Please make sure to register a plugin with \"${FIELD_INDEXING_DEFAULT}\" field type.`\n );\n }\n\n public getAll(): CmsEntryOpenSearchFieldIndex.Interface[] {\n return this.fieldIndexing;\n }\n}\n\nexport const CmsEntryOpenSearchFieldIndexRegistry = Abstraction.createImplementation({\n implementation: CmsEntryOpenSearchFieldIndexRegistryImpl,\n dependencies: [[CmsEntryOpenSearchFieldIndex, { multiple: true }]]\n});\n"],"names":["CmsEntryOpenSearchFieldIndexRegistryImpl","fieldIndexing","Map","fieldType","indexing","field","baseType","getBaseFieldType","fieldIndex","FIELD_INDEXING_DEFAULT","Error","CmsEntryOpenSearchFieldIndexRegistry","Abstraction","CmsEntryOpenSearchFieldIndex"],"mappings":";;;;AAKA,MAAMA;IAIF,YAAoCC,aAAuD,CAAE;aAAzDA,aAAa,GAAbA;aAHnB,KAAK,GAClB,IAAIC;IAEsF;IAEvF,IAAIC,SAAiB,EAAsD;QAC9E,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,YACf,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA;QAG1B,IAAIC,WAAW,IAAI,CAAC,aAAa,CAAC,IAAI,CAACC,CAAAA,QAC5BA,MAAM,SAAS,KAAKF;QAE/B,MAAMG,WAAWC,iBAAiB;YAC9B,MAAMJ;QACV;QACA,IAAI,CAACC,YAAYE,aAAaH,WAC1BC,WAAW,IAAI,CAAC,aAAa,CAAC,IAAI,CAACC,CAAAA,QACxBA,MAAM,SAAS,KAAKC;QAGnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAACH,WAAWC;QAC1B,OAAOA;IACX;IAEO,aAAqD;QACxD,MAAMI,aAAa,IAAI,CAAC,aAAa,CAAC,IAAI,CACtCH,CAAAA,QAASA,MAAM,SAAS,KAAKI;QAEjC,IAAID,YACA,OAAOA;QAKX,MAAM,IAAIE,MACN,CAAC,gFAAgF,EAAED,uBAAuB,aAAa,CAAC;IAEhI;IAEO,SAAmD;QACtD,OAAO,IAAI,CAAC,aAAa;IAC7B;AACJ;AAEO,MAAME,4EAAuCC,qCAAAA,oBAAgC,CAAC;IACjF,gBAAgBZ;IAChB,cAAc;QAAC;YAACa;YAA8B;gBAAE,UAAU;YAAK;SAAE;KAAC;AACtE"}
@@ -1,9 +1,7 @@
1
1
  import type { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types/index.js";
2
- import type { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
3
2
  export interface ToIndexParams {
4
3
  model: CmsModel;
5
4
  field: CmsModelField;
6
- fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
7
5
  value: any;
8
6
  rawValue: any;
9
7
  getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;
@@ -15,7 +13,6 @@ export interface ToIndexValue {
15
13
  export interface FromIndexParams {
16
14
  model: CmsModel;
17
15
  field: CmsModelField;
18
- fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
19
16
  value: any;
20
17
  rawValue: any;
21
18
  getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;
@@ -1 +1 @@
1
- {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport interface ToIndexParams {\n model: CmsModel;\n field: CmsModelField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ToIndexValue {\n value?: any;\n rawValue?: any;\n}\n\nexport interface FromIndexParams {\n model: CmsModel;\n field: CmsModelField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ICmsEntryOpenSearchFieldIndex {\n readonly fieldType: string;\n unmappedType?(field: Pick<CmsModelField, \"fieldId\" | \"type\">): string;\n toIndex(params: ToIndexParams): ToIndexValue;\n fromIndex(params: FromIndexParams): any;\n}\n\nexport const CmsEntryOpenSearchFieldIndex = createAbstraction<ICmsEntryOpenSearchFieldIndex>(\n \"Cms/Entry/OpenSearch/FieldIndex\"\n);\n\nexport namespace CmsEntryOpenSearchFieldIndex {\n export type Interface = ICmsEntryOpenSearchFieldIndex;\n export type ToIndex = ToIndexParams;\n export type ToValue = ToIndexValue;\n export type FromIndex = FromIndexParams;\n}\n"],"names":["CmsEntryOpenSearchFieldIndex","createAbstraction"],"mappings":";AAkCO,MAAMA,+BAA+BC,kBACxC"}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface ToIndexParams {\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ToIndexValue {\n value?: any;\n rawValue?: any;\n}\n\nexport interface FromIndexParams {\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ICmsEntryOpenSearchFieldIndex {\n readonly fieldType: string;\n unmappedType?(field: Pick<CmsModelField, \"fieldId\" | \"type\">): string;\n toIndex(params: ToIndexParams): ToIndexValue;\n fromIndex(params: FromIndexParams): any;\n}\n\nexport const CmsEntryOpenSearchFieldIndex = createAbstraction<ICmsEntryOpenSearchFieldIndex>(\n \"Cms/Entry/OpenSearch/FieldIndex\"\n);\n\nexport namespace CmsEntryOpenSearchFieldIndex {\n export type Interface = ICmsEntryOpenSearchFieldIndex;\n export type ToIndex = ToIndexParams;\n export type ToValue = ToIndexValue;\n export type FromIndex = FromIndexParams;\n}\n"],"names":["CmsEntryOpenSearchFieldIndex","createAbstraction"],"mappings":";AA+BO,MAAMA,+BAA+BC,kBACxC"}
@@ -7,17 +7,19 @@ import { NumberFieldIndex } from "./fields/NumberFieldIndex.js";
7
7
  import { DefaultFieldIndex } from "./fields/DefaultFieldIndex.js";
8
8
  import { DateTimeFieldIndex } from "./fields/DateTimeFieldIndex.js";
9
9
  import { ObjectFieldIndex } from "./fields/ObjectFieldIndex.js";
10
+ import { TextCompressedFieldIndex } from "./fields/TextCompressedFieldIndex.js";
10
11
  const CmsEntryOpenSearchFieldIndexFeature = createFeature({
11
12
  name: "Cms/Entry/OpenSearch/FieldIndexFeature",
12
13
  register: (container)=>{
13
- container.register(RichTextFieldIndex);
14
- container.register(JsonFieldIndex);
15
- container.register(LongTextFieldIndex);
16
- container.register(NumberFieldIndex);
17
- container.register(DefaultFieldIndex);
18
- container.register(DateTimeFieldIndex);
19
- container.register(ObjectFieldIndex);
20
- container.register(CmsEntryOpenSearchFieldIndexRegistry);
14
+ container.register(RichTextFieldIndex).inSingletonScope();
15
+ container.register(JsonFieldIndex).inSingletonScope();
16
+ container.register(LongTextFieldIndex).inSingletonScope();
17
+ container.register(NumberFieldIndex).inSingletonScope();
18
+ container.register(DefaultFieldIndex).inSingletonScope();
19
+ container.register(DateTimeFieldIndex).inSingletonScope();
20
+ container.register(ObjectFieldIndex).inSingletonScope();
21
+ container.register(TextCompressedFieldIndex).inSingletonScope();
22
+ container.register(CmsEntryOpenSearchFieldIndexRegistry).inSingletonScope();
21
23
  }
22
24
  });
23
25
  export { CmsEntryOpenSearchFieldIndexFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/feature.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"./CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { RichTextFieldIndex } from \"./fields/RichTextFieldIndex.js\";\nimport { JsonFieldIndex } from \"./fields/JsonFieldIndex.js\";\nimport { LongTextFieldIndex } from \"./fields/LongTextFieldIndex.js\";\nimport { NumberFieldIndex } from \"./fields/NumberFieldIndex.js\";\nimport { DefaultFieldIndex } from \"./fields/DefaultFieldIndex.js\";\nimport { DateTimeFieldIndex } from \"./fields/DateTimeFieldIndex.js\";\nimport { ObjectFieldIndex } from \"./fields/ObjectFieldIndex.js\";\n\nexport const CmsEntryOpenSearchFieldIndexFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FieldIndexFeature\",\n register: container => {\n container.register(RichTextFieldIndex);\n container.register(JsonFieldIndex);\n container.register(LongTextFieldIndex);\n container.register(NumberFieldIndex);\n container.register(DefaultFieldIndex);\n container.register(DateTimeFieldIndex);\n container.register(ObjectFieldIndex);\n container.register(CmsEntryOpenSearchFieldIndexRegistry);\n }\n});\n"],"names":["CmsEntryOpenSearchFieldIndexFeature","createFeature","container","RichTextFieldIndex","JsonFieldIndex","LongTextFieldIndex","NumberFieldIndex","DefaultFieldIndex","DateTimeFieldIndex","ObjectFieldIndex","CmsEntryOpenSearchFieldIndexRegistry"],"mappings":";;;;;;;;;AAUO,MAAMA,sCAAsCC,cAAc;IAC7D,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;IACvB;AACJ"}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/feature.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"./CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { RichTextFieldIndex } from \"./fields/RichTextFieldIndex.js\";\nimport { JsonFieldIndex } from \"./fields/JsonFieldIndex.js\";\nimport { LongTextFieldIndex } from \"./fields/LongTextFieldIndex.js\";\nimport { NumberFieldIndex } from \"./fields/NumberFieldIndex.js\";\nimport { DefaultFieldIndex } from \"./fields/DefaultFieldIndex.js\";\nimport { DateTimeFieldIndex } from \"./fields/DateTimeFieldIndex.js\";\nimport { ObjectFieldIndex } from \"./fields/ObjectFieldIndex.js\";\nimport { TextCompressedFieldIndex } from \"~/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js\";\n\nexport const CmsEntryOpenSearchFieldIndexFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FieldIndexFeature\",\n register: container => {\n container.register(RichTextFieldIndex).inSingletonScope();\n container.register(JsonFieldIndex).inSingletonScope();\n container.register(LongTextFieldIndex).inSingletonScope();\n container.register(NumberFieldIndex).inSingletonScope();\n container.register(DefaultFieldIndex).inSingletonScope();\n container.register(DateTimeFieldIndex).inSingletonScope();\n container.register(ObjectFieldIndex).inSingletonScope();\n container.register(TextCompressedFieldIndex).inSingletonScope();\n\n // must be registered last\n container.register(CmsEntryOpenSearchFieldIndexRegistry).inSingletonScope();\n }\n});\n"],"names":["CmsEntryOpenSearchFieldIndexFeature","createFeature","container","RichTextFieldIndex","JsonFieldIndex","LongTextFieldIndex","NumberFieldIndex","DefaultFieldIndex","DateTimeFieldIndex","ObjectFieldIndex","TextCompressedFieldIndex","CmsEntryOpenSearchFieldIndexRegistry"],"mappings":";;;;;;;;;;AAWO,MAAMA,sCAAsCC,cAAc;IAC7D,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC,oBAAoB,gBAAgB;QACvDD,UAAU,QAAQ,CAACE,gBAAgB,gBAAgB;QACnDF,UAAU,QAAQ,CAACG,oBAAoB,gBAAgB;QACvDH,UAAU,QAAQ,CAACI,kBAAkB,gBAAgB;QACrDJ,UAAU,QAAQ,CAACK,mBAAmB,gBAAgB;QACtDL,UAAU,QAAQ,CAACM,oBAAoB,gBAAgB;QACvDN,UAAU,QAAQ,CAACO,kBAAkB,gBAAgB;QACrDP,UAAU,QAAQ,CAACQ,0BAA0B,gBAAgB;QAG7DR,UAAU,QAAQ,CAACS,sCAAsC,gBAAgB;IAC7E;AACJ"}
@@ -1,8 +1,11 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
2
3
  declare class DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
4
+ private readonly fieldRegistry;
3
5
  readonly fieldType: "*";
4
- toIndex({ field, fieldRegistry, value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
- fromIndex({ field, fieldRegistry, value, rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ constructor(fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface);
7
+ toIndex({ field, value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
8
+ fromIndex({ field, value, rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
9
  }
7
10
  export declare const DefaultFieldIndex: typeof DefaultFieldIndexImpl & {
8
11
  __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
@@ -1,8 +1,13 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
2
  import { FIELD_INDEXING_DEFAULT } from "../constants.js";
3
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
3
4
  class DefaultFieldIndexImpl {
4
- toIndex({ field, fieldRegistry, value }) {
5
- const fieldType = fieldRegistry.get(field.type);
5
+ constructor(fieldRegistry){
6
+ this.fieldRegistry = fieldRegistry;
7
+ this.fieldType = FIELD_INDEXING_DEFAULT;
8
+ }
9
+ toIndex({ field, value }) {
10
+ const fieldType = this.fieldRegistry.get(field.type);
6
11
  if (fieldType?.isSearchable === true) return {
7
12
  value
8
13
  };
@@ -10,19 +15,18 @@ class DefaultFieldIndexImpl {
10
15
  rawValue: value
11
16
  };
12
17
  }
13
- fromIndex({ field, fieldRegistry, value, rawValue }) {
14
- const fieldType = fieldRegistry.get(field.type);
18
+ fromIndex({ field, value, rawValue }) {
19
+ const fieldType = this.fieldRegistry.get(field.type);
15
20
  const isSearchable = fieldType?.isSearchable ?? false;
16
21
  if (isSearchable) return void 0 === value ? rawValue : value;
17
22
  return void 0 === rawValue ? value : rawValue;
18
23
  }
19
- constructor(){
20
- this.fieldType = FIELD_INDEXING_DEFAULT;
21
- }
22
24
  }
23
25
  const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
24
26
  implementation: DefaultFieldIndexImpl,
25
- dependencies: []
27
+ dependencies: [
28
+ CmsModelFieldToGraphQLRegistry
29
+ ]
26
30
  });
27
31
  export { DefaultFieldIndex };
28
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"../constants.js\";\n\nclass DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = FIELD_INDEXING_DEFAULT;\n\n public toIndex({\n field,\n fieldRegistry,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n const fieldType = fieldRegistry.get(field.type);\n\n if (fieldType?.isSearchable === true) {\n return { value };\n }\n\n return { rawValue: value };\n }\n\n public fromIndex({\n field,\n fieldRegistry,\n value,\n rawValue\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const fieldType = fieldRegistry.get(field.type);\n const isSearchable = fieldType?.isSearchable ?? false;\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n}\n\nexport const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DefaultFieldIndexImpl,\n dependencies: []\n});\n"],"names":["DefaultFieldIndexImpl","field","fieldRegistry","value","fieldType","rawValue","isSearchable","undefined","FIELD_INDEXING_DEFAULT","DefaultFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";;AAGA,MAAMA;IAGK,QAAQ,EACXC,KAAK,EACLC,aAAa,EACbC,KAAK,EAC8B,EAAwC;QAC3E,MAAMC,YAAYF,cAAc,GAAG,CAACD,MAAM,IAAI;QAE9C,IAAIG,WAAW,iBAAiB,MAC5B,OAAO;YAAED;QAAM;QAGnB,OAAO;YAAE,UAAUA;QAAM;IAC7B;IAEO,UAAU,EACbF,KAAK,EACLC,aAAa,EACbC,KAAK,EACLE,QAAQ,EAC6B,EAAO;QAC5C,MAAMD,YAAYF,cAAc,GAAG,CAACD,MAAM,IAAI;QAC9C,MAAMK,eAAeF,WAAW,gBAAgB;QAEhD,IAAIE,cACA,OAAOH,AAAUI,WAAVJ,QAAsBE,WAAWF;QAE5C,OAAOE,AAAaE,WAAbF,WAAyBF,QAAQE;IAC5C;;aA7BgB,SAAS,GAAGG;;AA8BhC;AAEO,MAAMC,oBAAoBC,6BAA6B,oBAAoB,CAAC;IAC/E,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"../constants.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nclass DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = FIELD_INDEXING_DEFAULT;\n public constructor(private readonly fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface) {}\n\n public toIndex({\n field,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n const fieldType = this.fieldRegistry.get(field.type);\n\n if (fieldType?.isSearchable === true) {\n return { value };\n }\n\n return { rawValue: value };\n }\n\n public fromIndex({ field, value, rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const fieldType = this.fieldRegistry.get(field.type);\n const isSearchable = fieldType?.isSearchable ?? false;\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n}\n\nexport const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DefaultFieldIndexImpl,\n dependencies: [CmsModelFieldToGraphQLRegistry]\n});\n"],"names":["DefaultFieldIndexImpl","fieldRegistry","FIELD_INDEXING_DEFAULT","field","value","fieldType","rawValue","isSearchable","undefined","DefaultFieldIndex","CmsEntryOpenSearchFieldIndex","CmsModelFieldToGraphQLRegistry"],"mappings":";;;AAIA,MAAMA;IAEF,YAAoCC,aAAuD,CAAE;aAAzDA,aAAa,GAAbA;aADpB,SAAS,GAAGC;IACkE;IAEvF,QAAQ,EACXC,KAAK,EACLC,KAAK,EAC8B,EAAwC;QAC3E,MAAMC,YAAY,IAAI,CAAC,aAAa,CAAC,GAAG,CAACF,MAAM,IAAI;QAEnD,IAAIE,WAAW,iBAAiB,MAC5B,OAAO;YAAED;QAAM;QAGnB,OAAO;YAAE,UAAUA;QAAM;IAC7B;IAEO,UAAU,EAAED,KAAK,EAAEC,KAAK,EAAEE,QAAQ,EAA0C,EAAO;QACtF,MAAMD,YAAY,IAAI,CAAC,aAAa,CAAC,GAAG,CAACF,MAAM,IAAI;QACnD,MAAMI,eAAeF,WAAW,gBAAgB;QAEhD,IAAIE,cACA,OAAOH,AAAUI,WAAVJ,QAAsBE,WAAWF;QAE5C,OAAOE,AAAaE,WAAbF,WAAyBF,QAAQE;IAC5C;AACJ;AAEO,MAAMG,oBAAoBC,6BAA6B,oBAAoB,CAAC;IAC/E,gBAAgBV;IAChB,cAAc;QAACW;KAA+B;AAClD"}
@@ -1,8 +1,10 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
2
  declare class ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
3
  readonly fieldType = "object";
4
- toIndex({ fieldRegistry, model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
- fromIndex({ field, value, rawValue, model, getFieldIndex, fieldRegistry }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
4
+ toIndex({ model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
+ fromIndex({ field, value, rawValue, model, getFieldIndex }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ private processToIndex;
7
+ private processFromIndex;
6
8
  }
7
9
  export declare const ObjectFieldIndex: typeof ObjectFieldIndexImpl & {
8
10
  __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
@@ -1,47 +1,7 @@
1
1
  import { getFieldIdentifiers } from "../../../helpers/index.js";
2
2
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
3
- const processToIndex = (params)=>{
4
- const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, fieldRegistry, model } = params;
5
- return fields.reduce((values, field)=>{
6
- const plugin = getFieldIndex(field.type);
7
- const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
8
- if (!identifiers) return values;
9
- const { value, rawValue } = plugin.toIndex({
10
- model,
11
- field,
12
- value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
13
- rawValue: sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],
14
- getFieldIndex,
15
- fieldRegistry
16
- });
17
- if (void 0 !== value) values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
18
- if (void 0 !== rawValue) values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] = rawValue;
19
- return values;
20
- }, {
21
- value: {},
22
- rawValue: {}
23
- });
24
- };
25
- const processFromIndex = (params)=>{
26
- const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, fieldRegistry, model } = params;
27
- return fields.reduce((values, field)=>{
28
- const plugin = getFieldIndex(field.type);
29
- const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
30
- if (!identifiers) return values;
31
- const value = plugin.fromIndex({
32
- fieldRegistry,
33
- model,
34
- field,
35
- value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
36
- rawValue: sourceRawValue ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null,
37
- getFieldIndex
38
- });
39
- if (void 0 !== value) values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
40
- return values;
41
- }, {});
42
- };
43
3
  class ObjectFieldIndexImpl {
44
- toIndex({ fieldRegistry, model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }) {
4
+ toIndex({ model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }) {
45
5
  if (!initialValue) return {
46
6
  value: null
47
7
  };
@@ -52,12 +12,11 @@ class ObjectFieldIndexImpl {
52
12
  rawValue: []
53
13
  };
54
14
  for(const key in initialValue){
55
- const { value, rawValue } = processToIndex({
15
+ const { value, rawValue } = this.processToIndex({
56
16
  value: initialValue[key],
57
17
  rawValue: initialRawValue[key],
58
18
  getFieldIndex,
59
19
  model,
60
- fieldRegistry,
61
20
  fields
62
21
  });
63
22
  result.value.push(value);
@@ -68,40 +27,75 @@ class ObjectFieldIndexImpl {
68
27
  rawValue: result.rawValue.length > 0 ? result.rawValue : void 0
69
28
  };
70
29
  }
71
- return processToIndex({
30
+ return this.processToIndex({
72
31
  value: initialValue,
73
32
  rawValue: initialRawValue,
74
33
  getFieldIndex,
75
34
  model,
76
- fieldRegistry,
77
35
  fields
78
36
  });
79
37
  }
80
- fromIndex({ field, value, rawValue, model, getFieldIndex, fieldRegistry }) {
38
+ fromIndex({ field, value, rawValue, model, getFieldIndex }) {
81
39
  if (!value) return null;
82
40
  const fields = field.settings?.fields || [];
83
41
  if (field.list) {
84
42
  const source = value || rawValue || [];
85
- return source.map((_, index)=>processFromIndex({
43
+ return source.map((_, index)=>this.processFromIndex({
86
44
  value: value ? value[index] || {} : {},
87
45
  rawValue: rawValue ? rawValue[index] || {} : {},
88
46
  getFieldIndex,
89
47
  model,
90
- fieldRegistry,
91
48
  fields
92
49
  }));
93
50
  }
94
- return processFromIndex({
51
+ return this.processFromIndex({
95
52
  value,
96
53
  rawValue,
97
54
  getFieldIndex,
98
55
  model,
99
- fieldRegistry,
100
56
  fields
101
57
  });
102
58
  }
59
+ processToIndex(params) {
60
+ const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, model } = params;
61
+ return fields.reduce((values, field)=>{
62
+ const plugin = getFieldIndex(field.type);
63
+ const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
64
+ if (!identifiers) return values;
65
+ const { value, rawValue } = plugin.toIndex({
66
+ model,
67
+ field,
68
+ value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
69
+ rawValue: sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],
70
+ getFieldIndex
71
+ });
72
+ if (void 0 !== value) values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
73
+ if (void 0 !== rawValue) values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] = rawValue;
74
+ return values;
75
+ }, {
76
+ value: {},
77
+ rawValue: {}
78
+ });
79
+ }
103
80
  constructor(){
104
81
  this.fieldType = "object";
82
+ this.processFromIndex = (params)=>{
83
+ const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, model } = params;
84
+ return fields.reduce((values, field)=>{
85
+ const plugin = getFieldIndex(field.type);
86
+ const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
87
+ if (!identifiers) return values;
88
+ const value = plugin.fromIndex({
89
+ model,
90
+ field,
91
+ value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
92
+ rawValue: sourceRawValue ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null,
93
+ getFieldIndex
94
+ });
95
+ if (void 0 !== value) values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
96
+ return values;
97
+ }, {});
98
+ };
105
99
  }
106
100
  }
107
101
  const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { getFieldIdentifiers } from \"~/helpers/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\ninterface ProcessToIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\ninterface ReducerValue {\n value: Record<string, any>;\n rawValue: Record<string, any>;\n}\n\nconst processToIndex = (params: ProcessToIndexParams): ReducerValue => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<ReducerValue>(\n (values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue:\n sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],\n getFieldIndex,\n fieldRegistry\n });\n\n if (value !== undefined) {\n values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n if (rawValue !== undefined) {\n values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] =\n rawValue;\n }\n\n return values;\n },\n { value: {}, rawValue: {} }\n );\n};\n\ninterface ProcessFromIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue?: Record<string, any> | null;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\nconst processFromIndex = (params: ProcessFromIndexParams): Record<string, any> => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<Record<string, any>>((values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const value = plugin.fromIndex({\n fieldRegistry,\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue: sourceRawValue\n ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier]\n : null,\n getFieldIndex\n });\n\n if (value !== undefined) {\n values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n\n return values;\n }, {});\n};\n\nclass ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"object\";\n\n public toIndex({\n fieldRegistry,\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.list) {\n const result: { value: Record<string, any>[]; rawValue: Record<string, any>[] } = {\n value: [],\n rawValue: []\n };\n for (const key in initialValue) {\n const { value, rawValue } = processToIndex({\n value: initialValue[key],\n rawValue: initialRawValue[key],\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n\n result.value.push(value);\n result.rawValue.push(rawValue);\n }\n\n return {\n value: result.value.length > 0 ? result.value : undefined,\n rawValue: result.rawValue.length > 0 ? result.rawValue : undefined\n };\n }\n\n return processToIndex({\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n\n public fromIndex({\n field,\n value,\n rawValue,\n model,\n getFieldIndex,\n fieldRegistry\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n if (field.list) {\n const source = value || rawValue || [];\n\n return source.map((_: any, index: number) =>\n processFromIndex({\n value: value ? value[index] || {} : {},\n rawValue: rawValue ? rawValue[index] || {} : {},\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n })\n );\n }\n\n return processFromIndex({\n value,\n rawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n}\n\nexport const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: ObjectFieldIndexImpl,\n dependencies: []\n});\n"],"names":["processToIndex","params","fields","sourceValue","sourceRawValue","getFieldIndex","fieldRegistry","model","values","field","plugin","identifiers","getFieldIdentifiers","value","rawValue","undefined","processFromIndex","ObjectFieldIndexImpl","initialValue","initialRawValue","result","key","source","_","index","ObjectFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";;AAmBA,MAAMA,iBAAiB,CAACC;IACpB,MAAM,EACFC,MAAM,EACN,OAAOC,WAAW,EAClB,UAAUC,cAAc,EACxBC,aAAa,EACbC,aAAa,EACbC,KAAK,EACR,GAAGN;IAEJ,OAAOC,OAAO,MAAM,CAChB,CAACM,QAAQC;QACL,MAAMC,SAASL,cAAcI,MAAM,IAAI;QAEvC,MAAME,cAAcC,oBAAoBT,aAAaC,gB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IAAI,CAAC,IAAI,CAAC;oBAC9CnB;oBACAE;oBACAD;oBACAJ;gBACJ;QAER;QAEA,OAAOc,iBAAiB;YACpBH;YACAC;YACAT;YACAE;YACAD;YACAJ;QACJ;IACJ;;aAxFgB,SAAS,GAAG;;AAyFhC;AAEO,MAAMuB,mBAAmBC,6BAA6B,oBAAoB,CAAC;IAC9E,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { getFieldIdentifiers } from \"~/helpers/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\ninterface ProcessToIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n model: CmsModel;\n}\n\ninterface ReducerValue {\n value: Record<string, any>;\n rawValue: Record<string, any>;\n}\n\ninterface ProcessFromIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue?: Record<string, any> | null;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n model: CmsModel;\n}\n\nclass ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"object\";\n\n public toIndex({\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.list) {\n const result: { value: Record<string, any>[]; rawValue: Record<string, any>[] } = {\n value: [],\n rawValue: []\n };\n for (const key in initialValue) {\n const { value, rawValue } = this.processToIndex({\n value: initialValue[key],\n rawValue: initialRawValue[key],\n getFieldIndex,\n model,\n fields\n });\n\n result.value.push(value);\n result.rawValue.push(rawValue);\n }\n\n return {\n value: result.value.length > 0 ? result.value : undefined,\n rawValue: result.rawValue.length > 0 ? result.rawValue : undefined\n };\n }\n\n return this.processToIndex({\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex,\n model,\n fields\n });\n }\n\n public fromIndex({\n field,\n value,\n rawValue,\n model,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n if (field.list) {\n const source = value || rawValue || [];\n\n return source.map((_: any, index: number) =>\n this.processFromIndex({\n value: value ? value[index] || {} : {},\n rawValue: rawValue ? rawValue[index] || {} : {},\n getFieldIndex,\n model,\n fields\n })\n );\n }\n\n return this.processFromIndex({\n value,\n rawValue,\n getFieldIndex,\n model,\n fields\n });\n }\n\n private processToIndex(params: ProcessToIndexParams): ReducerValue {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n model\n } = params;\n\n return fields.reduce<ReducerValue>(\n (values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[\n identifiers.valueIdentifier || identifiers.rawValueIdentifier\n ],\n rawValue:\n sourceRawValue[\n identifiers.rawValueIdentifier || identifiers.valueIdentifier\n ],\n getFieldIndex\n });\n\n if (value !== undefined) {\n values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] =\n value;\n }\n if (rawValue !== undefined) {\n values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] =\n rawValue;\n }\n\n return values;\n },\n { value: {}, rawValue: {} }\n );\n }\n\n private processFromIndex = (params: ProcessFromIndexParams): Record<string, any> => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n model\n } = params;\n\n return fields.reduce<Record<string, any>>((values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const value = plugin.fromIndex({\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue: sourceRawValue\n ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier]\n : null,\n getFieldIndex\n });\n\n if (value !== undefined) {\n values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n\n return values;\n }, {});\n };\n}\n\nexport const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: ObjectFieldIndexImpl,\n dependencies: []\n});\n"],"names":["ObjectFieldIndexImpl","model","field","initialValue","initialRawValue","getFieldIndex","fields","result","key","value","rawValue","undefined","source","_","index","params","sourceValue","sourceRawValue","values","plugin","identifiers","getFieldIdentifiers","ObjectFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";;AAyBA,MAAMA;IAGK,QAAQ,EACXC,KAAK,EACLC,KAAK,EACL,OAAOC,YAAY,EACnB,UAAUC,eAAe,EACzBC,aAAa,EACsB,EAAwC;QAC3E,IAAI,CAACF,cACD,OAAO;YAAE,OAAO;QAAK;QAGzB,MAAMG,SAAUJ,MAAM,QAAQ,EAAE,UAAU,EAAE;QAE5C,IAAIA,MAAM,IAAI,EAAE;YACZ,MAAMK,SAA4E;gBAC9E,OAAO,EAAE;gBACT,UAAU,EAAE;YAChB;YACA,IAAK,MAAMC,OAAOL,aAAc;gBAC5B,MAAM,EAAEM,KAAK,EAAEC,QAAQ,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;oBAC5C,OAAOP,YAAY,CAACK,IAAI;oBACxB,UAAUJ,eAAe,CAACI,IAAI;oBAC9BH;oBACAJ;oBACAK;gBACJ;gBAEAC,OAAO,KAAK,CAAC,IAA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@@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
3
+ declare class TextCompressedFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
4
+ private readonly fieldRegistry;
5
+ readonly fieldType = "text:compressed";
6
+ constructor(fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface);
7
+ toIndex(params: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
8
+ fromIndex(params: CmsEntryOpenSearchFieldIndex.FromIndex): any;
9
+ private isSearchable;
10
+ }
11
+ export declare const TextCompressedFieldIndex: typeof TextCompressedFieldIndexImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
13
+ };
14
+ export {};
@@ -0,0 +1,39 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
3
+ class TextCompressedFieldIndexImpl {
4
+ constructor(fieldRegistry){
5
+ this.fieldRegistry = fieldRegistry;
6
+ this.fieldType = "text:compressed";
7
+ }
8
+ toIndex(params) {
9
+ const { field, value } = params;
10
+ const isSearchable = this.isSearchable(field);
11
+ if (isSearchable) return {
12
+ value
13
+ };
14
+ return {
15
+ rawValue: value
16
+ };
17
+ }
18
+ fromIndex(params) {
19
+ const { field, value, rawValue } = params;
20
+ const isSearchable = this.isSearchable(field);
21
+ if (isSearchable) return void 0 === value ? rawValue : value;
22
+ return void 0 === rawValue ? value : rawValue;
23
+ }
24
+ isSearchable(field) {
25
+ const fieldType = this.fieldRegistry.get(field.type);
26
+ if (!fieldType?.isSearchable) return false;
27
+ if (field.settings?.disableFullTextSearch === true) return false;
28
+ return true;
29
+ }
30
+ }
31
+ const TextCompressedFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
32
+ implementation: TextCompressedFieldIndexImpl,
33
+ dependencies: [
34
+ CmsModelFieldToGraphQLRegistry
35
+ ]
36
+ });
37
+ export { TextCompressedFieldIndex };
38
+
39
+ //# sourceMappingURL=TextCompressedFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nclass TextCompressedFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"text:compressed\";\n\n public constructor(private readonly fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface) {}\n\n public toIndex(\n params: CmsEntryOpenSearchFieldIndex.ToIndex\n ): CmsEntryOpenSearchFieldIndex.ToValue {\n const { field, value } = params;\n const isSearchable = this.isSearchable(field);\n\n if (isSearchable) {\n return { value };\n }\n\n return {\n rawValue: value\n };\n }\n\n public fromIndex(params: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const { field, value, rawValue } = params;\n const isSearchable = this.isSearchable(field);\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n\n private isSearchable(field: CmsModelField): boolean {\n const fieldType = this.fieldRegistry.get(field.type);\n if (!fieldType?.isSearchable) {\n return false;\n } else if (field.settings?.disableFullTextSearch === true) {\n return false;\n }\n return true;\n }\n}\n\nexport const TextCompressedFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: TextCompressedFieldIndexImpl,\n dependencies: [CmsModelFieldToGraphQLRegistry]\n});\n"],"names":["TextCompressedFieldIndexImpl","fieldRegistry","params","field","value","isSearchable","rawValue","undefined","fieldType","TextCompressedFieldIndex","CmsEntryOpenSearchFieldIndex","CmsModelFieldToGraphQLRegistry"],"mappings":";;AAIA,MAAMA;IAGF,YAAoCC,aAAuD,CAAE;aAAzDA,aAAa,GAAbA;aAFpB,SAAS,GAAG;IAEkE;IAEvF,QACHC,MAA4C,EACR;QACpC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QACzB,MAAMG,eAAe,IAAI,CAAC,YAAY,CAACF;QAEvC,IAAIE,cACA,OAAO;YAAED;QAAM;QAGnB,OAAO;YACH,UAAUA;QACd;IACJ;IAEO,UAAUF,MAA8C,EAAO;QAClE,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEE,QAAQ,EAAE,GAAGJ;QACnC,MAAMG,eAAe,IAAI,CAAC,YAAY,CAACF;QAEvC,IAAIE,cACA,OAAOD,AAAUG,WAAVH,QAAsBE,WAAWF;QAE5C,OAAOE,AAAaC,WAAbD,WAAyBF,QAAQE;IAC5C;IAEQ,aAAaH,KAAoB,EAAW;QAChD,MAAMK,YAAY,IAAI,CAAC,aAAa,CAAC,GAAG,CAACL,MAAM,IAAI;QACnD,IAAI,CAACK,WAAW,cACZ,OAAO;QACJ,IAAIL,MAAM,QAAQ,EAAE,0BAA0B,MACjD,OAAO;QAEX,OAAO;IACX;AACJ;AAEO,MAAMM,2BAA2BC,6BAA6B,oBAAoB,CAAC;IACtF,gBAAgBV;IAChB,cAAc;QAACW;KAA+B;AAClD"}
@@ -10,7 +10,7 @@ interface ExtractEntriesFromIndexParams<T extends CmsEntryValues = CmsEntryValue
10
10
  model: CmsModel;
11
11
  entries: CmsIndexEntry<T>[];
12
12
  }
13
- interface PrepareElasticsearchDataParams<T extends CmsEntryValues = CmsEntryValues> extends SetupEntriesIndexHelpersParams {
13
+ interface PrepareElasticsearchDataParams<T extends CmsEntryValues = CmsEntryValues> extends Omit<SetupEntriesIndexHelpersParams, "fieldRegistry"> {
14
14
  model: CmsModel;
15
15
  entry: CmsEntry<T>;
16
16
  storageEntry: CmsEntry<T>;
@@ -1,7 +1,7 @@
1
1
  import { WebinyError } from "@webiny/error";
2
2
  import { getFieldIdentifier, getFieldIdentifiers } from "./fieldIdentifier.js";
3
3
  const prepareEntryToIndex = (params)=>{
4
- const { fieldRegistry, fieldIndexRegistry, storageEntry, entry, model } = params;
4
+ const { fieldIndexRegistry, storageEntry, entry, model } = params;
5
5
  function getFieldIndex(type) {
6
6
  const fieldIndexing = fieldIndexRegistry.get(type);
7
7
  if (fieldIndexing) return fieldIndexing;
@@ -14,7 +14,6 @@ const prepareEntryToIndex = (params)=>{
14
14
  if (!identifier) continue;
15
15
  const fieldIndex = getFieldIndex(field.type);
16
16
  const { value, rawValue } = fieldIndex.toIndex({
17
- fieldRegistry,
18
17
  model,
19
18
  field,
20
19
  rawValue: entry.values[identifier],
@@ -48,7 +47,6 @@ const extractEntriesFromIndex = ({ fieldRegistry, fieldIndexRegistry, entries, m
48
47
  const key = identifiers.valueIdentifier;
49
48
  const rawKey = identifiers.rawValueIdentifier;
50
49
  indexValues[key] = fieldIndex.fromIndex({
51
- fieldRegistry,
52
50
  model,
53
51
  field,
54
52
  getFieldIndex,
@@ -1 +1 @@
1
- {"version":3,"file":"helpers/entryIndexHelpers.js","sources":["../../src/helpers/entryIndexHelpers.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { CmsEntry, CmsEntryValues, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsIndexEntry } from \"~/types.js\";\nimport { getFieldIdentifier, getFieldIdentifiers } from \"~/helpers/fieldIdentifier.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport type {\n CmsEntryOpenSearchFieldIndex,\n CmsEntryOpenSearchFieldIndexRegistry\n} from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\ninterface SetupEntriesIndexHelpersParams {\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;\n}\n\ninterface ExtractEntriesFromIndexParams<\n T extends CmsEntryValues = CmsEntryValues\n> extends SetupEntriesIndexHelpersParams {\n model: CmsModel;\n entries: CmsIndexEntry<T>[];\n}\n\ninterface PrepareElasticsearchDataParams<\n T extends CmsEntryValues = CmsEntryValues\n> extends SetupEntriesIndexHelpersParams {\n model: CmsModel;\n entry: CmsEntry<T>;\n storageEntry: CmsEntry<T>;\n}\n\nexport const prepareEntryToIndex = <T extends CmsEntryValues = CmsEntryValues>(\n params: PrepareElasticsearchDataParams<T>\n): CmsIndexEntry<T> => {\n const { fieldRegistry, fieldIndexRegistry, storageEntry, entry, model } = params;\n\n function getFieldIndex(type: string): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndexing = fieldIndexRegistry.get(type);\n if (fieldIndexing) {\n return fieldIndexing;\n }\n return fieldIndexRegistry.getDefault();\n }\n\n // These objects will contain values processed by field index implementations\n const values: T = {} as T;\n const rawValues: T = {} as T;\n\n // We're only interested in current model fields.\n for (const field of model.fields) {\n const identifier = getFieldIdentifier(storageEntry.values, field) as keyof T;\n if (!identifier) {\n continue;\n }\n\n const fieldIndex = getFieldIndex(field.type);\n\n const { value, rawValue } = fieldIndex.toIndex({\n fieldRegistry,\n model,\n field,\n rawValue: entry.values[identifier],\n value: storageEntry.values[identifier],\n getFieldIndex\n });\n\n if (typeof value !== \"undefined\") {\n values[identifier] = value;\n }\n\n if (typeof rawValue !== \"undefined\") {\n rawValues[identifier] = rawValue;\n }\n }\n return {\n ...storageEntry,\n values,\n rawValues\n };\n};\n\nexport const extractEntriesFromIndex = <T extends CmsEntryValues = CmsEntryValues>({\n fieldRegistry,\n fieldIndexRegistry,\n entries,\n model\n}: ExtractEntriesFromIndexParams<T>): CmsEntry<T>[] => {\n function getFieldIndex(type: string): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndex = fieldIndexRegistry.get(type);\n if (fieldIndex) {\n return fieldIndex;\n }\n return fieldIndexRegistry.getDefault();\n }\n\n const list: CmsEntry<T>[] = [];\n\n for (const entry of entries) {\n // This object will contain values processed by field index plugins\n const indexValues: T = {} as T;\n\n // We only consider fields that are present in the model\n for (const field of model.fields) {\n const fieldType = fieldRegistry.get(field.type);\n if (!fieldType) {\n throw new WebinyError(\n `Missing field type \"${field.type}\". Extract entries from index.`\n );\n }\n\n const fieldIndex = getFieldIndex(field.type);\n /**\n * We can safely cast as the code will not continue in case of no identifiers.\n */\n const identifiers = getFieldIdentifiers(entry.values, entry.rawValues, field);\n if (!identifiers) {\n continue;\n }\n try {\n const key = identifiers.valueIdentifier as keyof T;\n const rawKey = identifiers.rawValueIdentifier as keyof T;\n indexValues[key] = fieldIndex.fromIndex({\n fieldRegistry,\n model,\n field,\n getFieldIndex,\n value: entry.values[key || rawKey],\n /**\n * Possibly no rawValues so we must check for the existence of the field.\n */\n rawValue: entry.rawValues ? entry.rawValues[rawKey || key] : null\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not transform entry field from index.\",\n ex.code || \"FIELD_FROM_INDEX_ERROR\",\n {\n field,\n entry\n }\n );\n }\n }\n /**\n * Let's have a new entry so we do not modify the original one.\n */\n const newEntry: CmsEntry<T> = {\n ...entry,\n values: indexValues\n };\n /**\n * If we want to remove the rawValues, TYPE, latest, published and __type, we must make them optional or ignore them.\n */\n // @ts-expect-error\n delete newEntry[\"rawValues\"];\n // @ts-expect-error\n delete newEntry[\"TYPE\"];\n // @ts-expect-error\n delete newEntry[\"__type\"];\n // @ts-expect-error\n delete newEntry[\"latest\"];\n // @ts-expect-error\n delete newEntry[\"published\"];\n list.push({\n ...newEntry\n });\n }\n\n return list;\n};\n"],"names":["prepareEntryToIndex","params","fieldRegistry","fieldIndexRegistry","storageEntry","entry","model","getFieldIndex","type","fieldIndexing","values","rawValues","field","identifier","getFieldIdentifier","fieldIndex","value","rawValue","extractEntriesFromIndex","entries","list","indexValues","fieldType","WebinyError","identifiers","getFieldIdentifiers","key","rawKey","ex","newEntry"],"mappings":";;AA8BO,MAAMA,sBAAsB,CAC/BC;IAEA,MAAM,EAAEC,aAAa,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGL;IAE1E,SAASM,cAAcC,IAAY;QAC/B,MAAMC,gBAAgBN,mBAAmB,GAAG,CAACK;QAC7C,IAAIC,eACA,OAAOA;QAEX,OAAON,mBAAmB,UAAU;IACxC;IAGA,MAAMO,SAAY,CAAC;IACnB,MAAMC,YAAe,CAAC;IAGtB,KAAK,MAAMC,SAASN,MAAM,MAAM,CAAE;QAC9B,MAAMO,aAAaC,mBAAmBV,aAAa,MAAM,EAAEQ;QAC3D,IAAI,CAACC,YACD;QAGJ,MAAME,aAAaR,cAAcK,MAAM,IAAI;QAE3C,MAAM,EAAEI,KAAK,EAAEC,QAAQ,EAAE,GAAGF,WAAW,OAAO,CAAC;YAC3Cb;YACAI;YACAM;YACA,UAAUP,MAAM,MAAM,CAACQ,WAAW;YAClC,OAAOT,aAAa,MAAM,CAACS,WAAW;YACtCN;QACJ;QAEA,IAAI,AAAiB,WAAVS,OACPN,MAAM,CAACG,WAAW,GAAGG;QAGzB,IAAI,AAAoB,WAAbC,UACPN,SAAS,CAACE,WAAW,GAAGI;IAEhC;IACA,OAAO;QACH,GAAGb,YAAY;QACfM;QACAC;IACJ;AACJ;AAEO,MAAMO,0BAA0B,CAA4C,EAC/EhB,aAAa,EACbC,kBAAkB,EAClBgB,OAAO,EACPb,KAAK,EAC0B;IAC/B,SAASC,cAAcC,IAAY;QAC/B,MAAMO,aAAaZ,mBAAmB,GAAG,CAACK;QAC1C,IAAIO,YACA,OAAOA;QAEX,OAAOZ,mBAAmB,UAAU;IACxC;IAEA,MAAMiB,OAAsB,EAAE;IAE9B,KAAK,MAAMf,SAASc,QAAS;QAEzB,MAAME,cAAiB,CAAC;QAGxB,KAAK,MAAMT,SAASN,MAAM,MAAM,CAAE;YAC9B,MAAMgB,YAAYpB,cAAc,GAAG,CAACU,MAAM,IAAI;YAC9C,IAAI,CAACU,WACD,MAAM,IAAIC,YACN,CAAC,oBAAoB,EAAEX,MAAM,IAAI,CAAC,8BAA8B,CAAC;YAIzE,MAAMG,aAAaR,cAAcK,MAAM,IAAI;YAI3C,MAAMY,cAAcC,oBAAoBpB,MAAM,MAAM,EAAEA,MAAM,SAAS,EAAEO;YACvE,IAAKY,aAGL,IAAI;gBACA,MAAME,MAAMF,YAAY,eAAe;gBACvC,MAAMG,SAASH,YAAY,kBAAkB;gBAC7CH,WAAW,CAACK,IAAI,GAAGX,WAAW,SAAS,CAAC;oBACpCb;oBACAI;oBACAM;oBACAL;oBACA,OAAOF,MAAM,MAAM,CAACqB,OAAOC,OAAO;oBAIlC,UAAUtB,MAAM,SAAS,GAAGA,MAAM,SAAS,CAACsB,UAAUD,IAAI,GAAG;gBACjE;YACJ,EAAE,OAAOE,IAAI;gBACT,MAAM,IAAIL,YACNK,GAAG,OAAO,IAAI,+CACdA,GAAG,IAAI,IAAI,0BACX;oBACIhB;oBACAP;gBACJ;YAER;QACJ;QAIA,MAAMwB,WAAwB;YAC1B,GAAGxB,KAAK;YACR,QAAQgB;QACZ;QAKA,OAAOQ,QAAQ,CAAC,YAAY;QAE5B,OAAOA,QAAQ,CAAC,OAAO;QAEvB,OAAOA,QAAQ,CAAC,SAAS;QAEzB,OAAOA,QAAQ,CAAC,SAAS;QAEzB,OAAOA,QAAQ,CAAC,YAAY;QAC5BT,KAAK,IAAI,CAAC;YACN,GAAGS,QAAQ;QACf;IACJ;IAEA,OAAOT;AACX"}
1
+ {"version":3,"file":"helpers/entryIndexHelpers.js","sources":["../../src/helpers/entryIndexHelpers.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { CmsEntry, CmsEntryValues, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsIndexEntry } from \"~/types.js\";\nimport { getFieldIdentifier, getFieldIdentifiers } from \"~/helpers/fieldIdentifier.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport type {\n CmsEntryOpenSearchFieldIndex,\n CmsEntryOpenSearchFieldIndexRegistry\n} from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\ninterface SetupEntriesIndexHelpersParams {\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;\n}\n\ninterface ExtractEntriesFromIndexParams<\n T extends CmsEntryValues = CmsEntryValues\n> extends SetupEntriesIndexHelpersParams {\n model: CmsModel;\n entries: CmsIndexEntry<T>[];\n}\n\ninterface PrepareElasticsearchDataParams<T extends CmsEntryValues = CmsEntryValues> extends Omit<\n SetupEntriesIndexHelpersParams,\n \"fieldRegistry\"\n> {\n model: CmsModel;\n entry: CmsEntry<T>;\n storageEntry: CmsEntry<T>;\n}\n\nexport const prepareEntryToIndex = <T extends CmsEntryValues = CmsEntryValues>(\n params: PrepareElasticsearchDataParams<T>\n): CmsIndexEntry<T> => {\n const { fieldIndexRegistry, storageEntry, entry, model } = params;\n\n function getFieldIndex(type: string): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndexing = fieldIndexRegistry.get(type);\n if (fieldIndexing) {\n return fieldIndexing;\n }\n return fieldIndexRegistry.getDefault();\n }\n\n // These objects will contain values processed by field index implementations\n const values: T = {} as T;\n const rawValues: T = {} as T;\n\n // We're only interested in current model fields.\n for (const field of model.fields) {\n const identifier = getFieldIdentifier(storageEntry.values, field) as keyof T;\n if (!identifier) {\n continue;\n }\n\n const fieldIndex = getFieldIndex(field.type);\n\n const { value, rawValue } = fieldIndex.toIndex({\n model,\n field,\n rawValue: entry.values[identifier],\n value: storageEntry.values[identifier],\n getFieldIndex\n });\n\n if (typeof value !== \"undefined\") {\n values[identifier] = value;\n }\n\n if (typeof rawValue !== \"undefined\") {\n rawValues[identifier] = rawValue;\n }\n }\n return {\n ...storageEntry,\n values,\n rawValues\n };\n};\n\nexport const extractEntriesFromIndex = <T extends CmsEntryValues = CmsEntryValues>({\n fieldRegistry,\n fieldIndexRegistry,\n entries,\n model\n}: ExtractEntriesFromIndexParams<T>): CmsEntry<T>[] => {\n function getFieldIndex(type: string): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndex = fieldIndexRegistry.get(type);\n if (fieldIndex) {\n return fieldIndex;\n }\n return fieldIndexRegistry.getDefault();\n }\n\n const list: CmsEntry<T>[] = [];\n\n for (const entry of entries) {\n // This object will contain values processed by field index plugins\n const indexValues: T = {} as T;\n\n // We only consider fields that are present in the model\n for (const field of model.fields) {\n const fieldType = fieldRegistry.get(field.type);\n if (!fieldType) {\n throw new WebinyError(\n `Missing field type \"${field.type}\". Extract entries from index.`\n );\n }\n\n const fieldIndex = getFieldIndex(field.type);\n /**\n * We can safely cast as the code will not continue in case of no identifiers.\n */\n const identifiers = getFieldIdentifiers(entry.values, entry.rawValues, field);\n if (!identifiers) {\n continue;\n }\n try {\n const key = identifiers.valueIdentifier as keyof T;\n const rawKey = identifiers.rawValueIdentifier as keyof T;\n indexValues[key] = fieldIndex.fromIndex({\n model,\n field,\n getFieldIndex,\n value: entry.values[key || rawKey],\n /**\n * Possibly no rawValues so we must check for the existence of the field.\n */\n rawValue: entry.rawValues ? entry.rawValues[rawKey || key] : null\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not transform entry field from index.\",\n ex.code || \"FIELD_FROM_INDEX_ERROR\",\n {\n field,\n entry\n }\n );\n }\n }\n /**\n * Let's have a new entry so we do not modify the original one.\n */\n const newEntry: CmsEntry<T> = {\n ...entry,\n values: indexValues\n };\n /**\n * If we want to remove the rawValues, TYPE, latest, published and __type, we must make them optional or ignore them.\n */\n // @ts-expect-error\n delete newEntry[\"rawValues\"];\n // @ts-expect-error\n delete newEntry[\"TYPE\"];\n // @ts-expect-error\n delete newEntry[\"__type\"];\n // @ts-expect-error\n delete newEntry[\"latest\"];\n // @ts-expect-error\n delete newEntry[\"published\"];\n list.push({\n ...newEntry\n });\n }\n\n return list;\n};\n"],"names":["prepareEntryToIndex","params","fieldIndexRegistry","storageEntry","entry","model","getFieldIndex","type","fieldIndexing","values","rawValues","field","identifier","getFieldIdentifier","fieldIndex","value","rawValue","extractEntriesFromIndex","fieldRegistry","entries","list","indexValues","fieldType","WebinyError","identifiers","getFieldIdentifiers","key","rawKey","ex","newEntry"],"mappings":";;AA+BO,MAAMA,sBAAsB,CAC/BC;IAEA,MAAM,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGJ;IAE3D,SAASK,cAAcC,IAAY;QAC/B,MAAMC,gBAAgBN,mBAAmB,GAAG,CAACK;QAC7C,IAAIC,eACA,OAAOA;QAEX,OAAON,mBAAmB,UAAU;IACxC;IAGA,MAAMO,SAAY,CAAC;IACnB,MAAMC,YAAe,CAAC;IAGtB,KAAK,MAAMC,SAASN,MAAM,MAAM,CAAE;QAC9B,MAAMO,aAAaC,mBAAmBV,aAAa,MAAM,EAAEQ;QAC3D,IAAI,CAACC,YACD;QAGJ,MAAME,aAAaR,cAAcK,MAAM,IAAI;QAE3C,MAAM,EAAEI,KAAK,EAAEC,QAAQ,EAAE,GAAGF,WAAW,OAAO,CAAC;YAC3CT;YACAM;YACA,UAAUP,MAAM,MAAM,CAACQ,WAAW;YAClC,OAAOT,aAAa,MAAM,CAACS,WAAW;YACtCN;QACJ;QAEA,IAAI,AAAiB,WAAVS,OACPN,MAAM,CAACG,WAAW,GAAGG;QAGzB,IAAI,AAAoB,WAAbC,UACPN,SAAS,CAACE,WAAW,GAAGI;IAEhC;IACA,OAAO;QACH,GAAGb,YAAY;QACfM;QACAC;IACJ;AACJ;AAEO,MAAMO,0BAA0B,CAA4C,EAC/EC,aAAa,EACbhB,kBAAkB,EAClBiB,OAAO,EACPd,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