zephyr-edge-contract 0.0.20 → 0.0.22

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 (46) hide show
  1. package/LICENSE +38 -38
  2. package/dist/index.d.ts +3 -1
  3. package/dist/index.js +7 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/api-contract-negotiation/get-api-contract.d.ts +2 -0
  6. package/dist/lib/api-contract-negotiation/get-api-contract.js +5 -1
  7. package/dist/lib/api-contract-negotiation/get-api-contract.js.map +1 -1
  8. package/dist/lib/errors/codes.d.ts +276 -0
  9. package/dist/lib/errors/codes.js +349 -0
  10. package/dist/lib/errors/codes.js.map +1 -0
  11. package/dist/lib/errors/index.d.ts +2 -0
  12. package/dist/lib/errors/index.js +6 -0
  13. package/dist/lib/errors/index.js.map +1 -0
  14. package/dist/lib/errors/zephyr.d.ts +463 -0
  15. package/dist/lib/errors/zephyr.js +153 -0
  16. package/dist/lib/errors/zephyr.js.map +1 -0
  17. package/dist/lib/node-persist/token.js +1 -1
  18. package/dist/lib/node-persist/token.js.map +1 -1
  19. package/dist/lib/utils/clean-stack.d.ts +7 -0
  20. package/dist/lib/utils/clean-stack.js +44 -0
  21. package/dist/lib/utils/clean-stack.js.map +1 -0
  22. package/dist/lib/utils/debug.d.ts +10 -6
  23. package/dist/lib/utils/debug.js +10 -6
  24. package/dist/lib/utils/debug.js.map +1 -1
  25. package/dist/lib/utils/error-codes-messages.d.ts +19 -17
  26. package/dist/lib/utils/error-codes-messages.js +19 -17
  27. package/dist/lib/utils/error-codes-messages.js.map +1 -1
  28. package/dist/lib/utils/error-formatted-message.d.ts +1 -1
  29. package/dist/lib/utils/picocolor.d.ts +1 -0
  30. package/dist/lib/utils/picocolor.js +8 -16
  31. package/dist/lib/utils/picocolor.js.map +1 -1
  32. package/dist/lib/utils/promise.d.ts +12 -0
  33. package/dist/lib/utils/promise.js +32 -0
  34. package/dist/lib/utils/promise.js.map +1 -0
  35. package/dist/lib/utils/string.d.ts +8 -0
  36. package/dist/lib/utils/string.js +15 -0
  37. package/dist/lib/utils/string.js.map +1 -0
  38. package/dist/lib/utils/strip-ansi.d.ts +15 -0
  39. package/dist/lib/utils/strip-ansi.js +28 -0
  40. package/dist/lib/utils/strip-ansi.js.map +1 -0
  41. package/dist/lib/utils/ze-http-request.d.ts +17 -3
  42. package/dist/lib/utils/ze-http-request.js +145 -52
  43. package/dist/lib/utils/ze-http-request.js.map +1 -1
  44. package/dist/package.json +1 -1
  45. package/package.json +1 -1
  46. package/test/utils/string.test.ts +96 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // https://github.com/sindresorhus/escape-string-regexp
3
+ // https://github.com/sindresorhus/clean-stack
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.cleanStack = void 0;
6
+ const node_os_1 = require("node:os");
7
+ const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
8
+ const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
9
+ function escapeStringRegexp(string) {
10
+ if (typeof string !== 'string') {
11
+ throw new TypeError('Expected a string');
12
+ }
13
+ // Escape characters with special meaning either inside or outside character sets.
14
+ // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
15
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
16
+ }
17
+ function cleanStack(stack, { pretty = false, basePath = process.cwd(), pathFilter } = {}) {
18
+ const basePathRegex = basePath && new RegExp(`(file://)?${escapeStringRegexp(basePath.replace(/\\/g, '/'))}/?`, 'g');
19
+ const homeDirectory = pretty ? (0, node_os_1.homedir)().replace(/\\/g, '/') : '';
20
+ return stack
21
+ .replace(/\\/g, '/')
22
+ .split('\n')
23
+ .filter((line) => {
24
+ const pathMatches = line.match(extractPathRegex);
25
+ if (pathMatches === null || !pathMatches[1]) {
26
+ return true;
27
+ }
28
+ const match = pathMatches[1];
29
+ return pathFilter ? !pathRegex.test(match) && pathFilter(match) : !pathRegex.test(match);
30
+ })
31
+ .filter((line) => line.trim() !== '')
32
+ .map((line) => {
33
+ if (basePathRegex) {
34
+ line = line.replace(basePathRegex, '');
35
+ }
36
+ if (pretty) {
37
+ line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDirectory, '~')));
38
+ }
39
+ return line;
40
+ })
41
+ .join('\n');
42
+ }
43
+ exports.cleanStack = cleanStack;
44
+ //# sourceMappingURL=clean-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean-stack.js","sourceRoot":"","sources":["../../../src/lib/utils/clean-stack.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,8CAA8C;;;AAE9C,qCAAkC;AAElC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAC/C,MAAM,SAAS,GACb,yIAAyI,CAAC;AAQ5I,SAAS,kBAAkB,CAAC,MAAc;IACxC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;IAED,kFAAkF;IAClF,6JAA6J;IAC7J,OAAO,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9E,CAAC;AAED,SAAgB,UAAU,CAAC,KAAa,EAAE,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,KAAc,EAAE;IAC9G,MAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,MAAM,CAAC,aAAa,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACrH,MAAM,aAAa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CAAC,CAAC;AAChB,CAAC;AA/BD,gCA+BC"}
@@ -6,13 +6,17 @@ export declare const brightGreenBgName: string;
6
6
  export declare const brightRedBgName: string;
