@ms-cloudpack/remote-cache 0.7.9 → 0.8.1
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/{AzureRemoteCacheClient-LMRNY2C6.js → AzureRemoteCacheClient-YFWJLZNA.js} +2122 -3714
- package/dist/{ReporterDecorator-JLGERQ2U.js → ReporterDecorator-5LUAHYKK.js} +3 -3
- package/dist/{chunk-TXSHKS6T.js → chunk-D7DHZQ7L.js} +300 -326
- package/dist/{chunk-FUGMINXQ.js → chunk-DSANWO7J.js} +1 -1
- package/dist/{chunk-VCWIWY5Y.js → chunk-FW2AO4WO.js} +217 -305
- package/dist/{chunk-IVPGYNQL.js → chunk-GFDVXVVH.js} +1 -1
- package/dist/{chunk-B4GP6UPK.js → chunk-LRFMBF43.js} +137 -184
- package/dist/{getCredential-QZKOLRT5.js → getCredential-W6MRP3D2.js} +862 -381
- package/dist/{getListOfBlobs-TYZM4XYI.js → getListOfBlobs-2GKCJGDO.js} +4 -4
- package/dist/index.js +9 -9
- package/lib/authentication/forks/identity-cache-persistence/cachePersistencePlugin.d.ts +34 -0
- package/lib/authentication/forks/identity-cache-persistence/platforms.d.ts +50 -0
- package/lib/authentication/forks/identity-cache-persistence/provider.d.ts +17 -0
- package/lib/authentication/forks/msal-node-extensions/error/PersistenceError.d.ts +37 -0
- package/lib/authentication/forks/msal-node-extensions/lock/CrossPlatformLock.d.ts +25 -0
- package/lib/authentication/forks/msal-node-extensions/lock/CrossPlatformLockOptions.d.ts +16 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/BasePersistence.d.ts +6 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/FilePersistence.d.ts +31 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/FilePersistenceWithDataProtection.d.ts +30 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/IPersistence.d.ts +17 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/IPersistenceConfiguration.d.ts +16 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/NapiRsKeyRingPersistence.d.ts +19 -0
- package/lib/authentication/forks/msal-node-extensions/persistence/PersistenceCachePlugin.d.ts +35 -0
- package/lib/authentication/forks/msal-node-extensions/utils/Constants.d.ts +44 -0
- package/lib/authentication/forks/msal-node-extensions/utils/TypeGuards.d.ts +10 -0
- package/lib/authentication/getCredential.d.ts +0 -1
- package/lib/registerAzureLogger.d.ts +0 -1
- package/package.json +6 -4
|
@@ -6,15 +6,15 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
createBlobStorageUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GFDVXVVH.js";
|
|
10
10
|
import {
|
|
11
11
|
require_dist
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-FW2AO4WO.js";
|
|
13
|
+
import "./chunk-D7DHZQ7L.js";
|
|
14
14
|
import {
|
|
15
15
|
__name,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LRFMBF43.js";
|
|
18
18
|
|
|
19
19
|
// src/getListOfBlobs.ts
|
|
20
20
|
var import_storage_blob = __toESM(require_dist(), 1);
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const __dirname = topLevelPath.dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
__name,
|
|
9
9
|
require_commonjs
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LRFMBF43.js";
|
|
11
11
|
|
|
12
12
|
// src/registerAzureLogger.ts
|
|
13
13
|
import EventEmitter from "events";
|
|
@@ -84,10 +84,10 @@ var RetryDecorator = _RetryDecorator;
|
|
|
84
84
|
// src/retry/blockListIsInvalidRetryPolicy.ts
|
|
85
85
|
var blockListIsInvalidRetryPolicy = {
|
|
86
86
|
maxRetries: 1,
|
|
87
|
-
handle: (error) => {
|
|
87
|
+
handle: /* @__PURE__ */ __name((error) => {
|
|
88
88
|
return error instanceof Error && error.message.indexOf("The specified block list is invalid.") > -1;
|
|
89
|
-
},
|
|
90
|
-
wait: () => 0
|
|
89
|
+
}, "handle"),
|
|
90
|
+
wait: /* @__PURE__ */ __name(() => 0, "wait")
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/createRemoteCacheClient.ts
|
|
@@ -96,10 +96,10 @@ async function createRemoteCacheClient(params) {
|
|
|
96
96
|
const azureLogEventHandler = registerAzureLogger();
|
|
97
97
|
const { context, options } = params;
|
|
98
98
|
const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
|
|
99
|
-
const { getCredential } = await import("./getCredential-
|
|
100
|
-
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-
|
|
101
|
-
const { ReporterDecorator } = await import("./ReporterDecorator-
|
|
102
|
-
const { getListOfBlobs } = await import("./getListOfBlobs-
|
|
99
|
+
const { getCredential } = await import("./getCredential-W6MRP3D2.js");
|
|
100
|
+
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-YFWJLZNA.js");
|
|
101
|
+
const { ReporterDecorator } = await import("./ReporterDecorator-5LUAHYKK.js");
|
|
102
|
+
const { getListOfBlobs } = await import("./getListOfBlobs-2GKCJGDO.js");
|
|
103
103
|
const credential = await getCredential(
|
|
104
104
|
{ loginMethod, cachePath, tenantId },
|
|
105
105
|
{ ...context, azureLogger: azureLogEventHandler }
|
|
@@ -115,7 +115,7 @@ async function createRemoteCacheClient(params) {
|
|
|
115
115
|
retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),
|
|
116
116
|
cacheClient: new InMemoryDecorator({
|
|
117
117
|
cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),
|
|
118
|
-
getList: () => Promise.resolve(listOfBlobs)
|
|
118
|
+
getList: /* @__PURE__ */ __name(() => Promise.resolve(listOfBlobs), "getList")
|
|
119
119
|
})
|
|
120
120
|
}),
|
|
121
121
|
context
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import type { IdentityPlugin } from '@azure/identity';
|
|
7
|
+
/**
|
|
8
|
+
* A plugin that provides persistent token caching for `@azure/identity`
|
|
9
|
+
* credentials. The plugin API is compatible with `@azure/identity` versions
|
|
10
|
+
* 2.0.0 and later. Load this plugin using the `useIdentityPlugin`
|
|
11
|
+
* function, imported from `@azure/identity`.
|
|
12
|
+
*
|
|
13
|
+
* In order to enable this functionality, you must also pass
|
|
14
|
+
* `tokenCachePersistenceOptions` to your credential constructors with an
|
|
15
|
+
* `enabled` property set to true.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
*
|
|
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);
|
|
25
|
+
*
|
|
26
|
+
* const credential = new DeviceCodeCredential({
|
|
27
|
+
* tokenCachePersistenceOptions: {
|
|
28
|
+
* enabled: true
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const cachePersistencePlugin: IdentityPlugin;
|
|
34
|
+
//# sourceMappingURL=cachePersistencePlugin.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TokenCachePersistenceOptions } from '@azure/identity';
|
|
2
|
+
import type { IPersistence } from '../msal-node-extensions/persistence/IPersistence.js';
|
|
3
|
+
/**
|
|
4
|
+
* Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const defaultMsalValues: {
|
|
8
|
+
tokenCache: {
|
|
9
|
+
name: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
};
|
|
12
|
+
keyRing: {
|
|
13
|
+
label: string;
|
|
14
|
+
schema: string;
|
|
15
|
+
collection: string;
|
|
16
|
+
attributes: {
|
|
17
|
+
MsalClientID: string;
|
|
18
|
+
'Microsoft.Developer.IdentityService': string;
|
|
19
|
+
};
|
|
20
|
+
service: string;
|
|
21
|
+
account: string;
|
|
22
|
+
};
|
|
23
|
+
keyChain: {
|
|
24
|
+
service: string;
|
|
25
|
+
account: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Options that are used by the underlying MSAL cache provider.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export type MsalPersistenceOptions = Omit<TokenCachePersistenceOptions, 'enabled'>;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns a persistent token cache instance.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
type MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<IPersistence>;
|
|
38
|
+
/**
|
|
39
|
+
* Set of the platforms we attempt to deliver persistence on.
|
|
40
|
+
*
|
|
41
|
+
* - 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.
|
|
43
|
+
*
|
|
44
|
+
* Other platforms _are not supported_ at this time.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export declare const msalPersistencePlatforms: Partial<Record<NodeJS.Platform, MsalPersistenceFactory>>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=platforms.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import type { MsalPersistenceOptions } from './platforms.js';
|
|
7
|
+
import type { ICachePlugin as CachePlugin } from '@azure/msal-node';
|
|
8
|
+
import type { IPersistence } from '../msal-node-extensions/persistence/IPersistence.js';
|
|
9
|
+
/**
|
|
10
|
+
* This is used to gain access to the underlying Persistence instance, which we use for testing
|
|
11
|
+
*
|
|
12
|
+
* @returns a raw persistence instance
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function createPersistence(options: MsalPersistenceOptions): Promise<IPersistence>;
|
|
16
|
+
export declare function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin>;
|
|
17
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/error/PersistenceError.ts
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when trying to write MSAL cache to persistence.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PersistenceError extends Error {
|
|
10
|
+
errorCode: string;
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
constructor(errorCode: string, errorMessage: string);
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when trying to access the file system.
|
|
15
|
+
*/
|
|
16
|
+
static createFileSystemError(errorCode: string, errorMessage: string): PersistenceError;
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when trying to encrypt or decrypt data using DPAPI on Windows.
|
|
19
|
+
*/
|
|
20
|
+
static createFilePersistenceWithDPAPIError(errorMessage: string): PersistenceError;
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when using the cross platform lock.
|
|
23
|
+
*/
|
|
24
|
+
static createCrossPlatformLockError(errorMessage: string): PersistenceError;
|
|
25
|
+
/**
|
|
26
|
+
* Error thrown when trying to write, load, or delete data from NapiRsKeyRingPersistence.
|
|
27
|
+
*/
|
|
28
|
+
static createNapiRsKeyRingPersistenceError(errorMessage: string): PersistenceError;
|
|
29
|
+
/**
|
|
30
|
+
* Throw cache persistence error
|
|
31
|
+
*
|
|
32
|
+
* @param errorMessage string
|
|
33
|
+
* @returns PersistenceError
|
|
34
|
+
*/
|
|
35
|
+
static createCachePersistenceError(errorMessage: string): PersistenceError;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=PersistenceError.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CrossPlatformLockOptions } from './CrossPlatformLockOptions.js';
|
|
2
|
+
import type { Logger } from '@azure/msal-common';
|
|
3
|
+
/**
|
|
4
|
+
* Cross-process lock that works on all platforms.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CrossPlatformLock {
|
|
7
|
+
private readonly lockFilePath;
|
|
8
|
+
private lockFileHandle;
|
|
9
|
+
private readonly retryNumber;
|
|
10
|
+
private readonly retryDelay;
|
|
11
|
+
private logger;
|
|
12
|
+
constructor(lockFilePath: string, logger: Logger, lockOptions?: CrossPlatformLockOptions);
|
|
13
|
+
/**
|
|
14
|
+
* Locks cache from read or writes by creating file with same path and name as
|
|
15
|
+
* cache file but with .lockfile extension. If another process has already created
|
|
16
|
+
* the lockfile, will back off and retry based on configuration settings set by CrossPlatformLockOptions
|
|
17
|
+
*/
|
|
18
|
+
lock(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* unlocks cache file by deleting .lockfile.
|
|
21
|
+
*/
|
|
22
|
+
unlock(): Promise<void>;
|
|
23
|
+
private sleep;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=CrossPlatformLock.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/lock/CrossPlatformLockOptions.ts
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Options for CrossPlatform lock.
|
|
8
|
+
*
|
|
9
|
+
* retryNumber: Numbers of times we should try to acquire a lock. Defaults to 500.
|
|
10
|
+
* retryDelay: Time to wait before trying to retry a lock acquisition. Defaults to 100 ms.
|
|
11
|
+
*/
|
|
12
|
+
export type CrossPlatformLockOptions = {
|
|
13
|
+
retryNumber: number;
|
|
14
|
+
retryDelay: number;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=CrossPlatformLockOptions.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IPersistence } from './IPersistence.js';
|
|
2
|
+
import type { LoggerOptions } from '@azure/msal-common';
|
|
3
|
+
import { Logger } from '@azure/msal-common';
|
|
4
|
+
import { BasePersistence } from './BasePersistence.js';
|
|
5
|
+
/**
|
|
6
|
+
* Reads and writes data to file specified by file location. File contents are not
|
|
7
|
+
* encrypted.
|
|
8
|
+
*
|
|
9
|
+
* If file or directory has not been created, it FilePersistence.create() will create
|
|
10
|
+
* file and any directories in the path recursively.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FilePersistence extends BasePersistence implements IPersistence {
|
|
13
|
+
private filePath;
|
|
14
|
+
private logger;
|
|
15
|
+
private constructor();
|
|
16
|
+
static create(fileLocation: string, loggerOptions?: LoggerOptions): Promise<FilePersistence>;
|
|
17
|
+
save(contents: string): Promise<void>;
|
|
18
|
+
saveBuffer(contents: Uint8Array): Promise<void>;
|
|
19
|
+
load(): Promise<string | null>;
|
|
20
|
+
loadBuffer(): Promise<Uint8Array>;
|
|
21
|
+
delete(): Promise<boolean>;
|
|
22
|
+
getFilePath(): string;
|
|
23
|
+
reloadNecessary(lastSync: number): Promise<boolean>;
|
|
24
|
+
getLogger(): Logger;
|
|
25
|
+
createForPersistenceValidation(): Promise<FilePersistence>;
|
|
26
|
+
private static createDefaultLoggerOptions;
|
|
27
|
+
private timeLastModified;
|
|
28
|
+
private createCacheFile;
|
|
29
|
+
private createFileDirectory;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=FilePersistence.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/persistence/FilePersistenceWithDataProtection.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { IPersistence } from './IPersistence.js';
|
|
7
|
+
import { type DataProtectionScope } from 'node-dpapi-prebuilt';
|
|
8
|
+
import type { Logger, LoggerOptions } from '@azure/msal-common';
|
|
9
|
+
import { BasePersistence } from './BasePersistence.js';
|
|
10
|
+
/**
|
|
11
|
+
* Uses CryptProtectData and CryptUnprotectData on Windows to encrypt and decrypt file contents.
|
|
12
|
+
*
|
|
13
|
+
* scope: Scope of the data protection. Either local user or the current machine
|
|
14
|
+
* optionalEntropy: Password or other additional entropy used to encrypt the data
|
|
15
|
+
*/
|
|
16
|
+
export declare class FilePersistenceWithDataProtection extends BasePersistence implements IPersistence {
|
|
17
|
+
private filePersistence;
|
|
18
|
+
private scope;
|
|
19
|
+
private optionalEntropy;
|
|
20
|
+
private constructor();
|
|
21
|
+
static create(fileLocation: string, scope: DataProtectionScope, optionalEntropy?: string, loggerOptions?: LoggerOptions): Promise<FilePersistenceWithDataProtection>;
|
|
22
|
+
save(contents: string): Promise<void>;
|
|
23
|
+
load(): Promise<string | null>;
|
|
24
|
+
delete(): Promise<boolean>;
|
|
25
|
+
reloadNecessary(lastSync: number): Promise<boolean>;
|
|
26
|
+
getFilePath(): string;
|
|
27
|
+
getLogger(): Logger;
|
|
28
|
+
createForPersistenceValidation(): Promise<FilePersistenceWithDataProtection>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=FilePersistenceWithDataProtection.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/persistence/IPersistence.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { Logger } from '@azure/msal-common';
|
|
7
|
+
export interface IPersistence {
|
|
8
|
+
save(contents: string): Promise<void>;
|
|
9
|
+
load(): Promise<string | null>;
|
|
10
|
+
delete(): Promise<boolean>;
|
|
11
|
+
reloadNecessary(lastSync: number): Promise<boolean>;
|
|
12
|
+
getFilePath(): string;
|
|
13
|
+
getLogger(): Logger;
|
|
14
|
+
verifyPersistence(): Promise<boolean>;
|
|
15
|
+
createForPersistenceValidation(): Promise<IPersistence>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=IPersistence.d.ts.map
|
package/lib/authentication/forks/msal-node-extensions/persistence/IPersistenceConfiguration.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/persistence/IPersistenceConfiguration.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { LoggerOptions } from '@azure/msal-common';
|
|
7
|
+
import type { DataProtectionScope } from 'node-dpapi-prebuilt';
|
|
8
|
+
export interface IPersistenceConfiguration {
|
|
9
|
+
cachePath?: string;
|
|
10
|
+
dataProtectionScope?: DataProtectionScope;
|
|
11
|
+
serviceName?: string;
|
|
12
|
+
accountName?: string;
|
|
13
|
+
usePlaintextFileOnLinux?: boolean;
|
|
14
|
+
loggerOptions?: LoggerOptions;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=IPersistenceConfiguration.d.ts.map
|
package/lib/authentication/forks/msal-node-extensions/persistence/NapiRsKeyRingPersistence.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Logger, LoggerOptions } from '@azure/msal-common';
|
|
2
|
+
import { BasePersistence } from './BasePersistence.js';
|
|
3
|
+
import type { IPersistence } from './IPersistence.js';
|
|
4
|
+
export declare class NapiRsKeyRingPersistance extends BasePersistence implements IPersistence {
|
|
5
|
+
readonly service: string;
|
|
6
|
+
readonly account: string;
|
|
7
|
+
private readonly entry;
|
|
8
|
+
private readonly filePersistence;
|
|
9
|
+
private constructor();
|
|
10
|
+
static create(fileLocation: string, serviceName: string, accountName: string, loggerOptions?: LoggerOptions): Promise<NapiRsKeyRingPersistance>;
|
|
11
|
+
save(contents: string): Promise<void>;
|
|
12
|
+
load(): Promise<string | null>;
|
|
13
|
+
delete(): Promise<boolean>;
|
|
14
|
+
reloadNecessary(lastSync: number): Promise<boolean>;
|
|
15
|
+
getFilePath(): string;
|
|
16
|
+
getLogger(): Logger;
|
|
17
|
+
createForPersistenceValidation(): Promise<IPersistence>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=NapiRsKeyRingPersistence.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/persistence/PersistenceCachePlugin.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { IPersistence } from './IPersistence.js';
|
|
7
|
+
import type { CrossPlatformLockOptions } from '../lock/CrossPlatformLockOptions.js';
|
|
8
|
+
import type { TokenCacheContext, ICachePlugin } from '@azure/msal-common';
|
|
9
|
+
/**
|
|
10
|
+
* MSAL cache plugin which enables callers to write the MSAL cache to disk on Windows,
|
|
11
|
+
* macOs, and Linux.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PersistenceCachePlugin implements ICachePlugin {
|
|
14
|
+
persistence: IPersistence;
|
|
15
|
+
lastSync: number;
|
|
16
|
+
currentCache: string | null;
|
|
17
|
+
lockFilePath: string;
|
|
18
|
+
private crossPlatformLock;
|
|
19
|
+
private logger;
|
|
20
|
+
constructor(persistence: IPersistence, lockOptions?: CrossPlatformLockOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Reads from storage and saves an in-memory copy. If persistence has not been updated
|
|
23
|
+
* since last time data was read, in memory copy is used.
|
|
24
|
+
*
|
|
25
|
+
* If cacheContext.cacheHasChanged === true, then file lock is created and not deleted until
|
|
26
|
+
* afterCacheAccess() is called, to prevent the cache file from changing in between
|
|
27
|
+
* beforeCacheAccess() and afterCacheAccess().
|
|
28
|
+
*/
|
|
29
|
+
beforeCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Writes to storage if MSAL in memory copy of cache has been changed.
|
|
32
|
+
*/
|
|
33
|
+
afterCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=PersistenceCachePlugin.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/utils/Constants.ts
|
|
5
|
+
*/
|
|
6
|
+
export declare const Constants: {
|
|
7
|
+
/**
|
|
8
|
+
* An existing file was the target of an operation that required that the target not exist
|
|
9
|
+
*/
|
|
10
|
+
EEXIST_ERROR: string;
|
|
11
|
+
/**
|
|
12
|
+
* No such file or directory: Commonly raised by fs operations to indicate that a component
|
|
13
|
+
* of the specified pathname does not exist. No entity (file or directory) could be found
|
|
14
|
+
* by the given path
|
|
15
|
+
*/
|
|
16
|
+
ENOENT_ERROR: string;
|
|
17
|
+
/**
|
|
18
|
+
* Operation not permitted. An attempt was made to perform an operation that requires
|
|
19
|
+
* elevated privileges.
|
|
20
|
+
*/
|
|
21
|
+
EPERM_ERROR: string;
|
|
22
|
+
/**
|
|
23
|
+
* Default service name for using MSAL Keytar
|
|
24
|
+
*/
|
|
25
|
+
DEFAULT_SERVICE_NAME: string;
|
|
26
|
+
/**
|
|
27
|
+
* Test data used to verify underlying persistence mechanism
|
|
28
|
+
*/
|
|
29
|
+
PERSISTENCE_TEST_DATA: string;
|
|
30
|
+
DEFAULT_CACHE_FILE_NAME: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const Platform: {
|
|
33
|
+
readonly WINDOWS: "win32";
|
|
34
|
+
readonly LINUX: "linux";
|
|
35
|
+
readonly MACOS: "darwin";
|
|
36
|
+
};
|
|
37
|
+
export type Platform = (typeof Platform)[keyof typeof Platform];
|
|
38
|
+
export declare const ErrorCodes: {
|
|
39
|
+
readonly INTERATION_REQUIRED_ERROR_CODE: "interaction_required";
|
|
40
|
+
readonly SERVER_UNAVAILABLE: "server_unavailable";
|
|
41
|
+
readonly UNKNOWN: "unknown_error";
|
|
42
|
+
};
|
|
43
|
+
export type ErrorCodes = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
44
|
+
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FORK NOTE:
|
|
3
|
+
* This file has been copied over from the `@azure/msal-node-extensions` package.
|
|
4
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/src/utils/TypeGuards.ts
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns whether or not the given object is a Node.js error
|
|
8
|
+
*/
|
|
9
|
+
export declare const isNodeError: (error: unknown) => error is NodeJS.ErrnoException;
|
|
10
|
+
//# sourceMappingURL=TypeGuards.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,15 +27,17 @@
|
|
|
27
27
|
"lib/**/*.d.ts"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@azure/msal-node-extensions": "^1.0.10",
|
|
31
30
|
"@ms-cloudpack/retry": "^0.1.2",
|
|
32
31
|
"@ms-cloudpack/task-reporter": "^0.14.1",
|
|
33
|
-
"@ms-cloudpack/telemetry": "^0.
|
|
32
|
+
"@ms-cloudpack/telemetry": "^0.6.1",
|
|
33
|
+
"@napi-rs/keyring": "^1.0.0",
|
|
34
|
+
"node-dpapi-prebuilt": "^1.0.3"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@azure/identity": "^4.2.1",
|
|
37
|
-
"@azure/identity-cache-persistence": "^1.1.0",
|
|
38
38
|
"@azure/logger": "^1.0.0",
|
|
39
|
+
"@azure/msal-common": "14.12.0",
|
|
40
|
+
"@azure/msal-node": "^2.9.2",
|
|
39
41
|
"@azure/storage-blob": "^12.17.0",
|
|
40
42
|
"@ms-cloudpack/eslint-plugin-internal": "*",
|
|
41
43
|
"@ms-cloudpack/scripts": "*",
|