@webiny/api-aco 0.0.0-unstable.d65ec29d44 → 0.0.0-unstable.da99e0b846

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 (49) hide show
  1. package/README.md +6 -6
  2. package/createAcoGraphQL.js +10 -9
  3. package/createAcoGraphQL.js.map +1 -1
  4. package/createAcoModels.js +0 -2
  5. package/createAcoModels.js.map +1 -1
  6. package/folder/folder.gql.js +1 -1
  7. package/folder/folder.gql.js.map +1 -1
  8. package/folder/folder.model.d.ts +3 -3
  9. package/folder/folder.model.js +3 -7
  10. package/folder/folder.model.js.map +1 -1
  11. package/folder/folder.so.d.ts +1 -6
  12. package/folder/folder.so.js +103 -108
  13. package/folder/folder.so.js.map +1 -1
  14. package/folder/folder.types.d.ts +2 -2
  15. package/folder/folder.types.js.map +1 -1
  16. package/folder/onFolderBeforeDelete.hook.js +11 -11
  17. package/folder/onFolderBeforeDelete.hook.js.map +1 -1
  18. package/index.d.ts +1 -1
  19. package/index.js +3 -3
  20. package/index.js.map +1 -1
  21. package/package.json +22 -21
  22. package/record/record.gql.js +2 -3
  23. package/record/record.gql.js.map +1 -1
  24. package/record/record.model.d.ts +3 -3
  25. package/record/record.model.js +7 -25
  26. package/record/record.model.js.map +1 -1
  27. package/record/record.so.d.ts +1 -6
  28. package/record/record.so.js +51 -61
  29. package/record/record.so.js.map +1 -1
  30. package/record/record.types.d.ts +3 -4
  31. package/record/record.types.js.map +1 -1
  32. package/types.d.ts +9 -0
  33. package/types.js +8 -1
  34. package/types.js.map +1 -1
  35. package/utils/createListSort.d.ts +2 -0
  36. package/utils/createListSort.js +13 -0
  37. package/utils/createListSort.js.map +1 -0
  38. package/utils/createModelField.d.ts +0 -1
  39. package/utils/createModelField.js +2 -4
  40. package/utils/createModelField.js.map +1 -1
  41. package/utils/createOperationsWrapper.d.ts +9 -0
  42. package/utils/createOperationsWrapper.js +29 -0
  43. package/utils/createOperationsWrapper.js.map +1 -0
  44. package/utils/getFieldValues.d.ts +1 -1
  45. package/utils/getFieldValues.js +9 -2
  46. package/utils/getFieldValues.js.map +1 -1
  47. package/utils/modelFactory.d.ts +3 -3
  48. package/utils/modelFactory.js +4 -2
  49. package/utils/modelFactory.js.map +1 -1
@@ -11,7 +11,6 @@ const createModelField = params => {
11
11
  label,
12
12
  fieldId: initialFieldId,
13
13
  type,
14
- parent,
15
14
  settings = {},
16
15
  listValidation = [],
17
16
  validation = [],
@@ -22,10 +21,9 @@ const createModelField = params => {
22
21
  }
23
22
  } = params;
24
23
  const fieldId = initialFieldId ? (0, _camelCase.default)(initialFieldId) : (0, _camelCase.default)(label);
