@contentful/app-scripts 1.28.0 → 1.30.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.
|
@@ -68,13 +68,55 @@ NOTE: This will create an app definition in your Contentful organization.
|
|
|
68
68
|
when(answers) {
|
|
69
69
|
return answers.locations.includes('entry-field');
|
|
70
70
|
},
|
|
71
|
-
validate(
|
|
72
|
-
if (
|
|
71
|
+
validate(input) {
|
|
72
|
+
if (input.length < 1) {
|
|
73
73
|
return 'You must choose at least one field type.';
|
|
74
74
|
}
|
|
75
75
|
return true;
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
|
+
{
|
|
79
|
+
name: 'pageNav',
|
|
80
|
+
message: 'Page location: Would you like your page location to render in the main navigation?',
|
|
81
|
+
type: 'confirm',
|
|
82
|
+
default: false,
|
|
83
|
+
when(answers) {
|
|
84
|
+
return answers.locations.includes('page');
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'pageNavLinkName',
|
|
89
|
+
message: 'Page location: Provide a name for the link in the main navigation:',
|
|
90
|
+
when(answers) {
|
|
91
|
+
return answers.locations.includes('page') && answers.pageNav;
|
|
92
|
+
},
|
|
93
|
+
validate(input) {
|
|
94
|
+
if (input.length < 1 || input.length > 40) {
|
|
95
|
+
return 'Size must be at least 1 and at most 40';
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'pageNavLinkPath',
|
|
102
|
+
message: 'Page location: Provide a path which starts with / and does not contain empty space:',
|
|
103
|
+
default: '/',
|
|
104
|
+
when(answers) {
|
|
105
|
+
return answers.locations.includes('page') && answers.pageNav;
|
|
106
|
+
},
|
|
107
|
+
validate(input) {
|
|
108
|
+
if (input.length > 512) {
|
|
109
|
+
return 'Maximum 512 characters';
|
|
110
|
+
}
|
|
111
|
+
if (input.includes(' ')) {
|
|
112
|
+
return 'Path cannot contain empty space';
|
|
113
|
+
}
|
|
114
|
+
if (!input.startsWith('/')) {
|
|
115
|
+
return 'Path must start with /';
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
},
|
|
119
|
+
},
|
|
78
120
|
{
|
|
79
121
|
name: 'host',
|
|
80
122
|
message: `Contentful CMA endpoint URL:`,
|
|
@@ -57,6 +57,20 @@ async function createAppDefinition(accessToken, appDefinitionSettings) {
|
|
|
57
57
|
fieldTypes: appDefinitionSettings.fields || [],
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
if (location === 'page') {
|
|
61
|
+
const { pageNav, pageNavLinkName, pageNavLinkPath } = appDefinitionSettings;
|
|
62
|
+
return {
|
|
63
|
+
location,
|
|
64
|
+
...(pageNav
|
|
65
|
+
? {
|
|
66
|
+
navigationItem: {
|
|
67
|
+
name: pageNavLinkName,
|
|
68
|
+
path: pageNavLinkPath,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
: {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
60
74
|
return {
|
|
61
75
|
location,
|
|
62
76
|
};
|
package/lib/utils.js
CHANGED
|
@@ -27,7 +27,22 @@ const throwValidationException = (subject, message, details) => {
|
|
|
27
27
|
};
|
|
28
28
|
exports.throwValidationException = throwValidationException;
|
|
29
29
|
const isValidNetwork = (address) => {
|
|
30
|
-
|
|
30
|
+
// Regular expression to validate network addresses
|
|
31
|
+
const addressRegex = new RegExp('^(?:' + // Start of the non-capturing group for the entire address
|
|
32
|
+
'(?:' + // Start of the non-capturing group for domain names
|
|
33
|
+
'(?:\\*\\.)' + // Matches wildcard domains like *.example.com
|
|
34
|
+
'(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)' + // Matches a single subdomain
|
|
35
|
+
'[a-zA-Z]{2,6}' + // Matches the top-level domain (TLD)
|
|
36
|
+
'|' + // OR
|
|
37
|
+
'(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+' + // Matches standard domains with one or more subdomains
|
|
38
|
+
'[a-zA-Z]{2,6}' + // Matches the top-level domain (TLD)
|
|
39
|
+
')|' + // End of the non-capturing group for domain names, OR
|
|
40
|
+
'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}' + // Matches the first three octets of an IPv4 address
|
|
41
|
+
'(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|' + // Matches the last octet of an IPv4 address
|
|
42
|
+
'(\\[(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\\]' + // Matches IPv6 addresses in square brackets
|
|
43
|
+
'|(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4})' + // Matches IPv6 addresses without square brackets
|
|
44
|
+
')(?::\\d{1,5})?$' // Matches an optional port number (1 to 5 digits)
|
|
45
|
+
);
|
|
31
46
|
return addressRegex.test(address);
|
|
32
47
|
};
|
|
33
48
|
exports.isValidNetwork = isValidNetwork;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,19 +60,19 @@
|
|
|
60
60
|
"open": "8.4.2",
|
|
61
61
|
"ora": "5.4.1"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "1b6acf5b891b5e4f828b537f6e10fc4f72ff2df4",
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tsconfig/node18": "18.2.4",
|
|
66
|
-
"@types/adm-zip": "0.5.
|
|
66
|
+
"@types/adm-zip": "0.5.6",
|
|
67
67
|
"@types/analytics-node": "3.1.14",
|
|
68
68
|
"@types/chai": "4.3.16",
|
|
69
69
|
"@types/inquirer": "8.2.1",
|
|
70
|
-
"@types/lodash": "4.17.
|
|
71
|
-
"@types/mocha": "10.0.
|
|
70
|
+
"@types/lodash": "4.17.13",
|
|
71
|
+
"@types/mocha": "10.0.9",
|
|
72
72
|
"@types/proxyquire": "1.3.31",
|
|
73
73
|
"@types/sinon": "17.0.3",
|
|
74
74
|
"chai": "4.5.0",
|
|
75
|
-
"mocha": "10.
|
|
75
|
+
"mocha": "10.8.1",
|
|
76
76
|
"proxyquire": "2.1.3",
|
|
77
77
|
"sinon": "19.0.2",
|
|
78
78
|
"ts-mocha": "10.0.0",
|