@twilio/flex-dev-utils 5.0.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/axios.d.ts +6 -0
  4. package/dist/axios.js +18 -0
  5. package/dist/axios.js.map +1 -0
  6. package/dist/credentials.d.ts +40 -0
  7. package/dist/credentials.js +241 -0
  8. package/dist/credentials.js.map +1 -0
  9. package/dist/env.d.ts +1 -0
  10. package/dist/env.js +13 -0
  11. package/dist/env.js.map +1 -0
  12. package/dist/errors/index.d.ts +6 -0
  13. package/dist/errors/index.js +19 -0
  14. package/dist/errors/index.js.map +1 -0
  15. package/dist/errors/lib/FlexPluginError.d.ts +7 -0
  16. package/dist/errors/lib/FlexPluginError.js +54 -0
  17. package/dist/errors/lib/FlexPluginError.js.map +1 -0
  18. package/dist/errors/lib/UserActionError.d.ts +5 -0
  19. package/dist/errors/lib/UserActionError.js +35 -0
  20. package/dist/errors/lib/UserActionError.js.map +1 -0
  21. package/dist/errors/lib/ValidationError.d.ts +3 -0
  22. package/dist/errors/lib/ValidationError.js +30 -0
  23. package/dist/errors/lib/ValidationError.js.map +1 -0
  24. package/dist/exit.d.ts +8 -0
  25. package/dist/exit.js +18 -0
  26. package/dist/exit.js.map +1 -0
  27. package/dist/fs.d.ts +318 -0
  28. package/dist/fs.js +797 -0
  29. package/dist/fs.js.map +1 -0
  30. package/dist/http/index.d.ts +1 -0
  31. package/dist/http/index.js +10 -0
  32. package/dist/http/index.js.map +1 -0
  33. package/dist/http/lib/http.d.ts +114 -0
  34. package/dist/http/lib/http.js +337 -0
  35. package/dist/http/lib/http.js.map +1 -0
  36. package/dist/index.d.ts +25 -0
  37. package/dist/index.js +93 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/keychain.d.ts +25 -0
  40. package/dist/keychain.js +84 -0
  41. package/dist/keychain.js.map +1 -0
  42. package/dist/lodash.d.ts +13 -0
  43. package/dist/lodash.js +30 -0
  44. package/dist/lodash.js.map +1 -0
  45. package/dist/logger/index.d.ts +13 -0
  46. package/dist/logger/index.js +52 -0
  47. package/dist/logger/index.js.map +1 -0
  48. package/dist/logger/lib/boxen.d.ts +38 -0
  49. package/dist/logger/lib/boxen.js +85 -0
  50. package/dist/logger/lib/boxen.js.map +1 -0
  51. package/dist/logger/lib/columnify.d.ts +2 -0
  52. package/dist/logger/lib/columnify.js +8 -0
  53. package/dist/logger/lib/columnify.js.map +1 -0
  54. package/dist/logger/lib/logger.d.ts +157 -0
  55. package/dist/logger/lib/logger.js +354 -0
  56. package/dist/logger/lib/logger.js.map +1 -0
  57. package/dist/logger/lib/strings.d.ts +16 -0
  58. package/dist/logger/lib/strings.js +33 -0
  59. package/dist/logger/lib/strings.js.map +1 -0
  60. package/dist/logger/lib/table.d.ts +25 -0
  61. package/dist/logger/lib/table.js +75 -0
  62. package/dist/logger/lib/table.js.map +1 -0
  63. package/dist/open.d.ts +2 -0
  64. package/dist/open.js +9 -0
  65. package/dist/open.js.map +1 -0
  66. package/dist/prints.d.ts +11 -0
  67. package/dist/prints.js +47 -0
  68. package/dist/prints.js.map +1 -0
  69. package/dist/progress/index.d.ts +1 -0
  70. package/dist/progress/index.js +9 -0
  71. package/dist/progress/index.js.map +1 -0
  72. package/dist/progress/lib/progress.d.ts +21 -0
  73. package/dist/progress/lib/progress.js +118 -0
  74. package/dist/progress/lib/progress.js.map +1 -0
  75. package/dist/questions/index.d.ts +1 -0
  76. package/dist/questions/index.js +12 -0
  77. package/dist/questions/index.js.map +1 -0
  78. package/dist/questions/lib/inquirer.d.ts +39 -0
  79. package/dist/questions/lib/inquirer.js +136 -0
  80. package/dist/questions/lib/inquirer.js.map +1 -0
  81. package/dist/random.d.ts +15 -0
  82. package/dist/random.js +28 -0
  83. package/dist/random.js.map +1 -0
  84. package/dist/runner.d.ts +8 -0
  85. package/dist/runner.js +98 -0
  86. package/dist/runner.js.map +1 -0
  87. package/dist/semver.d.ts +9 -0
  88. package/dist/semver.js +36 -0
  89. package/dist/semver.js.map +1 -0
  90. package/dist/sids.d.ts +48 -0
  91. package/dist/sids.js +50 -0
  92. package/dist/sids.js.map +1 -0
  93. package/dist/spawn/index.d.ts +4 -0
  94. package/dist/spawn/index.js +15 -0
  95. package/dist/spawn/index.js.map +1 -0
  96. package/dist/spawn/lib/node.d.ts +9 -0
  97. package/dist/spawn/lib/node.js +74 -0
  98. package/dist/spawn/lib/node.js.map +1 -0
  99. package/dist/spawn/lib/npm.d.ts +9 -0
  100. package/dist/spawn/lib/npm.js +74 -0
  101. package/dist/spawn/lib/npm.js.map +1 -0
  102. package/dist/spawn/lib/spawn.d.ts +22 -0
  103. package/dist/spawn/lib/spawn.js +111 -0
  104. package/dist/spawn/lib/spawn.js.map +1 -0
  105. package/dist/spawn/lib/yarn.d.ts +9 -0
  106. package/dist/spawn/lib/yarn.js +74 -0
  107. package/dist/spawn/lib/yarn.js.map +1 -0
  108. package/dist/updateNotifier.d.ts +6 -0
  109. package/dist/updateNotifier.js +20 -0
  110. package/dist/updateNotifier.js.map +1 -0
  111. package/dist/urls.d.ts +28 -0
  112. package/dist/urls.js +147 -0
  113. package/dist/urls.js.map +1 -0
  114. package/dist/validators.d.ts +42 -0
  115. package/dist/validators.js +78 -0
  116. package/dist/validators.js.map +1 -0
  117. package/package.json +89 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Simple input validator to verify it is not empty
