@webiny/api-aco 0.0.0-unstable.6509387258 → 0.0.0-unstable.9e825fd5fb

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.
@@ -26,7 +26,6 @@ const createAcoModels = context => {
26
26
  })) {
27
27
  return;
28
28
  }
29
- context.security.disableAuthorization();
30
29
  const locale = context.i18n.getContentLocale();
31
30
  if (!locale) {
32
31
  throw new _error.default("Missing content locale in api-aco/storageOperations/index.ts", "LOCALE_ERROR");
@@ -62,6 +61,5 @@ const createAcoModels = context => {
62
61
  * Register them so that they are accessible in cms context
63
62
  */
64
63
  context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);
65
- context.security.enableAuthorization();
66
64
  };
67
65
  exports.createAcoModels = createAcoModels;
@@ -1 +1 @@
1
- {"version":3,"names":["createAcoModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","security","disableAuthorization","locale","getContentLocale","WebinyError","groupId","cmsGroupPlugin","CmsGroupPlugin","id","slug","name","description","icon","isPrivate","modelDefinitions","createFolderModelDefinition","createSearchModelDefinition","cmsModelPlugins","map","modelDefinition","modelFactory","group","contentModelGroup","tenant","getCurrentTenant","code","plugins","register","enableAuthorization"],"sources":["createAcoModels.ts"],"sourcesContent":["import { CmsGroupPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nimport { createFolderModelDefinition } from \"~/folder/folder.model\";\nimport { createSearchModelDefinition } from \"~/record/record.model\";\nimport { modelFactory } from \"~/utils/modelFactory\";\nimport { isInstallationPending } from \"~/utils/isInstallationPending\";\n\nexport const createAcoModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n context.security.disableAuthorization();\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-aco/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n const groupId = \"contentModelGroup_aco\";\n\n /**\n * Create a CmsGroup.\n */\n const cmsGroupPlugin = new CmsGroupPlugin({\n id: groupId,\n slug: \"aco\",\n name: \"ACO\",\n description: \"Group for Advanced Content Organisation and Search\",\n icon: \"fas/folder\",\n isPrivate: true\n });\n\n /**\n * Create CmsModel plugins.\n */\n const modelDefinitions = [createFolderModelDefinition(), createSearchModelDefinition()];\n const cmsModelPlugins = modelDefinitions.map(modelDefinition => {\n return modelFactory({\n group: cmsGroupPlugin.contentModelGroup,\n tenant: context.tenancy.getCurrentTenant().id,\n locale: locale.code,\n modelDefinition\n });\n });\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);\n\n context.security.enableAuthorization();\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAEA;AACA;AACA;AACA;AAEO,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4CAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEAN,OAAO,CAACO,QAAQ,CAACC,oBAAoB,EAAE;EAEvC,MAAMC,MAAM,GAAGT,OAAO,CAACM,IAAI,CAACI,gBAAgB,EAAE;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cAAc,CACjB;EACL;EAEA,MAAMC,OAAO,GAAG,uBAAuB;;EAEvC;AACJ;AACA;EACI,MAAMC,cAAc,GAAG,IAAIC,8BAAc,CAAC;IACtCC,EAAE,EAAEH,OAAO;IACXI,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,KAAK;IACXC,WAAW,EAAE,oDAAoD;IACjEC,IAAI,EAAE,YAAY;IAClBC,SAAS,EAAE;EACf,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMC,gBAAgB,GAAG,CAAC,IAAAC,mCAA2B,GAAE,EAAE,IAAAC,mCAA2B,GAAE,CAAC;EACvF,MAAMC,eAAe,GAAGH,gBAAgB,CAACI,GAAG,CAACC,eAAe,IAAI;IAC5D,OAAO,IAAAC,0BAAY,EAAC;MAChBC,KAAK,EAAEf,cAAc,CAACgB,iBAAiB;MACvCC,MAAM,EAAE9B,OAAO,CAACK,OAAO,CAAC0B,gBAAgB,EAAE,CAAChB,EAAE;MAC7CN,MAAM,EAAEA,MAAM,CAACuB,IAAI;MACnBN;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;AACJ;AACA;EACI1B,OAAO,CAACiC,OAAO,CAACC,QAAQ,CAAC,CAACrB,cAAc,EAAEW,eAAe,CAAC,CAAC;EAE3DxB,OAAO,CAACO,QAAQ,CAAC4B,mBAAmB,EAAE;AAC1C,CAAC;AAAC"}
1
+ {"version":3,"names":["createAcoModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","groupId","cmsGroupPlugin","CmsGroupPlugin","id","slug","name","description","icon","isPrivate","modelDefinitions","createFolderModelDefinition","createSearchModelDefinition","cmsModelPlugins","map","modelDefinition","modelFactory","group","contentModelGroup","tenant","getCurrentTenant","code","plugins","register"],"sources":["createAcoModels.ts"],"sourcesContent":["import { CmsGroupPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nimport { createFolderModelDefinition } from \"~/folder/folder.model\";\nimport { createSearchModelDefinition } from \"~/record/record.model\";\nimport { modelFactory } from \"~/utils/modelFactory\";\nimport { isInstallationPending } from \"~/utils/isInstallationPending\";\n\nexport const createAcoModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-aco/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n const groupId = \"contentModelGroup_aco\";\n\n /**\n * Create a CmsGroup.\n */\n const cmsGroupPlugin = new CmsGroupPlugin({\n id: groupId,\n slug: \"aco\",\n name: \"ACO\",\n description: \"Group for Advanced Content Organisation and Search\",\n icon: \"fas/folder\",\n isPrivate: true\n });\n\n /**\n * Create CmsModel plugins.\n */\n const modelDefinitions = [createFolderModelDefinition(), createSearchModelDefinition()];\n const cmsModelPlugins = modelDefinitions.map(modelDefinition => {\n return modelFactory({\n group: cmsGroupPlugin.contentModelGroup,\n tenant: context.tenancy.getCurrentTenant().id,\n locale: locale.code,\n modelDefinition\n });\n });\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAEA;AACA;AACA;AACA;AAEO,MAAMA,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4CAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEA,MAAMC,MAAM,GAAGP,OAAO,CAACM,IAAI,CAACE,gBAAgB,EAAE;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cAAc,CACjB;EACL;EAEA,MAAMC,OAAO,GAAG,uBAAuB;;EAEvC;AACJ;AACA;EACI,MAAMC,cAAc,GAAG,IAAIC,8BAAc,CAAC;IACtCC,EAAE,EAAEH,OAAO;IACXI,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,KAAK;IACXC,WAAW,EAAE,oDAAoD;IACjEC,IAAI,EAAE,YAAY;IAClBC,SAAS,EAAE;EACf,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMC,gBAAgB,GAAG,CAAC,IAAAC,mCAA2B,GAAE,EAAE,IAAAC,mCAA2B,GAAE,CAAC;EACvF,MAAMC,eAAe,GAAGH,gBAAgB,CAACI,GAAG,CAACC,eAAe,IAAI;IAC5D,OAAO,IAAAC,0BAAY,EAAC;MAChBC,KAAK,EAAEf,cAAc,CAACgB,iBAAiB;MACvCC,MAAM,EAAE5B,OAAO,CAACK,OAAO,CAACwB,gBAAgB,EAAE,CAAChB,EAAE;MAC7CN,MAAM,EAAEA,MAAM,CAACuB,IAAI;MACnBN;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;AACJ;AACA;EACIxB,OAAO,CAAC+B,OAAO,CAACC,QAAQ,CAAC,CAACrB,cAAc,EAAEW,eAAe,CAAC,CAAC;AAC/D,CAAC;AAAC"}
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const createACO: () => (import("@webiny/api").ContextPlugin<import("./types").AcoContext> | import("@webiny/api-headless-cms/types").CmsModelFieldToGraphQLPlugin<import("@webiny/api-headless-cms/types").CmsModelField>[] | import("@webiny/api").ContextPlugin<import("@webiny/api-admin-settings/types").AdminSettingsContext>)[];
1
+ export declare const createAco: () => (import("@webiny/api").ContextPlugin<import("./types").AcoContext> | import("@webiny/api-headless-cms/types").CmsModelFieldToGraphQLPlugin<import("@webiny/api-headless-cms/types").CmsModelField>[] | import("@webiny/api").ContextPlugin<import("@webiny/api-admin-settings/types").AdminSettingsContext>)[];
package/index.js CHANGED
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createACO = void 0;
6
+ exports.createAco = void 0;
7
7
  var _apiAdminSettings = require("@webiny/api-admin-settings");
8
8
  var _createAcoContext = require("./createAcoContext");
9
9
  var _createAcoFields = require("./createAcoFields");
10
10
  var _createAcoGraphQL = require("./createAcoGraphQL");
11
- const createACO = () => {
11
+ const createAco = () => {
12
12
  return [...(0, _apiAdminSettings.createAdminSettingsContext)(), (0, _createAcoContext.createAcoContext)(), (0, _createAcoFields.createAcoFields)(), (0, _createAcoGraphQL.createAcoGraphQL)()];
13
13
  };
14
- exports.createACO = createACO;
14
+ exports.createAco = createAco;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createACO","createAdminSettingsContext","createAcoContext","createAcoFields","createAcoGraphQL"],"sources":["index.ts"],"sourcesContent":["import { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nimport { createAcoContext } from \"~/createAcoContext\";\nimport { createAcoFields } from \"~/createAcoFields\";\nimport { createAcoGraphQL } from \"~/createAcoGraphQL\";\n\nexport const createACO = () => {\n return [\n ...createAdminSettingsContext(),\n createAcoContext(),\n createAcoFields(),\n createAcoGraphQL()\n ];\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AAEO,MAAMA,SAAS,GAAG,MAAM;EAC3B,OAAO,CACH,GAAG,IAAAC,4CAA0B,GAAE,EAC/B,IAAAC,kCAAgB,GAAE,EAClB,IAAAC,gCAAe,GAAE,EACjB,IAAAC,kCAAgB,GAAE,CACrB;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createAco","createAdminSettingsContext","createAcoContext","createAcoFields","createAcoGraphQL"],"sources":["index.ts"],"sourcesContent":["import { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nimport { createAcoContext } from \"~/createAcoContext\";\nimport { createAcoFields } from \"~/createAcoFields\";\nimport { createAcoGraphQL } from \"~/createAcoGraphQL\";\n\nexport const createAco = () => {\n return [\n ...createAdminSettingsContext(),\n createAcoContext(),\n createAcoFields(),\n createAcoGraphQL()\n ];\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AAEO,MAAMA,SAAS,GAAG,MAAM;EAC3B,OAAO,CACH,GAAG,IAAAC,4CAA0B,GAAE,EAC/B,IAAAC,kCAAgB,GAAE,EAClB,IAAAC,gCAAe,GAAE,EACjB,IAAAC,kCAAgB,GAAE,CACrB;AACL,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-aco",
3
- "version": "0.0.0-unstable.6509387258",
3
+ "version": "0.0.0-unstable.9e825fd5fb",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "aco:base"
@@ -27,32 +27,32 @@
27
27
  "@babel/preset-env": "^7.19.4",
28
28
  "@babel/preset-typescript": "^7.18.6",
29
29
  "@babel/runtime": "^7.19.0",
30
- "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.6509387258",
31
- "@webiny/api-i18n-ddb": "^0.0.0-unstable.6509387258",
32
- "@webiny/api-security-so-ddb": "^0.0.0-unstable.6509387258",
33
- "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.6509387258",
34
- "@webiny/api-wcp": "^0.0.0-unstable.6509387258",
35
- "@webiny/cli": "^0.0.0-unstable.6509387258",
36
- "@webiny/handler-aws": "^0.0.0-unstable.6509387258",
37
- "@webiny/plugins": "^0.0.0-unstable.6509387258",
38
- "@webiny/project-utils": "^0.0.0-unstable.6509387258",
30
+ "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.9e825fd5fb",
31
+ "@webiny/api-i18n-ddb": "^0.0.0-unstable.9e825fd5fb",
32
+ "@webiny/api-security-so-ddb": "^0.0.0-unstable.9e825fd5fb",
33
+ "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.9e825fd5fb",
34
+ "@webiny/api-wcp": "^0.0.0-unstable.9e825fd5fb",
35
+ "@webiny/cli": "^0.0.0-unstable.9e825fd5fb",
36
+ "@webiny/handler-aws": "^0.0.0-unstable.9e825fd5fb",
37
+ "@webiny/plugins": "^0.0.0-unstable.9e825fd5fb",
38
+ "@webiny/project-utils": "^0.0.0-unstable.9e825fd5fb",
39
39
  "rimraf": "^3.0.2",
40
40
  "ttypescript": "^1.5.13",
41
41
  "typescript": "^4.7.4"
42
42
  },
43
43
  "dependencies": {
44
- "@webiny/api": "0.0.0-unstable.6509387258",
45
- "@webiny/api-admin-settings": "0.0.0-unstable.6509387258",
46
- "@webiny/api-headless-cms": "0.0.0-unstable.6509387258",
47
- "@webiny/api-i18n": "0.0.0-unstable.6509387258",
48
- "@webiny/api-security": "0.0.0-unstable.6509387258",
49
- "@webiny/api-tenancy": "0.0.0-unstable.6509387258",
50
- "@webiny/error": "0.0.0-unstable.6509387258",
51
- "@webiny/handler": "0.0.0-unstable.6509387258",
52
- "@webiny/handler-graphql": "0.0.0-unstable.6509387258",
53
- "@webiny/pubsub": "0.0.0-unstable.6509387258",
54
- "@webiny/utils": "0.0.0-unstable.6509387258",
44
+ "@webiny/api": "0.0.0-unstable.9e825fd5fb",
45
+ "@webiny/api-admin-settings": "0.0.0-unstable.9e825fd5fb",
46
+ "@webiny/api-headless-cms": "0.0.0-unstable.9e825fd5fb",
47
+ "@webiny/api-i18n": "0.0.0-unstable.9e825fd5fb",
48
+ "@webiny/api-security": "0.0.0-unstable.9e825fd5fb",
49
+ "@webiny/api-tenancy": "0.0.0-unstable.9e825fd5fb",
50
+ "@webiny/error": "0.0.0-unstable.9e825fd5fb",
51
+ "@webiny/handler": "0.0.0-unstable.9e825fd5fb",
52
+ "@webiny/handler-graphql": "0.0.0-unstable.9e825fd5fb",
53
+ "@webiny/pubsub": "0.0.0-unstable.9e825fd5fb",
54
+ "@webiny/utils": "0.0.0-unstable.9e825fd5fb",
55
55
  "lodash": "4.17.21"
56
56
  },
57
- "gitHead": "6509387258f8fe18e270a16d0f5b89ba4134f088"
57
+ "gitHead": "9e825fd5fb3c021691acbaee6c5fd925f5f5de4d"
58
58
  }
package/types.d.ts CHANGED
@@ -41,3 +41,7 @@ export declare type AcoStorageOperations = AcoFolderStorageOperations & AcoSearc
41
41
  export interface AcoContext extends BaseContext, I18NContext, TenancyContext, SecurityContext, CmsContext {
42
42
  aco: AdvancedContentOrganisation;
43
43
  }
44
+ /**
45
+ * @deprecated Use AcoContext instead
46
+ */
47
+ export declare type ACOContext = AcoContext;
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ListSortDirection"],"sources":["types.ts"],"sourcesContent":["import { Tenant, TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { AcoSearchRecordCrud, AcoSearchRecordStorageOperations } from \"~/record/record.types\";\nimport { AcoFolderCrud, AcoFolderStorageOperations } from \"~/folder/folder.types\";\n\nexport interface User {\n id: string;\n type: string;\n displayName: string | null;\n}\n\nexport interface ListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\nexport enum ListSortDirection {\n ASC,\n DESC\n}\n\nexport type ListSort = Record<string, ListSortDirection>;\n\nexport interface AcoBaseFields {\n id: string;\n entryId: string;\n createdOn: string;\n createdBy: User;\n savedOn: string;\n}\n\nexport interface AdvancedContentOrganisation {\n folder: AcoFolderCrud;\n search: AcoSearchRecordCrud;\n}\n\nexport interface CreateAcoParams {\n getIdentity: () => SecurityIdentity;\n getLocale: () => I18NLocale;\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n}\n\nexport type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations;\n\nexport interface AcoContext\n extends BaseContext,\n I18NContext,\n TenancyContext,\n SecurityContext,\n CmsContext {\n aco: AdvancedContentOrganisation;\n}\n"],"mappings":";;;;;;IAoBYA,iBAAiB;AAAA;AAAA,WAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,iCAAjBA,iBAAiB"}
1
+ {"version":3,"names":["ListSortDirection"],"sources":["types.ts"],"sourcesContent":["import { Tenant, TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { AcoSearchRecordCrud, AcoSearchRecordStorageOperations } from \"~/record/record.types\";\nimport { AcoFolderCrud, AcoFolderStorageOperations } from \"~/folder/folder.types\";\n\nexport interface User {\n id: string;\n type: string;\n displayName: string | null;\n}\n\nexport interface ListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\nexport enum ListSortDirection {\n ASC,\n DESC\n}\n\nexport type ListSort = Record<string, ListSortDirection>;\n\nexport interface AcoBaseFields {\n id: string;\n entryId: string;\n createdOn: string;\n createdBy: User;\n savedOn: string;\n}\n\nexport interface AdvancedContentOrganisation {\n folder: AcoFolderCrud;\n search: AcoSearchRecordCrud;\n}\n\nexport interface CreateAcoParams {\n getIdentity: () => SecurityIdentity;\n getLocale: () => I18NLocale;\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n}\n\nexport type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations;\n\nexport interface AcoContext\n extends BaseContext,\n I18NContext,\n TenancyContext,\n SecurityContext,\n CmsContext {\n aco: AdvancedContentOrganisation;\n}\n\n/**\n * @deprecated Use AcoContext instead\n */\nexport type ACOContext = AcoContext;\n"],"mappings":";;;;;;IAoBYA,iBAAiB;AAAA;AAAA,WAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,iCAAjBA,iBAAiB"}
@@ -13,14 +13,14 @@ const createOperationsWrapper = params => {
13
13
  modelName
14
14
  } = params;
15
15
  const withModel = async cb => {
16
- security.disableAuthorization();
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
- security.enableAuthorization();
23
- return result;
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
24
  };
25
25
  return {
26
26
  withModel
@@ -1 +1 @@
1
- {"version":3,"names":["createOperationsWrapper","params","cms","security","modelName","withModel","cb","disableAuthorization","model","getModel","WebinyError","result","enableAuthorization"],"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 security.disableAuthorization();\n const model = await cms.getModel(modelName);\n\n if (!model) {\n throw new WebinyError(`Could not find \"${modelName}\" model.`, \"MODEL_NOT_FOUND_ERROR\");\n }\n\n const result = await cb(model);\n\n security.enableAuthorization();\n\n return result;\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;IACnBH,QAAQ,CAACI,oBAAoB,EAAE;IAC/B,MAAMC,KAAK,GAAG,MAAMN,GAAG,CAACO,QAAQ,CAACL,SAAS,CAAC;IAE3C,IAAI,CAACI,KAAK,EAAE;MACR,MAAM,IAAIE,cAAW,CAAE,mBAAkBN,SAAU,UAAS,EAAE,uBAAuB,CAAC;IAC1F;IAEA,MAAMO,MAAM,GAAG,MAAML,EAAE,CAACE,KAAK,CAAC;IAE9BL,QAAQ,CAACS,mBAAmB,EAAE;IAE9B,OAAOD,MAAM;EACjB,CAAC;EAED,OAAO;IACHN;EACJ,CAAC;AACL,CAAC;AAAC"}
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"}