25
- const id = `${(0, _camelCase.default)(parent)}_${fieldId}`;
26
24
  return {
27
- id,
28
- storageId: fieldId,
25
+ id: fieldId,
26
+ storageId: `${type}@${fieldId}`,
29
27
  fieldId,
30
28
  label,
31
29
  type,
@@ -1 +1 @@
1
- {"version":3,"names":["createModelField","params","label","fieldId","initialFieldId","type","parent","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","camelCase","id","storageId"],"sources":["createModelField.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport camelCase from \"lodash/camelCase\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n fieldId?: string;\n parent: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const {\n label,\n fieldId: initialFieldId,\n type,\n parent,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n }\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n const id = `${camelCase(parent)}_${fieldId}`;\n\n return {\n id,\n storageId: fieldId,\n fieldId,\n label,\n type,\n settings,\n listValidation,\n validation,\n multipleValues,\n predefinedValues\n };\n};\n"],"mappings":";;;;;;;AACA;AAQO,MAAMA,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,IAAI;IACJC,MAAM;IACNC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC,GAAGZ,MAAM;EAEV,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAU,kBAAS,EAACV,cAAc,CAAC,GAAG,IAAAU,kBAAS,EAACZ,KAAK,CAAC;EAC7E,MAAMa,EAAE,GAAI,GAAE,IAAAD,kBAAS,EAACR,MAAM,CAAE,IAAGH,OAAQ,EAAC;EAE5C,OAAO;IACHY,EAAE;IACFC,SAAS,EAAEb,OAAO;IAClBA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJE,QAAQ;IACRC,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createModelField","params","label","fieldId","initialFieldId","type","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","camelCase","id","storageId"],"sources":["createModelField.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport camelCase from \"lodash/camelCase\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n fieldId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const {\n label,\n fieldId: initialFieldId,\n type,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n }\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: fieldId,\n storageId: `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n listValidation,\n validation,\n multipleValues,\n predefinedValues\n };\n};\n"],"mappings":";;;;;;;AACA;AAOO,MAAMA,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC,GAAGX,MAAM;EAEV,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAS,kBAAS,EAACT,cAAc,CAAC,GAAG,IAAAS,kBAAS,EAACX,KAAK,CAAC;EAE7E,OAAO;IACHY,EAAE,EAAEX,OAAO;IACXY,SAAS,EAAG,GAAEV,IAAK,IAAGF,OAAQ,EAAC;IAC/BA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJC,QAAQ;IACRC,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC;EACJ,CAAC;AACL,CAAC;AAAC"}
@@ -0,0 +1,9 @@
1
+ import { CreateAcoStorageOperationsParams } from "../createAcoStorageOperations";
2
+ import { CmsModel } from "@webiny/api-headless-cms/types";
3
+ interface CreateOperationsWrapperParams extends CreateAcoStorageOperationsParams {
4
+ modelName: string;
5
+ }
6
+ export declare const createOperationsWrapper: (params: CreateOperationsWrapperParams) => {
7
+ withModel: <TResult>(cb: (model: CmsModel) => Promise<TResult>) => Promise<TResult>;
8
+ };
9
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createOperationsWrapper = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ const createOperationsWrapper = params => {
10
+ const {
11
+ cms,
12
+ security,
13
+ modelName
14
+ } = params;
15
+ const withModel = async cb => {
16
+ return security.withoutAuthorization(async () => {
17
+ const model = await cms.getModel(modelName);
18
+ if (!model) {
19
+ throw new _error.default(`Could not find "${modelName}" model.`, "MODEL_NOT_FOUND_ERROR");
20
+ }
21
+ const result = await cb(model);
22
+ return result;
23
+ });
24
+ };
25
+ return {
26
+ withModel
27
+ };
28
+ };
29
+ exports.createOperationsWrapper = createOperationsWrapper;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createOperationsWrapper","params","cms","security","modelName","withModel","cb","withoutAuthorization","model","getModel","WebinyError","result"],"sources":["createOperationsWrapper.ts"],"sourcesContent":["import { CreateAcoStorageOperationsParams } from \"~/createAcoStorageOperations\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\ninterface CreateOperationsWrapperParams extends CreateAcoStorageOperationsParams {\n modelName: string;\n}\n\nexport const createOperationsWrapper = (params: CreateOperationsWrapperParams) => {\n const { cms, security, modelName } = params;\n\n const withModel = async <TResult>(\n cb: (model: CmsModel) => Promise<TResult>\n ): Promise<TResult> => {\n return security.withoutAuthorization(async () => {\n const model = await cms.getModel(modelName);\n\n if (!model) {\n throw new WebinyError(\n `Could not find \"${modelName}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n\n const result = await cb(model);\n\n return result;\n });\n };\n\n return {\n withModel\n };\n};\n"],"mappings":";;;;;;;AAEA;AAMO,MAAMA,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,GAAG;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAE3C,MAAMI,SAAS,GAAG,MACdC,EAAyC,IACtB;IACnB,OAAOH,QAAQ,CAACI,oBAAoB,CAAC,YAAY;MAC7C,MAAMC,KAAK,GAAG,MAAMN,GAAG,CAACO,QAAQ,CAACL,SAAS,CAAC;MAE3C,IAAI,CAACI,KAAK,EAAE;QACR,MAAM,IAAIE,cAAW,CAChB,mBAAkBN,SAAU,UAAS,EACtC,uBAAuB,CAC1B;MACL;MAEA,MAAMO,MAAM,GAAG,MAAML,EAAE,CAACE,KAAK,CAAC;MAE9B,OAAOG,MAAM;IACjB,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACHN;EACJ,CAAC;AACL,CAAC;AAAC"}
@@ -1,2 +1,2 @@
1
1
  import { CmsEntry } from "@webiny/api-headless-cms/types";