3
+ *
4
+ * @param input the input to validate
5
+ */
6
+ export declare const isInputNotEmpty: (input: string) => boolean;
7
+ /**
8
+ * Validates that the accountSid is valid
9
+ *
10
+ * @param str the accountSid
11
+ */
12
+ export declare const validateAccountSid: (str: string) => string | boolean;
13
+ /**
14
+ * Validates that the apiKey is valid
15
+ *
16
+ * @param str the apiKey
17
+ */
18
+ export declare const validateApiKey: (str: string) => string | boolean;
19
+ /**
20
+ * Validates the string is valid URL
21
+ *
22
+ * @param url {string} the URL string to validate
23
+ * @return whether the URL is valid
24
+ * @private
25
+ */
26
+ export declare const isValidUrl: (url: string) => boolean;
27
+ /**
28
+ * Validates the string is a GitHub URL
29
+ *
30
+ * @param url {string} the URL string to validate
31
+ * @return whether the URL is GitHub
32
+ * @private
33
+ */
34
+ export declare const isGitHubUrl: (url: string) => boolean;
35
+ /**
36
+ * Validates that the URL is a GitHub URL
37
+ *
38
+ * @param url the URL to validate
39
+ */
40
+ export declare const validateGitHubUrl: (url: string) => string | boolean;
41
+ declare const _default: {};
42
+ export default _default;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateGitHubUrl = exports.isGitHubUrl = exports.isValidUrl = exports.validateApiKey = exports.validateAccountSid = exports.isInputNotEmpty = void 0;
4
+ var sids_1 = require("./sids");
5
+ var URL_REGEX = /^(https?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
6
+ var GITHUB_REGEX = /github\.com/;
7
+ /**
8
+ * Simple input validator to verify it is not empty
9
+ *
10
+ * @param input the input to validate
11
+ */
12
+ var isInputNotEmpty = function (input) { return Boolean(input && input.length > 0); };
13
+ exports.isInputNotEmpty = isInputNotEmpty;
14
+ /**
15
+ * Validates that the accountSid is valid
16
+ *
17
+ * @param str the accountSid
18
+ */
19
+ var validateAccountSid = function (str) {
20
+ if (!exports.isInputNotEmpty(str)) {
21
+ return false;
22
+ }
23
+ if (!sids_1.isSidOfType(str, sids_1.SidPrefix.AccountSid)) {
24
+ return 'Invalid Account Sid was provided';
25
+ }
26
+ return true;
27
+ };
28
+ exports.validateAccountSid = validateAccountSid;
29
+ /**
30
+ * Validates that the apiKey is valid
31
+ *
32
+ * @param str the apiKey
33
+ */
34
+ var validateApiKey = function (str) {
35
+ if (!exports.isInputNotEmpty(str)) {
36
+ return false;
37
+ }
38
+ if (!sids_1.isSidOfType(str, sids_1.SidPrefix.ApiKey)) {
39
+ return 'Invalid Account Sid was provided';
40
+ }
41
+ return true;
42
+ };
43
+ exports.validateApiKey = validateApiKey;
44
+ /**
45
+ * Validates the string is valid URL
46
+ *
47
+ * @param url {string} the URL string to validate
48
+ * @return whether the URL is valid
49
+ * @private
50
+ */
51
+ var isValidUrl = function (url) { return URL_REGEX.test(url); };
52
+ exports.isValidUrl = isValidUrl;
53
+ /**
54
+ * Validates the string is a GitHub URL
55
+ *
56
+ * @param url {string} the URL string to validate
57
+ * @return whether the URL is GitHub
58
+ * @private
59
+ */
60
+ var isGitHubUrl = function (url) { return GITHUB_REGEX.test(url); };
61
+ exports.isGitHubUrl = isGitHubUrl;
62
+ /**
63
+ * Validates that the URL is a GitHub URL
64
+ *
65
+ * @param url the URL to validate
66
+ */
67
+ var validateGitHubUrl = function (url) {
68
+ if (!exports.isValidUrl(url)) {
69
+ return 'Please enter a valid URL';
70
+ }
71
+ if (!exports.isGitHubUrl(url)) {
72
+ return 'Only GitHub URLs are currently supported';
73
+ }
74
+ return true;
75
+ };
76
+ exports.validateGitHubUrl = validateGitHubUrl;
77
+ exports.default = {};
78
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAEhD,IAAM,SAAS,GAAG,yFAAyF,CAAC;AAC5G,IAAM,YAAY,GAAG,aAAa,CAAC;AAEnC;;;;GAIG;AACI,IAAM,eAAe,GAAG,UAAC,KAAa,IAAc,OAAA,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAlC,CAAkC,CAAC;AAAjF,QAAA,eAAe,mBAAkE;AAE9F;;;;GAIG;AACI,IAAM,kBAAkB,GAAG,UAAC,GAAW;IAC5C,IAAI,CAAC,uBAAe,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,CAAC,kBAAW,CAAC,GAAG,EAAE,gBAAS,CAAC,UAAU,CAAC,EAAE;QAC3C,OAAO,kCAAkC,CAAC;KAC3C;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B;AAEF;;;;GAIG;AACI,IAAM,cAAc,GAAG,UAAC,GAAW;IACxC,IAAI,CAAC,uBAAe,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,CAAC,kBAAW,CAAC,GAAG,EAAE,gBAAS,CAAC,MAAM,CAAC,EAAE;QACvC,OAAO,kCAAkC,CAAC;KAC3C;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB;AAEF;;;;;;GAMG;AACI,IAAM,UAAU,GAAG,UAAC,GAAW,IAAc,OAAA,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAnB,CAAmB,CAAC;AAA3D,QAAA,UAAU,cAAiD;AAExE;;;;;;GAMG;AACI,IAAM,WAAW,GAAG,UAAC,GAAW,IAAc,OAAA,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAtB,CAAsB,CAAC;AAA/D,QAAA,WAAW,eAAoD;AAE5E;;;;GAIG;AACI,IAAM,iBAAiB,GAAG,UAAC,GAAW;IAC3C,IAAI,CAAC,kBAAU,CAAC,GAAG,CAAC,EAAE;QACpB,OAAO,0BAA0B,CAAC;KACnC;IAED,IAAI,CAAC,mBAAW,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,0CAA0C,CAAC;KACnD;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEF,kBAAe,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@twilio/flex-dev-utils",
3
+ "version": "5.0.0",
4
+ "description": "Common development utility for creating a Flex plugin",
5
+ "keywords": [
6
+ "flex",
7
+ "plugin",
8
+ "scripts",
9
+ "twilio"
10
+ ],
11
+ "homepage": "https://github.com/twilio/flex-plugin-builder",
12
+ "bugs": {
13
+ "url": "https://github.com/twilio/flex-plugin-builder/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/twilio/flex-plugin-builder.git"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Flex Runtime <flex-runtime@twilio.com>",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "prebuild": "npm run clean",
28
+ "build": "cd ../.. && tsc -p \"packages/flex-dev-utils/tsconfig.json\"",
29
+ "clean": "rm -rf dist",
30
+ "lint": "eslint --ext ts src/",
31
+ "lint:fix": "npm run lint -- --fix",
32
+ "test": "cd ../.. && jest packages/flex-dev-utils --color",
33
+ "test:watch": "cd ../.. && jest packages/flex-dev-utils --watch --color"
34
+ },
35
+ "dependencies": {
36
+ "@k88/pipe-compose": "^2.5.0",
37
+ "@twilio/flex-plugins-utils-env": "5.0.0",
38
+ "@twilio/flex-plugins-utils-exception": "5.0.0",
39
+ "address": "^1.1.2",
40
+ "app-module-path": "^2.2.0",
41
+ "axios": "^0.24.0",
42
+ "axios-cache-adapter": "^2.7.3",
43
+ "axios-mock-adapter": "^1.20.0",
44
+ "boxen": "^5.1.2",
45
+ "chalk": "^4.1.2",
46
+ "columnify": "^1.5.4",
47
+ "copy-template-dir": "^1.4.0",
48
+ "execa": "^5.1.1",
49
+ "globby": "^11.0.4",
50
+ "inquirer": "7.3.3",
51
+ "lodash": "^4.17.21",
52
+ "log-symbols": "^4.1.0",
53
+ "mkdirp": "^1.0.4",
54
+ "net": "^1.0.2",
55
+ "open": "^8.4.0",
56
+ "ora": "^5.4.1",
57
+ "qs": "^6.10.1",
58
+ "rimraf": "^3.0.2",
59
+ "semver": "^7.3.5",
60
+ "string-width": "^4.2.3",
61
+ "table": "^6.7.3",
62
+ "update-notifier": "^5.1.0",
63
+ "url": "^0.11.0",
64
+ "util": "^0.12.4",
65
+ "wrap-ansi": "^4.0.0"
66
+ },
67
+ "devDependencies": {
68
+ "@types/app-module-path": "^2.2.0",
69
+ "@types/columnify": "^1.5.1",
70
+ "@types/inquirer": "^7.3.3",
71
+ "@types/lodash": "^4.14.177",
72
+ "@types/mkdirp": "^1.0.2",
73
+ "@types/qs": "^6.9.7",
74
+ "@types/rimraf": "^3.0.2",
75
+ "@types/semver": "^7.3.8",
76
+ "@types/string-width": "^4.0.1",
77
+ "@types/table": "^6.3.2",
78
+ "@types/update-notifier": "^5.1.0",
79
+ "@types/wrap-ansi": "^3.0.0",
80
+ "axios-mock-adapter": "^1.20.0"
81
+ },
82
+ "optionalDependencies": {
83
+ "keytar": "^7.7.0"
84
+ },
85
+ "publishConfig": {
86
+ "access": "public"
87
+ },
88
+ "gitHead": "7f9a9580b554b4f99aa4591e3ec9da17d2554729"
89
+ }