@contentful/app-scripts 1.30.2 → 1.31.1
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/definition-api.js +10 -2
- package/lib/upload/validate-bundle.js +9 -7
- package/lib/utils.js +6 -6
- package/package.json +6 -6
package/lib/definition-api.js
CHANGED
|
@@ -10,8 +10,16 @@ const constants_1 = require("./constants");
|
|
|
10
10
|
async function fetchDefinitions(client, orgId) {
|
|
11
11
|
try {
|
|
12
12
|
const organization = await client.getOrganization(orgId);
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const batchedAppDefinitions = [];
|
|
14
|
+
let skip = 0;
|
|
15
|
+
let totalNumOfAppDefinitions = 0;
|
|
16
|
+
while (skip === 0 || batchedAppDefinitions.length < totalNumOfAppDefinitions) {
|
|
17
|
+
const appDefinitionsResponse = await organization.getAppDefinitions({ skip, limit: 100 });
|
|
18
|
+
totalNumOfAppDefinitions = appDefinitionsResponse.total;
|
|
19
|
+
batchedAppDefinitions.push(...appDefinitionsResponse.items);
|
|
20
|
+
skip += 100;
|
|
21
|
+
}
|
|
22
|
+
return batchedAppDefinitions.map((def) => ({
|
|
15
23
|
name: def.name,
|
|
16
24
|
value: def.sys.id,
|
|
17
25
|
}));
|
|
@@ -17,14 +17,16 @@ const validateBundle = (path, { functions, actions }) => {
|
|
|
17
17
|
const buildFolder = path_1.default.join('./', path);
|
|
18
18
|
const files = fs_1.default.readdirSync(buildFolder, { recursive: true, encoding: 'utf-8' });
|
|
19
19
|
const entry = getEntryFile(files);
|
|
20
|
-
if (!entry) {
|
|
21
|
-
throw new Error('
|
|
20
|
+
if (!entry && !functions && !actions) {
|
|
21
|
+
throw new Error('Ensure your bundle includes a valid index.html file in its root folder, or a valid Contentful Function entrypoint (defined in your contentful-app-manifest.json file).');
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (entry) {
|
|
24
|
+
const entryFile = fs_1.default.readFileSync(path_1.default.join(buildFolder, entry), { encoding: 'utf8' });
|
|
25
|
+
if (fileContainsAbsolutePath(entryFile)) {
|
|
26
|
+
console.log('----------------------------');
|
|
27
|
+
console.warn(`${chalk_1.default.red('Warning:')} This bundle uses absolute paths. Please use relative paths instead for correct rendering. See more details here https://www.contentful.com/developers/docs/extensibility/app-framework/app-bundle/#limitations`);
|
|
28
|
+
console.log('----------------------------');
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
if (functions) {
|
|
30
32
|
const functionWithoutEntryFile = functions.find(({ path }) => !files.includes(path));
|
package/lib/utils.js
CHANGED
|
@@ -10,15 +10,15 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
10
10
|
const cache_credential_1 = require("./cache-credential");
|
|
11
11
|
const DEFAULT_MANIFEST_PATH = './contentful-app-manifest.json';
|
|
12
12
|
const functionEvents = {
|
|
13
|
+
appActionCall: 'appaction.call',
|
|
14
|
+
appEventFilter: 'appevent.filter',
|
|
15
|
+
appEventHandler: 'appevent.handler',
|
|
16
|
+
appEventTransformation: 'appevent.transformation',
|
|
13
17
|
fieldMappingEvent: 'graphql.field.mapping',
|
|
14
18
|
resourceTypeMappingEvent: 'graphql.resourcetype.mapping',
|
|
15
19
|
queryEvent: 'graphql.query',
|
|
16
20
|
resourceLinksSearchEvent: 'resources.search',
|
|
17
|
-
resourceLinksLookupEvent: 'resources.lookup'
|
|
18
|
-
appEventFilter: 'appevent.filter',
|
|
19
|
-
appEventHandler: 'appevent.handler',
|
|
20
|
-
appEventTransformation: 'appevent.transformation',
|
|
21
|
-
appActionCall: 'appaction.call',
|
|
21
|
+
resourceLinksLookupEvent: 'resources.lookup'
|
|
22
22
|
};
|
|
23
23
|
const throwValidationException = (subject, message, details) => {
|
|
24
24
|
console.log(`${chalk_1.default.red('Validation Error:')} Missing or invalid ${subject}.`);
|
|
@@ -126,7 +126,7 @@ function getEntityFromManifest(type) {
|
|
|
126
126
|
process.exit(1);
|
|
127
127
|
}
|
|
128
128
|
if (hasInvalidEvent) {
|
|
129
|
-
console.log(`${chalk_1.default.red('Error:')} Invalid events
|
|
129
|
+
console.log(`${chalk_1.default.red('Error:')} Invalid events found in the accepts array for ${type} "${item.name}".`);
|
|
130
130
|
// eslint-disable-next-line no-process-exit
|
|
131
131
|
process.exit(1);
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
"bottleneck": "2.19.5",
|
|
53
53
|
"chalk": "4.1.2",
|
|
54
54
|
"commander": "12.1.0",
|
|
55
|
-
"contentful-management": "11.
|
|
56
|
-
"dotenv": "16.4.
|
|
55
|
+
"contentful-management": "11.40.0",
|
|
56
|
+
"dotenv": "16.4.6",
|
|
57
57
|
"ignore": "6.0.2",
|
|
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": "
|
|
63
|
+
"gitHead": "abfff61de7708ed53d3f3afbbb59f64673ca5a4a",
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tsconfig/node18": "18.2.4",
|
|
66
|
-
"@types/adm-zip": "0.5.
|
|
66
|
+
"@types/adm-zip": "0.5.7",
|
|
67
67
|
"@types/analytics-node": "3.1.14",
|
|
68
68
|
"@types/chai": "4.3.16",
|
|
69
69
|
"@types/inquirer": "8.2.1",
|
|
70
70
|
"@types/lodash": "4.17.13",
|
|
71
|
-
"@types/mocha": "10.0.
|
|
71
|
+
"@types/mocha": "10.0.10",
|
|
72
72
|
"@types/proxyquire": "1.3.31",
|
|
73
73
|
"@types/sinon": "17.0.3",
|
|
74
74
|
"chai": "4.5.0",
|