zephyr-edge-contract 0.0.0-canary-20241116123955

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 (116) hide show
  1. package/LICENSE +39 -0
  2. package/README.md +5 -0
  3. package/dist/index.d.ts +31 -0
  4. package/dist/index.js +54 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/api-contract-negotiation/get-api-contract.d.ts +11 -0
  7. package/dist/lib/api-contract-negotiation/get-api-contract.js +19 -0
  8. package/dist/lib/api-contract-negotiation/get-api-contract.js.map +1 -0
  9. package/dist/lib/edge-api/publish-request.d.ts +46 -0
  10. package/dist/lib/edge-api/publish-request.js +3 -0
  11. package/dist/lib/edge-api/publish-request.js.map +1 -0
  12. package/dist/lib/edge-api/ze-envs-request.d.ts +10 -0
  13. package/dist/lib/edge-api/ze-envs-request.js +3 -0
  14. package/dist/lib/edge-api/ze-envs-request.js.map +1 -0
  15. package/dist/lib/errors/codes.d.ts +292 -0
  16. package/dist/lib/errors/codes.js +382 -0
  17. package/dist/lib/errors/codes.js.map +1 -0
  18. package/dist/lib/errors/index.d.ts +2 -0
  19. package/dist/lib/errors/index.js +6 -0
  20. package/dist/lib/errors/index.js.map +1 -0
  21. package/dist/lib/errors/zephyr.d.ts +493 -0
  22. package/dist/lib/errors/zephyr.js +153 -0
  23. package/dist/lib/errors/zephyr.js.map +1 -0
  24. package/dist/lib/node-persist/app-deploy-result-cache.d.ts +7 -0
  25. package/dist/lib/node-persist/app-deploy-result-cache.js +26 -0
  26. package/dist/lib/node-persist/app-deploy-result-cache.js.map +1 -0
  27. package/dist/lib/node-persist/application-configuration.d.ts +4 -0
  28. package/dist/lib/node-persist/application-configuration.js +29 -0
  29. package/dist/lib/node-persist/application-configuration.js.map +1 -0
  30. package/dist/lib/node-persist/fs-cache.d.ts +3 -0
  31. package/dist/lib/node-persist/fs-cache.js +26 -0
  32. package/dist/lib/node-persist/fs-cache.js.map +1 -0
  33. package/dist/lib/node-persist/hash-cache.d.ts +7 -0
  34. package/dist/lib/node-persist/hash-cache.js +26 -0
  35. package/dist/lib/node-persist/hash-cache.js.map +1 -0
  36. package/dist/lib/node-persist/partial-assets-map.d.ts +4 -0
  37. package/dist/lib/node-persist/partial-assets-map.js +31 -0
  38. package/dist/lib/node-persist/partial-assets-map.js.map +1 -0
  39. package/dist/lib/node-persist/secret-token.d.ts +2 -0
  40. package/dist/lib/node-persist/secret-token.js +13 -0
  41. package/dist/lib/node-persist/secret-token.js.map +1 -0
  42. package/dist/lib/node-persist/storage-keys.d.ts +10 -0
  43. package/dist/lib/node-persist/storage-keys.js +15 -0
  44. package/dist/lib/node-persist/storage-keys.js.map +1 -0
  45. package/dist/lib/node-persist/token.d.ts +4 -0
  46. package/dist/lib/node-persist/token.js +36 -0
  47. package/dist/lib/node-persist/token.js.map +1 -0
  48. package/dist/lib/node-persist/upload-provider-options.d.ts +22 -0
  49. package/dist/lib/node-persist/upload-provider-options.js +13 -0
  50. package/dist/lib/node-persist/upload-provider-options.js.map +1 -0
  51. package/dist/lib/plugin-options/zephyr-plugin-options.d.ts +35 -0
  52. package/dist/lib/plugin-options/zephyr-plugin-options.js +3 -0
  53. package/dist/lib/plugin-options/zephyr-plugin-options.js.map +1 -0
  54. package/dist/lib/snapshot.d.ts +40 -0
  55. package/dist/lib/snapshot.js +3 -0
  56. package/dist/lib/snapshot.js.map +1 -0
  57. package/dist/lib/utils/clean-stack.d.ts +7 -0
  58. package/dist/lib/utils/clean-stack.js +44 -0
  59. package/dist/lib/utils/clean-stack.js.map +1 -0
  60. package/dist/lib/utils/create-application-u-i-d.d.ts +5 -0
  61. package/dist/lib/utils/create-application-u-i-d.js +15 -0
  62. package/dist/lib/utils/create-application-u-i-d.js.map +1 -0
  63. package/dist/lib/utils/create-snapshot-id.d.ts +11 -0
  64. package/dist/lib/utils/create-snapshot-id.js +10 -0
  65. package/dist/lib/utils/create-snapshot-id.js.map +1 -0
  66. package/dist/lib/utils/debug-enabled.d.ts +1 -0
  67. package/dist/lib/utils/debug-enabled.js +9 -0
  68. package/dist/lib/utils/debug-enabled.js.map +1 -0
  69. package/dist/lib/utils/debug.d.ts +22 -0
  70. package/dist/lib/utils/debug.js +36 -0
  71. package/dist/lib/utils/debug.js.map +1 -0
  72. package/dist/lib/utils/error-codes-messages.d.ts +206 -0
  73. package/dist/lib/utils/error-codes-messages.js +203 -0
  74. package/dist/lib/utils/error-codes-messages.js.map +1 -0
  75. package/dist/lib/utils/error-formatted-message.d.ts +5 -0
  76. package/dist/lib/utils/error-formatted-message.js +36 -0
  77. package/dist/lib/utils/error-formatted-message.js.map +1 -0
  78. package/dist/lib/utils/picocolor.d.ts +43 -0
  79. package/dist/lib/utils/picocolor.js +85 -0
  80. package/dist/lib/utils/picocolor.js.map +1 -0
  81. package/dist/lib/utils/promise.d.ts +12 -0
  82. package/dist/lib/utils/promise.js +29 -0
  83. package/dist/lib/utils/promise.js.map +1 -0
  84. package/dist/lib/utils/safe-json-parse.d.ts +1 -0
  85. package/dist/lib/utils/safe-json-parse.js +13 -0
  86. package/dist/lib/utils/safe-json-parse.js.map +1 -0
  87. package/dist/lib/utils/string.d.ts +8 -0
  88. package/dist/lib/utils/string.js +15 -0
  89. package/dist/lib/utils/string.js.map +1 -0
  90. package/dist/lib/utils/strip-ansi.d.ts +15 -0
  91. package/dist/lib/utils/strip-ansi.js +28 -0
  92. package/dist/lib/utils/strip-ansi.js.map +1 -0
  93. package/dist/lib/utils/ze-http-request.d.ts +19 -0
  94. package/dist/lib/utils/ze-http-request.js +157 -0
  95. package/dist/lib/utils/ze-http-request.js.map +1 -0
  96. package/dist/lib/ze-api/app-list.d.ts +9 -0
  97. package/dist/lib/ze-api/app-list.js +3 -0
  98. package/dist/lib/ze-api/app-list.js.map +1 -0
  99. package/dist/lib/ze-api/app-version.d.ts +16 -0
  100. package/dist/lib/ze-api/app-version.js +3 -0
  101. package/dist/lib/ze-api/app-version.js.map +1 -0
  102. package/dist/lib/ze-api/converted-graph.d.ts +22 -0
  103. package/dist/lib/ze-api/converted-graph.js +3 -0
  104. package/dist/lib/ze-api/converted-graph.js.map +1 -0
  105. package/dist/lib/ze-api/local-package-json.d.ts +21 -0
  106. package/dist/lib/ze-api/local-package-json.js +9 -0
  107. package/dist/lib/ze-api/local-package-json.js.map +1 -0
  108. package/dist/lib/zephyr-build-stats.d.ts +125 -0
  109. package/dist/lib/zephyr-build-stats.js +11 -0
  110. package/dist/lib/zephyr-build-stats.js.map +1 -0
  111. package/dist/lib/zephyr-edge-contract.d.ts +105 -0
  112. package/dist/lib/zephyr-edge-contract.js +3 -0
  113. package/dist/lib/zephyr-edge-contract.js.map +1 -0
  114. package/dist/package.json +23 -0
  115. package/package.json +23 -0
  116. package/test/utils/string.test.ts +96 -0
