zephyr-edge-contract 0.0.0-canary-20241122011536 → 0.0.0-canary-20241122020244
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.
- package/dist/index.d.ts +22 -9
- package/dist/index.js +45 -24
- package/dist/index.js.map +1 -1
- package/dist/lib/api-contract-negotiation/get-api-contract.js +0 -1
- package/dist/lib/api-contract-negotiation/get-api-contract.js.map +1 -1
- package/dist/lib/errors/codes.d.ts +308 -0
- package/dist/lib/errors/codes.js +406 -0
- package/dist/lib/errors/codes.js.map +1 -0
- package/dist/lib/errors/index.d.ts +2 -0
- package/dist/lib/errors/index.js +6 -0
- package/dist/lib/errors/index.js.map +1 -0
- package/dist/lib/errors/zephyr.d.ts +513 -0
- package/dist/lib/errors/zephyr.js +153 -0
- package/dist/lib/errors/zephyr.js.map +1 -0
- package/dist/lib/node-persist/app-deploy-result-cache.d.ts +7 -0
- package/dist/lib/node-persist/app-deploy-result-cache.js +26 -0
- package/dist/lib/node-persist/app-deploy-result-cache.js.map +1 -0
- package/dist/lib/node-persist/application-configuration.d.ts +4 -0
- package/dist/lib/node-persist/application-configuration.js +29 -0
- package/dist/lib/node-persist/application-configuration.js.map +1 -0
- package/dist/lib/node-persist/fs-cache.d.ts +3 -0
- package/dist/lib/node-persist/fs-cache.js +26 -0
- package/dist/lib/node-persist/fs-cache.js.map +1 -0
- package/dist/lib/node-persist/hash-cache.d.ts +7 -0
- package/dist/lib/node-persist/hash-cache.js +26 -0
- package/dist/lib/node-persist/hash-cache.js.map +1 -0
- package/dist/lib/node-persist/partial-assets-map.d.ts +4 -0
- package/dist/lib/node-persist/partial-assets-map.js +31 -0
- package/dist/lib/node-persist/partial-assets-map.js.map +1 -0
- package/dist/lib/node-persist/secret-token.d.ts +2 -0
- package/dist/lib/node-persist/secret-token.js +13 -0
- package/dist/lib/node-persist/secret-token.js.map +1 -0
- package/dist/lib/node-persist/storage-keys.d.ts +10 -0
- package/dist/lib/node-persist/storage-keys.js +15 -0
- package/dist/lib/node-persist/storage-keys.js.map +1 -0
- package/dist/lib/node-persist/token.d.ts +4 -0
- package/dist/lib/node-persist/token.js +36 -0
- package/dist/lib/node-persist/token.js.map +1 -0
- package/dist/lib/node-persist/upload-provider-options.d.ts +22 -0
- package/dist/lib/node-persist/upload-provider-options.js +13 -0
- package/dist/lib/node-persist/upload-provider-options.js.map +1 -0
- package/dist/lib/plugin-options/{zephyr-webpack-plugin-options.d.ts → zephyr-plugin-options.d.ts} +3 -0
- package/dist/lib/plugin-options/{zephyr-webpack-plugin-options.js → zephyr-plugin-options.js} +1 -1
- package/dist/lib/plugin-options/zephyr-plugin-options.js.map +1 -0
- package/dist/lib/snapshot.js +0 -1
- package/dist/lib/snapshot.js.map +1 -1
- package/dist/lib/utils/clean-stack.d.ts +7 -0
- package/dist/lib/utils/clean-stack.js +44 -0
- package/dist/lib/utils/clean-stack.js.map +1 -0
- package/dist/lib/utils/{create-application-uid.d.ts → create-application-u-i-d.d.ts} +1 -1
- package/dist/lib/utils/{create-application-uid.js → create-application-u-i-d.js} +6 -5
- package/dist/lib/utils/create-application-u-i-d.js.map +1 -0
- package/dist/lib/utils/create-snapshot-id.d.ts +0 -7
- package/dist/lib/utils/create-snapshot-id.js +4 -18
- package/dist/lib/utils/create-snapshot-id.js.map +1 -1
- package/dist/lib/utils/debug-enabled.d.ts +1 -0
- package/dist/lib/utils/debug-enabled.js +9 -0
- package/dist/lib/utils/debug-enabled.js.map +1 -0
- package/dist/lib/utils/debug.d.ts +22 -0
- package/dist/lib/utils/debug.js +36 -0
- package/dist/lib/utils/debug.js.map +1 -0
- package/dist/lib/utils/error-codes-messages.d.ts +206 -0
- package/dist/lib/utils/error-codes-messages.js +203 -0
- package/dist/lib/utils/error-codes-messages.js.map +1 -0
- package/dist/lib/utils/error-formatted-message.d.ts +5 -0
- package/dist/lib/utils/error-formatted-message.js +36 -0
- package/dist/lib/utils/error-formatted-message.js.map +1 -0
- package/dist/lib/utils/picocolor.d.ts +43 -0
- package/dist/lib/utils/picocolor.js +85 -0
- package/dist/lib/utils/picocolor.js.map +1 -0
- package/dist/lib/utils/promise.d.ts +12 -0
- package/dist/lib/utils/promise.js +29 -0
- package/dist/lib/utils/promise.js.map +1 -0
- package/dist/lib/{string → utils}/string.d.ts +2 -6
- package/dist/lib/{string → utils}/string.js +1 -2
- package/dist/lib/utils/string.js.map +1 -0
- package/dist/lib/{string → utils}/strip-ansi.d.ts +1 -2
- package/dist/lib/{string → utils}/strip-ansi.js +1 -2
- package/dist/lib/utils/strip-ansi.js.map +1 -0
- package/dist/lib/utils/ze-http-request.d.ts +19 -0
- package/dist/lib/utils/ze-http-request.js +157 -0
- package/dist/lib/utils/ze-http-request.js.map +1 -0
- package/dist/lib/ze-api/converted-graph.d.ts +2 -0
- package/dist/lib/zephyr-build-stats.d.ts +14 -30
- package/dist/lib/zephyr-build-stats.js +0 -1
- package/dist/lib/zephyr-build-stats.js.map +1 -1
- package/dist/lib/zephyr-edge-contract.d.ts +4 -12
- package/dist/lib/zephyr-edge-contract.js +0 -1
- package/dist/lib/zephyr-edge-contract.js.map +1 -1
- package/dist/package.json +7 -3
- package/package.json +7 -3
- package/test/utils/string.test.ts +96 -0
- package/dist/lib/plugin-options/zephyr-webpack-plugin-options.js.map +0 -1
- package/dist/lib/promise/index.d.ts +0 -29
- package/dist/lib/promise/index.js +0 -63
- package/dist/lib/promise/index.js.map +0 -1
- package/dist/lib/string/string.js.map +0 -1
- package/dist/lib/string/strip-ansi.js.map +0 -1
- package/dist/lib/utils/create-application-uid.js.map +0 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Replaces all occurrences of {{key}} in the string with the value of the key in the
|
|
3
|
-
* params object.
|
|
2
|
+
* Replaces all occurrences of {{key}} in the string with the value of the key in the params object.
|
|
4
3
|
*
|
|
5
4
|
* `{{ example }}` or `{{ example = value }}` to have a default value
|
|
6
5
|
*/
|
|
7
6
|
export declare function formatString<const S extends string>(str: S, params: Record<FindTemplates<S>, string | number | boolean>): string;
|
|
8
|
-
/**
|
|
9
|
-
* Gets a string like `{{ key }} text {{ key2 }}` and returns an string union with key and
|
|
10
|
-
* key2
|
|
11
|
-
*/
|
|
7
|
+
/** Gets a string like `{{ key }} text {{ key2 }}` and returns an string union with key and key2 */
|
|
12
8
|
export type FindTemplates<S extends string> = `${S}` extends `${infer Prefix}{{ ${infer Key} }}${infer Suffix}` ? FindTemplates<Prefix> | Key | FindTemplates<Suffix> : never;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatString = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Replaces all occurrences of {{key}} in the string with the value of the key in the
|
|
6
|
-
* params object.
|
|
5
|
+
* Replaces all occurrences of {{key}} in the string with the value of the key in the params object.
|
|
7
6
|
*
|
|
8
7
|
* `{{ example }}` or `{{ example = value }}` to have a default value
|
|
9
8
|
*/
|
|
@@ -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"}
|
|
@@ -8,8 +8,7 @@ const ANSI_REGEX = new RegExp([
|
|
|
8
8
|
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
9
9
|
].join('|'), 'g');
|
|
10
10
|
/**
|
|
11
|
-
* Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a
|
|
12
|
-
* string.
|
|
11
|
+
* Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
15
14
|
* ```
|
|
@@ -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,iDAAoD;AACpD,mCAAiC;AACjC,uCAA+D;AAC/D,uDAAoD;AAOpD,gCAAgC;AAChC,MAAa,aAAa;IAA1B;;QACE,wCAAwC;QACxC,+BAAS,IAAI,CAAC,GAAG,EAAE,EAAC;QAEpB,0BAA0B;QAC1B,qCAAW;QAEX,mCAAmC;QACnC,yCAA6B;QAE7B,yCAAyC;QACzC,sCAAwB;QAExB,0DAA0D;QAC1D,iCAAW,IAAA,8BAAoB,GAAmB,EAAC;QA6CnD,oBAAoB;QACpB,SAAI,GAAG,+BAAA,IAAI,8BAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,+BAAA,IAAI,8BAAS,CAAC,OAAO,CAAC,CAAC;QAqB9D,gDAAgD;QAChD,wCAAkB,CAAC,KAAU,EAAE,EAAE;;YAC/B,IAAI,8BAA8B,IAAI,KAAK,EAAE,CAAC;gBAC5C,+BAAA,IAAI,uDAAQ,MAAZ,IAAI,EACF,IAAI,oBAAW,CAAC,iBAAQ,CAAC,4BAA4B,E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tC,GAAG,CAAC,GAAG,CAAC,+BAAA,IAAI,2BAAM,CAAC,CAAC;AACtB,CAAC,yDAuFO,QAAiB;;IACvB,MAAM,GAAG,GAAG;QACV,IAAI,+BAAA,IAAI,8BAAS,CAAC,MAAM,IAAI,KAAK,KAAK,+BAAA,IAAI,0BAAK,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,+BAAA,IAAI,4BAAO,IAAI;QACjF,CAAA,MAAA,+BAAA,IAAI,2BAAM,0CAAE,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAA,+BAAA,IAAI,2BAAM,CAAC,MAAM,mCAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAChF,QAAQ,CAAC,CAAC,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;QACvC,+BAAA,IAAI,8BAAS,CAAC,CAAC,CAAC,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"}
|
|
@@ -3,6 +3,7 @@ export interface ConvertedGraph {
|
|
|
3
3
|
id?: string;
|
|
4
4
|
version?: string;
|
|
5
5
|
name?: string;
|
|
6
|
+
/** //TODO: what is this? */
|
|
6
7
|
remote: unknown;
|
|
7
8
|
metadata: unknown;
|
|
8
9
|
versionData: unknown;
|
|
@@ -17,4 +18,5 @@ export interface ConvertedGraph {
|
|
|
17
18
|
dependencies?: LocalPackageJson[];
|
|
18
19
|
devDependencies?: LocalPackageJson[];
|
|
19
20
|
optionalDependencies?: LocalPackageJson[];
|
|
21
|
+
target?: 'ios' | 'android' | 'web' | undefined;
|
|
20
22
|
}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
/** Todo: this worst and most outdated model so far, had to be refactored */
|
|
2
1
|
export interface ZephyrBuildStats {
|
|
3
|
-
/** @deprecated */
|
|
4
2
|
project: string;
|
|
5
3
|
/** Application_uid */
|
|
6
4
|
id: string;
|
|
7
5
|
name: string;
|
|
8
6
|
version: string;
|
|
9
|
-
/** @deprecated */
|
|
10
7
|
environment: string;
|
|
11
8
|
posted?: Date;
|
|
12
9
|
/** Default to `remoteEntry.js` unless user defines it */
|
|
13
10
|
remote: string | undefined;
|
|
14
|
-
/** @deprecated - Never use meta, metadata and other senseless data aggregator names */
|
|
15
11
|
metadata: unknown;
|
|
16
12
|
/**
|
|
17
|
-
* This is for understanding what dependencies are being shared and created by the
|
|
18
|
-
* remote
|
|
13
|
+
* This is for understanding what dependencies are being shared and created by the remote
|
|
19
14
|
*
|
|
20
15
|
* @question how are we going to use it in the future ?
|
|
21
16
|
*/
|
|
@@ -24,7 +19,6 @@ export interface ZephyrBuildStats {
|
|
|
24
19
|
consumes: ApplicationConsumes[];
|
|
25
20
|
/** This is the component this app is exposing, includes the component name and file name */
|
|
26
21
|
modules: ApplicationModule[];
|
|
27
|
-
/** @deprecated */
|
|
28
22
|
tags: string[];
|
|
29
23
|
/** Dependencies in package.json */
|
|
30
24
|
dependencies?: RawDependency[];
|
|
@@ -34,7 +28,7 @@ export interface ZephyrBuildStats {
|
|
|
34
28
|
peerDependencies?: RawDependency[];
|
|
35
29
|
/** DevDependencies in package.json */
|
|
36
30
|
devDependencies?: RawDependency[];
|
|
37
|
-
/**
|
|
31
|
+
/** What does this default means and what it indicates? */
|
|
38
32
|
default?: boolean;
|
|
39
33
|
/** If this is a host app all the remotes goes into here from the mFConfig */
|
|
40
34
|
remotes?: string[];
|
|
@@ -43,23 +37,17 @@ export interface ZephyrBuildStats {
|
|
|
43
37
|
name: string;
|
|
44
38
|
/** Version field form package.json */
|
|
45
39
|
version: string;
|
|
46
|
-
/**
|
|
47
|
-
* If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono,
|
|
48
|
-
* ZephyrCloudIO would be the org field here
|
|
49
|
-
*/
|
|
40
|
+
/** If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono, ZephyrCloudIO would be the org field here */
|
|
50
41
|
org: string;
|
|
51
|
-
/**
|
|
52
|
-
* If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono,
|
|
53
|
-
* zephyr-mono would be the project field here
|
|
54
|
-
*/
|
|
42
|
+
/** If the repository's git remote url is https://github.com/ZephyrCloudIO/zephyr-mono, zephyr-mono would be the project field here */
|
|
55
43
|
project: string;
|
|
56
44
|
/** This is the user's uuid */
|
|
57
45
|
buildId: string;
|
|
58
46
|
};
|
|
59
47
|
git: {
|
|
60
48
|
/**
|
|
61
|
-
* If the local git configuration sets a username this `git.name` would be the `git
|
|
62
|
-
*
|
|
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
|
|
63
51
|
*
|
|
64
52
|
* @required To build a successfully through Zephyr user must have this field
|
|
65
53
|
*/
|
|
@@ -71,15 +59,13 @@ export interface ZephyrBuildStats {
|
|
|
71
59
|
*/
|
|
72
60
|
email: string;
|
|
73
61
|
/**
|
|
74
|
-
* If the branch of this repository is set this would be the result after running `git
|
|
75
|
-
* rev-parse --abbrev-ref HEAD`
|
|
62
|
+
* If the branch of this repository is set this would be the result after running `git rev-parse --abbrev-ref HEAD`
|
|
76
63
|
*
|
|
77
64
|
* @required To build a successfully through Zephyr user must have this field
|
|
78
65
|
*/
|
|
79
66
|
branch: string;
|
|
80
67
|
/**
|
|
81
|
-
* If there has been commit of this repo, this would be the result of `git rev-parse
|
|
82
|
-
* HEAD`
|
|
68
|
+
* If there has been commit of this repo, this would be the result of `git rev-parse HEAD`
|
|
83
69
|
*
|
|
84
70
|
* @requires To build a successfully through Zephyr user must have this field
|
|
85
71
|
*/
|
|
@@ -89,19 +75,17 @@ export interface ZephyrBuildStats {
|
|
|
89
75
|
username?: string;
|
|
90
76
|
isCI: boolean;
|
|
91
77
|
};
|
|
92
|
-
/**
|
|
93
|
-
* Become the first part of `remote_host` and `remote_entry_url` in database in
|
|
94
|
-
* `ApplicationTag` table
|
|
95
|
-
*/
|
|
78
|
+
/** Become the first part of `remote_host` and `remote_entry_url` in database in `ApplicationTag` table */
|
|
96
79
|
edge: {
|
|
97
80
|
url: string;
|
|
98
81
|
versionUrl?: string;
|
|
99
82
|
};
|
|
100
|
-
|
|
101
|
-
/** @deprecated */
|
|
83
|
+
/** Unused legacy field */
|
|
102
84
|
platform?: DeploymentIntegrationPlatform | undefined;
|
|
103
|
-
/**
|
|
104
|
-
type
|
|
85
|
+
/** //TODO: remove this field, unused */
|
|
86
|
+
type?: unknown;
|
|
87
|
+
/** The target platform of the build */
|
|
88
|
+
build_target?: string;
|
|
105
89
|
}
|
|
106
90
|
declare enum DeploymentIntegrationPlatform {
|
|
107
91
|
CLOUDFLARE = "cloudflare",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zephyr-build-stats.js","sourceRoot":"","sources":["../../src/lib/zephyr-build-stats.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -20,26 +20,17 @@ interface KnownAssetInfo {
|
|
|
20
20
|
modulehash?: string | string[];
|
|
21
21
|
/** The value(s) of the content hash used for this asset */
|
|
22
22
|
contenthash?: string | string[];
|
|
23
|
-
/**
|
|
24
|
-
* When asset was created from a source file (potentially transformed), the original
|
|
25
|
-
* filename relative to compilation context
|
|
26
|
-
*/
|
|
23
|
+
/** When asset was created from a source file (potentially transformed), the original filename relative to compilation context */
|
|
27
24
|
sourceFilename?: string;
|
|
28
25
|
/** Size in bytes, only set after asset has been emitted */
|
|
29
26
|
size?: number;
|
|
30
|
-
/**
|
|
31
|
-
* True, when asset is only used for development and doesn't count towards user-facing
|
|
32
|
-
* assets
|
|
33
|
-
*/
|
|
27
|
+
/** True, when asset is only used for development and doesn't count towards user-facing assets */
|
|
34
28
|
development?: boolean;
|
|
35
29
|
/** True, when asset ships data for updating an existing application (HMR) */
|
|
36
30
|
hotModuleReplacement?: boolean;
|
|
37
31
|
/** True, when asset is javascript and an ESM */
|
|
38
32
|
javascriptModule?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Object of pointers to other assets, keyed by type of relation (only points from
|
|
41
|
-
* parent to child)
|
|
42
|
-
*/
|
|
33
|
+
/** Object of pointers to other assets, keyed by type of relation (only points from parent to child) */
|
|
43
34
|
related?: Record<string, string | string[]>;
|
|
44
35
|
}
|
|
45
36
|
export interface Source {
|
|
@@ -56,6 +47,7 @@ export interface UploadableAsset {
|
|
|
56
47
|
}
|
|
57
48
|
export interface ZeUploadAssetsOptions {
|
|
58
49
|
missingAssets: ZeBuildAsset[];
|
|
50
|
+
count: number;
|
|
59
51
|
assetsMap: {
|
|
60
52
|
[key: string]: ZeBuildAsset;
|
|
61
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zephyr-edge-contract.js","sourceRoot":"","sources":["../../src/lib/zephyr-edge-contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zephyr-edge-contract.js","sourceRoot":"","sources":["../../src/lib/zephyr-edge-contract.ts"],"names":[],"mappings":""}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-edge-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
"patch-version": "pnpm version"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"tslib": "^2.3.0"
|
|
14
|
+
"tslib": "^2.3.0",
|
|
15
|
+
"debug": "^4.3.4",
|
|
16
|
+
"node-persist": "^4.0.1"
|
|
15
17
|
},
|
|
16
18
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^20.11.19"
|
|
19
|
+
"@types/node": "^20.11.19",
|
|
20
|
+
"@types/node-persist": "^3.1.8",
|
|
21
|
+
"@types/debug": "^4.1.12"
|
|
18
22
|
}
|
|
19
23
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-edge-contract",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20241122020244",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"tslib": "^2.3.0"
|
|
9
|
+
"tslib": "^2.3.0",
|
|
10
|
+
"debug": "^4.3.4",
|
|
11
|
+
"node-persist": "^4.0.1"
|
|
10
12
|
},
|
|
11
13
|
"devDependencies": {
|
|
12
|
-
"@types/node": "^20.11.19"
|
|
14
|
+
"@types/node": "^20.11.19",
|
|
15
|
+
"@types/node-persist": "^3.1.8",
|
|
16
|
+
"@types/debug": "^4.1.12"
|
|
13
17
|
},
|
|
14
18
|
"scripts": {
|
|
15
19
|
"build": "nx build zephyr-edge-contract",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { formatString } from '../../src/lib/utils/string';
|
|
2
|
+
|
|
3
|
+
const data: { str: string; params: any; expected: string }[] = [
|
|
4
|
+
// no defaults
|
|
5
|
+
{
|
|
6
|
+
str: 'pre {{ name }} post',
|
|
7
|
+
params: { name: 'A' },
|
|
8
|
+
expected: 'pre A post',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
str: '{{ name }} post',
|
|
12
|
+
params: { name: 'A' },
|
|
13
|
+
expected: 'A post',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
str: 'pre {{ name }}',
|
|
17
|
+
params: { name: 'A' },
|
|
18
|
+
expected: 'pre A',
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// without params
|
|
22
|
+
{
|
|
23
|
+
str: 'pre {{ name }} post',
|
|
24
|
+
params: {},
|
|
25
|
+
expected: 'pre name post',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
str: '{{ name }} post',
|
|
29
|
+
params: {},
|
|
30
|
+
expected: 'name post',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
str: 'pre {{ name }}',
|
|
34
|
+
params: {},
|
|
35
|
+
expected: 'pre name',
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Default
|
|
39
|
+
{
|
|
40
|
+
str: 'pre {{ name = B }} post',
|
|
41
|
+
params: {},
|
|
42
|
+
expected: 'pre B post',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
str: '{{ name = B }} post',
|
|
46
|
+
params: {},
|
|
47
|
+
expected: 'B post',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
str: 'pre {{ name = B }}',
|
|
51
|
+
params: {},
|
|
52
|
+
expected: 'pre B',
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// Default with params
|
|
56
|
+
{
|
|
57
|
+
str: 'pre {{ name = B }} post',
|
|
58
|
+
params: { name: 'C' },
|
|
59
|
+
expected: 'pre C post',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
str: '{{ name = B }} post',
|
|
63
|
+
params: { name: 'C' },
|
|
64
|
+
expected: 'C post',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
str: 'pre {{ name = B }}',
|
|
68
|
+
params: { name: 'C' },
|
|
69
|
+
expected: 'pre C',
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
// Default with spaces
|
|
73
|
+
{
|
|
74
|
+
str: 'pre {{ name = A B }} post',
|
|
75
|
+
params: {},
|
|
76
|
+
expected: 'pre A B post',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
str: '{{ name = A B }} post',
|
|
80
|
+
params: {},
|
|
81
|
+
expected: 'A B post',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
str: 'pre {{ name = A B }}',
|
|
85
|
+
params: {},
|
|
86
|
+
expected: 'pre A B',
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
describe('formatString()', () => {
|
|
91
|
+
for (const { str, params, expected } of data) {
|
|
92
|
+
it(`Formats "${str}" with ${JSON.stringify(params)} to "${expected}"`, () => {
|
|
93
|
+
expect(formatString(str, params)).toBe(expected);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zephyr-webpack-plugin-options.js","sourceRoot":"","sources":["../../../src/lib/plugin-options/zephyr-webpack-plugin-options.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
/**
|
|
12
|
-
* Creates a deferred promise.
|
|
13
|
-
*
|
|
14
|
-
* @returns A tuple containing the promise, resolve and reject functions in array
|
|
15
|
-
*/
|
|
16
|
-
export declare function deferred<T>(): [
|
|
17
|
-
Promise<T>,
|
|
18
|
-
(value: T | PromiseLike<T>) => void,
|
|
19
|
-
(reason?: unknown) => void
|
|
20
|
-
];
|
|
21
|
-
/**
|
|
22
|
-
* Lazy loads a promise.
|
|
23
|
-
*
|
|
24
|
-
* @link https://github.com/sindresorhus/p-lazy
|
|
25
|
-
*/
|
|
26
|
-
export declare function PromiseLazyLoad<const T, const P = void>(promise: (params: P) => Promise<T>): (params: P) => Promise<T>;
|
|
27
|
-
/** Creates a `[error, value]` tuple value from a promise. */
|
|
28
|
-
export declare function PromiseTuple<P>(maybePromise: PromiseLike<P> | P): Promise<[null, P] | [unknown, undefined]>;
|
|
29
|
-
export declare function isSuccessTuple<P>(tuple: [unknown, P | undefined]): tuple is [null, P];
|