@webiny/app-headless-cms-common 6.6.0-alpha.4 → 6.6.0-alpha.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-headless-cms-common",
3
- "version": "6.6.0-alpha.4",
3
+ "version": "6.6.0-alpha.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -18,18 +18,18 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "@fortawesome/fontawesome-svg-core": "7.3.1",
21
- "@webiny/admin-ui": "6.6.0-alpha.4",
22
- "@webiny/app": "6.6.0-alpha.4",
23
- "@webiny/app-admin": "6.6.0-alpha.4",
24
- "@webiny/form": "6.6.0-alpha.4",
25
- "@webiny/plugins": "6.6.0-alpha.4",
26
- "@webiny/validation": "6.6.0-alpha.4",
21
+ "@webiny/admin-ui": "6.6.0-alpha.6",
22
+ "@webiny/app": "6.6.0-alpha.6",
23
+ "@webiny/app-admin": "6.6.0-alpha.6",
24
+ "@webiny/form": "6.6.0-alpha.6",
25
+ "@webiny/plugins": "6.6.0-alpha.6",
26
+ "@webiny/validation": "6.6.0-alpha.6",
27
27
  "dnd-core": "16.0.1",
28
28
  "react": "18.3.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/react": "18.3.31",
32
- "@webiny/build-tools": "6.6.0-alpha.4",
32
+ "@webiny/build-tools": "6.6.0-alpha.6",
33
33
  "rimraf": "6.1.3",
34
34
  "typescript": "7.0.2"
35
35
  },