2
- export declare function getFieldValues(entry: CmsEntry, fields: string[]): any;
2
+ export declare function getFieldValues(entry: CmsEntry, fields: string[], useEntryId?: boolean): any;
@@ -7,6 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getFieldValues = getFieldValues;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _pick = _interopRequireDefault(require("lodash/pick"));
10
- function getFieldValues(entry, fields) {
11
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
10
+ var _utils = require("@webiny/utils");
11
+ function getFieldValues(entry, fields, useEntryId) {
12
+ // We return the `id` without version in case of `useEntryId` flag is passed.
13
+ const {
14
+ id
15
+ } = (0, _utils.parseIdentifier)(entry.id);
16
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values), useEntryId && {
17
+ id
18
+ });
12
19
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldValues","entry","fields","pick","values"],"sources":["getFieldValues.ts"],"sourcesContent":["import pick from \"lodash/pick\";\n\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\n\nexport function getFieldValues(entry: CmsEntry, fields: string[]): any {\n return { ...pick(entry, fields), ...entry.values };\n}\n"],"mappings":";;;;;;;;AAAA;AAIO,SAASA,cAAc,CAACC,KAAe,EAAEC,MAAgB,EAAO;EACnE,mEAAY,IAAAC,aAAI,EAACF,KAAK,EAAEC,MAAM,CAAC,GAAKD,KAAK,CAACG,MAAM;AACpD"}
1
+ {"version":3,"names":["getFieldValues","entry","fields","useEntryId","id","parseIdentifier","pick","values"],"sources":["getFieldValues.ts"],"sourcesContent":["import pick from \"lodash/pick\";\n\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport function getFieldValues(entry: CmsEntry, fields: string[], useEntryId?: boolean): any {\n // We return the `id` without version in case of `useEntryId` flag is passed.\n const { id } = parseIdentifier(entry.id);\n return { ...pick(entry, fields), ...entry.values, ...(useEntryId && { id }) };\n}\n"],"mappings":";;;;;;;;AAAA;AAGA;AAEO,SAASA,cAAc,CAACC,KAAe,EAAEC,MAAgB,EAAEC,UAAoB,EAAO;EACzF;EACA,MAAM;IAAEC;EAAG,CAAC,GAAG,IAAAC,sBAAe,EAACJ,KAAK,CAACG,EAAE,CAAC;EACxC,+FAAY,IAAAE,aAAI,EAACL,KAAK,EAAEC,MAAM,CAAC,GAAKD,KAAK,CAACM,MAAM,GAAMJ,UAAU,IAAI;IAAEC;EAAG,CAAC;AAC9E"}
@@ -1,5 +1,5 @@
1
- import { CmsModelPlugin } from "@webiny/api-headless-cms";
2
- import { CmsModel, CmsGroup } from "@webiny/api-headless-cms/types";
1
+ import { CmsModelPlugin, CmsPrivateModelFull } from "@webiny/api-headless-cms";
2
+ import { CmsGroup } from "@webiny/api-headless-cms/types";
3
3
  interface Params {
4
4
  group: Pick<CmsGroup, "id" | "name">;
5
5
  /**
@@ -9,7 +9,7 @@ interface Params {
9
9
  */
10
10
  locale?: string;
11
11
  tenant?: string;
12
- modelDefinition: Omit<CmsModel, "locale" | "tenant" | "webinyVersion" | "group">;
12
+ modelDefinition: Omit<CmsPrivateModelFull, "noValidate" | "group">;
13
13
  }
