@ms-cloudpack/remote-cache 0.11.78 → 0.12.0

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 (34) hide show
  1. package/NOTICE.txt +132 -87
  2. package/dist/{AzureRemoteCacheClient-S57Z5QDW.js → AzureRemoteCacheClient-IQQATZ4C.js} +20 -20
  3. package/dist/{ReporterDecorator-DNRF2TDF.js → ReporterDecorator-TXYL7NGD.js} +1 -1
  4. package/dist/{chunk-DTZKESCD.js → chunk-3AKZVDQW.js} +656 -6094
  5. package/dist/{chunk-GKUS2JGY.js → chunk-BKTAAWO5.js} +1 -3
  6. package/dist/{chunk-3WTIWSWN.js → chunk-JVACB3EN.js} +1 -1
  7. package/dist/{chunk-HONSOHFT.js → chunk-VAAN3ZWL.js} +1 -1
  8. package/dist/chunk-X63PAUN4.js +7082 -0
  9. package/dist/{esm-DMIAQHJU.js → esm-OOZX3H2S.js} +7 -6
  10. package/dist/getCredential-SDHKBJNP.js +17468 -0
  11. package/dist/{getListOfBlobs-EKSDNQNV.js → getListOfBlobs-TO4FMDDN.js} +1 -1
  12. package/dist/index.js +477 -25
  13. package/dist/package-PNRD3FFN.js +562 -0
  14. package/lib/authentication/forks/identity-cache-persistence/cachePersistencePlugin.d.ts +10 -13
  15. package/lib/authentication/forks/identity-cache-persistence/platforms.d.ts +4 -4
  16. package/lib/authentication/forks/identity-cache-persistence/provider.d.ts +2 -7
  17. package/lib/authentication/forks/msal-node-extensions/Dpapi.d.ts +6 -0
  18. package/lib/authentication/forks/msal-node-extensions/error/PersistenceError.d.ts +25 -9
  19. package/lib/authentication/forks/msal-node-extensions/index.d.ts +7 -0
  20. package/lib/authentication/forks/msal-node-extensions/lock/CrossPlatformLock.d.ts +1 -1
  21. package/lib/authentication/forks/msal-node-extensions/lock/CrossPlatformLockOptions.d.ts +0 -5
  22. package/lib/authentication/forks/msal-node-extensions/persistence/DataProtectionScope.d.ts +2 -0
  23. package/lib/authentication/forks/msal-node-extensions/persistence/FilePersistence.d.ts +1 -2
  24. package/lib/authentication/forks/msal-node-extensions/persistence/FilePersistenceWithDataProtection.d.ts +2 -7
  25. package/lib/authentication/forks/msal-node-extensions/persistence/IPersistence.d.ts +1 -6
  26. package/lib/authentication/forks/msal-node-extensions/persistence/IPersistenceConfiguration.d.ts +2 -7
  27. package/lib/authentication/forks/msal-node-extensions/persistence/NapiRsKeyRingPersistence.d.ts +1 -1
  28. package/lib/authentication/forks/msal-node-extensions/persistence/PersistenceCachePlugin.d.ts +8 -6
  29. package/lib/authentication/forks/msal-node-extensions/utils/Constants.d.ts +0 -16
  30. package/lib/authentication/forks/msal-node-extensions/utils/TypeGuards.d.ts +0 -5
  31. package/package.json +16 -16
  32. package/dist/chunk-BOUMQX3J.js +0 -1464
  33. package/dist/chunk-MIWDHAQF.js +0 -470
  34. package/dist/getCredential-Y4HWJOQE.js +0 -30268
