@webiny/api-apw 0.0.0-ee-vpcs.549378cf03 → 0.0.0-unstable.3386f66516

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/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { CreateApwContextParams } from "./scheduler/types";
2
- export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext>)[];
3
- export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
2
+ export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
4
3
  export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
package/index.js CHANGED
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.createApwPageBuilderContext = exports.createApwHeadlessCmsContext = exports.createApwGraphQL = void 0;
8
+ exports.createApwPageBuilderContext = exports.createApwGraphQL = void 0;
9
9
 
10
10
  var _graphql = _interopRequireDefault(require("./plugins/graphql"));
11
11
 
@@ -19,12 +19,6 @@ var _apiAdminSettings = require("@webiny/api-admin-settings");
19
19
  * We have separated context and GraphQL creation so user can initialize only context if required.
20
20
  * GraphQL will not work without context, but context will without GraphQL.
21
21
  */
22
- const createApwHeadlessCmsContext = params => {
23
- return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
24
- };
25
-
26
- exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
27
-
28
22
  const createApwPageBuilderContext = params => {
29
23
  return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
30
24
  };
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAC,4CAAA,GAAJ,EAAkC,GAAG,IAAAC,8BAAA,GAArC,EAA4D,IAAAC,oCAAA,EAAkBH,MAAlB,CAA5D,CAAP;AACH,CAFM;;;;AAIA,MAAMI,2BAA2B,GAAIJ,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAG,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBN,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMO,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}
1
+ {"version":3,"names":["createApwPageBuilderContext","params","createAdminSettingsContext","createMailerContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport { createApwPageBuilderContext as createPageBuilder } from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAEA;;AACA;;AARA;AACA;AACA;AACA;AAOO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAC,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBJ,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMK,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-apw",
3
- "version": "0.0.0-ee-vpcs.549378cf03",
3
+ "version": "0.0.0-unstable.3386f66516",
4
4
  "keywords": [
5
5
  "apw:base"
6
6
  ],
@@ -17,27 +17,27 @@
17
17
  "@aws-sdk/client-cloudwatch-events": "3.186.0",
18
18
  "@babel/runtime": "7.19.0",
19
19
  "@commodo/fields": "1.1.2-beta.20",
20
- "@webiny/api": "0.0.0-ee-vpcs.549378cf03",
21
- "@webiny/api-admin-settings": "0.0.0-ee-vpcs.549378cf03",
22
- "@webiny/api-headless-cms": "0.0.0-ee-vpcs.549378cf03",
23
- "@webiny/api-i18n": "0.0.0-ee-vpcs.549378cf03",
24
- "@webiny/api-i18n-ddb": "0.0.0-ee-vpcs.549378cf03",
25
- "@webiny/api-mailer": "0.0.0-ee-vpcs.549378cf03",
26
- "@webiny/api-page-builder": "0.0.0-ee-vpcs.549378cf03",
27
- "@webiny/api-security": "0.0.0-ee-vpcs.549378cf03",
28
- "@webiny/api-tenancy": "0.0.0-ee-vpcs.549378cf03",
29
- "@webiny/api-wcp": "0.0.0-ee-vpcs.549378cf03",
30
- "@webiny/db-dynamodb": "0.0.0-ee-vpcs.549378cf03",
31
- "@webiny/error": "0.0.0-ee-vpcs.549378cf03",
32
- "@webiny/handler": "0.0.0-ee-vpcs.549378cf03",
33
- "@webiny/handler-client": "0.0.0-ee-vpcs.549378cf03",
34
- "@webiny/handler-db": "0.0.0-ee-vpcs.549378cf03",
35
- "@webiny/handler-graphql": "0.0.0-ee-vpcs.549378cf03",
36
- "@webiny/handler-logs": "0.0.0-ee-vpcs.549378cf03",
37
- "@webiny/plugins": "0.0.0-ee-vpcs.549378cf03",
38
- "@webiny/pubsub": "0.0.0-ee-vpcs.549378cf03",
39
- "@webiny/utils": "0.0.0-ee-vpcs.549378cf03",
40
- "@webiny/validation": "0.0.0-ee-vpcs.549378cf03",
20
+ "@webiny/api": "0.0.0-unstable.3386f66516",
21
+ "@webiny/api-admin-settings": "0.0.0-unstable.3386f66516",
22
+ "@webiny/api-headless-cms": "0.0.0-unstable.3386f66516",
23
+ "@webiny/api-i18n": "0.0.0-unstable.3386f66516",
24
+ "@webiny/api-i18n-ddb": "0.0.0-unstable.3386f66516",
25
+ "@webiny/api-mailer": "0.0.0-unstable.3386f66516",
26
+ "@webiny/api-page-builder": "0.0.0-unstable.3386f66516",
27
+ "@webiny/api-security": "0.0.0-unstable.3386f66516",
28
+ "@webiny/api-tenancy": "0.0.0-unstable.3386f66516",
29
+ "@webiny/api-wcp": "0.0.0-unstable.3386f66516",
30
+ "@webiny/db-dynamodb": "0.0.0-unstable.3386f66516",
31
+ "@webiny/error": "0.0.0-unstable.3386f66516",
32
+ "@webiny/handler": "0.0.0-unstable.3386f66516",
33
+ "@webiny/handler-client": "0.0.0-unstable.3386f66516",
34
+ "@webiny/handler-db": "0.0.0-unstable.3386f66516",
35
+ "@webiny/handler-graphql": "0.0.0-unstable.3386f66516",
36
+ "@webiny/handler-logs": "0.0.0-unstable.3386f66516",
37
+ "@webiny/plugins": "0.0.0-unstable.3386f66516",
38
+ "@webiny/pubsub": "0.0.0-unstable.3386f66516",
39
+ "@webiny/utils": "0.0.0-unstable.3386f66516",
40
+ "@webiny/validation": "0.0.0-unstable.3386f66516",
41
41
  "dayjs": "1.11.5",
42
42
  "lodash": "4.17.21",
43
43
  "mdbid": "1.0.0"
@@ -46,14 +46,14 @@
46
46
  "@babel/cli": "^7.19.3",
47
47
  "@babel/core": "^7.19.3",
48
48
  "@babel/preset-env": "^7.19.4",
49
- "@webiny/api-headless-cms-ddb": "^0.0.0-ee-vpcs.549378cf03",
50
- "@webiny/api-page-builder-so-ddb": "^0.0.0-ee-vpcs.549378cf03",
51
- "@webiny/api-security-so-ddb": "^0.0.0-ee-vpcs.549378cf03",
52
- "@webiny/api-tenancy-so-ddb": "^0.0.0-ee-vpcs.549378cf03",
53
- "@webiny/cli": "^0.0.0-ee-vpcs.549378cf03",
54
- "@webiny/handler-aws": "^0.0.0-ee-vpcs.549378cf03",
55
- "@webiny/project-utils": "^0.0.0-ee-vpcs.549378cf03",
56
- "@webiny/wcp": "^0.0.0-ee-vpcs.549378cf03",
49
+ "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.3386f66516",
50
+ "@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.3386f66516",
51
+ "@webiny/api-security-so-ddb": "^0.0.0-unstable.3386f66516",
52
+ "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.3386f66516",
53
+ "@webiny/cli": "^0.0.0-unstable.3386f66516",
54
+ "@webiny/handler-aws": "^0.0.0-unstable.3386f66516",
55
+ "@webiny/project-utils": "^0.0.0-unstable.3386f66516",
56
+ "@webiny/wcp": "^0.0.0-unstable.3386f66516",
57
57
  "get-yarn-workspaces": "^1.0.2",
58
58
  "graphql": "^15.7.2",
59
59
  "jest": "^28.1.0",
@@ -72,5 +72,5 @@
72
72
  "build": "yarn webiny run build",
73
73
  "watch": "yarn webiny run watch"
74
74
  },
75
- "gitHead": "549378cf03fcd27845fc3fa23d1dc6b32896f630"
75
+ "gitHead": "3386f66516b16fe54e2508243b91dfff1a0156f9"
76
76
  }
