@fluid-experimental/property-common 0.49.0 → 0.50.0-41540
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/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/chronometer.d.ts +55 -0
- package/lib/chronometer.d.ts.map +1 -0
- package/lib/chronometer.js +185 -0
- package/lib/chronometer.js.map +1 -0
- package/lib/consoleUtils.d.ts +16 -0
- package/lib/consoleUtils.d.ts.map +1 -0
- package/lib/consoleUtils.js +20 -0
- package/lib/consoleUtils.js.map +1 -0
- package/lib/constants.d.ts +1219 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +1274 -0
- package/lib/constants.js.map +1 -0
- package/lib/datastructures/collection.d.ts +203 -0
- package/lib/datastructures/collection.d.ts.map +1 -0
- package/lib/datastructures/collection.js +377 -0
- package/lib/datastructures/collection.js.map +1 -0
- package/lib/datastructures/dataArray.d.ts +275 -0
- package/lib/datastructures/dataArray.d.ts.map +1 -0
- package/lib/datastructures/dataArray.js +497 -0
- package/lib/datastructures/dataArray.js.map +1 -0
- package/lib/datastructures/index.d.ts +9 -0
- package/lib/datastructures/index.d.ts.map +1 -0
- package/lib/datastructures/index.js +9 -0
- package/lib/datastructures/index.js.map +1 -0
- package/lib/datastructures/integer64.d.ts +47 -0
- package/lib/datastructures/integer64.d.ts.map +1 -0
- package/lib/datastructures/integer64.js +140 -0
- package/lib/datastructures/integer64.js.map +1 -0
- package/lib/datastructures/sortedCollection.d.ts +77 -0
- package/lib/datastructures/sortedCollection.d.ts.map +1 -0
- package/lib/datastructures/sortedCollection.js +140 -0
- package/lib/datastructures/sortedCollection.js.map +1 -0
- package/lib/deferredPromise.d.ts +28 -0
- package/lib/deferredPromise.d.ts.map +1 -0
- package/lib/deferredPromise.js +43 -0
- package/lib/deferredPromise.js.map +1 -0
- package/lib/deterministicRandomGenerator.d.ts +39 -0
- package/lib/deterministicRandomGenerator.d.ts.map +1 -0
- package/lib/deterministicRandomGenerator.js +83 -0
- package/lib/deterministicRandomGenerator.js.map +1 -0
- package/lib/error_objects/flaggedError.d.ts +29 -0
- package/lib/error_objects/flaggedError.d.ts.map +1 -0
- package/lib/error_objects/flaggedError.js +45 -0
- package/lib/error_objects/flaggedError.js.map +1 -0
- package/lib/error_objects/httpError.d.ts +31 -0
- package/lib/error_objects/httpError.d.ts.map +1 -0
- package/lib/error_objects/httpError.js +58 -0
- package/lib/error_objects/httpError.js.map +1 -0
- package/lib/error_objects/httpErrorNoStack.d.ts +25 -0
- package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -0
- package/lib/error_objects/httpErrorNoStack.js +29 -0
- package/lib/error_objects/httpErrorNoStack.js.map +1 -0
- package/lib/error_objects/index.d.ts +9 -0
- package/lib/error_objects/index.d.ts.map +1 -0
- package/lib/error_objects/index.js +9 -0
- package/lib/error_objects/index.js.map +1 -0
- package/lib/error_objects/operationError.d.ts +32 -0
- package/lib/error_objects/operationError.d.ts.map +1 -0
- package/lib/error_objects/operationError.js +73 -0
- package/lib/error_objects/operationError.js.map +1 -0
- package/lib/guidUtils.d.ts +16 -0
- package/lib/guidUtils.d.ts.map +1 -0
- package/lib/guidUtils.js +297 -0
- package/lib/guidUtils.js.map +1 -0
- package/lib/hashCalculator.d.ts +6 -0
- package/lib/hashCalculator.d.ts.map +1 -0
- package/lib/hashCalculator.js +14 -0
- package/lib/hashCalculator.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/joinPaths.d.ts +19 -0
- package/lib/joinPaths.d.ts.map +1 -0
- package/lib/joinPaths.js +28 -0
- package/lib/joinPaths.js.map +1 -0
- package/lib/packageVersion.d.ts +9 -0
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/packageVersion.js +9 -0
- package/lib/packageVersion.js.map +1 -0
- package/package.json +22 -2
- package/platform-dependent/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/packageVersion.ts +1 -1
- package/dist/test/chronometer.spec.js +0 -90
- package/dist/test/chronometer.spec.js.map +0 -1
- package/dist/test/datastructures/collection.spec.js +0 -401
- package/dist/test/datastructures/collection.spec.js.map +0 -1
- package/dist/test/datastructures/dataArray.spec.js +0 -79
- package/dist/test/datastructures/dataArray.spec.js.map +0 -1
- package/dist/test/datastructures/sortedCollection.spec.js +0 -106
- package/dist/test/datastructures/sortedCollection.spec.js.map +0 -1
- package/dist/test/deterministicRandomGenerator.spec.js +0 -18
- package/dist/test/deterministicRandomGenerator.spec.js.map +0 -1
- package/dist/test/error_objects/flaggedError.spec.js +0 -23
- package/dist/test/error_objects/flaggedError.spec.js.map +0 -1
- package/dist/test/error_objects/httpError.spec.js +0 -61
- package/dist/test/error_objects/httpError.spec.js.map +0 -1
- package/dist/test/error_objects/httpErrorNoStack.spec.js +0 -55
- package/dist/test/error_objects/httpErrorNoStack.spec.js.map +0 -1
- package/dist/test/error_objects/operationError.spec.js +0 -132
- package/dist/test/error_objects/operationError.spec.js.map +0 -1
- package/dist/test/guidUtils.spec.js +0 -184
- package/dist/test/guidUtils.spec.js.map +0 -1
- package/dist/test/strings/joinPaths.spec.js +0 -18
- package/dist/test/strings/joinPaths.spec.js.map +0 -1
- package/dist/test/tsconfig.tsbuildinfo +0 -2278
- package/nyc/mocha-junit-report.xml +0 -175
- package/src/test/chronometer.spec.ts +0 -99
- package/src/test/datastructures/collection.spec.ts +0 -567
- package/src/test/datastructures/dataArray.spec.ts +0 -81
- package/src/test/datastructures/sortedCollection.spec.ts +0 -128
- package/src/test/deterministicRandomGenerator.spec.ts +0 -18
- package/src/test/error_objects/flaggedError.spec.ts +0 -22
- package/src/test/error_objects/httpError.spec.ts +0 -68
- package/src/test/error_objects/httpErrorNoStack.spec.ts +0 -64
- package/src/test/error_objects/operationError.spec.ts +0 -152
- package/src/test/guidUtils.spec.ts +0 -213
- package/src/test/strings/joinPaths.spec.ts +0 -17
- package/src/test/tsconfig.json +0 -21
- package/tsconfig.esnext.tsbuildinfo +0 -824
- package/tsconfig.tsbuildinfo +0 -823
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FlaggedError {
|
|
6
|
+
/**
|
|
7
|
+
* Flags that may be set on an error instance.
|
|
8
|
+
*/
|
|
9
|
+
static FLAGS: {
|
|
10
|
+
/**
|
|
11
|
+
* A transient error results from an operation that could succeed if retried.
|
|
12
|
+
*/
|
|
13
|
+
TRANSIENT: number;
|
|
14
|
+
/**
|
|
15
|
+
* A quiet error should not trigger an error log.
|
|
16
|
+
*/
|
|
17
|
+
QUIET: number;
|
|
18
|
+
};
|
|
19
|
+
protected flags: number;
|
|
20
|
+
/**
|
|
21
|
+
* @returns True if the quiet flag is set.
|
|
22
|
+
*/
|
|
23
|
+
isQuiet(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @returns True if the transient flag is set.
|
|
26
|
+
*/
|
|
27
|
+
isTransient(): boolean;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=flaggedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flaggedError.d.ts","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,qBAAa,YAAY;IACrB;;OAEG;IACH,MAAM,CAAC,KAAK;QACR;;WAEG;;QAEH;;WAEG;;MAEL;IAEF,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAE5B;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,WAAW,IAAI,OAAO;CAGzB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a flag is set
|
|
7
|
+
* @param flags - flags set within an error object
|
|
8
|
+
* @param flag - A flag to be checked
|
|
9
|
+
* @returns True if the flag is set in passed flags, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
const _isFlagSet = (flags, flag) => {
|
|
12
|
+
// eslint-disable-next-line no-bitwise
|
|
13
|
+
return (flags & flag) === flag;
|
|
14
|
+
};
|
|
15
|
+
export class FlaggedError {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.flags = 0;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @returns True if the quiet flag is set.
|
|
21
|
+
*/
|
|
22
|
+
isQuiet() {
|
|
23
|
+
return _isFlagSet(this.flags, FlaggedError.FLAGS.QUIET);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @returns True if the transient flag is set.
|
|
27
|
+
*/
|
|
28
|
+
isTransient() {
|
|
29
|
+
return _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Flags that may be set on an error instance.
|
|
34
|
+
*/
|
|
35
|
+
FlaggedError.FLAGS = {
|
|
36
|
+
/**
|
|
37
|
+
* A transient error results from an operation that could succeed if retried.
|
|
38
|
+
*/
|
|
39
|
+
TRANSIENT: 1,
|
|
40
|
+
/**
|
|
41
|
+
* A quiet error should not trigger an error log.
|
|
42
|
+
*/
|
|
43
|
+
QUIET: 2,
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=flaggedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flaggedError.js","sourceRoot":"","sources":["../../src/error_objects/flaggedError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,sCAAsC;IACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,OAAO,YAAY;IAAzB;QAec,UAAK,GAAW,CAAC,CAAC;IAehC,CAAC;IAbG;;OAEG;IACH,OAAO;QACH,OAAQ,UAAU,CAAC,IAAI,CAAC,KAAK,EAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,WAAW;QACP,OAAQ,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;;AA5BD;;GAEG;AACI,kBAAK,GAAG;IACX;;OAEG;IACH,SAAS,EAAE,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,CAAC;CACX,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Checks if a flag is set\n * @param flags - flags set within an error object\n * @param flag - A flag to be checked\n * @returns True if the flag is set in passed flags, false otherwise.\n */\n const _isFlagSet = (flags: number, flag: number) => {\n // eslint-disable-next-line no-bitwise\n return (flags & flag) === flag;\n};\n\nexport class FlaggedError {\n /**\n * Flags that may be set on an error instance.\n */\n static FLAGS = {\n /**\n * A transient error results from an operation that could succeed if retried.\n */\n TRANSIENT: 1,\n /**\n * A quiet error should not trigger an error log.\n */\n QUIET: 2,\n };\n\n protected flags: number = 0;\n\n /**\n * @returns True if the quiet flag is set.\n */\n isQuiet(): boolean {\n return _isFlagSet(this.flags,FlaggedError.FLAGS.QUIET);\n }\n\n /**\n * @returns True if the transient flag is set.\n */\n isTransient(): boolean {\n return _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);\n }\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class extending Error with HTTP-specific error information like statusCode and statusMessage
|
|
3
|
+
* @param title - The error title
|
|
4
|
+
* @param statusCode - A numeric HTTP status code
|
|
5
|
+
* @param statusMessage - A string message representing the response status message
|
|
6
|
+
* @param method - The HTTP method used in the request
|
|
7
|
+
* @param url - The URL that the request was sent to
|
|
8
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
9
|
+
*/
|
|
10
|
+
export declare class HTTPError extends Error {
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
statusCode?: number | undefined;
|
|
13
|
+
statusMessage?: string | undefined;
|
|
14
|
+
method?: string | undefined;
|
|
15
|
+
url?: string | undefined;
|
|
16
|
+
flags: number;
|
|
17
|
+
constructor(title?: string | undefined, statusCode?: number | undefined, statusMessage?: string | undefined, method?: string | undefined, url?: string | undefined, flags?: number);
|
|
18
|
+
static FLAGS: {
|
|
19
|
+
TRANSIENT: number;
|
|
20
|
+
QUIET: number;
|
|
21
|
+
};
|
|
22
|
+
isQuiet(): boolean;
|
|
23
|
+
isTransient(): boolean;
|
|
24
|
+
private _generateMessage;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a string representing the HTTPError object
|
|
27
|
+
* @returns a string representing the HTTPError object
|
|
28
|
+
*/
|
|
29
|
+
toString(): string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=httpError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpError.d.ts","sourceRoot":"","sources":["../../src/error_objects/httpError.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAErB,KAAK,CAAC;IACN,UAAU,CAAC;IACX,aAAa,CAAC;IACd,MAAM,CAAC;IACP,GAAG,CAAC;IACJ,KAAK;gBALL,KAAK,CAAC,oBAAQ,EACd,UAAU,CAAC,oBAAQ,EACnB,aAAa,CAAC,oBAAQ,EACtB,MAAM,CAAC,oBAAQ,EACf,GAAG,CAAC,oBAAQ,EACZ,KAAK,SAAI;IASpB,MAAM,CAAC,KAAK;;;MAAsB;IAElC,OAAO,IAAI,OAAO;IAIlB,WAAW,IAAI,OAAO;IAItB,OAAO,CAAC,gBAAgB;IAWxB;;;OAGG;IACH,QAAQ,IAAI,MAAM;CAUrB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { FlaggedError } from "./flaggedError";
|
|
6
|
+
/**
|
|
7
|
+
* Class extending Error with HTTP-specific error information like statusCode and statusMessage
|
|
8
|
+
* @param title - The error title
|
|
9
|
+
* @param statusCode - A numeric HTTP status code
|
|
10
|
+
* @param statusMessage - A string message representing the response status message
|
|
11
|
+
* @param method - The HTTP method used in the request
|
|
12
|
+
* @param url - The URL that the request was sent to
|
|
13
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
14
|
+
*/
|
|
15
|
+
export class HTTPError extends Error {
|
|
16
|
+
constructor(title, statusCode, statusMessage, method, url, flags = 0) {
|
|
17
|
+
super();
|
|
18
|
+
this.title = title;
|
|
19
|
+
this.statusCode = statusCode;
|
|
20
|
+
this.statusMessage = statusMessage;
|
|
21
|
+
this.method = method;
|
|
22
|
+
this.url = url;
|
|
23
|
+
this.flags = flags;
|
|
24
|
+
Object.setPrototypeOf(this, HTTPError.prototype);
|
|
25
|
+
this.name = "HTTPError";
|
|
26
|
+
this.message = this._generateMessage(title, statusCode, statusMessage, method, url);
|
|
27
|
+
this.stack = (new Error(this.message)).stack;
|
|
28
|
+
}
|
|
29
|
+
isQuiet() {
|
|
30
|
+
return FlaggedError.prototype.isQuiet.call(this);
|
|
31
|
+
}
|
|
32
|
+
isTransient() {
|
|
33
|
+
return FlaggedError.prototype.isTransient.call(this);
|
|
34
|
+
}
|
|
35
|
+
_generateMessage(title, statusCode, statusMessage, method, url) {
|
|
36
|
+
const titleStr = (title === undefined) ? "" : String(title);
|
|
37
|
+
const statusCodeStr = (statusCode === undefined) ? "" : String(statusCode);
|
|
38
|
+
const statusMessageStr = (statusMessage === undefined) ? "" : String(statusMessage);
|
|
39
|
+
const methodStr = (method === undefined) ? "" : String(method);
|
|
40
|
+
const urlStr = (url === undefined) ? "" : String(url);
|
|
41
|
+
return `HTTPError: ${titleStr}, statusCode:${statusCodeStr}, ` +
|
|
42
|
+
`statusMessage:${statusMessageStr}, method:${methodStr}, url:${urlStr}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns a string representing the HTTPError object
|
|
46
|
+
* @returns a string representing the HTTPError object
|
|
47
|
+
*/
|
|
48
|
+
toString() {
|
|
49
|
+
const stack = (this.stack === undefined) ? "" : String(this.stack);
|
|
50
|
+
const isFirefox = typeof window !== "undefined" &&
|
|
51
|
+
typeof window.navigator !== "undefined" &&
|
|
52
|
+
typeof window.navigator.userAgent !== "undefined" &&
|
|
53
|
+
window.navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
|
|
54
|
+
return isFirefox ? `${this.message}, stack:${stack}` : `stack:${stack}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
HTTPError.FLAGS = FlaggedError.FLAGS;
|
|
58
|
+
//# sourceMappingURL=httpError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpError.js","sourceRoot":"","sources":["../../src/error_objects/httpError.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { FlaggedError } from \"./flaggedError\";\n\n/**\n * Class extending Error with HTTP-specific error information like statusCode and statusMessage\n * @param title - The error title\n * @param statusCode - A numeric HTTP status code\n * @param statusMessage - A string message representing the response status message\n * @param method - The HTTP method used in the request\n * @param url - The URL that the request was sent to\n * @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.\n */\nexport class HTTPError extends Error {\n constructor(\n public title?: string,\n public statusCode?: number,\n public statusMessage?: string,\n public method?: string,\n public url?: string,\n public flags = 0,\n ) {\n super();\n Object.setPrototypeOf(this, HTTPError.prototype);\n this.name = \"HTTPError\";\n this.message = this._generateMessage(title, statusCode, statusMessage, method, url);\n this.stack = (new Error(this.message)).stack;\n }\n\n static FLAGS = FlaggedError.FLAGS;\n\n isQuiet(): boolean {\n return FlaggedError.prototype.isQuiet.call(this);\n }\n\n isTransient(): boolean {\n return FlaggedError.prototype.isTransient.call(this);\n }\n\n private _generateMessage(title, statusCode, statusMessage, method, url) {\n const titleStr = (title === undefined) ? \"\" : String(title);\n const statusCodeStr = (statusCode === undefined) ? \"\" : String(statusCode);\n const statusMessageStr = (statusMessage === undefined) ? \"\" : String(statusMessage);\n const methodStr = (method === undefined) ? \"\" : String(method);\n const urlStr = (url === undefined) ? \"\" : String(url);\n\n return `HTTPError: ${titleStr}, statusCode:${statusCodeStr}, ` +\n `statusMessage:${statusMessageStr}, method:${methodStr}, url:${urlStr}`;\n }\n\n /**\n * Returns a string representing the HTTPError object\n * @returns a string representing the HTTPError object\n */\n toString(): string {\n const stack = (this.stack === undefined) ? \"\" : String(this.stack);\n\n const isFirefox = typeof window !== \"undefined\" &&\n typeof window.navigator !== \"undefined\" &&\n typeof window.navigator.userAgent !== \"undefined\" &&\n window.navigator.userAgent.toLowerCase().indexOf(\"firefox\") > -1;\n\n return isFirefox ? `${this.message}, stack:${stack}` : `stack:${stack}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { HTTPError } from "./httpError";
|
|
6
|
+
/**
|
|
7
|
+
* Class extending HTTPError without storing the stack
|
|
8
|
+
*/
|
|
9
|
+
export declare class HTTPErrorNoStack extends HTTPError {
|
|
10
|
+
static FLAGS: {
|
|
11
|
+
TRANSIENT: number;
|
|
12
|
+
QUIET: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @param message - The error message
|
|
16
|
+
* @param statusCode - A numeric HTTP status code
|
|
17
|
+
* @param statusMessage - A string message representing the response status message
|
|
18
|
+
* @param method - The HTTP method used in the request
|
|
19
|
+
* @param url - The URL that the request was sent to
|
|
20
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
21
|
+
*/
|
|
22
|
+
constructor(message?: any, statusCode?: any, statusMessage?: any, method?: any, url?: any, flags?: any);
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=httpErrorNoStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpErrorNoStack.d.ts","sourceRoot":"","sources":["../../src/error_objects/httpErrorNoStack.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC3C,MAAM,CAAC,KAAK;;;MAAsB;IAElC;;;;;;;OAOG;gBACS,OAAO,CAAC,KAAA,EAAE,UAAU,CAAC,KAAA,EAAE,aAAa,CAAC,KAAA,EAAE,MAAM,CAAC,KAAA,EAAE,GAAG,CAAC,KAAA,EAAE,KAAK,CAAC,KAAA;IAMxE,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { HTTPError } from "./httpError";
|
|
6
|
+
import { FlaggedError } from "./flaggedError";
|
|
7
|
+
/**
|
|
8
|
+
* Class extending HTTPError without storing the stack
|
|
9
|
+
*/
|
|
10
|
+
export class HTTPErrorNoStack extends HTTPError {
|
|
11
|
+
/**
|
|
12
|
+
* @param message - The error message
|
|
13
|
+
* @param statusCode - A numeric HTTP status code
|
|
14
|
+
* @param statusMessage - A string message representing the response status message
|
|
15
|
+
* @param method - The HTTP method used in the request
|
|
16
|
+
* @param url - The URL that the request was sent to
|
|
17
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
18
|
+
*/
|
|
19
|
+
constructor(message, statusCode, statusMessage, method, url, flags) {
|
|
20
|
+
super(message, statusCode, statusMessage, method, url, flags);
|
|
21
|
+
Object.setPrototypeOf(this, HTTPErrorNoStack.prototype);
|
|
22
|
+
delete this.stack;
|
|
23
|
+
}
|
|
24
|
+
toString() {
|
|
25
|
+
return this.message;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
HTTPErrorNoStack.FLAGS = FlaggedError.FLAGS;
|
|
29
|
+
//# sourceMappingURL=httpErrorNoStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpErrorNoStack.js","sourceRoot":"","sources":["../../src/error_objects/httpErrorNoStack.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAG3C;;;;;;;OAOG;IACH,YAAY,OAAQ,EAAE,UAAW,EAAE,aAAc,EAAE,MAAO,EAAE,GAAI,EAAE,KAAM;QACpE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;;AAlBM,sBAAK,GAAG,YAAY,CAAC,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { HTTPError } from \"./httpError\";\nimport { FlaggedError } from \"./flaggedError\";\n\n/**\n * Class extending HTTPError without storing the stack\n */\nexport class HTTPErrorNoStack extends HTTPError {\n static FLAGS = FlaggedError.FLAGS;\n\n /**\n * @param message - The error message\n * @param statusCode - A numeric HTTP status code\n * @param statusMessage - A string message representing the response status message\n * @param method - The HTTP method used in the request\n * @param url - The URL that the request was sent to\n * @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.\n */\n constructor(message?, statusCode?, statusMessage?, method?, url?, flags?) {\n super(message, statusCode, statusMessage, method, url, flags);\n Object.setPrototypeOf(this, HTTPErrorNoStack.prototype);\n delete this.stack;\n }\n\n toString(): string {\n return this.message;\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { FlaggedError } from "./flaggedError";
|
|
6
|
+
export { OperationError } from "./operationError";
|
|
7
|
+
export { HTTPError } from "./httpError";
|
|
8
|
+
export { HTTPErrorNoStack } from "./httpErrorNoStack";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error_objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { FlaggedError } from "./flaggedError";
|
|
6
|
+
export { OperationError } from "./operationError";
|
|
7
|
+
export { HTTPError } from "./httpError";
|
|
8
|
+
export { HTTPErrorNoStack } from "./httpErrorNoStack";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error_objects/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { FlaggedError } from \"./flaggedError\";\nexport { OperationError } from \"./operationError\";\nexport { HTTPError } from \"./httpError\";\nexport { HTTPErrorNoStack } from \"./httpErrorNoStack\";\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export declare class OperationError extends Error {
|
|
6
|
+
operation?: string | undefined;
|
|
7
|
+
statusCode?: number | undefined;
|
|
8
|
+
flags: number;
|
|
9
|
+
static FLAGS: {
|
|
10
|
+
TRANSIENT: number;
|
|
11
|
+
QUIET: number;
|
|
12
|
+
};
|
|
13
|
+
stack: string | undefined;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Instantiates an OperationError, which mimics the Error class with added properties
|
|
17
|
+
* meant for reporting the result of operations.
|
|
18
|
+
* @param message - The error message.
|
|
19
|
+
* @param operation - The operation name.
|
|
20
|
+
* @param statusCode - The operation result as a numerical status code.
|
|
21
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
22
|
+
*/
|
|
23
|
+
constructor(message?: string, operation?: string | undefined, statusCode?: number | undefined, flags?: number);
|
|
24
|
+
isQuiet(): boolean;
|
|
25
|
+
isTransient(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @returns A string representation of the error flags.
|
|
28
|
+
*/
|
|
29
|
+
private _flagsToString;
|
|
30
|
+
toString(): string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=operationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationError.d.ts","sourceRoot":"","sources":["../../src/error_objects/operationError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,qBAAa,cAAe,SAAQ,KAAK;IAe1B,SAAS,CAAC;IACV,UAAU,CAAC;IACX,KAAK,EAAE,MAAM;IAhBxB,MAAM,CAAC,KAAK;;;MAAsB;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;;;;;;SAOK;gBAED,OAAO,CAAC,EAAE,MAAM,EACT,SAAS,CAAC,oBAAQ,EAClB,UAAU,CAAC,oBAAQ,EACnB,KAAK,GAAE,MAAU;IAQ5B,OAAO;IAIP,WAAW;IAIX;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB,QAAQ,IAAI,MAAM;CA4BrB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* An operation error maintains additional information compared to a plain {@link #Error}:
|
|
7
|
+
* - The operation name
|
|
8
|
+
* - A status code
|
|
9
|
+
* - Extensible flags. {@see ExtendedError.FLAGS}.
|
|
10
|
+
*/
|
|
11
|
+
import _ from "lodash";
|
|
12
|
+
import { FlaggedError } from "./flaggedError";
|
|
13
|
+
export class OperationError extends Error {
|
|
14
|
+
/**
|
|
15
|
+
* Instantiates an OperationError, which mimics the Error class with added properties
|
|
16
|
+
* meant for reporting the result of operations.
|
|
17
|
+
* @param message - The error message.
|
|
18
|
+
* @param operation - The operation name.
|
|
19
|
+
* @param statusCode - The operation result as a numerical status code.
|
|
20
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
21
|
+
*/
|
|
22
|
+
constructor(message, operation, statusCode, flags = 0) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.operation = operation;
|
|
25
|
+
this.statusCode = statusCode;
|
|
26
|
+
this.flags = flags;
|
|
27
|
+
Object.setPrototypeOf(this, OperationError.prototype);
|
|
28
|
+
this.name = "OperationError";
|
|
29
|
+
this.stack = Error(message).stack;
|
|
30
|
+
}
|
|
31
|
+
isQuiet() {
|
|
32
|
+
return FlaggedError.prototype.isQuiet.call(this);
|
|
33
|
+
}
|
|
34
|
+
isTransient() {
|
|
35
|
+
return FlaggedError.prototype.isTransient.call(this);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @returns A string representation of the error flags.
|
|
39
|
+
*/
|
|
40
|
+
_flagsToString() {
|
|
41
|
+
const flagArray = [];
|
|
42
|
+
_.mapValues(FlaggedError.FLAGS, (flagValue, flagName) => {
|
|
43
|
+
// eslint-disable-next-line no-bitwise
|
|
44
|
+
if ((this.flags & flagValue) === flagValue) {
|
|
45
|
+
flagArray.push(flagName);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return `${this.flags} [${flagArray.join(",")}]`;
|
|
49
|
+
}
|
|
50
|
+
toString() {
|
|
51
|
+
const extendedFieldsArray = [];
|
|
52
|
+
if (this.operation !== undefined) {
|
|
53
|
+
extendedFieldsArray.push(this.operation);
|
|
54
|
+
}
|
|
55
|
+
if (this.statusCode !== undefined) {
|
|
56
|
+
extendedFieldsArray.push(this.statusCode.toString());
|
|
57
|
+
}
|
|
58
|
+
if (this.flags) {
|
|
59
|
+
extendedFieldsArray.push(this._flagsToString.call(this));
|
|
60
|
+
}
|
|
61
|
+
let msg = this.name;
|
|
62
|
+
if (extendedFieldsArray.length > 0) {
|
|
63
|
+
msg += `[${extendedFieldsArray.join(", ")}]`;
|
|
64
|
+
}
|
|
65
|
+
msg += `: ${this.message}`;
|
|
66
|
+
if (this.stack !== undefined) {
|
|
67
|
+
msg += `, stack: ${this.stack}`;
|
|
68
|
+
}
|
|
69
|
+
return msg;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
OperationError.FLAGS = FlaggedError.FLAGS;
|
|
73
|
+
//# sourceMappingURL=operationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationError.js","sourceRoot":"","sources":["../../src/error_objects/operationError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAO,cAAe,SAAQ,KAAK;IAKrC;;;;;;;SAOK;IACL,YACI,OAAgB,EACT,SAAkB,EAClB,UAAmB,EACnB,QAAgB,CAAC;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,cAAS,GAAT,SAAS,CAAS;QAClB,eAAU,GAAV,UAAU,CAAS;QACnB,UAAK,GAAL,KAAK,CAAY;QAGxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IACtC,CAAC;IAED,OAAO;QACH,OAAO,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,WAAW;QACP,OAAO,YAAY,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACK,cAAc;QAClB,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE;YACpD,sCAAsC;YACtC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,SAAS,EAAE;gBACxC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC5B;QACL,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACpD,CAAC;IAED,QAAQ;QACJ,MAAM,mBAAmB,GAAa,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;YAC9B,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC5C;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;YAC/B,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxD;QAED,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC5D;QAED,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QAEpB,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,GAAG,IAAI,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SAChD;QAED,GAAG,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QAE3B,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC1B,GAAG,IAAI,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;SACnC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;;AAzEM,oBAAK,GAAG,YAAY,CAAC,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * An operation error maintains additional information compared to a plain {@link #Error}:\n * - The operation name\n * - A status code\n * - Extensible flags. {@see ExtendedError.FLAGS}.\n */\nimport _ from \"lodash\";\nimport { FlaggedError } from \"./flaggedError\";\n\nexport class OperationError extends Error {\n static FLAGS = FlaggedError.FLAGS;\n public stack: string | undefined;\n public readonly name: string;\n\n /**\n * Instantiates an OperationError, which mimics the Error class with added properties\n * meant for reporting the result of operations.\n * @param message - The error message.\n * @param operation - The operation name.\n * @param statusCode - The operation result as a numerical status code.\n * @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.\n */\n constructor(\n message?: string,\n public operation?: string,\n public statusCode?: number,\n public flags: number = 0,\n ) {\n super(message);\n Object.setPrototypeOf(this, OperationError.prototype);\n this.name = \"OperationError\";\n this.stack = Error(message).stack;\n }\n\n isQuiet() {\n return FlaggedError.prototype.isQuiet.call(this);\n }\n\n isTransient() {\n return FlaggedError.prototype.isTransient.call(this);\n }\n\n /**\n * @returns A string representation of the error flags.\n */\n private _flagsToString() {\n const flagArray: string[] = [];\n _.mapValues(FlaggedError.FLAGS, (flagValue, flagName) => {\n // eslint-disable-next-line no-bitwise\n if ((this.flags & flagValue) === flagValue) {\n flagArray.push(flagName);\n }\n });\n return `${this.flags} [${flagArray.join(\",\")}]`;\n }\n\n toString(): string {\n const extendedFieldsArray: string[] = [];\n if (this.operation !== undefined) {\n extendedFieldsArray.push(this.operation);\n }\n\n if (this.statusCode !== undefined) {\n extendedFieldsArray.push(this.statusCode.toString());\n }\n\n if (this.flags) {\n extendedFieldsArray.push(this._flagsToString.call(this));\n }\n\n let msg = this.name;\n\n if (extendedFieldsArray.length > 0) {\n msg += `[${extendedFieldsArray.join(\", \")}]`;\n }\n\n msg += `: ${this.message}`;\n\n if (this.stack !== undefined) {\n msg += `, stack: ${this.stack}`;\n }\n\n return msg;\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GuidUtils: {
|
|
6
|
+
uint32x4ToGUID: (in_guidArray: Uint32Array | Int32Array | number[], base64?: boolean) => string;
|
|
7
|
+
guidToUint32x4: (in_guid: string, result?: Uint32Array) => Uint32Array;
|
|
8
|
+
base64Tobase16: (in_guid: string) => string;
|
|
9
|
+
base16ToBase64: (in_guid: string) => string;
|
|
10
|
+
initializeGUIDGenerator: (...args: any[]) => void;
|
|
11
|
+
generateGUID: (base64?: boolean) => string;
|
|
12
|
+
isGUID: (in_guid: string) => boolean;
|
|
13
|
+
combineGuids: (in_guid1: string, in_guid2: string, base64?: boolean) => string;
|
|
14
|
+
hashCombine4xUint32: (in_array1: Uint32Array, in_array2: Uint32Array, io_result?: Uint32Array | undefined) => Uint32Array;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=guidUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidUtils.d.ts","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2TH,eAAO,MAAM,SAAS;mCAtKwB,WAAW,GAAG,UAAU,GAAG,MAAM,EAAE,WAAU,OAAO,KAAW,MAAM;8BA4B1E,MAAM,WAAU,WAAW,KAAwB,WAAW;8BAsBtE,MAAM;8BASN,MAAM;;wCAaQ,MAAM;sBAwB5B,MAAM;6BA0DS,MAAM,YAAY,MAAM,uBAAmB,MAAM;qCA/C1E,WAAW,aACX,WAAW,0CAEvB,WAAW;CAkEb,CAAC"}
|