@@ -0,0 +1 @@
1
+ export declare function safe_json_parse<T = Record<string, unknown>>(str: string): T | undefined;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safe_json_parse = void 0;
4
+ function safe_json_parse(str) {
5
+ try {
6
+ return JSON.parse(str);
7
+ }
8
+ catch (_a) {
9
+ return;
10
+ }
11
+ }
12
+ exports.safe_json_parse = safe_json_parse;
13
+ //# sourceMappingURL=safe-json-parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-json-parse.js","sourceRoot":"","sources":["../../../src/lib/utils/safe-json-parse.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAC7B,GAAW;IAEX,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,WAAM,CAAC;QACP,OAAO;IACT,CAAC;AACH,CAAC;AARD,0CAQC"}
@@ -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"}
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import type { ClientRequestArgs } from 'node:http';
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
+ }
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var _ZeHttpRequest_instances, _ZeHttpRequest_start, _ZeHttpRequest_url, _ZeHttpRequest_options, _ZeHttpRequest_data, _ZeHttpRequest_promise, _ZeHttpRequest_reject, _ZeHttpRequest_resolve, _ZeHttpRequest_request, _ZeHttpRequest_onRequestError, _ZeHttpRequest_onResponse, _ZeHttpRequest_handleUnknownError, _ZeHttpRequest_onResponseAsync, _ZeHttpRequest_redact;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ZeHttpRequest = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const http = tslib_1.__importStar(require("node:http"));
7
+ const https = tslib_1.__importStar(require("node:https"));
8
+ const consumers_1 = require("node:stream/consumers");
9
+ const get_api_contract_1 = require("../api-contract-negotiation/get-api-contract");
10
+ const errors_1 = require("../errors");
11
+ const token_1 = require("../node-persist/token");
12
+ const debug_1 = require("./debug");
13
+ const promise_1 = require("./promise");
14
+ const safe_json_parse_1 = require("./safe-json-parse");
15
+ /** Starts a new http request */
16
+ class ZeHttpRequest {
17
+ constructor() {
18
+ _ZeHttpRequest_instances.add(this);
19
+ /** The time the request was started. */
20
+ _ZeHttpRequest_start.set(this, Date.now());
21
+ /** The URL to request. */
22
+ _ZeHttpRequest_url.set(this, void 0);
23
+ /** The options for the request. */
24
+ _ZeHttpRequest_options.set(this, void 0);
25
+ /** The data to send with the request. */
26
+ _ZeHttpRequest_data.set(this, void 0);
27
+ // private methods for resolving and rejecting the promise
28
+ _ZeHttpRequest_promise.set(this, (0, promise_1.PromiseWithResolvers)());
29
+ // promise extension
30
+ this.then = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_promise, "f").promise.then.bind(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_promise, "f").promise);
31
+ /** Handles the error when the request fails. */
32
+ _ZeHttpRequest_onRequestError.set(this, (cause) => {
33
+ var _a, _b;
34
+ if ('ERR_TLS_CERT_ALTNAME_INVALID' in cause) {
35
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_reject).call(this, new errors_1.ZephyrError(errors_1.ZeErrors.ERR_TLS_CERT_ALTNAME_INVALID, {
36
+ cause,
37
+ }));
38
+ return;
39
+ }
40
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_reject).call(this, new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
41
+ url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
42
+ method: (_b = (_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : 'GET',
43
+ content: 'Could not send request',
44
+ status: '-1',
45
+ cause,
46
+ }));
47
+ });
48
+ /** Handles the response from the server. */
49
+ _ZeHttpRequest_onResponse.set(this, (res) => {
50
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_onResponseAsync, "f").call(this, res).catch(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_handleUnknownError, "f"));
51
+ });
52
+ _ZeHttpRequest_handleUnknownError.set(this, (cause) => {
53
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_reject).call(this, new errors_1.ZephyrError(errors_1.ZeErrors.ERR_UNKNOWN, { message: 'Could not process provided http.IncomingMessage', cause }));
54
+ });
55
+ _ZeHttpRequest_onResponseAsync.set(this, async (res) => {
56
+ var _a, _b, _c, _d, _e;
57
+ if (res.statusCode === 401) {
58
+ // Clean the tokens and throw an error
59
+ await (0, token_1.cleanTokens)();
60
+ throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_AUTH_ERROR, { message: 'Unauthenticated request' });
61
+ }
62
+ if (res.statusCode === 403) {
63
+ throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_AUTH_FORBIDDEN_ERROR, { message: 'Unauthorized request' });
64
+ }
65
+ const [resOk, resErr, resText] = await (0, promise_1.PromiseTuple)((0, consumers_1.text)(res));
66
+ if (!resOk) {
67
+ return tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_onRequestError, "f").call(this, resErr);
68
+ }
69
+ const message = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_redact).call(this, resText);
70
+ if (message === 'Not Implemented') {
71
+ throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_UNKNOWN, {
72
+ message: 'Not implemented yet. Please get in contact with our support.',
73
+ });
74
+ }
75
+ if (res.statusCode === undefined) {
76
+ throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
77
+ content: 'No status code found',
78
+ method: (_b = (_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== null && _b !== void 0 ? _b : 'GET',
79
+ url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
80
+ status: -1,
81
+ });
82
+ }
83
+ if (!tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").pathname.includes('application/logs')) {
84
+ (0, debug_1.ze_log)(message);
85
+ }
86
+ // Only parses data if reply content is json
87
+ const resData = (_c = (0, safe_json_parse_1.safe_json_parse)(resText)) !== null && _c !== void 0 ? _c : resText;
88
+ if (res.statusCode >= 300) {
89
+ throw new errors_1.ZephyrError(errors_1.ZeErrors.ERR_HTTP_ERROR, {
90
+ status: res.statusCode,
91
+ url: tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").toString(),
92
+ content: resData,
93
+ method: (_e = (_d = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : 'GET',
94
+ });
95
+ }
96
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_instances, "m", _ZeHttpRequest_resolve).call(this, resData);
97
+ });
98
+ }
99
+ /** Creates a new http request. */
100
+ static from(urlStr, options = {}, data) {
101
+ const req = new ZeHttpRequest();
102
+ tslib_1.__classPrivateFieldSet(req, _ZeHttpRequest_data, data, "f");
103
+ tslib_1.__classPrivateFieldSet(req, _ZeHttpRequest_options, options, "f");
104
+ // Parse the url into a URL object
105
+ if (typeof urlStr === 'string') {
106
+ tslib_1.__classPrivateFieldSet(req, _ZeHttpRequest_url, new URL(urlStr), "f");
107
+ }
108
+ else if (urlStr instanceof URL) {
109
+ tslib_1.__classPrivateFieldSet(req, _ZeHttpRequest_url, urlStr, "f");
110
+ }
111
+ else {
112
+ tslib_1.__classPrivateFieldSet(req, _ZeHttpRequest_url, new URL(urlStr.path, urlStr.base), "f");
113
+ for (const [key, value] of Object.entries(urlStr.query)) {
114
+ tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_url, "f").searchParams.append(key, String(value));
115
+ }
116
+ }
117
+ const is_preview = (0, get_api_contract_1.ZE_IS_PREVIEW)();
118
+ const ze_api_endpoint_host = (0, get_api_contract_1.ZE_API_ENDPOINT_HOST)();
119
+ const zephyr_api_endpoint = (0, get_api_contract_1.ZEPHYR_API_ENDPOINT)();
120
+ // Add a query param hint in preview environments
121
+ if (is_preview && tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_url, "f").host === ze_api_endpoint_host) {
122
+ tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_url, "f").searchParams.set('api_host', zephyr_api_endpoint);
123
+ }
124
+ tslib_1.__classPrivateFieldGet(req, _ZeHttpRequest_instances, "m", _ZeHttpRequest_request).call(req);
125
+ return req;
126
+ }
127
+ /** Transforms `Promise<HttpResponse<T>>` into `Promise<T>` */
128
+ async unwrap() {
129
+ const [ok, error, data] = await this;
130
+ if (!ok) {
131
+ throw error;
132
+ }
133
+ return data;
134
+ }
135
+ }
136
+ exports.ZeHttpRequest = ZeHttpRequest;
137
+ _ZeHttpRequest_start = new WeakMap(), _ZeHttpRequest_url = new WeakMap(), _ZeHttpRequest_options = new WeakMap(), _ZeHttpRequest_data = new WeakMap(), _ZeHttpRequest_promise = new WeakMap(), _ZeHttpRequest_onRequestError = new WeakMap(), _ZeHttpRequest_onResponse = new WeakMap(), _ZeHttpRequest_handleUnknownError = new WeakMap(), _ZeHttpRequest_onResponseAsync = new WeakMap(), _ZeHttpRequest_instances = new WeakSet(), _ZeHttpRequest_reject = function _ZeHttpRequest_reject(error) {
138
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_promise, "f").resolve([false, error]);
139
+ }, _ZeHttpRequest_resolve = function _ZeHttpRequest_resolve(data) {
140
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_promise, "f").resolve([true, null, data]);
141
+ }, _ZeHttpRequest_request = function _ZeHttpRequest_request() {
142
+ var _a;
143
+ const requester = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f").protocol === 'https:' ? https : http;
144
+ const req = requester.request(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f"), (_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f")) !== null && _a !== void 0 ? _a : {}, tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_onResponse, "f"));
145
+ req.on('error', tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_onRequestError, "f"));
146
+ req.end(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_data, "f"));
147
+ }, _ZeHttpRequest_redact = function _ZeHttpRequest_redact(response) {
148
+ var _a, _b;
149
+ const str = [
150
+ `[${tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f").method || 'GET'}][${tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_url, "f")}]: ${Date.now() - tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_start, "f")}ms`,
151
+ ((_a = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_data, "f")) === null || _a === void 0 ? void 0 : _a.length) ? ` - ${(((_b = tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_data, "f").length) !== null && _b !== void 0 ? _b : 0) / 1024).toFixed(2)}kb` : '',
152
+ response ? `Response: ${response}` : '',
153
+ tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f") ? `Options: ${JSON.stringify(tslib_1.__classPrivateFieldGet(this, _ZeHttpRequest_options, "f"))}` : '',
154
+ ].join('\n');
155
+ return str.replace(/Bearer ([^"|']+)/gi, 'Bearer [REDACTED]').replace(/"?jwt"?:["|\W']{0,2}([^"|']+)(["|'])/gi, 'jwt: [REDACTED]');
156
+ };
157
+ //# sourceMappingURL=ze-http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ze-http-request.js","sourceRoot":"","sources":["../../../src/lib/utils/ze-http-request.ts"],"names":[],"mappings":";;;;;AACA,wDAAkC;AAClC,0DAAoC;AACpC,qDAA6C;AAC7C,mFAAwH;AACxH,sCAAkD;AAClD,i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YAAY,IAAI,CAAC,SAAS,CAAC,+BAAA,IAAI,8BAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;KACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,OAAO,CAAC,wCAAwC,EAAE,iBAAiB,CAAC,CAAC;AACrI,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface ZeApplicationList {
2
+ list: {
3
+ name: string;
4
+ url: string;
5
+ }[];
6
+ origin: string;
7
+ domain: string;
8
+ cursor: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=app-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-list.js","sourceRoot":"","sources":["../../../src/lib/ze-api/app-list.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ export interface ZeAppVersion {
2
+ application_uid: string;
3
+ snapshot_id: string;
4
+ version: string;
5
+ version_id: string;
6
+ remote_entry_url: string;
7
+ remote_host: string;
8
+ name: string;
9
+ tag?: string;
10
+ env?: string;
11
+ createdAt: string;
12
+ author: string;
13
+ }
14
+ export interface ZeAppVersionResponse extends ZeAppVersion {
15
+ remotes?: ZeAppVersion[];
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=app-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-version.js","sourceRoot":"","sources":["../../../src/lib/ze-api/app-version.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { LocalPackageJson } from './local-package-json';
2
+ export interface ConvertedGraph {
3
+ id?: string;
4
+ version?: string;
5
+ name?: string;
6
+ /** //TODO: what is this? */
7
+ remote: unknown;
8
+ metadata: unknown;
9
+ versionData: unknown;
10
+ overrides: unknown[];
11
+ consumes: unknown[];
12
+ modules: unknown[];
13
+ environment: unknown;
14
+ posted: unknown;
15
+ group: unknown;
16
+ sha: unknown;
17
+ buildHash: unknown;
18
+ dependencies?: LocalPackageJson[];
19
+ devDependencies?: LocalPackageJson[];
20
+ optionalDependencies?: LocalPackageJson[];
21
+ target?: 'ios' | 'android' | 'web' | undefined;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=converted-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converted-graph.js","sourceRoot":"","sources":["../../../src/lib/ze-api/converted-graph.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Extracts and returns the license/licenses abbrevations
3
+ * from the respective fields.
4
+ * @param {Object} packageJson The package.json file content as object.
5
+ * @return {String}
6
+ */
7
+ export interface LocalPackageJson {
8
+ name: string;
9
+ version: string;
10
+ homepage?: string;
11
+ size?: number;
12
+ license?: {
13
+ type: string;
14
+ } | string;
15
+ licenses?: Array<{
16
+ type: string;
17
+ }> | {
18
+ type: string;
19
+ } | string;
20
+ [key: string]: LocalPackageJson[keyof LocalPackageJson];
21
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Extracts and returns the license/licenses abbrevations
4
+ * from the respective fields.
5
+ * @param {Object} packageJson The package.json file content as object.
6
+ * @return {String}
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=local-package-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-package-json.js","sourceRoot":"","sources":["../../../src/lib/ze-api/local-package-json.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -0,0 +1,125 @@
1
+ export interface ZephyrBuildStats {
2
+ project: string;
3
+ /** Application_uid */
4
+ id: string;
5
+ name: string;
6
+ version: string;
7
+ environment: string;
8
+ posted?: Date;
9
+ /** Default to `remoteEntry.js` unless user defines it */
10
+ remote: string | undefined;
11
+ metadata: unknown;
12
+ /**
13
+ * This is for understanding what dependencies are being shared and created by the remote
14
+ *
15
+ * @question how are we going to use it in the future ?
16
+ */
17
+ overrides: ApplicationOverride[];
18
+ /** The remotes this app is consuming */
19
+ consumes: ApplicationConsumes[];
20
+ /** This is the component this app is exposing, includes the component name and file name */
21
+ modules: ApplicationModule[];
22
+ tags: string[];
23
+ /** Dependencies in package.json */
24
+ dependencies?: RawDependency[];
25
+ /** OptionalDependencies in package.json */
26
+ optionalDependencies?: RawDependency[];
27
+ /** PeerDependencies in package.json */
28
+ peerDependencies?: RawDependency[];
29
+ /** DevDependencies in package.json */
30
+ devDependencies?: RawDependency[];
31
+ /** What does this default means and what it indicates? */
32
+ default?: boolean;
33
+ /** If this is a host app all the remotes goes into here from the mFConfig */
34
+ remotes?: string[];
35
+ app: {
36
+ /** Name field from package.json */
37
+ name: string;
38
+ /** Version field form package.json */
39
+ version: string;
40
+ /** If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono, ZephyrCloudIO would be the org field here */
41
+ org: string;
42
+ /** If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono, zephyr-mono would be the project field here */
43
+ project: string;
44
+ /** This is the user's uuid */
45
+ buildId: string;
46
+ };
47
+ git: {
48
+ /**
49
+ * If the local git configuration sets a username this `git.name` would be the `git user.name`, see [ze-util-get-git-info] in
50
+ * zephyr-agent
51
+ *
52
+ * @required To build a successfully through Zephyr user must have this field
53
+ */
54
+ name: string;
55
+ /**
56
+ * If the email of local git config is set this email is the `git user.email`
57
+ *
58
+ * @required To build a successfully through Zephyr user must have this field
59
+ */
60
+ email: string;
61
+ /**
62
+ * If the branch of this repository is set this would be the result after running `git rev-parse --abbrev-ref HEAD`
63
+ *
64
+ * @required To build a successfully through Zephyr user must have this field
65
+ */
66
+ branch: string;
67
+ /**
68
+ * If there has been commit of this repo, this would be the result of `git rev-parse HEAD`
69
+ *
70
+ * @requires To build a successfully through Zephyr user must have this field
71
+ */
72
+ commit: string;
73
+ };
74
+ context: {
75
+ username?: string;
76
+ isCI: boolean;
77
+ };
78
+ /** Become the first part of `remote_host` and `remote_entry_url` in database in `ApplicationTag` table */
79
+ edge: {
80
+ url: string;
81
+ versionUrl?: string;
82
+ };
83
+ /** Unused legacy field */
84
+ platform?: DeploymentIntegrationPlatform | undefined;
85
+ /** //TODO: remove this field, unused */
86
+ type?: unknown;
87
+ /** The target platform of the build */
88
+ build_target?: string;
89
+ }
90
+ declare enum DeploymentIntegrationPlatform {
91
+ CLOUDFLARE = "cloudflare",
92
+ AWS = "aws",
93
+ NETLIFY = "netlify",
94
+ AZURE = "azure",
95
+ GCP = "gcp"
96
+ }
97
+ export interface RawDependency {
98
+ name: string;
99
+ version: string;
100
+ }
101
+ export interface ApplicationModule {
102
+ id: string;
103
+ name: string;
104
+ applicationID: string;
105
+ requires: string[];
106
+ file: string;
107
+ }
108
+ export interface ApplicationOverride {
109
+ id: string;
110
+ name: string;
111
+ version: string;
112
+ location: string;
113
+ applicationID: string;
114
+ }
115
+ export interface ApplicationConsumes {
116
+ consumingApplicationID: string;
117
+ applicationID: string;
118
+ name: string;
119
+ usedIn: UsedIn[];
120
+ }
121
+ export interface UsedIn {
122
+ file: string;
123
+ url: string;
124
+ }
125
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var DeploymentIntegrationPlatform;
4
+ (function (DeploymentIntegrationPlatform) {
5
+ DeploymentIntegrationPlatform["CLOUDFLARE"] = "cloudflare";
6
+ DeploymentIntegrationPlatform["AWS"] = "aws";
7
+ DeploymentIntegrationPlatform["NETLIFY"] = "netlify";
8
+ DeploymentIntegrationPlatform["AZURE"] = "azure";
9
+ DeploymentIntegrationPlatform["GCP"] = "gcp";
10
+ })(DeploymentIntegrationPlatform || (DeploymentIntegrationPlatform = {}));
11
+ //# sourceMappingURL=zephyr-build-stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zephyr-build-stats.js","sourceRoot":"","sources":["../../src/lib/zephyr-build-stats.ts"],"names":[],"mappings":";;AAgGA,IAAK,6BAMJ;AAND,WAAK,6BAA6B;IAChC,0DAAyB,CAAA;IACzB,4CAAW,CAAA;IACX,oDAAmB,CAAA;IACnB,gDAAe,CAAA;IACf,4CAAW,CAAA;AACb,CAAC,EANI,6BAA6B,KAA7B,6BAA6B,QAMjC"}
@@ -0,0 +1,105 @@
1
+ /// <reference types="node" />
2
+ export interface Asset {
3
+ /**
4
+ * the filename of the asset
5
+ */
6
+ name: string;
7
+ /**
8
+ * source of the asset
9
+ */
10
+ source: Source;
11
+ /**
12
+ * info about the asset
13
+ */
14
+ info: KnownAssetInfo;
15
+ }
16
+ interface KnownAssetInfo {
17
+ /**
18
+ * true, if the asset can be long term cached forever (contains a hash)
19
+ */
20
+ immutable?: boolean;
21
+ /**
22
+ * whether the asset is minimized
23
+ */
24
+ minimized?: boolean;
25
+ /**
26
+ * the value(s) of the full hash used for this asset
27
+ */
28
+ fullhash?: string | string[];
29
+ /**
30
+ * the value(s) of the chunk hash used for this asset
31
+ */
32
+ chunkhash?: string | string[];
33
+ /**
34
+ * the value(s) of the module hash used for this asset
35
+ */
36
+ modulehash?: string | string[];
37
+ /**
38
+ * the value(s) of the content hash used for this asset
39
+ */
40
+ contenthash?: string | string[];
41
+ /**
42
+ * when asset was created from a source file (potentially transformed), the original filename relative to compilation context
43
+ */
44
+ sourceFilename?: string;
45
+ /**
46
+ * size in bytes, only set after asset has been emitted
47
+ */
48
+ size?: number;
49
+ /**
50
+ * true, when asset is only used for development and doesn't count towards user-facing assets
51
+ */
52
+ development?: boolean;
53
+ /**
54
+ * true, when asset ships data for updating an existing application (HMR)
55
+ */
56
+ hotModuleReplacement?: boolean;
57
+ /**
58
+ * true, when asset is javascript and an ESM
59
+ */
60
+ javascriptModule?: boolean;
61
+ /**
62
+ * object of pointers to other assets, keyed by type of relation (only points from parent to child)
63
+ */
64
+ related?: Record<string, string | string[]>;
65
+ }
66
+ export interface Source {
67
+ size(): number;
68
+ source(): string | Buffer;
69
+ buffer(): Buffer;
70
+ }
71
+ export interface UploadableAsset {
72
+ path: string;
73
+ extname: string;
74
+ hash: string;
75
+ size: number;
76
+ buffer: Buffer | string;
77
+ }
78
+ export interface ZeUploadAssetsOptions {
79
+ missingAssets: ZeBuildAsset[];
80
+ count: number;
81
+ assetsMap: {
82
+ [key: string]: ZeBuildAsset;
83
+ };
84
+ }
85
+ export interface ZeBuildAsset {
86
+ path: string;
87
+ extname: string;
88
+ hash: string;
89
+ size: number;
90
+ buffer: Buffer | string;
91
+ }
92
+ export interface ZeBuildAssetsMap {
93
+ [key: string]: ZeBuildAsset;
94
+ }
95
+ export interface SnapshotUploadRes {
96
+ urls: {
97
+ version: string;
98
+ };
99
+ assets: ZeBuildAsset[];
100
+ assets_v2?: ZeBuildAsset[];
101
+ asset_time?: number;
102
+ asset_v2_time?: number;
103
+ message?: string;
104
+ }
105
+ export {};