zephyr-edge-contract 0.0.21 → 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 (45) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +7 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/api-contract-negotiation/get-api-contract.d.ts +2 -0
  5. package/dist/lib/api-contract-negotiation/get-api-contract.js +5 -1
  6. package/dist/lib/api-contract-negotiation/get-api-contract.js.map +1 -1
  7. package/dist/lib/errors/codes.d.ts +276 -0
  8. package/dist/lib/errors/codes.js +349 -0
  9. package/dist/lib/errors/codes.js.map +1 -0
  10. package/dist/lib/errors/index.d.ts +2 -0
  11. package/dist/lib/errors/index.js +6 -0
  12. package/dist/lib/errors/index.js.map +1 -0
  13. package/dist/lib/errors/zephyr.d.ts +463 -0
  14. package/dist/lib/errors/zephyr.js +153 -0
  15. package/dist/lib/errors/zephyr.js.map +1 -0
  16. package/dist/lib/node-persist/token.js +1 -1
  17. package/dist/lib/node-persist/token.js.map +1 -1
  18. package/dist/lib/utils/clean-stack.d.ts +7 -0
  19. package/dist/lib/utils/clean-stack.js +44 -0
  20. package/dist/lib/utils/clean-stack.js.map +1 -0
  21. package/dist/lib/utils/debug.d.ts +10 -6
  22. package/dist/lib/utils/debug.js +10 -6
  23. package/dist/lib/utils/debug.js.map +1 -1
  24. package/dist/lib/utils/error-codes-messages.d.ts +19 -17
  25. package/dist/lib/utils/error-codes-messages.js +19 -17
  26. package/dist/lib/utils/error-codes-messages.js.map +1 -1
  27. package/dist/lib/utils/error-formatted-message.d.ts +1 -1
  28. package/dist/lib/utils/picocolor.d.ts +1 -0
  29. package/dist/lib/utils/picocolor.js +8 -16
  30. package/dist/lib/utils/picocolor.js.map +1 -1
  31. package/dist/lib/utils/promise.d.ts +12 -0
  32. package/dist/lib/utils/promise.js +32 -0
  33. package/dist/lib/utils/promise.js.map +1 -0
  34. package/dist/lib/utils/string.d.ts +8 -0
  35. package/dist/lib/utils/string.js +15 -0
  36. package/dist/lib/utils/string.js.map +1 -0
  37. package/dist/lib/utils/strip-ansi.d.ts +15 -0
  38. package/dist/lib/utils/strip-ansi.js +28 -0
  39. package/dist/lib/utils/strip-ansi.js.map +1 -0
  40. package/dist/lib/utils/ze-http-request.d.ts +17 -3
  41. package/dist/lib/utils/ze-http-request.js +145 -52
  42. package/dist/lib/utils/ze-http-request.js.map +1 -1
  43. package/dist/package.json +1 -1
  44. package/package.json +1 -1
  45. package/test/utils/string.test.ts +96 -0
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ZEPHYR_API_ENDPOINT, ZE_API_ENDPOINT, ze_api_gateway } from './lib/api-contract-negotiation/get-api-contract';
2
2
  export { PublishRequest, StageZeroPublishRequest } from './lib/edge-api/publish-request';
3
3
  export { ZeEnvs, ZeUploadBuildStats } from './lib/edge-api/ze-envs-request';
4
+ export { ZeErrorCategories, ZeErrorCodes, ZeErrorKeys, ZeErrorType, ZeErrors, ZephyrError } from './lib/errors';
4
5
  export * as appDeployResultCache from './lib/node-persist/app-deploy-result-cache';
5
6
  export { getAppConfig, remoteAppConfig, saveAppConfig } from './lib/node-persist/application-configuration';
6
7
  export * as _fs_cache from './lib/node-persist/fs-cache';
