@griddo/core 11.0.25 → 11.0.26

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 (58) hide show
  1. package/README.md +0 -1
  2. package/dist/autotypes.js +1 -1
  3. package/dist/autotypes.js.map +1 -1
  4. package/dist/bin-tools/autotypes/misc/ascii.d.ts +2 -2
  5. package/dist/bin-tools/autotypes/misc/utils.d.ts +66 -3
  6. package/dist/bin-tools/autotypes/parser/index.d.ts +23 -0
  7. package/dist/bin-tools/autotypes/parsers-list/components-name.d.ts +5 -0
  8. package/dist/bin-tools/autotypes/parsers-list/data-templates-names.d.ts +5 -0
  9. package/dist/bin-tools/autotypes/parsers-list/datapacks.d.ts +8 -0
  10. package/dist/bin-tools/autotypes/parsers-list/form-fields.d.ts +5 -0
  11. package/dist/bin-tools/autotypes/parsers-list/form-templates.d.ts +5 -0
  12. package/dist/bin-tools/autotypes/parsers-list/index.d.ts +42 -0
  13. package/dist/bin-tools/autotypes/parsers-list/languages.d.ts +5 -0
  14. package/dist/bin-tools/autotypes/parsers-list/menu-items.d.ts +6 -0
  15. package/dist/bin-tools/autotypes/parsers-list/module-categories.d.ts +5 -0
  16. package/dist/bin-tools/autotypes/parsers-list/modules-name.d.ts +5 -0
  17. package/dist/bin-tools/autotypes/parsers-list/page-data-props.d.ts +5 -0
  18. package/dist/bin-tools/autotypes/parsers-list/page-data.d.ts +5 -0
  19. package/dist/bin-tools/autotypes/parsers-list/simple-data-props.d.ts +5 -0
  20. package/dist/bin-tools/autotypes/parsers-list/simple-data.d.ts +5 -0
  21. package/dist/bin-tools/autotypes/parsers-list/taxonomy-props.d.ts +5 -0
  22. package/dist/bin-tools/autotypes/parsers-list/taxonomy.d.ts +5 -0
  23. package/dist/bin-tools/autotypes/parsers-list/template-section-list.d.ts +5 -0
  24. package/dist/bin-tools/autotypes/parsers-list/templates-name.d.ts +5 -0
  25. package/dist/bin-tools/autotypes/parsers-list/themes.d.ts +8 -0
  26. package/dist/bin-tools/autotypes/{factories/props/getUIAndData/utils.d.ts → parsers-list/ui-data-props.d.ts} +6 -2
  27. package/dist/contexts/Page/index.d.ts +1 -1
  28. package/dist/hooks/index.d.ts +1 -2
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/types/core/index.d.ts +0 -3
  33. package/dist/types/schemas/SimpleContentType.d.ts +34 -11
  34. package/package.json +2 -2
  35. package/dist/bin-tools/autotypes/autotypes.d.ts +0 -11
  36. package/dist/bin-tools/autotypes/factories/index.d.ts +0 -20
  37. package/dist/bin-tools/autotypes/factories/names/getComponents.d.ts +0 -2
  38. package/dist/bin-tools/autotypes/factories/names/getDetailTemplates.d.ts +0 -2
  39. package/dist/bin-tools/autotypes/factories/names/getFormFieldsNames.d.ts +0 -2
  40. package/dist/bin-tools/autotypes/factories/names/getFormTemplatesNames.d.ts +0 -2
  41. package/dist/bin-tools/autotypes/factories/names/getModules.d.ts +0 -2
  42. package/dist/bin-tools/autotypes/factories/names/getPageData.d.ts +0 -2
  43. package/dist/bin-tools/autotypes/factories/names/getSimpleData.d.ts +0 -2
  44. package/dist/bin-tools/autotypes/factories/names/getTaxonomy.d.ts +0 -2
  45. package/dist/bin-tools/autotypes/factories/names/getTemplates.d.ts +0 -2
  46. package/dist/bin-tools/autotypes/factories/props/getPageData.d.ts +0 -2
  47. package/dist/bin-tools/autotypes/factories/props/getSectionList.d.ts +0 -8
  48. package/dist/bin-tools/autotypes/factories/props/getSimpleData.d.ts +0 -2
  49. package/dist/bin-tools/autotypes/factories/props/getTaxonomyData.d.ts +0 -2
  50. package/dist/bin-tools/autotypes/factories/props/getTypeFromField/index.d.ts +0 -25
  51. package/dist/bin-tools/autotypes/factories/props/getTypeFromField/utils.d.ts +0 -41
  52. package/dist/bin-tools/autotypes/factories/props/getUIAndData/index.d.ts +0 -2
  53. package/dist/bin-tools/autotypes/factories/schemas/getDataPacks.d.ts +0 -5
  54. package/dist/bin-tools/autotypes/factories/schemas/getLanguages.d.ts +0 -2
  55. package/dist/bin-tools/autotypes/factories/schemas/getMenuItems.d.ts +0 -2
  56. package/dist/bin-tools/autotypes/factories/schemas/getModuleCategories.d.ts +0 -14
  57. package/dist/bin-tools/autotypes/factories/schemas/getThemes.d.ts +0 -5
  58. package/dist/hooks/useSitemap.d.ts +0 -7