@@ -0,0 +1,562 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ __name
11
+ } from "./chunk-BKTAAWO5.js";
12
+
13
+ // ../../node_modules/.store/open-npm-10.2.0-e150b4e118/package/index.js
14
+ import process6 from "node:process";
15
+ import { Buffer } from "node:buffer";
16
+ import path from "node:path";
17
+ import { fileURLToPath } from "node:url";
18
+ import { promisify as promisify5 } from "node:util";
19
+ import childProcess from "node:child_process";
20
+ import fs5, { constants as fsConstants2 } from "node:fs/promises";
21
+
22
+ // ../../node_modules/.store/wsl-utils-npm-0.1.0-c5611c2140/package/index.js
23
+ import process2 from "node:process";
24
+ import fs4, { constants as fsConstants } from "node:fs/promises";
25
+
26
+ // ../../node_modules/.store/is-wsl-npm-3.1.1-6334502662/package/index.js
27
+ import process from "node:process";
28
+ import os from "node:os";
29
+ import fs3 from "node:fs";
30
+
31
+ // ../../node_modules/.store/is-inside-container-npm-1.0.0-f2c9e9bb96/package/index.js
32
+ import fs2 from "node:fs";
33
+
34
+ // ../../node_modules/.store/is-docker-npm-3.0.0-1570e32177/package/index.js
35
+ import fs from "node:fs";
36
+ var isDockerCached;
37
+ function hasDockerEnv() {
38
+ try {
39
+ fs.statSync("/.dockerenv");
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+ __name(hasDockerEnv, "hasDockerEnv");
46
+ function hasDockerCGroup() {
47
+ try {
48
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
53
+ __name(hasDockerCGroup, "hasDockerCGroup");
54
+ function isDocker() {
55
+ if (isDockerCached === void 0) {
56
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
57
+ }
58
+ return isDockerCached;
59
+ }
60
+ __name(isDocker, "isDocker");
61
+
62
+ // ../../node_modules/.store/is-inside-container-npm-1.0.0-f2c9e9bb96/package/index.js
63
+ var cachedResult;
64
+ var hasContainerEnv = /* @__PURE__ */ __name(() => {
65
+ try {
66
+ fs2.statSync("/run/.containerenv");
67
+ return true;
68
+ } catch {
69
+ return false;
70
+ }
71
+ }, "hasContainerEnv");
72
+ function isInsideContainer() {
73
+ if (cachedResult === void 0) {
74
+ cachedResult = hasContainerEnv() || isDocker();
75
+ }
76
+ return cachedResult;
77
+ }
78
+ __name(isInsideContainer, "isInsideContainer");
79
+
80
+ // ../../node_modules/.store/is-wsl-npm-3.1.1-6334502662/package/index.js
81
+ var isWsl = /* @__PURE__ */ __name(() => {
82
+ if (process.platform !== "linux") {
83
+ return false;
84
+ }
85
+ if (os.release().toLowerCase().includes("microsoft")) {
86
+ if (isInsideContainer()) {
87
+ return false;
88
+ }
89
+ return true;
90
+ }
91
+ try {
92
+ if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
93
+ return !isInsideContainer();
94
+ }
95
+ } catch {
96
+ }
97
+ if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
98
+ return !isInsideContainer();
99
+ }
100
+ return false;
101
+ }, "isWsl");
102
+ var package_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
103
+
104
+ // ../../node_modules/.store/wsl-utils-npm-0.1.0-c5611c2140/package/index.js
105
+ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
106
+ const defaultMountPoint = "/mnt/";
107
+ let mountPoint;
108
+ return async function() {
109
+ if (mountPoint) {
110
+ return mountPoint;
111
+ }
112
+ const configFilePath = "/etc/wsl.conf";
113
+ let isConfigFileExists = false;
114
+ try {
115
+ await fs4.access(configFilePath, fsConstants.F_OK);
116
+ isConfigFileExists = true;
117
+ } catch {
118
+ }
119
+ if (!isConfigFileExists) {
120
+ return defaultMountPoint;
121
+ }
122
+ const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
123
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
124
+ if (!configMountPoint) {
125
+ return defaultMountPoint;
126
+ }
127
+ mountPoint = configMountPoint.groups.mountPoint.trim();
128
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
129
+ return mountPoint;
130
+ };
131
+ })();
132
+ var powerShellPathFromWsl = /* @__PURE__ */ __name(async () => {
133
+ const mountPoint = await wslDrivesMountPoint();
134
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
135
+ }, "powerShellPathFromWsl");
136
+ var powerShellPath = /* @__PURE__ */ __name(async () => {
137
+ if (package_default) {
138
+ return powerShellPathFromWsl();
139
+ }
140
+ return `${process2.env.SYSTEMROOT || process2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
141
+ }, "powerShellPath");
142
+
143
+ // ../../node_modules/.store/define-lazy-prop-npm-3.0.0-6bb0fc1510/package/index.js
144
+ function defineLazyProperty(object, propertyName, valueGetter) {
145
+ const define = /* @__PURE__ */ __name((value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true }), "define");
146
+ Object.defineProperty(object, propertyName, {
147
+ configurable: true,
148
+ enumerable: true,
149
+ get() {
150
+ const result = valueGetter();
151
+ define(result);
152
+ return result;
153
+ },
154
+ set(value) {
155
+ define(value);
156
+ }
157
+ });
158
+ return object;
159
+ }
160
+ __name(defineLazyProperty, "defineLazyProperty");
161
+
162
+ // ../../node_modules/.store/default-browser-npm-5.5.0-318b15cbba/package/index.js
163
+ import { promisify as promisify4 } from "node:util";
164
+ import process5 from "node:process";
165
+ import { execFile as execFile4 } from "node:child_process";
166
+
167
+ // ../../node_modules/.store/default-browser-id-npm-5.0.1-f5b6cb1fde/package/index.js
168
+ import { promisify } from "node:util";
169
+ import process3 from "node:process";
170
+ import { execFile } from "node:child_process";
171
+ var execFileAsync = promisify(execFile);
172
+ async function defaultBrowserId() {
173
+ if (process3.platform !== "darwin") {
174
+ throw new Error("macOS only");
175
+ }
176
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
177
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
178
+ const browserId = match?.groups.id ?? "com.apple.Safari";
179
+ if (browserId === "com.apple.safari") {
180
+ return "com.apple.Safari";
181
+ }
182
+ return browserId;
183
+ }
184
+ __name(defaultBrowserId, "defaultBrowserId");
185
+
186
+ // ../../node_modules/.store/run-applescript-npm-7.1.0-2799ad8fdb/package/index.js
187
+ import process4 from "node:process";
188
+ import { promisify as promisify2 } from "node:util";
189
+ import { execFile as execFile2, execFileSync } from "node:child_process";
190
+ var execFileAsync2 = promisify2(execFile2);
191
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
192
+ if (process4.platform !== "darwin") {
193
+ throw new Error("macOS only");
194
+ }
195
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
196
+ const execOptions = {};
197
+ if (signal) {
198
+ execOptions.signal = signal;
199
+ }
200
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
201
+ return stdout.trim();
202
+ }
203
+ __name(runAppleScript, "runAppleScript");
204
+
205
+ // ../../node_modules/.store/bundle-name-npm-4.1.0-4688335533/package/index.js
206
+ async function bundleName(bundleId) {
207
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
208
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
209
+ }
210
+ __name(bundleName, "bundleName");
211
+
212
+ // ../../node_modules/.store/default-browser-npm-5.5.0-318b15cbba/package/windows.js
213
+ import { promisify as promisify3 } from "node:util";
214
+ import { execFile as execFile3 } from "node:child_process";
215
+ var execFileAsync3 = promisify3(execFile3);
216
+ var windowsBrowserProgIds = {
217
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
218
+ // The missing `L` is correct.
219
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
220
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
221
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
222
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
223
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
224
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
225
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
226
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
227
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
228
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
229
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
230
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
231
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
232
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
233
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
234
+ };
235
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
236
+ var UnknownBrowserError = class extends Error {
237
+ static {
238
+ __name(this, "UnknownBrowserError");
239
+ }
240
+ };
241
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
242
+ const { stdout } = await _execFileAsync("reg", [
243
+ "QUERY",
244
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
245
+ "/v",
246
+ "ProgId"
247
+ ]);
248
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
249
+ if (!match) {
250
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
251
+ }
252
+ const { id } = match.groups;
253
+ const dotIndex = id.lastIndexOf(".");
254
+ const hyphenIndex = id.lastIndexOf("-");
255
+ const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
256
+ const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
257
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
258
+ }
259
+ __name(defaultBrowser, "defaultBrowser");
260
+
261
+ // ../../node_modules/.store/default-browser-npm-5.5.0-318b15cbba/package/index.js
262
+ var execFileAsync4 = promisify4(execFile4);
263
+ var titleize = /* @__PURE__ */ __name((string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase()), "titleize");
264
+ async function defaultBrowser2() {
265
+ if (process5.platform === "darwin") {
266
+ const id = await defaultBrowserId();
267
+ const name = await bundleName(id);
268
+ return { name, id };
269
+ }
270
+ if (process5.platform === "linux") {
271
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
272
+ const id = stdout.trim();
273
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
274
+ return { name, id };
275
+ }
276
+ if (process5.platform === "win32") {
277
+ return defaultBrowser();
278
+ }
279
+ throw new Error("Only macOS, Linux, and Windows are supported");
280
+ }
281
+ __name(defaultBrowser2, "defaultBrowser");
282
+
283
+ // ../../node_modules/.store/open-npm-10.2.0-e150b4e118/package/index.js
284
+ var execFile5 = promisify5(childProcess.execFile);
285
+ var __dirname = path.dirname(fileURLToPath(import.meta.url));
286
+ var localXdgOpenPath = path.join(__dirname, "xdg-open");
287
+ var { platform, arch } = process6;
288
+ async function getWindowsDefaultBrowserFromWsl() {
289
+ const powershellPath = await powerShellPath();
290
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
291
+ const encodedCommand = Buffer.from(rawCommand, "utf16le").toString("base64");
292
+ const { stdout } = await execFile5(
293
+ powershellPath,
294
+ [
295
+ "-NoProfile",
296
+ "-NonInteractive",
297
+ "-ExecutionPolicy",
298
+ "Bypass",
299
+ "-EncodedCommand",
300
+ encodedCommand
301
+ ],
302
+ { encoding: "utf8" }
303
+ );
304
+ const progId = stdout.trim();
305
+ const browserMap = {
306
+ ChromeHTML: "com.google.chrome",
307
+ BraveHTML: "com.brave.Browser",
308
+ MSEdgeHTM: "com.microsoft.edge",
309
+ FirefoxURL: "org.mozilla.firefox"
310
+ };
311
+ return browserMap[progId] ? { id: browserMap[progId] } : {};
312
+ }
313
+ __name(getWindowsDefaultBrowserFromWsl, "getWindowsDefaultBrowserFromWsl");
314
+ var pTryEach = /* @__PURE__ */ __name(async (array, mapper) => {
315
+ let latestError;
316
+ for (const item of array) {
317
+ try {
318
+ return await mapper(item);
319
+ } catch (error) {
320
+ latestError = error;
321
+ }
322
+ }
323
+ throw latestError;
324
+ }, "pTryEach");
325
+ var baseOpen = /* @__PURE__ */ __name(async (options) => {
326
+ options = {
327
+ wait: false,
328
+ background: false,
329
+ newInstance: false,
330
+ allowNonzeroExitCode: false,
331
+ ...options
332
+ };
333
+ if (Array.isArray(options.app)) {
334
+ return pTryEach(options.app, (singleApp) => baseOpen({
335
+ ...options,
336
+ app: singleApp
337
+ }));
338
+ }
339
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
340
+ appArguments = [...appArguments];
341
+ if (Array.isArray(app)) {
342
+ return pTryEach(app, (appName) => baseOpen({
343
+ ...options,
344
+ app: {
345
+ name: appName,
346
+ arguments: appArguments
347
+ }
348
+ }));
349
+ }
350
+ if (app === "browser" || app === "browserPrivate") {
351
+ const ids = {
352
+ "com.google.chrome": "chrome",
353
+ "google-chrome.desktop": "chrome",
354
+ "com.brave.Browser": "brave",
355
+ "org.mozilla.firefox": "firefox",
356
+ "firefox.desktop": "firefox",
357
+ "com.microsoft.msedge": "edge",
358
+ "com.microsoft.edge": "edge",
359
+ "com.microsoft.edgemac": "edge",
360
+ "microsoft-edge.desktop": "edge"
361
+ };
362
+ const flags = {
363
+ chrome: "--incognito",
364
+ brave: "--incognito",
365
+ firefox: "--private-window",
366
+ edge: "--inPrivate"
367
+ };
368
+ const browser = package_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
369
+ if (browser.id in ids) {
370
+ const browserName = ids[browser.id];
371
+ if (app === "browserPrivate") {
372
+ appArguments.push(flags[browserName]);
373
+ }
374
+ return baseOpen({
375
+ ...options,
376
+ app: {
377
+ name: apps[browserName],
378
+ arguments: appArguments
379
+ }
380
+ });
381
+ }
382
+ throw new Error(`${browser.name} is not supported as a default browser`);
383
+ }
384
+ let command;
385
+ const cliArguments = [];
386
+ const childProcessOptions = {};
387
+ if (platform === "darwin") {
388
+ command = "open";
389
+ if (options.wait) {
390
+ cliArguments.push("--wait-apps");
391
+ }
392
+ if (options.background) {
393
+ cliArguments.push("--background");
394
+ }
395
+ if (options.newInstance) {
396
+ cliArguments.push("--new");
397
+ }
398
+ if (app) {
399
+ cliArguments.push("-a", app);
400
+ }
401
+ } else if (platform === "win32" || package_default && !isInsideContainer() && !app) {
402
+ command = await powerShellPath();
403
+ cliArguments.push(
404
+ "-NoProfile",
405
+ "-NonInteractive",
406
+ "-ExecutionPolicy",
407
+ "Bypass",
408
+ "-EncodedCommand"
409
+ );
410
+ if (!package_default) {
411
+ childProcessOptions.windowsVerbatimArguments = true;
412
+ }
413
+ const encodedArguments = ["Start"];
414
+ if (options.wait) {
415
+ encodedArguments.push("-Wait");
416
+ }
417
+ if (app) {
418
+ encodedArguments.push(`"\`"${app}\`""`);
419
+ if (options.target) {
420
+ appArguments.push(options.target);
421
+ }
422
+ } else if (options.target) {
423
+ encodedArguments.push(`"${options.target}"`);
424
+ }
425
+ if (appArguments.length > 0) {
426
+ appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
427
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
428
+ }
429
+ options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
430
+ } else {
431
+ if (app) {
432
+ command = app;
433
+ } else {
434
+ const isBundled = !__dirname || __dirname === "/";
435
+ let exeLocalXdgOpen = false;
436
+ try {
437
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
438
+ exeLocalXdgOpen = true;
439
+ } catch {
440
+ }
441
+ const useSystemXdgOpen = process6.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
442
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
443
+ }
444
+ if (appArguments.length > 0) {
445
+ cliArguments.push(...appArguments);
446
+ }
447
+ if (!options.wait) {
448
+ childProcessOptions.stdio = "ignore";
449
+ childProcessOptions.detached = true;
450
+ }
451
+ }
452
+ if (platform === "darwin" && appArguments.length > 0) {
453
+ cliArguments.push("--args", ...appArguments);
454
+ }
455
+ if (options.target) {
456
+ cliArguments.push(options.target);
457
+ }
458
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
459
+ if (options.wait) {
460
+ return new Promise((resolve, reject) => {
461
+ subprocess.once("error", reject);
462
+ subprocess.once("close", (exitCode) => {
463
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
464
+ reject(new Error(`Exited with code ${exitCode}`));
465
+ return;
466
+ }
467
+ resolve(subprocess);
468
+ });
469
+ });
470
+ }
471
+ subprocess.unref();
472
+ return subprocess;
473
+ }, "baseOpen");
474
+ var open = /* @__PURE__ */ __name((target, options) => {
475
+ if (typeof target !== "string") {
476
+ throw new TypeError("Expected a `target`");
477
+ }
478
+ return baseOpen({
479
+ ...options,
480
+ target
481
+ });
482
+ }, "open");
483
+ var openApp = /* @__PURE__ */ __name((name, options) => {
484
+ if (typeof name !== "string" && !Array.isArray(name)) {
485
+ throw new TypeError("Expected a valid `name`");
486
+ }
487
+ const { arguments: appArguments = [] } = options ?? {};
488
+ if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
489
+ throw new TypeError("Expected `appArguments` as Array type");
490
+ }
491
+ return baseOpen({
492
+ ...options,
493
+ app: {
494
+ name,
495
+ arguments: appArguments
496
+ }
497
+ });
498
+ }, "openApp");
499
+ function detectArchBinary(binary) {
500
+ if (typeof binary === "string" || Array.isArray(binary)) {
501
+ return binary;
502
+ }
503
+ const { [arch]: archBinary } = binary;
504
+ if (!archBinary) {
505
+ throw new Error(`${arch} is not supported`);
506
+ }
507
+ return archBinary;
508
+ }
509
+ __name(detectArchBinary, "detectArchBinary");
510
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
511
+ if (wsl && package_default) {
512
+ return detectArchBinary(wsl);
513
+ }
514
+ if (!platformBinary) {
515
+ throw new Error(`${platform} is not supported`);
516
+ }
517
+ return detectArchBinary(platformBinary);
518
+ }
519
+ __name(detectPlatformBinary, "detectPlatformBinary");
520
+ var apps = {};
521
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
522
+ darwin: "google chrome",
523
+ win32: "chrome",
524
+ linux: ["google-chrome", "google-chrome-stable", "chromium"]
525
+ }, {
526
+ wsl: {
527
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
528
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
529
+ }
530
+ }));
531
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
532
+ darwin: "brave browser",
533
+ win32: "brave",
534
+ linux: ["brave-browser", "brave"]
535
+ }, {
536
+ wsl: {
537
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
538
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
539
+ }
540
+ }));
541
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
542
+ darwin: "firefox",
543
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
544
+ linux: "firefox"
545
+ }, {
546
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
547
+ }));
548
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
549
+ darwin: "microsoft edge",
550
+ win32: "msedge",
551
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
552
+ }, {
553
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
554
+ }));
555
+ defineLazyProperty(apps, "browser", () => "browser");
556
+ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
557
+ var package_default2 = open;
558
+ export {
559
+ apps,
560
+ package_default2 as default,
561
+ openApp
562
+ };
@@ -1,8 +1,3 @@
1
- /**
2
- * FORK NOTE:
3
- * This file has been copied over from the `@azure/identity-cache-persistence` package.
4
- * https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-cache-persistence/src/index.ts
5
- */
6
1
  import type { IdentityPlugin } from '@azure/identity';