7
7
  declare function print_error_with_docs<K extends keyof typeof Errors>(errMsg?: K, ...args: unknown[]): void;
8
8
  export declare const ze_log: import("debug").Debugger;
9
- /** `ze_error` is used widely to debug our local build and deployment. You can turn on debug mode or having it work normally to attached documentation with our error codes in [errors](./error-types.ts). We have added unknown class to the error object.
10
- * If this is an error we haven't defined yet, you will need to do
9
+ /**
10
+ * `ze_error` is used widely to debug our local build and deployment. You can turn on debug mode or having it work normally to attached
11
+ * documentation with our error codes in [errors](./error-types.ts). We have added unknown class to the error object. If this is an error we
12
+ * haven't defined yet, you will need to do
13
+ *
14
+ * @deprecated
11
15
  * @example
12
- * ```ts
13
- * ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
14
- * ```
15
- * to specify this is an undefined error at the front.
16
+ * ```ts
17
+ * ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
18
+ * ```
19
+ * to specify this is an undefined error at the front.
16
20
  */
17
21
  export declare const ze_error: typeof print_error_with_docs;
18
22
  export {};
@@ -20,13 +20,17 @@ function print_error_with_docs(errMsg, ...args) {
20
20
  exports.ze_log = (0, debug_1.debug)('zephyr:log');
21
21
  // If debug mode is not enabled just print whatever console output is
22
22
  // If debug mode is enabled print the error from our end
23
- /** `ze_error` is used widely to debug our local build and deployment. You can turn on debug mode or having it work normally to attached documentation with our error codes in [errors](./error-types.ts). We have added unknown class to the error object.
24
- * If this is an error we haven't defined yet, you will need to do
23
+ /**
24
+ * `ze_error` is used widely to debug our local build and deployment. You can turn on debug mode or having it work normally to attached
25
+ * documentation with our error codes in [errors](./error-types.ts). We have added unknown class to the error object. If this is an error we
26
+ * haven't defined yet, you will need to do
27
+ *
28
+ * @deprecated
25
29
  * @example
26
- * ```ts
27
- * ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
28
- * ```
29
- * to specify this is an undefined error at the front.
30
+ * ```ts
31
+ * ze_error('ERR_UNKNOWN', `Error creating dist folder: ${(error as Error).message}`);
32
+ * ```
33
+ * to specify this is an undefined error at the front.
30
34
  */
31
35
  exports.ze_error = debug_enabled_1.is_debug_enabled ? (0, debug_1.debug)('zephyr:error') : print_error_with_docs;
32
36
  //# sourceMappingURL=debug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/lib/utils/debug.ts"],"names":[],"mappings":";;;AAAA,mHAAmH;AACnH,iCAA8B;AAC9B,2CAAoH;AACpH,mDAAmD;AACnD,uEAAgD;AAGhD,uDAAuD;AACvD,wDAAwD;AACxD,MAAM,IAAI,GAAG,UAAU,CAAC;AAEX,QAAA,UAAU,GAAG,IAAA,eAAG,EAAC,IAAI,CAAC,CAAC;AAEvB,QAAA,gBAAgB,GAAG,IAAA,gBAAI,EAAC,IAAA,wBAAY,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEnD,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,IAAA,0BAAc,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvD,QAAA,iBAAiB,GAAG,IAAA,gBAAI,EAAC,IAAA,yBAAa,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAErD,QAAA,eAAe,GAAG,IAAA,gBAAI,EAAC,IAAA,uBAAW,EAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE9D,SAAS,qBAAqB,CAAgC,MAAU,EAAE,GAAG,IAAe;IAC1F,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,uBAAe,IAAI,IAAA,6BAAG,EAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAe,EAAE,I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CAAC,GAAG,CAAC,uBAAe,EAAE,IAAA,qBAAS,EAAC,eAAe,CAAC,EAAE,IAAI,CAAC,CAAC;AACxI,CAAC;AAEY,QAAA,MAAM,GAAG,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC;AAC1C,qEAAqE;AACrE,wDAAwD;AACxD;;;;;;;;;;;GAWG;AACU,QAAA,QAAQ,GAAG,gCAAgB,CAAC,CAAC,CAAC,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC,CAAC,CAAE,qBAAsD,CAAC"}
@@ -1,6 +1,4 @@
1
- /**
2
- * Categories for all error codes.
3
- */
1
+ /** Categories for all error codes. */
4
2
  export declare const ErrorCategories: {
5
3
  readonly unknown: "00";
6
4
  readonly build: "10";
@@ -9,32 +7,36 @@ export declare const ErrorCategories: {
9
7
  };
10
8
  /**
11
9
  * A collection of error types and the error code during local/build stage
12
- * @description if you are searching for an error globally, if it is a build related error, it starts with `ZE10`, if it's a deployment related error, search for `ZE20` and then followed with their ID.
10
+ *
11
+ * If you are searching for an error globally, if it is a build related error, it starts with `ZE10`, if it's a deployment related error,
12
+ * search for `ZE20` and then followed with their ID.
13
+ *
13
14
  * - `ZE` at the front is a constant
14
- * - two digits at the middle PP (`10` for build error or `20` for deployment error) is their categories,
15
- * - last three digits is their ID.
15
+ * - Two digits at the middle PP (`10` for build error or `20` for deployment error) is their categories,
16
+ * - Last three digits is their ID.
16
17
  *
17
- * For example, if you have a `SNAPSHOT_NOT_FOUND` error, search for `ZE20023`, if you see an error showing up on terminal or application, the last three numbers are their IDs.
18
- * We might extend to have more errors in the future. */
18
+ * For example, if you have a `SNAPSHOT_NOT_FOUND` error, search for `ZE20023`, if you see an error showing up on terminal or application,
19
+ * the last three numbers are their IDs. We might extend to have more errors in the future.
20
+ */
19
21
  export declare const Errors: {
20
22
  readonly ERR_UNKNOWN: {
21
23
  readonly id: "000";
22
24
  readonly message: "Unknown error. Tell us about it in Discord https://zephyr-cloud.io/discord if you see this error";
23
25
  readonly kind: "unknown";
24
26
  };
25
- /** package.json not found error */
27
+ /** Package.json not found error */
26
28
  readonly ERR_PACKAGE_JSON_NOT_FOUND: {
27
29
  readonly id: "010";
28
30
  readonly message: "Package.json not found";
29
31
  readonly kind: "build";
30
32
  };
31
- /** Package.json is not in a valid json format*/
33
+ /** Package.json is not in a valid json format */
32
34
  readonly ERR_PACKAGE_JSON_NOT_VALID: {
33
35
  readonly id: "011";
34
36
  readonly message: "Package.json is not in a valid json format.";
35
37
  readonly kind: "build";
36
38
  };
37
- /** Webpack config error*/
39
+ /** Webpack config error */
38
40
  readonly ERR_WEBPACK_CONFIG: {
39
41
  readonly id: "012";
40
42
  readonly message: "Webpack config error.";
@@ -46,7 +48,7 @@ export declare const Errors: {
46
48
  readonly message: "Package.json must have a name and version field.";
47
49
  readonly kind: "build";
48
50
  };
49
- /** Git remote origin is not configured properly.*/
51
+ /** Git remote origin is not configured properly. */
50
52
  readonly ERR_GIT_REMOTE_ORIGIN: {
51
53
  readonly id: "014";
52
54
  readonly message: "Git remote origin is not configured properly.";
@@ -82,7 +84,7 @@ export declare const Errors: {
82
84
  readonly message: "Could not get build id.";
83
85
  readonly kind: "build";
84
86
  };
85
- /**Could not initialize Zephyr Agent. */
87
+ /** Could not initialize Zephyr Agent. */
86
88
  readonly ERR_INITIALIZE_ZEPHYR_AGENT: {
87
89
  readonly id: "020";
88
90
  readonly message: "Could not initialize Zephyr Agent.";
@@ -100,13 +102,13 @@ export declare const Errors: {
100
102
  readonly message: "Assets not found.";
101
103
  readonly kind: "deploy";
102
104
  };
103
- /** assets not found in snapshot */
105
+ /** Assets not found in snapshot */
104
106
  readonly ERR_ASSETS_NOT_FOUND_IN_SNAPSHOT: {
105
107
  readonly id: "011";
106
108
  readonly message: "Assets not found in snapshot.";
107
109
  readonly kind: "deploy";
108
110
  };
109
- /** application_uid missing */
111
+ /** Application_uid missing */
110
112
  readonly ERR_DEPLOY_MISSING_APPLICATION_UID: {
111
113
  readonly id: "012";
112
114
  readonly message: "`application_uid` is required.";
@@ -123,7 +125,7 @@ export declare const Errors: {
123
125
  readonly message: "Failed to load application configuration.";
124
126
  readonly kind: "deploy";
125
127
  };
126
- /**Failed to upload build stats. */
128
+ /** Failed to upload build stats. */
127
129
  readonly ERR_FAILED_UPLOAD_BUILD_STATS: {
128
130
  readonly id: "015";
129
131
  readonly message: "Failed to upload build stats.";
@@ -153,7 +155,7 @@ export declare const Errors: {
153
155
  readonly message: "Snapshot uploads gave no results.";
154
156
  readonly kind: "deploy";
155
157
  };
156
- /**Failed to get application hash list */
158
+ /** Failed to get application hash list */
157
159
  readonly ERR_GET_APPLICATION_HASH_LIST: {
158
160
  readonly id: "020";
159
161
  readonly message: "Failed to get application hash list.";
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Errors = exports.ErrorCategories = void 0;
4
- /**
5
- * Categories for all error codes.
6
- */
4
+ /** Categories for all error codes. */
7
5
  exports.ErrorCategories = {
8
6
  unknown: '00',
9
7
  build: '10',
@@ -12,32 +10,36 @@ exports.ErrorCategories = {
12
10
  };
13
11
  /**
14
12
  * A collection of error types and the error code during local/build stage
15
- * @description if you are searching for an error globally, if it is a build related error, it starts with `ZE10`, if it's a deployment related error, search for `ZE20` and then followed with their ID.
13
+ *
14
+ * If you are searching for an error globally, if it is a build related error, it starts with `ZE10`, if it's a deployment related error,
15
+ * search for `ZE20` and then followed with their ID.
16
+ *
16
17
  * - `ZE` at the front is a constant
17
- * - two digits at the middle PP (`10` for build error or `20` for deployment error) is their categories,
18
- * - last three digits is their ID.
18
+ * - Two digits at the middle PP (`10` for build error or `20` for deployment error) is their categories,
19
+ * - Last three digits is their ID.
19
20
  *
20
- * For example, if you have a `SNAPSHOT_NOT_FOUND` error, search for `ZE20023`, if you see an error showing up on terminal or application, the last three numbers are their IDs.
21
- * We might extend to have more errors in the future. */
21
+ * For example, if you have a `SNAPSHOT_NOT_FOUND` error, search for `ZE20023`, if you see an error showing up on terminal or application,
22
+ * the last three numbers are their IDs. We might extend to have more errors in the future.
23
+ */
22
24
  exports.Errors = {
23
25
  ERR_UNKNOWN: {
24
26
  id: '000',
25
27
  message: 'Unknown error. Tell us about it in Discord https://zephyr-cloud.io/discord if you see this error',
26
28
  kind: 'unknown',
27
29
  },
28
- /** package.json not found error */
30
+ /** Package.json not found error */
29
31
  ERR_PACKAGE_JSON_NOT_FOUND: {
30
32
  id: '010',
31
33
  message: 'Package.json not found',
32
34
  kind: 'build',
33
35
  },
34
- /** Package.json is not in a valid json format*/
36
+ /** Package.json is not in a valid json format */
35
37
  ERR_PACKAGE_JSON_NOT_VALID: {
36
38
  id: '011',
37
39
  message: 'Package.json is not in a valid json format.',
38
40
  kind: 'build',
39
41
  },
40
- /** Webpack config error*/
42
+ /** Webpack config error */
41
43
  ERR_WEBPACK_CONFIG: {
42
44
  id: '012',
43
45
  message: 'Webpack config error.',
@@ -49,7 +51,7 @@ exports.Errors = {
49
51
  message: 'Package.json must have a name and version field.',
50
52
  kind: 'build',
51
53
  },
52
- /** Git remote origin is not configured properly.*/
54
+ /** Git remote origin is not configured properly. */
53
55
  ERR_GIT_REMOTE_ORIGIN: {
54
56
  id: '014',
55
57
  message: 'Git remote origin is not configured properly.',
@@ -85,7 +87,7 @@ exports.Errors = {
85
87
  message: 'Could not get build id.',
86
88
  kind: 'build',
87
89
  },
88
- /**Could not initialize Zephyr Agent. */
90
+ /** Could not initialize Zephyr Agent. */
89
91
  ERR_INITIALIZE_ZEPHYR_AGENT: {
90
92
  id: '020',
91
93
  message: 'Could not initialize Zephyr Agent.',
@@ -103,13 +105,13 @@ exports.Errors = {
103
105
  message: 'Assets not found.',
104
106
  kind: 'deploy',
105
107
  },
106
- /** assets not found in snapshot */
108
+ /** Assets not found in snapshot */
107
109
  ERR_ASSETS_NOT_FOUND_IN_SNAPSHOT: {
108
110
  id: '011',
109
111
  message: 'Assets not found in snapshot.',
110
112
  kind: 'deploy',
111
113
  },
112
- /** application_uid missing */
114
+ /** Application_uid missing */
113
115
  ERR_DEPLOY_MISSING_APPLICATION_UID: {
114
116
  id: '012',
115
117
  message: '`application_uid` is required.',
@@ -126,7 +128,7 @@ exports.Errors = {
126
128
  message: 'Failed to load application configuration.',
127
129
  kind: 'deploy',
128
130
  },
129
- /**Failed to upload build stats. */
131
+ /** Failed to upload build stats. */
130
132
  ERR_FAILED_UPLOAD_BUILD_STATS: {
131
133
  id: '015',
132
134
  message: 'Failed to upload build stats.',
@@ -156,7 +158,7 @@ exports.Errors = {
156
158
  message: 'Snapshot uploads gave no results.',
157
159
  kind: 'deploy',
158
160
  },
159
- /**Failed to get application hash list */
161
+ /** Failed to get application hash list */
160
162
  ERR_GET_APPLICATION_HASH_LIST: {
161
163
  id: '020',
162
164
  message: 'Failed to get application hash list.',
@@ -1 +1 @@
1
- {"version":3,"file":"error-codes-messages.js","sourceRoot":"","sources":["../../../src/lib/utils/error-codes-messages.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;CAGd,CAAC;AAEF;;;;;;;;wDAQwD;AAC3C,QAAA,MAAM,GAAG;IACpB,WAAW,EAAE;QACX,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kGAAkG;QAC3G,IAAI,EAAE,SAAS;KAChB;IACD,mCAAmC;IACnC,0BAA0B,EAAE;QAC1B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,wBAAwB;QACjC,IAAI,EAAE,OAAO;KACd;IACD,gDAAgD;IAChD,0BAA0B,EAAE;QAC1B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,6CAA6C;QACtD,IAAI,EAAE,OAAO;KACd;IACD,0BAA0B;IAC1B,kBAAkB,EAAE;QAClB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,uBAAuB;QAChC,IAAI,EAAE,OAAO;KACd,EAAE,0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Q;KACf;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,qBAAqB;QAC9B,IAAI,EAAE,QAAQ;KACf;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,+BAA+B;QACxC,IAAI,EAAE,QAAQ;KACf;IACD,gCAAgC;IAChC,uBAAuB,EAAE;QACvB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kHAAkH;QAC3H,IAAI,EAAE,QAAQ;KACf;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,SAAS;KAChB;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,mCAAmC;QAC5C,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kHAAkH;QAC3H,IAAI,EAAE,OAAO;KACd;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,6BAA6B;QACtC,IAAI,EAAE,OAAO;KACd;CAOF,CAAC"}
1
+ {"version":3,"file":"error-codes-messages.js","sourceRoot":"","sources":["../../../src/lib/utils/error-codes-messages.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;CAGd,CAAC;AAEF;;;;;;;;;;;;GAYG;AACU,QAAA,MAAM,GAAG;IACpB,WAAW,EAAE;QACX,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kGAAkG;QAC3G,IAAI,EAAE,SAAS;KAChB;IACD,mCAAmC;IACnC,0BAA0B,EAAE;QAC1B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,wBAAwB;QACjC,IAAI,EAAE,OAAO;KACd;IACD,iDAAi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,EAAE,QAAQ;KACf;IACD,uDAAuD;IACvD,qCAAqC,EAAE;QACrC,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kDAAkD;QAC3D,IAAI,EAAE,QAAQ;KACf;IACD,yBAAyB,EAAE;QACzB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,QAAQ;KACf;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,qBAAqB;QAC9B,IAAI,EAAE,QAAQ;KACf;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,+BAA+B;QACxC,IAAI,EAAE,QAAQ;KACf;IACD,gCAAgC;IAChC,uBAAuB,EAAE;QACvB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kHAAkH;QAC3H,IAAI,EAAE,QAAQ;KACf;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,SAAS;KAChB;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,mCAAmC;QAC5C,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,kHAAkH;QAC3H,IAAI,EAAE,OAAO;KACd;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,6BAA6B;QACtC,IAAI,EAAE,OAAO;KACd;CAOF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Errors } from './error-codes-messages';
2
2
  export declare const docsPrefix = "https://docs.zephyr-cloud.io/errors";
3
3
  export declare function errCode<K extends keyof typeof Errors>(err: K): `ZE${string}${string}`;
4
- export declare function errMsg<K extends keyof typeof Errors>(err: K): "Unknown error. Tell us about it in Discord https://zephyr-cloud.io/discord if you see this error" | "Package.json not found" | "Package.json is not in a valid json format." | "Webpack config error." | "Package.json must have a name and version field." | "Git remote origin is not configured properly." | "Git username or email is not configured." | "Could not get git info." | "`application_uid` missing." | "Auth error." | "Could not get build id." | "Could not initialize Zephyr Agent." | "Error creating dist folder." | "Assets not found." | "Assets not found in snapshot." | "`application_uid` is required." | "Missing file hash." | "Failed to load application configuration." | "Failed to upload build stats." | "Did not receive envs from build stats upload." | "Failed to upload assets." | "Failed to upload snapshots." | "Snapshot uploads gave no results." | "Failed to get application hash list." | "Could not resolve application name with version." | "`snapshot_id` not found." | "Snapshot not found." | "Failed to deploy local build." | "Wrangler dependency is needed for Cloudflare deployment. Please install dependencies without --no-optional flag." | "Failed to convert graph to dashboard data." | "Error upload to cloudflare pages.";
4
+ export declare function errMsg<K extends keyof typeof Errors>(err: K): "Package.json is not in a valid json format." | "Webpack config error." | "`application_uid` missing." | "Could not initialize Zephyr Agent." | "Error creating dist folder." | "Assets not found." | "Assets not found in snapshot." | "`application_uid` is required." | "Missing file hash." | "Did not receive envs from build stats upload." | "Snapshot uploads gave no results." | "Failed to get application hash list." | "`snapshot_id` not found." | "Snapshot not found." | "Failed to deploy local build." | "Wrangler dependency is needed for Cloudflare deployment. Please install dependencies without --no-optional flag." | "Failed to load application configuration." | "Unknown error. Tell us about it in Discord https://zephyr-cloud.io/discord if you see this error" | "Package.json not found" | "Package.json must have a name and version field." | "Git remote origin is not configured properly." | "Git username or email is not configured." | "Could not get git info." | "Auth error." | "Could not get build id." | "Failed to upload build stats." | "Failed to upload assets." | "Failed to upload snapshots." | "Could not resolve application name with version." | "Failed to convert graph to dashboard data." | "Error upload to cloudflare pages.";
5
5
  export declare function err<K extends keyof typeof Errors>(err: K): string;
@@ -1,3 +1,4 @@
1
+ export declare const isTTY: string | boolean;
1
2
  export declare const reset: (s: string) => string;
2
3
  export declare const bold: (input: string) => string;
3
4
  export declare const dim: (input: string) => string;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  // ISC License
3
- var _a;
4
3
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.bgWhiteBright = exports.bgCyanBright = exports.bgMagentaBright = exports.bgBlueBright = exports.bgYellowBright = exports.bgGreenBright = exports.bgRedBright = exports.bgBlackBright = exports.whiteBright = exports.cyanBright = exports.magentaBright = exports.blueBright = exports.yellowBright = exports.greenBright = exports.redBright = exports.blackBright = exports.bgWhite = exports.bgCyan = exports.bgMagenta = exports.bgBlue = exports.bgYellow = exports.bgGreen = exports.bgRed = exports.bgBlack = exports.gray = exports.white = exports.cyan = exports.purple = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = exports.strikethrough = exports.hidden = exports.inverse = exports.underline = exports.italic = exports.dim = exports.bold = exports.reset = void 0;
4
+ exports.bgWhiteBright = exports.bgCyanBright = exports.bgMagentaBright = exports.bgBlueBright = exports.bgYellowBright = exports.bgGreenBright = exports.bgRedBright = exports.bgBlackBright = exports.whiteBright = exports.cyanBright = exports.magentaBright = exports.blueBright = exports.yellowBright = exports.greenBright = exports.redBright = exports.blackBright = exports.bgWhite = exports.bgCyan = exports.bgMagenta = exports.bgBlue = exports.bgYellow = exports.bgGreen = exports.bgRed = exports.bgBlack = exports.gray = exports.white = exports.cyan = exports.purple = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = exports.strikethrough = exports.hidden = exports.inverse = exports.underline = exports.italic = exports.dim = exports.bold = exports.reset = exports.isTTY = void 0;
6
5
  // Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
7
6
  // Permission to use, copy, modify, and/or distribute this software for any
8
7
  // purpose with or without fee is hereby granted, provided that the above
@@ -17,34 +16,27 @@ exports.bgWhiteBright = exports.bgCyanBright = exports.bgMagentaBright = exports
17
16
  //
18
17
  // https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1
19
18
  const debug_enabled_1 = require("./debug-enabled");
20
- const { env, stdout } = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.process) !== null && _a !== void 0 ? _a : {};
21
- const enabled = !debug_enabled_1.is_debug_enabled &&
22
- env &&
23
- !env['NO_COLOR'] &&
24
- (env['FORCE_COLOR'] ||
25
- ((stdout === null || stdout === void 0 ? void 0 : stdout.isTTY) && !env['CI'] && env['TERM'] !== 'dumb'));
19
+ const node_tty_1 = require("node:tty");
20
+ exports.isTTY = (!debug_enabled_1.is_debug_enabled && !process.env['NO_COLOR'] && process.env['FORCE_COLOR']) ||
21
+ ((0, node_tty_1.isatty)(process.stdout.fd) && !process.env['CI'] && process.env['TERM'] !== 'dumb');
26
22
  // const enabled = env
27
23
  const replaceClose = (str, close, replace, index) => {
28
24
  const start = str.substring(0, index) + replace;
29
25
  const end = str.substring(index + close.length);
30
26
  const nextIndex = end.indexOf(close);
31
- return ~nextIndex
32
- ? start + replaceClose(end, close, replace, nextIndex)
33
- : start + end;
27
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
34
28
  };
35
29
  const formatter = (open, close, replace = open) => {
36
- if (!enabled)
30
+ if (!exports.isTTY)
37
31
  return String;
38
32
  return (input) => {
39
33
  const string = '' + input;
40
34
  const index = string.indexOf(close, open.length);
41
- return ~index
42
- ? open + replaceClose(string, close, replace, index) + close
43
- : open + string + close;
35
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
44
36
  };
45
37
  };
46
38
  // text styles
47
- exports.reset = enabled ? (s) => `\x1b[0m${s}\x1b[0m` : String;
39
+ exports.reset = exports.isTTY ? (s) => `\x1b[0m${s}\x1b[0m` : String;
48
40
  exports.bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
49
41
  exports.dim = formatter('\x1b[2m', '\x1b[22m', '\x1b[22m\x1b[2m');
50
42
  exports.italic = formatter('\x1b[3m', '\x1b[23m');
@@ -1 +1 @@
1
- {"version":3,"file":"picocolor.js","sourceRoot":"","sources":["../../../src/lib/utils/picocolor.ts"],"names":[],"mappings":";AAAA,cAAc;;;;AAEd,wEAAwE;AAExE,2EAA2E;AAC3E,yEAAyE;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GAAG,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAE7D,4BAA4B;AACf,QAAA,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACnD,QAAA,WAAW,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACjD,QAAA,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACnD,QAAA,cAAc,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACpD,QAAA,YAAY,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAClD,QAAA,eAAe,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACrD,QAAA,YAAY,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAClD,QAAA,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ES 2023 Promise.withResolvers() polyfill
3
+ *
4
+ * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
5
+ */
6
+ export declare function PromiseWithResolvers<T>(): {
7
+ promise: Promise<T>;
8
+ resolve: (value: T | PromiseLike<T>) => void;
9
+ reject: (reason?: unknown) => void;
10
+ };
11
+ /** Creates a `[boolean, error, value]` tuple value from a promise. */
12
+ export declare function PromiseTuple<P>(maybePromise: PromiseLike<P> | P): Promise<[false, unknown] | [true, null, P]>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromiseTuple = exports.PromiseWithResolvers = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /**
6
+ * ES 2023 Promise.withResolvers() polyfill
7
+ *
8
+ * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
9
+ */
10
+ function PromiseWithResolvers() {
11
+ let resolve;
12
+ let reject;
13
+ const promise = new Promise((res, rej) => {
14
+ resolve = res;
15
+ reject = rej;
16
+ });
17
+ return { promise, resolve, reject };
18
+ }
19
+ exports.PromiseWithResolvers = PromiseWithResolvers;
20
+ /** Creates a `[boolean, error, value]` tuple value from a promise. */
21
+ function PromiseTuple(maybePromise) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ return [true, null, yield maybePromise];
25
+ }
26
+ catch (err) {
27
+ return [false, err];
28
+ }
29
+ });
30
+ }
31
+ exports.PromiseTuple = PromiseTuple;
32
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.js","sourceRoot":"","sources":["../../../src/lib/utils/promise.ts"],"names":[],"mappings":";;;;AAAA;;;;GAIG;AACH,SAAgB,oBAAoB;IAClC,IAAI,OAA6C,CAAC;IAClD,IAAI,MAAmC,CAAC;IAExC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAVD,oDAUC;AAED,sEAAsE;AACtE,SAAsB,YAAY,CAAI,YAAgC;;QACpE,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CAAA;AAND,oCAMC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Replaces all occurrences of {{key}} in the string with the value of the key in the params object.
3
+ *
4
+ * `{{ example }}` or `{{ example = value }}` to have a default value
5
+ */
6
+ export declare function formatString<const S extends string>(str: S, params: Record<FindTemplates<S>, string | number | boolean>): string;
7
+ /** Gets a string like `{{ key }} text {{ key2 }}` and returns an string union with key and key2 */
8
+ export type FindTemplates<S extends string> = `${S}` extends `${infer Prefix}{{ ${infer Key} }}${infer Suffix}` ? FindTemplates<Prefix> | Key | FindTemplates<Suffix> : never;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatString = void 0;
4
+ /**
5
+ * Replaces all occurrences of {{key}} in the string with the value of the key in the params object.
6
+ *
7
+ * `{{ example }}` or `{{ example = value }}` to have a default value
8
+ */
9
+ function formatString(str, params) {
10
+ return str.replace(/{{\s*([^}\s]+)\s*(?:=\s*(.+?)\s*)?}}/g, (_, key, def) => {
11
+ return params[key] || def || key;
12
+ });
13
+ }
14
+ exports.formatString = formatString;
15
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/lib/utils/string.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,YAAY,CAAyB,GAAM,EAAE,MAA2D;IACtH,OAAO,GAAG,CAAC,OAAO,CAAC,uCAAuC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1E,OAAO,MAAM,CAAC,GAAuB,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,oCAIC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
3
+ *
4
+ * @example
5
+ * ```
6
+ * import stripAnsi from 'strip-ansi';
7
+ *
8
+ * stripAnsi('\u001B[4mUnicorn\u001B[0m');
9
+ * //=> 'Unicorn'
10
+ *
11
+ * stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
12
+ * //=> 'Click'
13
+ * ```;
14
+ */
15
+ export declare function stripAnsi(string: string): string;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // extracted from https://github.com/chalk/ansi-regex/blob/main/index.js
3
+ // and https://github.com/chalk/strip-ansi/blob/main/index.d.ts
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.stripAnsi = void 0;
6
+ const ANSI_REGEX = new RegExp([
7
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
8
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
9
+ ].join('|'), 'g');
10
+ /**
11
+ * Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
12
+ *
13
+ * @example
14
+ * ```
15
+ * import stripAnsi from 'strip-ansi';
16
+ *
17
+ * stripAnsi('\u001B[4mUnicorn\u001B[0m');
18
+ * //=> 'Unicorn'
19
+ *
20
+ * stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
21
+ * //=> 'Click'
22
+ * ```;
23
+ */
24
+ function stripAnsi(string) {
25
+ return string.replace(ANSI_REGEX, '');
26
+ }
27
+ exports.stripAnsi = stripAnsi;
28
+ //# sourceMappingURL=strip-ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-ansi.js","sourceRoot":"","sources":["../../../src/lib/utils/strip-ansi.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,+DAA+D;;;AAE/D,MAAM,UAAU,GAAG,IAAI,MAAM,CAC3B;IACE,8HAA8H;IAC9H,0DAA0D;CAC3D,CAAC,IAAI,CAAC,GAAG,CAAC,EACX,GAAG,CACJ,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAFD,8BAEC"}
@@ -1,5 +1,19 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { ClientRequestArgs } from 'node:http';
3
- export declare function request<T = unknown>(url: URL, options?: ClientRequestArgs, data?: unknown & {
4
- length: number | undefined;
5
- }): Promise<T | string>;
4
+ /** Http request wrapper that returns a tuple with the response data or an error. */
5
+ export type HttpResponse<T> = [ok: true, error: null, data: T] | [ok: false, error: Error];
6
+ export type UrlString = string | URL | {
7
+ path: string;
8
+ base?: string;
9
+ query: Record<string, string | number | boolean>;
10
+ };
11
+ /** Starts a new http request */
12
+ export declare class ZeHttpRequest<T = void> implements PromiseLike<HttpResponse<T>> {
13
+ #private;
14
+ /** Creates a new http request. */
15
+ static from<T = void>(urlStr: UrlString, options?: ClientRequestArgs, data?: string | Buffer): ZeHttpRequest<T>;
16
+ then: <TResult1 = HttpResponse<T>, TResult2 = never>(onfulfilled?: ((value: HttpResponse<T>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
17
+ /** Transforms `Promise<HttpResponse<T>>` into `Promise<T>` */
18
+ unwrap(): Promise<T>;
19
+ }