package/types/model.d.ts CHANGED
@@ -39,6 +39,11 @@ export type CmsModelField<T = unknown> = T & {
39
39
  validation?: (CmsModelFieldValidator | Validator)[];
40
40
  listValidation?: CmsModelFieldValidator[];
41
41
  list?: boolean;
42
+ /**
43
+ * Renders the field, but doesn't let anyone edit its value. Set from a code-defined
44
+ * model with `.disabled()`. Admin app only, the API doesn't enforce it.
45
+ */
46
+ disabled?: boolean;
42
47
  predefinedValues?: CmsEditorFieldPredefinedValues;
43
48
  settings?: CmsModelFieldSettings<T>;
44
49
  renderer: {
@@ -1 +1 @@
1
- {"version":3,"file":"types/model.js","sources":["../../src/types/model.ts"],"sourcesContent":["import type React from \"react\";\nimport type { Validator } from \"@webiny/validation/types.js\";\nimport type { CmsDynamicZoneTemplate, CmsEditorFieldPredefinedValues } from \"~/types/index.js\";\nimport type { CmsIdentity } from \"~/types/shared.js\";\n\nexport interface CmsModelFieldValidator {\n name: string;\n message?: string;\n settings?: any;\n}\n\nexport interface CmsModelFieldSettings<T = unknown> {\n defaultValue?: string | boolean | number | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsModelField<T>[];\n layout?: CmsEditorFieldsLayout;\n models?: Pick<CmsModel, \"modelId\">[];\n templates?: CmsDynamicZoneTemplate[];\n imagesOnly?: boolean;\n [key: string]: any;\n}\n\nexport type FieldRuleAction = \"hide\" | \"disable\" | string;\n\nexport interface FieldRule {\n type: \"accessControl\" | \"condition\";\n target: string;\n operator: string;\n value: string | number | boolean | null;\n action: FieldRuleAction;\n}\n\nexport type CmsModelField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n storageId?: string;\n label: string;\n help?: string | React.ReactNode;\n description?: string | React.ReactNode;\n note?: string | React.ReactNode;\n placeholder?: string;\n validation?: (CmsModelFieldValidator | Validator)[];\n listValidation?: CmsModelFieldValidator[];\n list?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: CmsModelFieldSettings<T>;\n renderer: {\n name: string;\n settings?: Record<string, any>;\n };\n tags?: string[];\n rules?: FieldRule[];\n};\n\nexport type CmsEditorFieldId = string;\n\nexport interface CmsModelLayoutField {\n id: string;\n type: string;\n rules?: FieldRule[];\n}\n\nexport interface CmsSeparatorLayoutField extends CmsModelLayoutField {\n type: \"separator\";\n label: string;\n description?: string;\n}\n\nexport interface CmsAlertLayoutField extends CmsModelLayoutField {\n type: \"alert\";\n label: string;\n alertType: \"info\" | \"success\" | \"warning\" | \"danger\";\n}\n\nexport interface CmsTabLayoutTab {\n id: string;\n label: string;\n icon?: string;\n layout: CmsEditorFieldsLayout;\n rules?: FieldRule[];\n}\n\nexport interface CmsTabLayoutField extends CmsModelLayoutField {\n type: \"tabs\";\n label: string;\n description?: string | null;\n help?: string | null;\n tabs: CmsTabLayoutTab[];\n}\n\nexport type CmsLayoutField =\n | CmsSeparatorLayoutField\n | CmsAlertLayoutField\n | CmsTabLayoutField\n | CmsModelLayoutField;\n\nexport type CmsEditorLayoutCell = CmsEditorFieldId | CmsLayoutField;\nexport type CmsEditorFieldsLayout = CmsEditorLayoutCell[][];\n\n/**\n * Distinguish layout fields from field IDs (strings) and CmsModelField objects.\n *\n * In raw layout data (`CmsEditorFieldsLayout`), cells are either strings (field IDs)\n * or layout field objects — the `typeof` check handles that.\n *\n * In resolved layout data (after `getFieldsInLayout`), cells are either `CmsModelField`\n * or layout field objects — both have `{ id, type }`, but only `CmsModelField`\n * has `fieldId`, so we use its absence as the discriminator.\n */\nexport function isLayoutField(cell: unknown): cell is CmsLayoutField {\n return (\n typeof cell === \"object\" &&\n cell !== null &&\n \"type\" in cell &&\n typeof (cell as any).type === \"string\" &&\n !(\"fieldId\" in cell)\n );\n}\n\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsIdentity;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport interface CmsModel {\n id: string;\n group: string;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsModelField[];\n icon: string;\n name: string;\n modelId: string;\n singularApiName: string;\n pluralApiName: string;\n titleFieldId: string | null;\n descriptionFieldId: string | null;\n imageFieldId: string | null;\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsIdentity;\n tags: string[];\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n /**\n * Is model currently being deleted?\n */\n isBeingDeleted?: boolean;\n valuesSelection?: string;\n settings: {\n [key: string]: any;\n };\n metadata: {\n valuesSelection: string;\n };\n}\n"],"names":["isLayoutField","cell"],"mappings":"AA+GO,SAASA,cAAcC,IAAa;IACvC,OACI,AAAgB,YAAhB,OAAOA,QACPA,AAAS,SAATA,QACA,UAAUA,QACV,AAA8B,YAA9B,OAAQA,KAAa,IAAI,IACzB,CAAE,cAAaA,IAAG;AAE1B"}
1
+ {"version":3,"file":"types/model.js","sources":["../../src/types/model.ts"],"sourcesContent":["import type React from \"react\";\nimport type { Validator } from \"@webiny/validation/types.js\";\nimport type { CmsDynamicZoneTemplate, CmsEditorFieldPredefinedValues } from \"~/types/index.js\";\nimport type { CmsIdentity } from \"~/types/shared.js\";\n\nexport interface CmsModelFieldValidator {\n name: string;\n message?: string;\n settings?: any;\n}\n\nexport interface CmsModelFieldSettings<T = unknown> {\n defaultValue?: string | boolean | number | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsModelField<T>[];\n layout?: CmsEditorFieldsLayout;\n models?: Pick<CmsModel, \"modelId\">[];\n templates?: CmsDynamicZoneTemplate[];\n imagesOnly?: boolean;\n [key: string]: any;\n}\n\nexport type FieldRuleAction = \"hide\" | \"disable\" | string;\n\nexport interface FieldRule {\n type: \"accessControl\" | \"condition\";\n target: string;\n operator: string;\n value: string | number | boolean | null;\n action: FieldRuleAction;\n}\n\nexport type CmsModelField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n storageId?: string;\n label: string;\n help?: string | React.ReactNode;\n description?: string | React.ReactNode;\n note?: string | React.ReactNode;\n placeholder?: string;\n validation?: (CmsModelFieldValidator | Validator)[];\n listValidation?: CmsModelFieldValidator[];\n list?: boolean;\n /**\n * Renders the field, but doesn't let anyone edit its value. Set from a code-defined\n * model with `.disabled()`. Admin app only, the API doesn't enforce it.\n */\n disabled?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: CmsModelFieldSettings<T>;\n renderer: {\n name: string;\n settings?: Record<string, any>;\n };\n tags?: string[];\n rules?: FieldRule[];\n};\n\nexport type CmsEditorFieldId = string;\n\nexport interface CmsModelLayoutField {\n id: string;\n type: string;\n rules?: FieldRule[];\n}\n\nexport interface CmsSeparatorLayoutField extends CmsModelLayoutField {\n type: \"separator\";\n label: string;\n description?: string;\n}\n\nexport interface CmsAlertLayoutField extends CmsModelLayoutField {\n type: \"alert\";\n label: string;\n alertType: \"info\" | \"success\" | \"warning\" | \"danger\";\n}\n\nexport interface CmsTabLayoutTab {\n id: string;\n label: string;\n icon?: string;\n layout: CmsEditorFieldsLayout;\n rules?: FieldRule[];\n}\n\nexport interface CmsTabLayoutField extends CmsModelLayoutField {\n type: \"tabs\";\n label: string;\n description?: string | null;\n help?: string | null;\n tabs: CmsTabLayoutTab[];\n}\n\nexport type CmsLayoutField =\n | CmsSeparatorLayoutField\n | CmsAlertLayoutField\n | CmsTabLayoutField\n | CmsModelLayoutField;\n\nexport type CmsEditorLayoutCell = CmsEditorFieldId | CmsLayoutField;\nexport type CmsEditorFieldsLayout = CmsEditorLayoutCell[][];\n\n/**\n * Distinguish layout fields from field IDs (strings) and CmsModelField objects.\n *\n * In raw layout data (`CmsEditorFieldsLayout`), cells are either strings (field IDs)\n * or layout field objects — the `typeof` check handles that.\n *\n * In resolved layout data (after `getFieldsInLayout`), cells are either `CmsModelField`\n * or layout field objects — both have `{ id, type }`, but only `CmsModelField`\n * has `fieldId`, so we use its absence as the discriminator.\n */\nexport function isLayoutField(cell: unknown): cell is CmsLayoutField {\n return (\n typeof cell === \"object\" &&\n cell !== null &&\n \"type\" in cell &&\n typeof (cell as any).type === \"string\" &&\n !(\"fieldId\" in cell)\n );\n}\n\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsIdentity;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport interface CmsModel {\n id: string;\n group: string;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsModelField[];\n icon: string;\n name: string;\n modelId: string;\n singularApiName: string;\n pluralApiName: string;\n titleFieldId: string | null;\n descriptionFieldId: string | null;\n imageFieldId: string | null;\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsIdentity;\n tags: string[];\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n /**\n * Is model currently being deleted?\n */\n isBeingDeleted?: boolean;\n valuesSelection?: string;\n settings: {\n [key: string]: any;\n };\n metadata: {\n valuesSelection: string;\n };\n}\n"],"names":["isLayoutField","cell"],"mappings":"AAoHO,SAASA,cAAcC,IAAa;IACvC,OACI,AAAgB,YAAhB,OAAOA,QACPA,AAAS,SAATA,QACA,UAAUA,QACV,AAA8B,YAA9B,OAAQA,KAAa,IAAI,IACzB,CAAE,cAAaA,IAAG;AAE1B"}