@@ -59,9 +59,6 @@ interface Page<ContentType = unknown> {
59
59
  email: string;
60
60
  };
61
61
  entity?: string;
62
- /** First module of the page if appeared in a section called `HeroSection`
63
- * @deprecated To deprecated due to coupling with the section name */
64
- firstModule?: string;
65
62
  follow?: boolean;
66
63
  footer: FooterModule;
67
64
  footerTheme?: string;
@@ -3,13 +3,6 @@ import type { DataPacks, ExpirationData } from "./props";
3
3
  import type { SearchFrom, WithSearchable } from "../schema-fields/props";
4
4
  import type { SimpleContentTypeFields, TextField } from "../schema-fields/simple-content-type-fields";
5
5
  type SimpleContentTypeProp<ContentType> = SearchFrom & {
6
- /** An object to map fields to be used in search results */
7
- searchMapping?: {
8
- title: string;
9
- url: string;
10
- description?: string;
11
- image?: string;
12
- };
13
6
  /** An array of Griddo fields. */
14
7
  fields: [
15
8
  TextField<ContentType> & WithSearchable & {
@@ -18,16 +11,46 @@ type SimpleContentTypeProp<ContentType> = SearchFrom & {
18
11
  ...SimpleContentTypeFields<ContentType>[]
19
12
  ];
20
13
  };
21
- interface SimpleContentType<ContentType = unknown> extends BaseContentType, DataPacks, ExpirationData {
14
+ type SimpleContentTypeBody = {
22
15
  /** Indicates that the data is of type simple/category. Must always be `false`. */
23
16
  fromPage: false;
24
- /** Schema for the simple content type. */
25
- schema: SimpleContentTypeProp<ContentType>;
26
17
  /** Set the ContentType to private */
27
18
  private?: boolean;
28
19
  /** Set if ContentType is exportable */
29
20
  exportable?: boolean;
30
21
  /** Set if ContentType is included in page search using the `searchMapping` prop */
31
22
  includedInPageSearch?: boolean;
32
- }
23
+ };
24
+ type Schema<ContentType> = {
25
+ includedInPageSearch?: true;
26
+ /** Schema for the simple content type. */
27
+ schema: {
28
+ /** An object to map fields to be used in search results */
29
+ searchMapping: {
30
+ title: string;
31
+ url: string;
32
+ description?: string;
33
+ image?: string;
34
+ };
35
+ fields: [
36
+ TextField<ContentType> & WithSearchable & {
37
+ key: "title";
38
+ },
39
+ ...SimpleContentTypeFields<ContentType>[]
40
+ ];
41
+ };
42
+ } | {
43
+ /** Set if ContentType is included in page search using the `searchMapping` prop */
44
+ includedInPageSearch?: false | undefined;
45
+ /** Schema for the simple content type. */
46
+ schema: {
47
+ fields: [
48
+ TextField<ContentType> & WithSearchable & {
49
+ key: "title";
50
+ },
51
+ ...SimpleContentTypeFields<ContentType>[]
52
+ ];
53
+ };
54
+ };
55
+ type SimpleContentType<ContentType = unknown> = BaseContentType & DataPacks & ExpirationData & SimpleContentTypeBody & Schema<ContentType>;
33
56
  export type { SimpleContentType, SimpleContentTypeProp };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@griddo/core",
3
3
  "description": "Reload version of Griddo Core",
4
4
  "license": "UNLICENSED",
5
- "version": "11.0.25",
5
+ "version": "11.0.26",
6
6
  "authors": [
7
7
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
8
8
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -119,5 +119,5 @@
119
119
  "publishConfig": {
120
120
  "access": "public"
121
121
  },
122
- "gitHead": "ff159143be7318ebcc2c3de91a5b4e42428168ee"
122
+ "gitHead": "9f3c72f1c4e3a730e0b18f47260a62477e0bcb0e"
123
123
  }
@@ -1,11 +0,0 @@
1
- import type { ConfigFile } from "./misc/types";
2
- /**
3
- * Generates the `autotypes.d.ts` file in the root of the instance project using
4
- * the instance schemas exported in `griddo.config.file`
5
- * The main usage of this file is for intellisense and autocompletion in the
6
- * instance when they work with the React components and schemas.
7
- * @documentation https://www.notion.so/griddoio/AutoTypes-e7420867dd2e489c8da34a493b763cd8?pvs=4
8
- *
9
- * @param config The instance `griddo.config.ts` file path.
10
- */
11
- export declare function autotypes(config: ConfigFile, flags?: string): Promise<string>;
@@ -1,20 +0,0 @@
1
- import { getComponentsNames } from "./names/getComponents";
2
- import { getDetailTemplatesNames } from "./names/getDetailTemplates";
3
- import { getFormFieldsNames } from "./names/getFormFieldsNames";
4
- import { getFormTemplatesNames } from "./names/getFormTemplatesNames";
5
- import { getModulesNames } from "./names/getModules";
6
- import { getPageDataNames } from "./names/getPageData";
7
- import { getSimpleDataNames } from "./names/getSimpleData";
8
- import { getTaxonomyNames } from "./names/getTaxonomy";
9
- import { getTemplatesProps } from "./names/getTemplates";
10
- import { getPageDataProps } from "./props/getPageData";
11
- import { getSectionListType } from "./props/getSectionList";
12
- import { getSimpleDataProps } from "./props/getSimpleData";
13
- import { getTaxonomyDataProps } from "./props/getTaxonomyData";
14
- import { getUIAndDataProps } from "./props/getUIAndData";
15
- import { getDatapacksType } from "./schemas/getDataPacks";
16
- import { getLanguagesInterface } from "./schemas/getLanguages";
17
- import { getMenuItemsInterface } from "./schemas/getMenuItems";
18
- import { getModuleCategoriesType } from "./schemas/getModuleCategories";
19
- import { getThemesType } from "./schemas/getThemes";
20
- export { getComponentsNames, getDatapacksType, getDetailTemplatesNames, getFormFieldsNames, getFormTemplatesNames, getLanguagesInterface, getMenuItemsInterface, getModuleCategoriesType, getModulesNames, getPageDataNames, getPageDataProps, getSectionListType, getSimpleDataNames, getSimpleDataProps, getTaxonomyDataProps, getTaxonomyNames, getTemplatesProps, getThemesType, getUIAndDataProps, };
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getComponentsNames(schemas: Record<string, Schema.Component>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getDetailTemplatesNames(schemas: Record<string, Schema.Template | Schema.ListTemplate | Schema.PaginatedDataTemplate>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getFormFieldsNames(schemas: Record<string, Schema.FormField>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getFormTemplatesNames(schemas: Record<string, Schema.FormTemplate>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getModulesNames(schemas: Record<string, Schema.Module>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getPageDataNames(schemas: Record<string, Schema.PageContentType>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getSimpleDataNames(schemas: Record<string, Schema.SimpleContentType>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getTaxonomyNames(schemas: Record<string, Schema.CategoryContentType>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getTemplatesProps(schemas: Record<string, Schema.Template | Schema.ListTemplate | Schema.PaginatedDataTemplate>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getPageDataProps(schemas: Record<string, Schema.PageContentType>): string;
@@ -1,8 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- /**
3
- * Lista de templates y sus secciones
4
- * Esto es algo que se usa en los schemas de Griddo. Es como el inverso a un
5
- * whitelist donde indicamos en qué secciones de qué templates puede
6
- * aparecer un módulo.
7
- */
8
- export declare function getSectionListType(schemas: Record<string, Schema.Template | Schema.ListTemplate | Schema.PaginatedDataTemplate>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getSimpleDataProps(schemas: Record<string, Schema.SimpleContentType>): string;
@@ -1,2 +0,0 @@
1
- import type { Schema } from "../../../..";
2
- export declare function getTaxonomyDataProps(schemas: Record<string, Schema.CategoryContentType>): string;
@@ -1,25 +0,0 @@
1
- import type { PageContentTypeFields } from "../../../../../types/schema-fields/page-content-type-fields";
2
- import type { SimpleContentTypeFields } from "../../../../../types/schema-fields/simple-content-type-fields";
3
- import type { UIFields } from "../../../../../types/schema-fields/ui-fields";
4
- import type { UIFormFields } from "../../../../../types/schema-fields/ui-form-fields";
5
- import type { UITemplateFields } from "../../../../../types/schema-fields/ui-template-fields";
6
- import type { Module } from "../../../../../types/schemas";
7
- import type { KindSchema, SchemaTypeWithComponentProp } from "../../../misc/types";
8
- /**
9
- * Return an optional property (the key in some Griddo field) and its value
10
- * (some Griddo field type) serialized based on a schema field.
11
- *
12
- * @param field A Griddo field object
13
- * @param kind Schema type in order to later do some operations with fields
14
- * @param options Object options
15
- * @example
16
- * getTypeFromField({ type: 'TextField', key: 'cardTitle', ... }, "component")
17
- * // returns -> "cardTitle?: Fields.Text"
18
- */
19
- export declare function getTypeFromField(field: UIFields | UIFormFields | UITemplateFields | SimpleContentTypeFields | PageContentTypeFields, kind: KindSchema, options: {
20
- hasDistributorData: boolean;
21
- getStaticData: boolean;
22
- moduleSchemas: Array<Module | undefined>;
23
- schema: SchemaTypeWithComponentProp;
24
- allSchemas: any;
25
- }): string | undefined;
@@ -1,41 +0,0 @@
1
- import type { FieldReturnTypes, Fields, SchemaFieldTypes } from "../../../misc/types";
2
- /** Build a interface prop based on the field from the schema.
3
- * Optionally it can receives a custom value for the type and a generic string to use as generic value
4
- *
5
- * @example
6
- * getGriddoFieldPropType(TextFieldObjectFromSchema)
7
- * // -> TextFieldObjectFromSchema.key: Fields.TextField
8
- * getGriddoFieldPropType(TextFieldObjectFromSchema, 'MyCustomValue', 'foo')
9
- * // -> TextFieldObjectFromSchema.key: MyCustomValue<foo>
10
- */
11
- type GetInterfacePropTypeOptions = {
12
- returnTypeName?: FieldReturnTypes;
13
- generic?: string;
14
- };
15
- /**
16
- * Return a serialized type from a Griddo schema field.
17
- *
18
- * @param Fields A Griddo field object
19
- * @param options An options object
20
- * @returns A string that represent a interface prop type.
21
- * @example
22
- * interface SomeInterface {
23
- * prop: boolean; // this function returns a string for this: `prop: boolean`
24
- * }
25
- */
26
- declare function getGriddoFieldPropType(field: Fields, options?: GetInterfacePropTypeOptions): string;
27
- /**
28
- * Return a string separated by the pipe char "|" using the `value` from object array.
29
- */
30
- declare function getGenericFromOptions<T = unknown>(options: Array<{
31
- value: T;
32
- }>): string;
33
- /**
34
- * Return a string separated by the pipe char "|" using the `name` from object array.
35
- */
36
- declare function getGenericFromCheckBoxOptions<T>(options: Array<{
37
- name: T;
38
- }>): string;
39
- declare function getGenericFromWhitelist(whiteList: Array<string>): string;
40
- declare function returnType(type: SchemaFieldTypes): FieldReturnTypes;
41
- export { getGenericFromCheckBoxOptions, getGenericFromOptions, getGenericFromWhitelist, getGriddoFieldPropType, returnType, };
@@ -1,2 +0,0 @@
1
- import type { SchemaType } from "../../../misc/types";
2
- export declare function getUIAndDataProps(schemas: Record<string, SchemaType>): string;
@@ -1,5 +0,0 @@
1
- import type { DataPack, DataPackCategory } from "../../../../types/schemas";
2
- export declare function getDatapacksType(schema: Record<string, DataPack>, categoriesSchema: Record<string, DataPackCategory>): {
3
- DATAPACKS: string;
4
- DATAPACKS_CATEGORIES: string;
5
- };
@@ -1,2 +0,0 @@
1
- import type { LanguagesSchema } from "../../misc/types";
2
- export declare function getLanguagesInterface(schemas: LanguagesSchema): string;
@@ -1,2 +0,0 @@
1
- import type { MenuItemsSchema } from "../../misc/types";
2
- export declare function getMenuItemsInterface(menuItemsSchemas: MenuItemsSchema): string;
@@ -1,14 +0,0 @@
1
- import type { ModuleCategories } from "../../../../types/schemas";
2
- /**
3
- * Returns a string with the module categories type definition
4
- *
5
- * @example
6
- * type ModuleCategories =
7
- * | "spacers"
8
- * | "heros"
9
- * | "basic"
10
- * | "distributors"
11
- * | ...
12
- * @returns (see example above)
13
- */
14
- export declare function getModuleCategoriesType(schema: ModuleCategories): string;
@@ -1,5 +0,0 @@
1
- import type { ThemeEntry } from "../../../../types/schemas";
2
- export declare function getThemesType(themesSchema: Array<ThemeEntry>, subthemesSchema: Array<string>): {
3
- THEMES: string;
4
- SUBTHEMES: string;
5
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * `useSitemap()`
3
- *
4
- * @deprecated This hook will be removed from Griddo in the future
5
- */
6
- declare function useSitemap(): (boolean | undefined)[];
7
- export { useSitemap };