@@ -2,4 +2,3 @@ import { ContextPlugin } from "@webiny/api";
2
2
  import { ApwContext } from "../types";
3
3
  import { CreateApwContextParams } from "../scheduler/types";
4
4
  export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
5
- export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.createApwPageBuilderContext = exports.createApwHeadlessCmsContext = void 0;
8
+ exports.createApwPageBuilderContext = void 0;
9
9
 
10
10
  var _hooks = require("./hooks");
11
11
 
@@ -126,21 +126,4 @@ const createApwPageBuilderContext = params => {
126
126
  });
127
127
  };
128
128
 
129
- exports.createApwPageBuilderContext = createApwPageBuilderContext;
130
-
131
- const createApwHeadlessCmsContext = params => {
132
- return new _api.ContextPlugin(async context => {
133
- if (!context.wcp.canUseFeature("advancedPublishingWorkflow")) {
134
- return;
135
- } else if ((0, _utils.isInstallationPending)(context)) {
136
- return;
137
- }
138
-
139
- await setupApwContext(params).apply(context);
140
- await setupApwHeadlessCms().apply(context);
141
- await (0, _hooks.attachApwHooks)().apply(context);
142
- await (0, _security.createCustomAuth)(params).apply(context);
143
- });
144
- };
145
-
146
- exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
129
+ exports.createApwPageBuilderContext = createApwPageBuilderContext;
@@ -1 +1 @@
1
- {"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema","createApwHeadlessCmsContext"],"sources":["context.ts"],"sourcesContent":["import { attachApwHooks } from \"./hooks\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { createApw } from \"~/crud\";\nimport { apwPageBuilderHooks } from \"./pageBuilder\";\nimport { createStorageOperations } from \"~/storageOperations\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { CreateApwContextParams } from \"~/scheduler/types\";\nimport { createScheduler } from \"~/scheduler\";\nimport { createCustomAuth } from \"~/scheduler/handlers/executeAction/security\";\nimport { isInstallationPending } from \"./utils\";\nimport { extendPbPageSettingsSchema } from \"~/plugins/pageBuilder/extendPbPageSettingsSchema\";\nimport { apwContentPagePlugins } from \"~/plugins/pageBuilder/apwContentPagePlugins\";\nimport { apwCmsHooks } from \"~/plugins/cms\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst setupApwContext = (params: CreateApwContextParams) =>\n new ContextPlugin<ApwContext>(async context => {\n const { tenancy, security, i18n, handlerClient } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getPermission = async (name: string): Promise<SecurityPermission | null> => {\n return security.getPermission(name);\n };\n const getIdentity = () => security.getIdentity();\n\n const scheduler = createScheduler({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: params.storageOperations\n });\n\n context.apw = createApw({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: createStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n }),\n scheduler,\n handlerClient,\n plugins: context.plugins\n });\n });\n\nconst setupApwPageBuilder = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwPageBuilderHooks(context);\n });\n};\n\nconst setupApwHeadlessCms = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwCmsHooks(context);\n });\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwPageBuilder().apply(context);\n await setupApwHeadlessCms().apply(context);\n await apwContentPagePlugins().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);\n\n context.plugins.register(extendPbPageSettingsSchema());\n });\n};\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwHeadlessCms().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,eAAe,GAAIC,MAAD,IACpB,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC,IAArB;IAA2BC;EAA3B,IAA6CJ,OAAnD;;EAEA,IAAI,IAAAK,4BAAA,EAAsB;IAAEJ,OAAF;IAAWE;EAAX,CAAtB,CAAJ,EAA8C;IAC1C;EACH;;EAED,MAAMG,SAAS,GAAG,MAAkB;IAChC,MAAMC,MAAM,GAAGJ,IAAI,CAACK,gBAAL,EAAf;;IACA,IAAI,CAACD,MAAL,EAAa;MACT,MAAM,IAAIE,cAAJ,CACF,sDADE,EAEF,cAFE,CAAN;IAIH;;IAED,OAAOF,MAAP;EACH,CAVD;;EAYA,MAAMG,SAAS,GAAG,MAAc;IAC5B,OAAOT,OAAO,CAACU,gBAAR,EAAP;EACH,CAFD;;EAIA,MAAMC,aAAa,GAAG,MAAOC,IAAP,IAA4D;IAC9E,OAAOX,QAAQ,CAACU,aAAT,CAAuBC,IAAvB,CAAP;EACH,CAFD;;EAGA,MAAMC,WAAW,GAAG,MAAMZ,QAAQ,CAACY,WAAT,EAA1B;;EAEA,MAAMC,SAAS,GA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,MAAMwB,mBAAmB,GAAGO,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM0B,mBAAmB,GAAGK,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM,IAAAgC,4CAAA,IAAwBD,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAM,IAAAiC,qBAAA,IAAiBF,KAAjB,CAAuB/B,OAAvB,CAAN;IACA,MAAM,IAAAkC,0BAAA,EAAiBpC,MAAjB,EAAyBiC,KAAzB,CAA+B/B,OAA/B,CAAN;IAEAA,OAAO,CAACuB,OAAR,CAAgBY,QAAhB,CAAyB,IAAAC,sDAAA,GAAzB;EACH,CAfM,CAAP;AAgBH,CAjBM;;;;AAmBA,MAAMC,2BAA2B,GAAIvC,MAAD,IAAoC;EAC3E,OAAO,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;IAClD,IAAI,CAACA,OAAO,CAAC6B,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH,CAFD,MAEO,IAAI,IAAAzB,4BAAA,EAAsBL,OAAtB,CAAJ,EAAoC;MACvC;IACH;;IAED,MAAMH,eAAe,CAACC,MAAD,CAAf,CAAwBiC,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAM0B,mBAAmB,GAAGK,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM,IAAAiC,qBAAA,IAAiBF,KAAjB,CAAuB/B,OAAvB,CAAN;IACA,MAAM,IAAAkC,0BAAA,EAAiBpC,MAAjB,EAAyBiC,KAAzB,CAA+B/B,OAA/B,CAAN;EACH,CAXM,CAAP;AAYH,CAbM"}
1
+ {"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema"],"sources":["context.ts"],"sourcesContent":["import { attachApwHooks } from \"./hooks\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { createApw } from \"~/crud\";\nimport { apwPageBuilderHooks } from \"./pageBuilder\";\nimport { createStorageOperations } from \"~/storageOperations\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { CreateApwContextParams } from \"~/scheduler/types\";\nimport { createScheduler } from \"~/scheduler\";\nimport { createCustomAuth } from \"~/scheduler/handlers/executeAction/security\";\nimport { isInstallationPending } from \"./utils\";\nimport { extendPbPageSettingsSchema } from \"~/plugins/pageBuilder/extendPbPageSettingsSchema\";\nimport { apwContentPagePlugins } from \"~/plugins/pageBuilder/apwContentPagePlugins\";\nimport { apwCmsHooks } from \"~/plugins/cms\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst setupApwContext = (params: CreateApwContextParams) =>\n new ContextPlugin<ApwContext>(async context => {\n const { tenancy, security, i18n, handlerClient } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getPermission = async (name: string): Promise<SecurityPermission | null> => {\n return security.getPermission(name);\n };\n const getIdentity = () => security.getIdentity();\n\n const scheduler = createScheduler({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: params.storageOperations\n });\n\n context.apw = createApw({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: createStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n }),\n scheduler,\n handlerClient,\n plugins: context.plugins\n });\n });\n\nconst setupApwPageBuilder = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwPageBuilderHooks(context);\n });\n};\n\nconst setupApwHeadlessCms = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwCmsHooks(context);\n });\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwPageBuilder().apply(context);\n await setupApwHeadlessCms().apply(context);\n await apwContentPagePlugins().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);\n\n context.plugins.register(extendPbPageSettingsSchema());\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,eAAe,GAAIC,MAAD,IACpB,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC,IAArB;IAA2BC;EAA3B,IAA6CJ,OAAnD;;EAEA,IAAI,IAAAK,4BAAA,EAAsB;IAAEJ,OAAF;IAAWE;EAAX,CAAtB,CAAJ,EAA8C;IAC1C;EACH;;EAED,MAAMG,SAAS,GAAG,MAAkB;IAChC,MAAMC,MAAM,GAAGJ,IAAI,CAACK,gBAAL,EAAf;;IACA,IAAI,CAACD,MAAL,EAAa;MACT,MAAM,IAAIE,cAAJ,CACF,sDADE,EAEF,cAFE,CAAN;IAIH;;IAED,OAAOF,MAAP;EACH,CAVD;;EAYA,MA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,MAAMC,OAAN,IAAiB;IAClD,IAAI,CAACA,OAAO,CAAC6B,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH,CAFD,MAEO,IAAI,IAAAzB,4BAAA,EAAsBL,OAAtB,CAAJ,EAAoC;MACvC;IACH;;IAED,MAAMH,eAAe,CAACC,MAAD,CAAf,CAAwBiC,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAMwB,mBAAmB,GAAGO,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM0B,mBAAmB,GAAGK,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM,IAAAgC,4CAAA,IAAwBD,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAM,IAAAiC,qBAAA,IAAiBF,KAAjB,CAAuB/B,OAAvB,CAAN;IACA,MAAM,IAAAkC,0BAAA,EAAiBpC,MAAjB,EAAyBiC,KAAzB,CAA+B/B,OAA/B,CAAN;IAEAA,OAAO,CAACuB,OAAR,CAAgBY,QAAhB,CAAyB,IAAAC,sDAAA,GAAzB;EACH,CAfM,CAAP;AAgBH,CAjBM"}
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _plugins = require("@webiny/handler-graphql/plugins");
11
-
12
10
  var _workflow = _interopRequireDefault(require("./graphql/workflow.gql"));
