@contentful/app-scripts 1.14.0 → 1.15.0

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/lib/types.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface ContentfulFunction {
15
15
  name: string;
16
16
  description: string;
17
17
  path: string;
18
+ accepts: string[];
18
19
  allowNetworks?: string[];
19
20
  entryFile?: string;
20
21
  }
package/lib/utils.js CHANGED
@@ -87,21 +87,31 @@ function getEntityFromManifest(type) {
87
87
  return;
88
88
  }
89
89
  logProgress(`${type === 'actions' ? 'App Actions' : 'functions'} found in ${chalk_1.default.bold(DEFAULT_MANIFEST_PATH)}.`);
90
+ const fieldMappingEvent = "graphql.field.mapping";
91
+ const queryEvent = "graphql.query";
90
92
  const items = manifest[type].map((item) => {
91
93
  const allowNetworks = Array.isArray(item.allowNetworks)
92
94
  ? item.allowNetworks.map(exports.stripProtocol)
93
95
  : [];
96
+ const accepts = 'accepts' in item && Array.isArray(item.accepts) ? item.accepts : undefined;
97
+ const hasInvalidEvent = accepts?.some((event) => ![fieldMappingEvent, queryEvent].includes(event));
94
98
  const hasInvalidNetwork = allowNetworks.find((netWork) => !(0, exports.isValidNetwork)(netWork));
95
99
  if (hasInvalidNetwork) {
96
100
  console.log(`${chalk_1.default.red('Error:')} Invalid IP address ${hasInvalidNetwork} found in the allowNetworks array for ${type} "${item.name}".`);
97
101
  // eslint-disable-next-line no-process-exit
98
102
  process.exit(1);
99
103
  }
104
+ if (hasInvalidEvent) {
105
+ console.log(`${chalk_1.default.red('Error:')} Invalid events ${hasInvalidEvent} found in the accepts array for ${type} "${item.name}".`);
106
+ // eslint-disable-next-line no-process-exit
107
+ process.exit(1);
108
+ }
100
109
  // EntryFile is not used but we do want to strip it
101
110
  // eslint-disable-next-line no-unused-vars
102
111
  const { entryFile: _, ...itemWithoutEntryFile } = item;
103
112
  return {
104
113
  ...itemWithoutEntryFile,
114
+ ...(accepts && { accepts }),
105
115
  allowNetworks,
106
116
  };
107
117
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/app-scripts",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "A collection of scripts for building Contentful Apps",
5
5
  "author": "Contentful GmbH",
6
6
  "license": "MIT",
@@ -51,16 +51,16 @@
51
51
  "adm-zip": "0.5.10",
52
52
  "bottleneck": "2.19.5",
53
53
  "chalk": "4.1.2",
54
- "commander": "11.1.0",
55
- "contentful-management": "11.14.3",
56
- "dotenv": "16.4.1",
54
+ "commander": "12.0.0",
55
+ "contentful-management": "11.16.0",
56
+ "dotenv": "16.4.4",
57
57
  "ignore": "5.3.1",
58
58
  "inquirer": "8.2.6",
59
59
  "lodash": "4.17.21",
60
60
  "open": "8.4.2",
61
61
  "ora": "5.4.1"
62
62
  },
63
- "gitHead": "70d4b4a2ed21008ed58c125652cbb4a209344eb3",
63
+ "gitHead": "ca1260e5b969a8b5a1ff1104fbb2431cbf420ca3",
64
64
  "devDependencies": {
65
65
  "@tsconfig/node18": "18.2.2",
66
66
  "@types/adm-zip": "0.5.5",