@@ -17,8 +18,9 @@ export { brightBlueBgName, brightGreenBgName, brightRedBgName, brightYellowBgNam
17
18
  export * from './lib/utils/debug-enabled';
18
19
  export * from './lib/utils/picocolor';
19
20
  export * as color from './lib/utils/picocolor';
21
+ export * as ZeUtils from './lib/utils/promise';
20
22
  export { safe_json_parse } from './lib/utils/safe-json-parse';
21
- export { request } from './lib/utils/ze-http-request';
23
+ export { HttpResponse, UrlString, ZeHttpRequest } from './lib/utils/ze-http-request';
22
24
  export { ZeApplicationList } from './lib/ze-api/app-list';
23
25
  export { ZeAppVersion, ZeAppVersionResponse } from './lib/ze-api/app-version';
24
26
  export { ConvertedGraph } from './lib/ze-api/converted-graph';
package/dist/index.js CHANGED
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.request = exports.safe_json_parse = exports.color = exports.ze_log = exports.ze_error = exports.dimmedName = exports.brightYellowBgName = exports.brightRedBgName = exports.brightGreenBgName = exports.brightBlueBgName = exports.createSnapshotId = exports.createApplicationUID = exports.saveToken = exports.removeToken = exports.getToken = exports.cleanTokens = exports.hasSecretToken = exports.getSecretToken = exports.savePartialAssetMap = exports.removePartialAssetMap = exports.getPartialAssetMap = exports._hash_cache = exports._fs_cache = exports.saveAppConfig = exports.remoteAppConfig = exports.getAppConfig = exports.appDeployResultCache = exports.ze_api_gateway = exports.ZE_API_ENDPOINT = exports.ZEPHYR_API_ENDPOINT = void 0;
3
+ exports.ZeHttpRequest = exports.safe_json_parse = exports.ZeUtils = exports.color = exports.ze_log = exports.ze_error = exports.dimmedName = exports.brightYellowBgName = exports.brightRedBgName = exports.brightGreenBgName = exports.brightBlueBgName = exports.createSnapshotId = exports.createApplicationUID = exports.saveToken = exports.removeToken = exports.getToken = exports.cleanTokens = exports.hasSecretToken = exports.getSecretToken = exports.savePartialAssetMap = exports.removePartialAssetMap = exports.getPartialAssetMap = exports._hash_cache = exports._fs_cache = exports.saveAppConfig = exports.remoteAppConfig = exports.getAppConfig = exports.appDeployResultCache = exports.ZephyrError = exports.ZeErrors = exports.ZeErrorCategories = exports.ze_api_gateway = exports.ZE_API_ENDPOINT = exports.ZEPHYR_API_ENDPOINT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var get_api_contract_1 = require("./lib/api-contract-negotiation/get-api-contract");
6
6
  Object.defineProperty(exports, "ZEPHYR_API_ENDPOINT", { enumerable: true, get: function () { return get_api_contract_1.ZEPHYR_API_ENDPOINT; } });
7
7
  Object.defineProperty(exports, "ZE_API_ENDPOINT", { enumerable: true, get: function () { return get_api_contract_1.ZE_API_ENDPOINT; } });
8
8
  Object.defineProperty(exports, "ze_api_gateway", { enumerable: true, get: function () { return get_api_contract_1.ze_api_gateway; } });
9
+ var errors_1 = require("./lib/errors");
10
+ Object.defineProperty(exports, "ZeErrorCategories", { enumerable: true, get: function () { return errors_1.ZeErrorCategories; } });
11
+ Object.defineProperty(exports, "ZeErrors", { enumerable: true, get: function () { return errors_1.ZeErrors; } });
12
+ Object.defineProperty(exports, "ZephyrError", { enumerable: true, get: function () { return errors_1.ZephyrError; } });
9
13
  exports.appDeployResultCache = tslib_1.__importStar(require("./lib/node-persist/app-deploy-result-cache"));
10
14
  var application_configuration_1 = require("./lib/node-persist/application-configuration");
11
15
  Object.defineProperty(exports, "getAppConfig", { enumerable: true, get: function () { return application_configuration_1.getAppConfig; } });
@@ -41,8 +45,9 @@ Object.defineProperty(exports, "ze_log", { enumerable: true, get: function () {
41
45
  tslib_1.__exportStar(require("./lib/utils/debug-enabled"), exports);
42
46
  tslib_1.__exportStar(require("./lib/utils/picocolor"), exports);
43
47
  exports.color = tslib_1.__importStar(require("./lib/utils/picocolor"));
48
+ exports.ZeUtils = tslib_1.__importStar(require("./lib/utils/promise"));
44
49
  var safe_json_parse_1 = require("./lib/utils/safe-json-parse");
45
50
  Object.defineProperty(exports, "safe_json_parse", { enumerable: true, get: function () { return safe_json_parse_1.safe_json_parse; } });
46
51
  var ze_http_request_1 = require("./lib/utils/ze-http-request");
47
- Object.defineProperty(exports, "request", { enumerable: true, get: function () { return ze_http_request_1.request; } });
52
+ Object.defineProperty(exports, "ZeHttpRequest", { enumerable: true, get: function () { return ze_http_request_1.ZeHttpRequest; } });
48
53
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oFAAuH;AAA9G,uHAAA,mBAAmB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,kHAAA,cAAc,OAAA;AAG7D,2GAAmF;AACnF,0FAA4G;AAAnG,yHAAA,YAAY,OAAA;AAAE,4HAAA,eAAe,OAAA;AAAE,0HAAA,aAAa,OAAA;AACrD,iFAAyD;AACzD,qFAA6D;AAC7D,4EAAuH;AAA9G,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACvE,gEAAiF;AAAxE,8GAAA,cAAc,OAAA;AAAE,8GAAA,cAAc,OAAA;AACvC,kDAAyF;AAAhF,oGAAA,WAAW,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,kGAAA,SAAS,OAAA;AACtD,qFAA2D;AAG3D,iFAA4E;AAAnE,gIAAA,oBAAoB,OAAA;AAC7B,qEAAkE;AAAzD,sHAAA,gBAAgB,OAAA;AACzB,2CAA2I;AAAlI,yGAAA,gBAAgB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,mGAAA,UAAU,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,+FAAA,MAAM,OAAA;AAC/G,oEAA0C;AAC1C,gEAAsC;AACtC,uEAA+C;AAC/C,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AACxB,+DAAsD;AAA7C,0GAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oFAAuH;AAA9G,uHAAA,mBAAmB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,kHAAA,cAAc,OAAA;AAG7D,uCAAgH;AAAvG,2GAAA,iBAAiB,OAAA;AAA0C,kGAAA,QAAQ,OAAA;AAAE,qGAAA,WAAW,OAAA;AACzF,2GAAmF;AACnF,0FAA4G;AAAnG,yHAAA,YAAY,OAAA;AAAE,4HAAA,eAAe,OAAA;AAAE,0HAAA,aAAa,OAAA;AACrD,iFAAyD;AACzD,qFAA6D;AAC7D,4EAAuH;AAA9G,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACvE,gEAAiF;AAAxE,8GAAA,cAAc,OAAA;AAAE,8GAAA,cAAc,OAAA;AACvC,kDAAyF;AAAhF,oGAAA,WAAW,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,kGAAA,SAAS,OAAA;AACtD,qFAA2D;AAG3D,iFAA4E;AAAnE,gIAAA,oBAAoB,OAAA;AAC7B,qEAAkE;AAAzD,sHAAA,gBAAgB,OAAA;AACzB,2CAA2I;AAAlI,yGAAA,gBAAgB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,mGAAA,UAAU,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,+FAAA,MAAM,OAAA;AAC/G,oEAA0C;AAC1C,gEAAsC;AACtC,uEAA+C;AAC/C,uEAA+C;AAC/C,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AACxB,+DAAqF;AAAnD,gHAAA,aAAa,OAAA"}
@@ -1,5 +1,7 @@
1
1
  export declare const ZEPHYR_API_ENDPOINT: () => string;
2
2
  export declare const ZE_API_ENDPOINT: () => string;
3
+ export declare const ZE_API_ENDPOINT_HOST: () => string;
4
+ export declare const ZE_IS_PREVIEW: () => boolean;
3
5
  export declare const ze_api_gateway: {
4
6
  logs: string;
5
7
  build_stats: string;
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ze_api_gateway = exports.ZE_API_ENDPOINT = exports.ZEPHYR_API_ENDPOINT = void 0;
3
+ exports.ze_api_gateway = exports.ZE_IS_PREVIEW = exports.ZE_API_ENDPOINT_HOST = exports.ZE_API_ENDPOINT = exports.ZEPHYR_API_ENDPOINT = void 0;
4
4
  const ZEPHYR_API_ENDPOINT = () => { var _a; return (_a = process.env['ZE_API']) !== null && _a !== void 0 ? _a : 'https://api.zephyr-cloud.io'; };
5
5
  exports.ZEPHYR_API_ENDPOINT = ZEPHYR_API_ENDPOINT;
6
6
  const ZE_API_ENDPOINT = () => { var _a; return (_a = process.env['ZE_API_GATE']) !== null && _a !== void 0 ? _a : 'https://zeapi.zephyrcloud.app'; };
7
7
  exports.ZE_API_ENDPOINT = ZE_API_ENDPOINT;
8
+ const ZE_API_ENDPOINT_HOST = () => new URL((0, exports.ZE_API_ENDPOINT)()).host;
9
+ exports.ZE_API_ENDPOINT_HOST = ZE_API_ENDPOINT_HOST;
10
+ const ZE_IS_PREVIEW = () => process.env['ZE_IS_PREVIEW'] === 'true';
11
+ exports.ZE_IS_PREVIEW = ZE_IS_PREVIEW;
8
12
  exports.ze_api_gateway = {
9
13
  logs: '/logs',
10
14
  build_stats: '/build-stats',
@@ -1 +1 @@
1
- {"version":3,"file":"get-api-contract.js","sourceRoot":"","sources":["../../../src/lib/api-contract-negotiation/get-api-contract.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,GAAG,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,6BAA6B,CAAA,EAAA,CAAC;AAAnF,QAAA,mBAAmB,uBAAgE;AAEzF,MAAM,eAAe,GAAG,GAAG,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,mCAAI,+BAA+B,CAAA,EAAA,CAAC;AAAtF,QAAA,eAAe,mBAAuE;AAEtF,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,UAAU;IACnB,kBAAkB,EAAE,qBAAqB;CAC1C,CAAC"}
1
+ {"version":3,"file":"get-api-contract.js","sourceRoot":"","sources":["../../../src/lib/api-contract-negotiation/get-api-contract.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,GAAG,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,6BAA6B,CAAA,EAAA,CAAC;AAAnF,QAAA,mBAAmB,uBAAgE;AAEzF,MAAM,eAAe,GAAG,GAAG,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,mCAAI,+BAA+B,CAAA,EAAA,CAAC;AAAtF,QAAA,eAAe,mBAAuE;AAE5F,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,IAAA,uBAAe,GAAE,CAAC,CAAC,IAAI,CAAC;AAA7D,QAAA,oBAAoB,wBAAyC;AAEnE,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,MAAM,CAAC;AAA9D,QAAA,aAAa,iBAAiD;AAE9D,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,UAAU;IACnB,kBAAkB,EAAE,qBAAqB;CAC1C,CAAC"}
@@ -0,0 +1,276 @@
1
+ /** Categories for all error codes. */
2
+ export declare const ZeErrorCategories: {
3
+ /** Error we have yet catched and known */
4
+ readonly unknown: "00";
5
+ /** Stage 0 build error */
6
+ readonly build: "10";
7
+ /** Stage 1 Deployment error */
8
+ readonly deploy: "20";
9
+ /** Browser error */
10
+ readonly browser: "30";
11
+ /** Module Federation/Config related error */
12
+ readonly config: "40";
13
+ };
14
+ /**
15
+ * A collection of error types and the error code during local/build stage
16
+ *
17
+ * 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,
18
+ * search for `ZE20` and then followed with their ID.
19
+ *
20
+ * - `ZE` at the front is a constant
21
+ * - Two digits at the middle PP (`10` for build error or `20` for deployment error) is their categories,
22
+ * - Last three digits is their ID.
23
+ *
24
+ * For example, if you have a `SNAPSHOT_NOT_FOUND` error, search for `ZE20023`, if you see an error showing up on terminal or application,
25
+ * the last three numbers are their IDs. We might extend to have more errors in the future.
26
+ */
27
+ export declare const ZeErrors: {
28
+ readonly ERR_UNKNOWN: {
29
+ readonly id: "000";
30
+ readonly message: "\nUnknown error: {{ message }}\n\n";
31
+ readonly kind: "unknown";
32
+ };
33
+ /** Package.json not found error */
34
+ readonly ERR_PACKAGE_JSON_NOT_FOUND: {
35
+ readonly id: "010";
36
+ readonly message: "package.json not found";
37
+ readonly kind: "build";
38
+ };
39
+ /** Package.json is not in a valid json format */
40
+ readonly ERR_PACKAGE_JSON_NOT_VALID: {
41
+ readonly id: "011";
42
+ readonly message: "Package.json is not in a valid json format.";
43
+ readonly kind: "build";
44
+ };
45
+ /** Webpack config error */
46
+ readonly ERR_WEBPACK_CONFIG: {
47
+ readonly id: "012";
48
+ readonly message: "Webpack config error.";
49
+ readonly kind: "build";
50
+ };
51
+ readonly ERR_PACKAGE_JSON_MUST_HAVE_NAME_VERSION: {
52
+ readonly id: "013";
53
+ readonly message: "Zephyr need package.json to have name and version field to map your application configuration in deployment. Please ensure these fields exists in your package.json.";
54
+ readonly kind: "build";
55
+ };
56
+ readonly ERR_GIT_REMOTE_ORIGIN: {
57
+ readonly id: "014";
58
+ readonly message: "\nGit remote origin is not configured properly. git remote origin is not configured properly\n- please set valid 'git remote origin' by using commands below\n- git init && git remote add origin <url>\n";
59
+ readonly kind: "build";
60
+ };
61
+ /** Git username or email is not configured. */
62
+ readonly ERR_NO_GIT_USERNAME_EMAIL: {
63
+ readonly id: "015";
64
+ readonly message: "\nGit username or email is not configured:\n- please set valid 'git config user.name' and 'git config user.email'\n- or provide ZE_USER_TOKEN as environment variable\n";
65
+ readonly kind: "build";
66
+ };
67
+ /** Could not get git info */
68
+ readonly ERR_NO_GIT_INFO: {
69
+ readonly id: "016";
70
+ readonly message: "Could not get git info.\nCan you confirm this directory has initialized as a git repository?";
71
+ readonly kind: "build";
72
+ };
73
+ /** Build error application_uid missing. */
74
+ readonly ERR_MISSING_APPLICATION_UID: {
75
+ readonly id: "017";
76
+ readonly message: "`application_uid` missing.";
77
+ readonly kind: "build";
78
+ };
79
+ /** Auth error */
80
+ readonly ERR_AUTH_ERROR: {
81
+ readonly id: "018";
82
+ readonly message: "\nFailed to authenticate with Zephyr.\n\nPlease make sure you have a valid Zephyr account and you are logged in.\n\n{{ message }}\n";
83
+ readonly kind: "build";
84
+ };
85
+ readonly ERR_GET_BUILD_ID: {
86
+ readonly id: "019";
87
+ readonly message: "\nCould not generate Build ID. Ensure you meet the following requirements:\n\n1. Your Zephyr Account ({{ username }}) has write access to {{ application_uid }}\n2. You own the repository or is a collaborator with write access.\n3. This repository has commit history and has a proper git remote origin url.\n\nWhen trying out public examples, make sure to fork the repository to your account so you can have write access.\n\n";
88
+ readonly kind: "build";
89
+ };
90
+ /** Could not initialize Zephyr Agent. */
91
+ readonly ERR_INITIALIZE_ZEPHYR_AGENT: {
92
+ readonly id: "020";
93
+ readonly message: "Could not initialize Zephyr Agent.";
94
+ readonly kind: "build";
95
+ };
96
+ /** Cloudflare specific error */
97
+ readonly ERR_UNABLE_CREATE_DIST_FOLDER: {
98
+ readonly id: "021";
99
+ readonly message: "Error creating dist folder.";
100
+ readonly kind: "build";
101
+ };
102
+ /** Deployment error, assets not found */
103
+ readonly ERR_ASSETS_NOT_FOUND: {
104
+ readonly id: "010";
105
+ readonly message: "Assets not found.";
106
+ readonly kind: "deploy";
107
+ };
108
+ /** Assets not found in snapshot */
109
+ readonly ERR_ASSETS_NOT_FOUND_IN_SNAPSHOT: {
110
+ readonly id: "011";
111
+ readonly message: "Assets not found in snapshot.";
112
+ readonly kind: "deploy";
113
+ };
114
+ /** Application_uid missing */
115
+ readonly ERR_DEPLOY_MISSING_APPLICATION_UID: {
116
+ readonly id: "012";
117
+ readonly message: "`application_uid` is required.";
118
+ readonly kind: "deploy";
119
+ };
120
+ readonly ERR_MISSING_FILE_HASH: {
121
+ readonly id: "013";
122
+ readonly message: "Missing file hash.";
123
+ readonly kind: "deploy";
124
+ };
125
+ /** Failed to load application configuration. */
126
+ readonly ERR_LOAD_APP_CONFIG: {
127
+ readonly id: "014";
128
+ readonly message: "\n\nFailed to load Application Configuration for {{ application_uid }}.\n\nTry to remove ~/.zephyr folder and try again.\n\n ";
129
+ readonly kind: "deploy";
130
+ };
131
+ /** Did not receive envs from build stats upload */
132
+ readonly ERR_NOT_RECEIVE_ENVS_FROM_BUILD_STATS: {
133
+ readonly id: "016";
134
+ readonly message: "Did not receive envs from build stats upload.";
135
+ readonly kind: "deploy";
136
+ };
137
+ /** Failed to upload assets. */
138
+ readonly ERR_FAILED_UPLOAD: {
139
+ readonly id: "017";
140
+ readonly message: "\n\nCould not upload {{ type }} to your Edge Provider. This error will affect your tags and environments and it might fail deployments to custom domains.\n\nPlease check your network connection and try again.\n\n ";
141
+ readonly kind: "deploy";
142
+ };
143
+ /** Snapshot uploads gave no results. */
144
+ readonly ERR_SNAPSHOT_UPLOADS_NO_RESULTS: {
145
+ readonly id: "019";
146
+ readonly message: "Snapshot uploads gave no results.";
147
+ readonly kind: "deploy";
148
+ };
149
+ /** Failed to get application hash list */
150
+ readonly ERR_GET_APPLICATION_HASH_LIST: {
151
+ readonly id: "020";
152
+ readonly message: "Failed to get application hash list.";
153
+ readonly kind: "deploy";
154
+ };
155
+ readonly ERR_SNAPSHOT_ID_NOT_FOUND: {
156
+ readonly id: "022";
157
+ readonly message: "`snapshot_id` not found.";
158
+ readonly kind: "deploy";
159
+ };
160
+ readonly ERR_SNAPSHOT_NOT_FOUND: {
161
+ readonly id: "023";
162
+ readonly message: "Snapshot not found.";
163
+ readonly kind: "deploy";
164
+ };
165
+ readonly ERR_DEPLOY_LOCAL_BUILD: {
166
+ readonly id: "024";
167
+ readonly message: "Failed to deploy local build.";
168
+ readonly kind: "deploy";
169
+ };
170
+ /** Cloudflare specific error */
171
+ readonly ERR_WRANGLER_DEPENDENCY: {
172
+ readonly id: "025";
173
+ readonly message: "Wrangler dependency is needed for Cloudflare deployment. Please install dependencies without --no-optional flag.";
174
+ readonly kind: "deploy";
175
+ };
176
+ readonly ERR_CONVERT_GRAPH_TO_DASHBOARD: {
177
+ readonly id: "026";
178
+ readonly message: "\nFailed to convert federation configuration to needed information. We are reading your Module Federation configuration to understand your shared dependencies:\n\n- host application's name\n- remote application's name\n- shared dependencies.\n\nPlease refer to the official Module Federation guide https://module-federation.io/configure/index.html to make sure your have required inputs.\n";
179
+ readonly kind: "browser";
180
+ };
181
+ readonly ERR_UPLOAD_TO_CLOUDFLARE_PAGES: {
182
+ readonly id: "027";
183
+ readonly message: "Error upload to Cloudflare pages.";
184
+ readonly kind: "deploy";
185
+ };
186
+ readonly ERR_USER_IDENTITY: {
187
+ readonly id: "036";
188
+ readonly message: "\nGit username or email is not configured\n - please set valid 'git config user.name' and 'git config user.email'\n - or provide ZE_USER_TOKEN as environment variable\n";
189
+ readonly kind: "deploy";
190
+ };
191
+ readonly ERR_TLS_CERT_ALTNAME_INVALID: {
192
+ readonly id: "034";
193
+ readonly message: "You domain's TLS Certificate is invalid. Have you updated your domain settings with your Registrar?";
194
+ readonly kind: "deploy";
195
+ };
196
+ readonly ERR_HTTP_ERROR: {
197
+ readonly id: "035";
198
+ readonly message: "\n\nHTTP request for {{ method }} {{ url }} failed with status code {{ status }}.\n\nPlease check your network connection and try again.\n\n{{ content }}\n\n";
199
+ readonly kind: "config";
200
+ };
201
+ readonly ERR_NO_WRANGLER: {
202
+ readonly id: "028";
203
+ readonly message: "Wrangler is not installed. It's needed for Cloudflare deployment. Please install dependencies without --no-optional flag.";
204
+ readonly kind: "build";
205
+ };
206
+ readonly ERR_CREATE_DIST_FOLDER: {
207
+ readonly id: "029";
208
+ readonly message: "Error on creating dist folder. Zephyr is unable to create dist folder for your application's configuration.";
209
+ readonly kind: "build";
210
+ };
211
+ /**
212
+ * This case needs to be specific without a message as the server respond with 40*, so we will need to prioritize the server status code
213
+ * and prints out the status
214
+ *
215
+ * @example
216
+ * {
217
+ * "statusCode": 401,
218
+ * "timestamp": "2024-08-23T02:21:48.873Z",
219
+ * "path": "/v2/builder-packages-api/application-config?application-uid=home-spa.federated_apps.zmzlois"
220
+ * }
221
+ */
222
+ readonly ERR_NO_RESPONSE_FOR_APP_CONFIG: {
223
+ readonly id: "030";
224
+ readonly message: "Failed to load application configuration.";
225
+ readonly kind: "build";
226
+ };
227
+ readonly ERR_NO_JWT: {
228
+ readonly id: "031";
229
+ readonly message: "You don't have valid JWT token. Try to log out from the dashboard and log in again. https://app.zephyr-cloud.io";
230
+ readonly kind: "build";
231
+ };
232
+ readonly ERR_JWT_INVALID: {
233
+ readonly id: "032";
234
+ readonly message: "Your JWT token is invalid. Try to log out from the dashboard and log in again. https://app.zephyr-cloud.io";
235
+ readonly kind: "build";
236
+ };
237
+ readonly ERR_WEBSOCKET_CONNECTION: {
238
+ readonly id: "034";
239
+ readonly message: "Websocket connection error during login.";
240
+ readonly kind: "build";
241
+ };
242
+ readonly ERR_GET_APP_CONFIG: {
243
+ readonly id: "035";
244
+ readonly message: "Error when getting application configuration from API. Could not find application configuration. Please try again after removing ~/.zephyr folder.";
245
+ readonly kind: "build";
246
+ };
247
+ readonly ERR_GIT_COMMIT_HASH: {
248
+ readonly id: "036";
249
+ readonly message: "Failed to get git commit hash. Can you make sure this git repository has commit history?";
250
+ readonly kind: "build";
251
+ };
252
+ readonly ERR_RESOLVE_REMOTES: {
253
+ readonly id: "001";
254
+ readonly message: "\nPlease build {{ appUid }} with Zephyr first or add as Unmanaged applications.\n\nNote: you can read application uid as follows:\n- {{ appName }} - project.json 'name' field of remote application\n- {{ projectName }} - git repository name\n- {{ orgName }} - git organization name\n\n";
255
+ readonly kind: "config";
256
+ };
257
+ readonly ERR_CANNOT_RESOLVE_APP_NAME_WITH_VERSION: {
258
+ readonly id: "003";
259
+ readonly message: "\nIs the remote application being built? We are not able to find your remote application based on application_uid and remote name in configuration.\nNote that we typically map your remote based on below values\n\n- git username\n- git repository name\n- name in package.json\n- name in micro-frontend configuration.\n\nWe have a complete checklist for Micro-Frontend application configuration here: https://docs.zephyr-cloud.io/how-to/mf-guide\n ";
260
+ readonly kind: "config";
261
+ };
262
+ };
263
+ /** Error object for Zephyr errors. */
264
+ export type ZeErrors = typeof ZeErrors;
265
+ /** `"ERR_UNKNOWN"`, `"ERR_PACKAGE_JSON_NOT_FOUND"` ... */
266
+ export type ZeErrorKeys = keyof ZeErrors;
267
+ /** `ZeErrors.ERR_UNKNOWN`, `ZeErrors.ERR_PACKAGE_JSON_NOT_FOUND` ... */
268
+ export type ZeErrorType = ZeErrors[ZeErrorKeys];
269
+ /** Builds a Zephyr error code from a given error type. */
270
+ export type ZeErrorCode<K extends ZeErrorKeys> = `ZE${(typeof ZeErrorCategories)[ZeErrors[K]['kind']]}${ZeErrors[K]['id']}`;
271
+ /** `"ZE00000"`, `"ZE10010"` ... */
272
+ export type ZeErrorCodes = {
273
+ [K in ZeErrorKeys]: ZeErrorCode<K>;
274
+ }[ZeErrorKeys];
275
+ /** Ensures `a` and `b` are the same error type. */
276
+ export declare function isZeErrorEqual(a: ZeErrorType, b: ZeErrorType): boolean;