@contentful/app-scripts 1.27.0 → 1.29.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.
@@ -1,2 +1,3 @@
1
1
  import { UploadOptions, UploadSettings } from '../types';
2
2
  export declare function buildAppUploadSettings(options: UploadOptions): Promise<UploadSettings>;
3
+ export declare function hostProtocolFilter(input: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildAppUploadSettings = void 0;
3
+ exports.hostProtocolFilter = exports.buildAppUploadSettings = void 0;
4
4
  const inquirer_1 = require("inquirer");
5
5
  const get_app_info_1 = require("../get-app-info");
6
6
  const utils_1 = require("../utils");
@@ -37,6 +37,7 @@ async function buildAppUploadSettings(options) {
37
37
  name: 'host',
38
38
  message: `Contentful CMA endpoint URL:`,
39
39
  default: constants_1.DEFAULT_CONTENTFUL_API_HOST,
40
+ filter: hostProtocolFilter,
40
41
  });
41
42
  }
42
43
  const { activateBundle, ...appUploadSettings } = await (0, inquirer_1.prompt)(prompts);
@@ -53,3 +54,7 @@ async function buildAppUploadSettings(options) {
53
54
  };
54
55
  }
55
56
  exports.buildAppUploadSettings = buildAppUploadSettings;
57
+ function hostProtocolFilter(input) {
58
+ return input.replace(/^https?:\/\//, '');
59
+ }
60
+ exports.hostProtocolFilter = hostProtocolFilter;
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
- const addressRegex = /^(?:localhost|(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(\[(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\]|(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}))(?::\d{1,5})?$/;
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.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "A collection of scripts for building Contentful Apps",
5
5
  "author": "Contentful GmbH",
6
6
  "license": "MIT",
@@ -48,33 +48,33 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@segment/analytics-node": "^2.0.0",
51
- "adm-zip": "0.5.15",
51
+ "adm-zip": "0.5.16",
52
52
  "bottleneck": "2.19.5",
53
53
  "chalk": "4.1.2",
54
54
  "commander": "12.1.0",
55
- "contentful-management": "11.31.9",
55
+ "contentful-management": "11.35.1",
56
56
  "dotenv": "16.4.5",
57
- "ignore": "5.3.2",
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": "a2c683683c29974787b17871fe525d384fe295a6",
63
+ "gitHead": "2179b34098340843ad4e6eeaa09e341f34286164",
64
64
  "devDependencies": {
65
65
  "@tsconfig/node18": "18.2.4",
66
66
  "@types/adm-zip": "0.5.5",
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.7",
71
- "@types/mocha": "10.0.7",
70
+ "@types/lodash": "4.17.9",
71
+ "@types/mocha": "10.0.8",
72
72
  "@types/proxyquire": "1.3.31",
73
73
  "@types/sinon": "17.0.3",
74
74
  "chai": "4.5.0",
75
75
  "mocha": "10.7.3",
76
76
  "proxyquire": "2.1.3",
77
- "sinon": "18.0.0",
77
+ "sinon": "19.0.2",
78
78
  "ts-mocha": "10.0.0",
79
79
  "ts-node": "10.9.2"
80
80
  }