7
2
  /**
8
3
  * A plugin that provides persistent token caching for `@azure/identity`
@@ -16,18 +11,20 @@ import type { IdentityPlugin } from '@azure/identity';
16
11
  *
17
12
  * Example:
18
13
  *
19
- * ```javascript
20
- * import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
21
- * import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
22
- *
23
- * // Load the plugin
24
- * useIdentityPlugin(cachePersistencePlugin);
14
+ * ```ts snippet:ReadmeSampleDeviceCodeCredential
15
+ * import { DeviceCodeCredential } from "@azure/identity";
25
16
  *
26
17
  * const credential = new DeviceCodeCredential({
27
18
  * tokenCachePersistenceOptions: {
28
- * enabled: true
29
- * }
19
+ * enabled: true,
20
+ * },
30
21
  * });
22
+ *
23
+ * // We'll use the Microsoft Graph scope as an example
24
+ * const scope = "https://graph.microsoft.com/.default";
25
+ *
26
+ * // Print out part of the access token
27
+ * console.log((await credential.getToken(scope)).token.substring(0, 10), "...");
31
28
  * ```
32
29
  */
33
30
  export declare const cachePersistencePlugin: IdentityPlugin;
@@ -1,5 +1,5 @@
1
+ import { type IPersistence as Persistence } from '../msal-node-extensions/index.js';
1
2
  import type { TokenCachePersistenceOptions } from '@azure/identity';