13
11
 
14
12
  var _contentReview = _interopRequireDefault(require("./graphql/contentReview.gql"));
@@ -19,6 +17,8 @@ var _comment = _interopRequireDefault(require("./graphql/comment.gql"));
19
17
 
20
18
  var _changeRequest = _interopRequireDefault(require("./graphql/changeRequest.gql"));
21
19
 
20
+ var _plugins = require("@webiny/handler-graphql/plugins");
21
+
22
22
  var _api = require("@webiny/api");
23
23
 
24
24
  const emptyResolver = () => ({});
@@ -1 +1 @@
1
- {"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwCreatedBy {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,aAAa,GAAG,OAAO,EAAP,CAAtB;;AAEA,MAAMC,UAAU,GAAG,IAAIC,4BAAJ,CAAwB;EACvCC,QAAQ;EAAE;EAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA9C2C;EA+CvCC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IADF,CADA;IAIPO,QAAQ,EAAE;MACND,GAAG,EAAEN;IADC;EAJH;AA/C4B,CAAxB,CAAnB;;eAyDe,MAAM;EACjB,OAAO,IAAIQ,kBAAJ,CAA8BC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH;;IAEDF,OAAO,CAACG,OAAR,CAAgBC,QAAhB,CAAyB,CACrBZ,UADqB,EAErBa,iBAFqB,EAGrBC,sBAHqB,EAIrBC,iBAJqB,EAKrBC,gBALqB,EAMrBC,sBANqB,CAAzB;EAQH,CAbM,CAAP;AAcH,C"}
1
+ {"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwCreatedBy {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,aAAa,GAAG,OAAO,EAAP,CAAtB;;AAEA,MAAMC,UAAU,GAAG,IAAIC,4BAAJ,CAAwB;EACvCC,QAAQ;EAAE;EAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA9C2C;EA+CvCC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IADF,CADA;IAIPO,QAAQ,EAAE;MACND,GAAG,EAAEN;IADC;EAJH;AA/C4B,CAAxB,CAAnB;;eAyDe,MAAM;EACjB,OAAO,IAAIQ,kBAAJ,CAA8BC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH;;IAEDF,OAAO,CAACG,OAAR,CAAgBC,QAAhB,CAAyB,CACrBZ,UADqB,EAErBa,iBAFqB,EAGrBC,sBAHqB,EAIrBC,iBAJqB,EAKrBC,gBALqB,EAMrBC,sBANqB,CAAzB;EAQH,CAbM,CAAP;AAcH,C"}
@@ -9,5 +9,5 @@ export interface HandlerArgs {
9
9
  interface Configuration {
10
10
  storageOperations: ApwScheduleActionStorageOperations;
11
11
  }
12
- export declare const executeActionHandlerPlugins: (config: Configuration) => ((import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler").EventPlugin<HandlerArgs, import("@webiny/handler/types").Context, any> | ContextPlugin<import("@webiny/api/types").Context>)[];
12
+ export declare const executeActionHandlerPlugins: (config: Configuration) => ((import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler").EventPlugin<HandlerArgs, import("@webiny/handler/types").Context, any> | ContextPlugin<import("@webiny/api/types").Context>)[];
13
13
  export {};
@@ -19,4 +19,4 @@ export interface Configuration {
19
19
  executeAction: string;
20
20
  };
21
21
  }
22
- export declare const scheduleActionHandlerPlugins: (config: Configuration) => ((import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler-aws").RawEventHandler<HandlerArgs, import("@webiny/handler/types").Context, any>)[];
22
+ export declare const scheduleActionHandlerPlugins: (config: Configuration) => ((import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[] | import("@webiny/handler-aws").RawEventHandler<HandlerArgs, import("@webiny/handler/types").Context, any>)[];
@@ -19,7 +19,7 @@ export declare const encodeToken: ({ id, tenant, locale }: EncodeTokenParams) =>
19
19
  export declare const TOKEN_PREFIX = "apw-";
20
20
  export declare const decodeToken: (token: string) => Partial<EncodeTokenParams>;
21
21
  export declare const documentClient: DocumentClient;
22
- export declare const basePlugins: () => (import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[];
22
+ export declare const basePlugins: () => (import("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin").ValueFilterPlugin[][] | import("@webiny/handler").HandlerResultPlugin<import("@webiny/handler/types").Context> | import("@webiny/api").ContextPlugin<import("@webiny/handler-db/types").DbContext>[])[];
23
23
  /**
24
24
  * Get APW settings record from DDB.
25
25
  */
@@ -1,3 +1,3 @@
1
1
  import { Response, ErrorResponse } from "@webiny/handler-graphql";
2
- declare const _default: (fn: () => Promise<any>) => Promise<ErrorResponse | Response<any>>;
2
+ declare const _default: (fn: () => Promise<any>) => Promise<Response<any> | ErrorResponse>;
3
3
  export default _default;