utils/node_modules/@rushstack/node-core-library/lib/LegacyAdapters.js.map

1 line
5.7 KiB
Plaintext
Raw Normal View History

2024-02-07 01:33:07 -05:00
{"version":3,"file":"LegacyAdapters.js","sourceRoot":"","sources":["../src/LegacyAdapters.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAS3D;;;GAGG;AACH,MAAa,cAAc;IA6BlB,MAAM,CAAC,wBAAwB,CACpC,EAMS,EACT,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY;QAEZ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAkC,EAAE,MAA8B,EAAE,EAAE;YACxF,MAAM,EAAE,GAAoC,CAAC,KAAgC,EAAE,MAAe,EAAE,EAAE;gBAChG,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;iBAC1C;qBAAM;oBACL,OAAO,CAAC,MAAM,CAAC,CAAC;iBACjB;YACH,CAAC,CAAC;YAEF,IAAI;gBACF,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE;oBACxF,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;iBAChC;qBAAM,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE;oBACzE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;iBAC1B;qBAAM,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE;oBACnD,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;iBACpB;qBAAM,IAAI,IAAI,KAAK,SAAS,EAAE;oBAC7B,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;iBACd;qBAAM;oBACL,EAAE,CAAC,EAAE,CAAC,CAAC;iBACR;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,CAAU,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,8DAA8D;IACvD,MAAM,CAAC,UAAU,CAAC,KAA2B;QAClD,IAAI,KAAK,YAAY,KAAK,EAAE;YAC1B,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACzB;aAAM;YACL,MAAM,WAAW,GAAU,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAC1D,WAAmB,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,yDAAyD;YACjG,OAAO,WAAW,CAAC;SACpB;IACH,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CAAI,KAAU,EAAE,OAAgC;QACtE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF;AAjGD,wCAiGC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Callback used by {@link LegacyAdapters}.\n * @public\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type LegacyCallback<TResult, TError> = (error: TError | null | undefined, result: TResult) => void;\n\n/**\n * Helper functions used when interacting with APIs that do not follow modern coding practices.\n * @public\n */\nexport class LegacyAdapters {\n /**\n * This function wraps a function with a callback in a promise.\n */\n public static convertCallbackToPromise<TResult, TError>(\n fn: (cb: LegacyCallback<TResult, TError>) => void\n ): Promise<TResult>;\n public static convertCallbackToPromise<TResult, TError, TArg1>(\n fn: (arg1: TArg1, cb: LegacyCallback<TResult, TError>) => void,\n arg1: TArg1\n ): Promise<TResult>;\n public static convertCallbackToPromise<TResult, TError, TArg1, TArg2>(\n fn: (arg1: TArg1, arg2: TArg2, cb: LegacyCallback<TResult, TError>) => void,\n arg1: TArg1,\n arg2: TArg2\n ): Promise<TResult>;\n public static convertCallbackToPromise<TResult, TError, TArg1, TArg2, TArg3>(\n fn: (arg1: TArg1, arg2: TArg2, arg3: TArg3, cb: LegacyCallback<TResult, TError>) => void,\n arg1: TArg1,\n arg2: TArg2,\n arg3: TArg3\n ): Promise<TResult>;\n public static convertCallbackToPromise<TResult, TError, TArg1, TArg2, TArg3, TArg4>(\n fn: (arg1: TArg1, arg2: TArg2, arg3: TArg3, arg4: TArg4, cb: LegacyCallback<TResult, TError>) => void,\n arg1: TArg1,\n arg2: TArg2,\n arg3: TArg3,\n arg4: TArg4\n ): Promise<TResult>;\n public static convertCallbackToPromise<TResult, TError, TArg1, TArg2, TArg3, TArg4>(\n fn: (\n a: TArg1 | LegacyCallback<TResult, TError>,\n b?: TArg2 | LegacyCallback<TResult, TError>,\n c?: TArg3 | LegacyCallback<TResult, TError>,\n d?: TArg4 | LegacyCallback<TResult, TError>,\n e?: TArg4 | LegacyCallback<TResult, TError>\n ) => void,\n arg1?: TArg1,\n arg2?: TArg2,\n arg3?: TArg3,\n arg4?: TArg4\n ): Promise<TResult> {\n return new Promise((resolve: (result: TResult) => void, reject: (error: Error) => void) => {\n const cb: LegacyCallback<TResult, TError> = (error: TError | null | undefined, result: TResult) => {\n if (error) {\n reject(LegacyAdapters.scrubErr