2
- import type { IPersistence } from '../msal-node-extensions/persistence/IPersistence.js';
3
3
  /**
4
4
  * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
5
5
  * @internal
@@ -32,14 +32,14 @@ export declare const defaultMsalValues: {
32
32
  export type MsalPersistenceOptions = Omit<TokenCachePersistenceOptions, 'enabled'>;
33
33
  /**
34
34
  * A function that returns a persistent token cache instance.
35
- * @internal
36
35
  */
37
- type MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<IPersistence>;
36
+ type MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<Persistence>;
38
37
  /**
39
38
  * Set of the platforms we attempt to deliver persistence on.
40
39
  *
41
40
  * - On Windows we use DPAPI.
42
- * - On OSX (Darwin) and Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
41
+ * - On OSX (Darwin), we try to use the system's Keychain, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
42
+ * - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
43
43
  *
44
44
  * Other platforms _are not supported_ at this time.
45
45
  *
@@ -1,17 +1,12 @@
1
- /**
2
- * FORK NOTE:
3
- * This file has been copied over from the `@azure/identity-cache-persistence` package.
4
- * https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-cache-persistence/src/provider.ts
5
- */
6
1
  import type { MsalPersistenceOptions } from './platforms.js';
2
+ import { type IPersistence as Persistence } from '../msal-node-extensions/index.js';
7
3
  import type { ICachePlugin as CachePlugin } from '@azure/msal-node';
8
- import type { IPersistence } from '../msal-node-extensions/persistence/IPersistence.js';
9
4
  /**
10
5
  * This is used to gain access to the underlying Persistence instance, which we use for testing
11
6
  *
12
7
  * @returns a raw persistence instance
13
8
  * @internal
14
9
  */
15
- export declare function createPersistence(options: MsalPersistenceOptions): Promise<IPersistence>;
10
+ export declare function createPersistence(options: MsalPersistenceOptions): Promise<Persistence>;
16
11
  export declare function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin>;
17
12
  //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { protectData, unprotectData } from 'node-dpapi-prebuilt';
2
+ export declare const Dpapi: {
3
+ protectData: typeof protectData;
4
+ unprotectData: typeof unprotectData;
5
+ };
6
+ //# sourceMappingURL=Dpapi.d.ts.map