14
14
  export declare const modelFactory: (params: Params) => CmsModelPlugin;
15
15
  export {};
@@ -14,10 +14,12 @@ const modelFactory = params => {
14
14
  tenant,
15
15
  modelDefinition
16
16
  } = params;
17
- return (0, _apiHeadlessCms.createCmsModel)((0, _objectSpread2.default)({
17
+ return (0, _apiHeadlessCms.createCmsModel)((0, _objectSpread2.default)((0, _objectSpread2.default)({
18
18
  group,
19
19
  locale,
20
20
  tenant
21
- }, modelDefinition));
21
+ }, modelDefinition), {}, {
22
+ noValidate: true
23
+ }));
22
24
  };
23
25
  exports.modelFactory = modelFactory;
@@ -1 +1 @@
1
- {"version":3,"names":["modelFactory","params","group","locale","tenant","modelDefinition","createCmsModel"],"sources":["modelFactory.ts"],"sourcesContent":["import { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { CmsModel, CmsGroup } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n group: Pick<CmsGroup, \"id\" | \"name\">;\n /**\n * Locale and tenant do not need to be defined.\n * In that case model is not bound to any locale or tenant.\n * You can bind it to locale, tenant, both or none.\n */\n locale?: string;\n tenant?: string;\n modelDefinition: Omit<CmsModel, \"locale\" | \"tenant\" | \"webinyVersion\" | \"group\">;\n}\n\nexport const modelFactory = (params: Params): CmsModelPlugin => {\n const { group, locale, tenant, modelDefinition } = params;\n\n return createCmsModel({\n group,\n locale,\n tenant,\n ...modelDefinition\n });\n};\n"],"mappings":";;;;;;;;AAAA;AAeO,MAAMA,YAAY,GAAIC,MAAc,IAAqB;EAC5D,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,MAAM;EAEzD,OAAO,IAAAK,8BAAc;IACjBJ,KAAK;IACLC,MAAM;IACNC;EAAM,GACHC,eAAe,EACpB;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["modelFactory","params","group","locale","tenant","modelDefinition","createCmsModel","noValidate"],"sources":["modelFactory.ts"],"sourcesContent":["import { CmsModelPlugin, CmsPrivateModelFull, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { CmsGroup } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n group: Pick<CmsGroup, \"id\" | \"name\">;\n /**\n * Locale and tenant do not need to be defined.\n * In that case model is not bound to any locale or tenant.\n * You can bind it to locale, tenant, both or none.\n */\n locale?: string;\n tenant?: string;\n modelDefinition: Omit<CmsPrivateModelFull, \"noValidate\" | \"group\">;\n}\n\nexport const modelFactory = (params: Params): CmsModelPlugin => {\n const { group, locale, tenant, modelDefinition } = params;\n\n return createCmsModel({\n group,\n locale,\n tenant,\n ...modelDefinition,\n noValidate: true\n });\n};\n"],"mappings":";;;;;;;;AAAA;AAeO,MAAMA,YAAY,GAAIC,MAAc,IAAqB;EAC5D,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,MAAM;EAEzD,OAAO,IAAAK,8BAAc;IACjBJ,KAAK;IACLC,MAAM;IACNC;EAAM,GACHC,eAAe;IAClBE,UAAU,EAAE;EAAI,GAClB;AACN,CAAC;AAAC"}