@ms-cloudpack/remote-cache 0.3.1 → 0.4.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 (84) hide show
  1. package/lib/AzureRemoteCacheClient.d.ts +1 -1
  2. package/lib/AzureRemoteCacheClient.d.ts.map +1 -1
  3. package/lib/AzureRemoteCacheClient.js +4 -2
  4. package/lib/AzureRemoteCacheClient.js.map +1 -1
  5. package/lib/authentication/getAuthenticationRecord.d.ts +7 -0
  6. package/lib/authentication/getAuthenticationRecord.d.ts.map +1 -0
  7. package/lib/authentication/getAuthenticationRecord.js +17 -0
  8. package/lib/authentication/getAuthenticationRecord.js.map +1 -0
  9. package/lib/authentication/getAuthenticationRecordPath.d.ts +7 -0
  10. package/lib/authentication/getAuthenticationRecordPath.d.ts.map +1 -0
  11. package/lib/authentication/getAuthenticationRecordPath.js +10 -0
  12. package/lib/authentication/getAuthenticationRecordPath.js.map +1 -0
  13. package/lib/authentication/getCredential.d.ts +7 -1
  14. package/lib/authentication/getCredential.d.ts.map +1 -1
  15. package/lib/authentication/getCredential.js +41 -7
  16. package/lib/authentication/getCredential.js.map +1 -1
  17. package/lib/authentication/saveAuthenticationRecord.d.ts +9 -0
  18. package/lib/authentication/saveAuthenticationRecord.d.ts.map +1 -0
  19. package/lib/authentication/saveAuthenticationRecord.js +17 -0
  20. package/lib/authentication/saveAuthenticationRecord.js.map +1 -0
  21. package/lib/cache-persistance/cachePersistencePlugin.d.ts +32 -0
  22. package/lib/cache-persistance/cachePersistencePlugin.d.ts.map +1 -0
  23. package/lib/cache-persistance/cachePersistencePlugin.js +35 -0
  24. package/lib/cache-persistance/cachePersistencePlugin.js.map +1 -0
  25. package/lib/cache-persistance/platforms.d.ts +55 -0
  26. package/lib/cache-persistance/platforms.d.ts.map +1 -0
  27. package/lib/cache-persistance/platforms.js +109 -0
  28. package/lib/cache-persistance/platforms.js.map +1 -0
  29. package/lib/cache-persistance/provider.d.ts +15 -0
  30. package/lib/cache-persistance/provider.d.ts.map +1 -0
  31. package/lib/cache-persistance/provider.js +26 -0
  32. package/lib/cache-persistance/provider.js.map +1 -0
  33. package/lib/createBlobStorageUrl.d.ts +2 -0
  34. package/lib/createBlobStorageUrl.d.ts.map +1 -0
  35. package/lib/createBlobStorageUrl.js +4 -0
  36. package/lib/createBlobStorageUrl.js.map +1 -0
  37. package/lib/createRemoteCacheClient.d.ts +10 -4
  38. package/lib/createRemoteCacheClient.d.ts.map +1 -1
  39. package/lib/createRemoteCacheClient.js +10 -9
  40. package/lib/createRemoteCacheClient.js.map +1 -1
  41. package/lib/getListOfBlobs.d.ts +1 -1
  42. package/lib/getListOfBlobs.d.ts.map +1 -1
  43. package/lib/getListOfBlobs.js +3 -2
  44. package/lib/getListOfBlobs.js.map +1 -1
  45. package/lib/index.d.ts +1 -2
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js.map +1 -1
  48. package/lib/tsdoc-metadata.json +1 -1
  49. package/lib/types/RemoteCacheClientOptions.d.ts +3 -1
  50. package/lib/types/RemoteCacheClientOptions.d.ts.map +1 -1
  51. package/lib/types/RemoteCacheClientOptions.js.map +1 -1
  52. package/package.json +3 -2
  53. package/lib/authentication/KeyRingLocalTokenCache.d.ts +0 -14
  54. package/lib/authentication/KeyRingLocalTokenCache.d.ts.map +0 -1
  55. package/lib/authentication/KeyRingLocalTokenCache.js +0 -37
  56. package/lib/authentication/KeyRingLocalTokenCache.js.map +0 -1
  57. package/lib/authentication/acquireSasToken.d.ts +0 -3
  58. package/lib/authentication/acquireSasToken.d.ts.map +0 -1
  59. package/lib/authentication/acquireSasToken.js +0 -27
  60. package/lib/authentication/acquireSasToken.js.map +0 -1
  61. package/lib/authentication/createBlobStorageUrl.d.ts +0 -2
  62. package/lib/authentication/createBlobStorageUrl.d.ts.map +0 -1
  63. package/lib/authentication/createBlobStorageUrl.js +0 -4
  64. package/lib/authentication/createBlobStorageUrl.js.map +0 -1
  65. package/lib/authentication/getAuthenticatedConnectionString.d.ts +0 -3
  66. package/lib/authentication/getAuthenticatedConnectionString.d.ts.map +0 -1
  67. package/lib/authentication/getAuthenticatedConnectionString.js +0 -21
  68. package/lib/authentication/getAuthenticatedConnectionString.js.map +0 -1
  69. package/lib/authentication/getSasToken.d.ts +0 -12
  70. package/lib/authentication/getSasToken.d.ts.map +0 -1
  71. package/lib/authentication/getSasToken.js +0 -16
  72. package/lib/authentication/getSasToken.js.map +0 -1
  73. package/lib/authentication/isExpired.d.ts +0 -2
  74. package/lib/authentication/isExpired.d.ts.map +0 -1
  75. package/lib/authentication/isExpired.js +0 -10
  76. package/lib/authentication/isExpired.js.map +0 -1
  77. package/lib/types/ConnectionStringOptions.d.ts +0 -13
  78. package/lib/types/ConnectionStringOptions.d.ts.map +0 -1
  79. package/lib/types/ConnectionStringOptions.js +0 -2
  80. package/lib/types/ConnectionStringOptions.js.map +0 -1
  81. package/lib/types/LocalTokenCacheProvider.d.ts +0 -6
  82. package/lib/types/LocalTokenCacheProvider.d.ts.map +0 -1
  83. package/lib/types/LocalTokenCacheProvider.js +0 -2
  84. package/lib/types/LocalTokenCacheProvider.js.map +0 -1
@@ -3,7 +3,7 @@ import type { RemoteCacheClient, RemoteCacheClientOperationOptions, RemoteCacheC
3
3
  export declare class AzureRemoteCacheClient implements RemoteCacheClient {
4
4
  private readonly logger;
5
5
  private readonly config;
6
- constructor({ container, connectionString }: RemoteCacheClientOptions);
6
+ constructor({ container, storageAccount, credential }: RemoteCacheClientOptions);
7
7
  /**
8
8
  * Uploads the folder to the remote cache.
9
9
  * @param folderName - The name of the folder to upload.
@@ -1 +1 @@
1
- {"version":3,"file":"AzureRemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,KAAK,EACV,iBAAiB,EACjB,iCAAiC,EACjC,yCAAyC,EAC1C,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAIrB;gBAEU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,wBAAwB;IAcrE;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,yCAAyC;IAS/F;;;;;OAKG;IACG,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,iCAAiC;CAY7E"}
1
+ {"version":3,"file":"AzureRemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,KAAK,EACV,iBAAiB,EACjB,iCAAiC,EACjC,yCAAyC,EAC1C,MAAM,8BAA8B,CAAC;AAGtC,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAIrB;gBAEU,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,wBAAwB;IAe/E;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,yCAAyC;IAS/F;;;;;OAKG;IACG,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,iCAAiC;CAY7E"}
@@ -1,7 +1,8 @@
1
1
  import { makeLogger, put, fetch } from 'backfill/lib/api.js';
2
2
  import { existsSync } from 'fs';
3
+ import { createBlobStorageUrl } from './createBlobStorageUrl.js';
3
4
  export class AzureRemoteCacheClient {
4
- constructor({ container, connectionString }) {
5
+ constructor({ container, storageAccount, credential }) {
5
6
  this.logger = makeLogger('mute', process.stdout, process.stderr);
6
7
  this.config = {
7
8
  incrementalCaching: true,
@@ -9,7 +10,8 @@ export class AzureRemoteCacheClient {
9
10
  cacheStorageConfig: {
10
11
  provider: 'azure-blob',
11
12
  options: {
12
- connectionString,
13
+ connectionString: createBlobStorageUrl(storageAccount),
14
+ credential,
13
15
  container,
14
16
  },
15
17
  },
@@ -1 +1 @@
1
- {"version":3,"file":"AzureRemoteCacheClient.js","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAOhC,MAAM,OAAO,sBAAsB;IAQjC,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAA4B;QAPpD,WAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAQ3E,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,IAAI;YACxB,mBAAmB,EAAE,EAAE;YACvB,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,gBAAgB;oBAChB,SAAS;iBACV;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAA6C;QAC7F,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,WAAW,CAAC;SACpB;QAED,MAAM,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,EAAqC;QAC1E,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,OAAO,eAAe,CAAC;SACxB;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { makeLogger, put, fetch } from 'backfill/lib/api.js';\nimport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\nimport type { AzureBlobCacheStorageConfig } from 'backfill-config';\nimport { existsSync } from 'fs';\nimport type {\n RemoteCacheClient,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientDownloadOperationOptions,\n} from './types/RemoteCacheClient.js';\n\nexport class AzureRemoteCacheClient implements RemoteCacheClient {\n private readonly logger = makeLogger('mute', process.stdout, process.stderr);\n private readonly config: {\n cacheStorageConfig: AzureBlobCacheStorageConfig;\n incrementalCaching: boolean;\n internalCacheFolder: string;\n };\n\n constructor({ container, connectionString }: RemoteCacheClientOptions) {\n this.config = {\n incrementalCaching: true,\n internalCacheFolder: '', // not used by azure-blob\n cacheStorageConfig: {\n provider: 'azure-blob',\n options: {\n connectionString,\n container,\n },\n },\n };\n }\n\n /**\n * Uploads the folder to the remote cache.\n * @param folderName - The name of the folder to upload.\n * @param path - The path to the folder to upload.\n * @param globMatches - The glob pattern to use when uploading the folder.\n * @returns - A promise that resolves when the folder has been uploaded.\n */\n async uploadFolder({ folderName, path, globMatches }: RemoteCacheClientDownloadOperationOptions) {\n if (!existsSync(path)) {\n return 'not-found';\n }\n\n await put(path, folderName, this.logger, { ...this.config, outputGlob: globMatches });\n return 'success';\n }\n\n /**\n * Downloads the folder from the remote cache.\n * @param folderName - The name of the folder to download.\n * @param path - The path to download the folder to.\n * @returns - A promise that resolves when the folder has been downloaded.\n */\n async downloadFolder({ folderName, path }: RemoteCacheClientOperationOptions) {\n if (existsSync(path)) {\n return 'already-exist';\n }\n\n const result = await fetch(path, folderName, this.logger, this.config);\n if (!result) {\n return 'not-found';\n }\n\n return 'success';\n }\n}\n"]}
1
+ {"version":3,"file":"AzureRemoteCacheClient.js","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAMhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,sBAAsB;IAQjC,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAA4B;QAP9D,WAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAQ3E,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,IAAI;YACxB,mBAAmB,EAAE,EAAE;YACvB,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,gBAAgB,EAAE,oBAAoB,CAAC,cAAc,CAAC;oBACtD,UAAU;oBACV,SAAS;iBACV;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAA6C;QAC7F,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,WAAW,CAAC;SACpB;QAED,MAAM,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,EAAqC;QAC1E,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,OAAO,eAAe,CAAC;SACxB;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { makeLogger, put, fetch } from 'backfill/lib/api.js';\nimport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\nimport type { AzureBlobCacheStorageConfig } from 'backfill-config';\nimport { existsSync } from 'fs';\nimport type {\n RemoteCacheClient,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientDownloadOperationOptions,\n} from './types/RemoteCacheClient.js';\nimport { createBlobStorageUrl } from './createBlobStorageUrl.js';\n\nexport class AzureRemoteCacheClient implements RemoteCacheClient {\n private readonly logger = makeLogger('mute', process.stdout, process.stderr);\n private readonly config: {\n cacheStorageConfig: AzureBlobCacheStorageConfig;\n incrementalCaching: boolean;\n internalCacheFolder: string;\n };\n\n constructor({ container, storageAccount, credential }: RemoteCacheClientOptions) {\n this.config = {\n incrementalCaching: true,\n internalCacheFolder: '', // not used by azure-blob\n cacheStorageConfig: {\n provider: 'azure-blob',\n options: {\n connectionString: createBlobStorageUrl(storageAccount),\n credential,\n container,\n },\n },\n };\n }\n\n /**\n * Uploads the folder to the remote cache.\n * @param folderName - The name of the folder to upload.\n * @param path - The path to the folder to upload.\n * @param globMatches - The glob pattern to use when uploading the folder.\n * @returns - A promise that resolves when the folder has been uploaded.\n */\n async uploadFolder({ folderName, path, globMatches }: RemoteCacheClientDownloadOperationOptions) {\n if (!existsSync(path)) {\n return 'not-found';\n }\n\n await put(path, folderName, this.logger, { ...this.config, outputGlob: globMatches });\n return 'success';\n }\n\n /**\n * Downloads the folder from the remote cache.\n * @param folderName - The name of the folder to download.\n * @param path - The path to download the folder to.\n * @returns - A promise that resolves when the folder has been downloaded.\n */\n async downloadFolder({ folderName, path }: RemoteCacheClientOperationOptions) {\n if (existsSync(path)) {\n return 'already-exist';\n }\n\n const result = await fetch(path, folderName, this.logger, this.config);\n if (!result) {\n return 'not-found';\n }\n\n return 'success';\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Retrieves the authentication record from Cloudpack's global cache folder.
3
+ * @param cachePath - The path to Cloudpack's cache folder.
4
+ * @returns - The authentication record if it exists; otherwise, returns `undefined`.
5
+ */
6
+ export declare function getAuthenticationRecord(cachePath: string): import("@azure/identity").AuthenticationRecord | undefined;
7
+ //# sourceMappingURL=getAuthenticationRecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAuthenticationRecord.d.ts","sourceRoot":"","sources":["../../src/authentication/getAuthenticationRecord.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,8DAQxD"}
@@ -0,0 +1,17 @@
1
+ import { deserializeAuthenticationRecord } from '@azure/identity';
2
+ import { existsSync, readFileSync } from 'fs';
3
+ import { getAuthenticationRecordPath } from './getAuthenticationRecordPath.js';
4
+ /**
5
+ * Retrieves the authentication record from Cloudpack's global cache folder.
6
+ * @param cachePath - The path to Cloudpack's cache folder.
7
+ * @returns - The authentication record if it exists; otherwise, returns `undefined`.
8
+ */
9
+ export function getAuthenticationRecord(cachePath) {
10
+ const fullPath = getAuthenticationRecordPath(cachePath);
11
+ if (!existsSync(fullPath)) {
12
+ return undefined;
13
+ }
14
+ const content = readFileSync(fullPath, 'utf-8');
15
+ return deserializeAuthenticationRecord(content);
16
+ }
17
+ //# sourceMappingURL=getAuthenticationRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAuthenticationRecord.js","sourceRoot":"","sources":["../../src/authentication/getAuthenticationRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACvD,MAAM,QAAQ,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,+BAA+B,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import { deserializeAuthenticationRecord } from '@azure/identity';\nimport { existsSync, readFileSync } from 'fs';\nimport { getAuthenticationRecordPath } from './getAuthenticationRecordPath.js';\n\n/**\n * Retrieves the authentication record from Cloudpack's global cache folder.\n * @param cachePath - The path to Cloudpack's cache folder.\n * @returns - The authentication record if it exists; otherwise, returns `undefined`.\n */\nexport function getAuthenticationRecord(cachePath: string) {\n const fullPath = getAuthenticationRecordPath(cachePath);\n if (!existsSync(fullPath)) {\n return undefined;\n }\n\n const content = readFileSync(fullPath, 'utf-8');\n return deserializeAuthenticationRecord(content);\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Constructs and returns the full path to the authentication record file within the specified cache folder.
3
+ * @param cachePath - The path to Cloudpack's cache folder.
4
+ * @returns - The full path to the authentication record file.
5
+ */
6
+ export declare function getAuthenticationRecordPath(cachePath: string): string;
7
+ //# sourceMappingURL=getAuthenticationRecordPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAuthenticationRecordPath.d.ts","sourceRoot":"","sources":["../../src/authentication/getAuthenticationRecordPath.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,UAE5D"}
@@ -0,0 +1,10 @@
1
+ import path from 'path';
2
+ /**
3
+ * Constructs and returns the full path to the authentication record file within the specified cache folder.
4
+ * @param cachePath - The path to Cloudpack's cache folder.
5
+ * @returns - The full path to the authentication record file.
6
+ */
7
+ export function getAuthenticationRecordPath(cachePath) {
8
+ return path.join(cachePath, 'tokencache.bin');
9
+ }
10
+ //# sourceMappingURL=getAuthenticationRecordPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAuthenticationRecordPath.js","sourceRoot":"","sources":["../../src/authentication/getAuthenticationRecordPath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAiB;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import path from 'path';\n\n/**\n * Constructs and returns the full path to the authentication record file within the specified cache folder.\n * @param cachePath - The path to Cloudpack's cache folder.\n * @returns - The full path to the authentication record file.\n */\nexport function getAuthenticationRecordPath(cachePath: string) {\n return path.join(cachePath, 'tokencache.bin');\n}\n"]}
@@ -1,4 +1,10 @@
1
1
  import { AzureCliCredential, DeviceCodeCredential, InteractiveBrowserCredential } from '@azure/identity';
2
2
  import type { LoginMethod } from '../types/LoginMethod.js';
3
- export declare function getCredential(loginMethod: LoginMethod): InteractiveBrowserCredential | DeviceCodeCredential | AzureCliCredential;
3
+ /**
4
+ * Gets a credential for the given login method.
5
+ * If the login method is 'azure-cli', it will return an AzureCliCredential.
6
+ * Otherwise, it will return an InteractiveBrowserCredential or a DeviceCodeCredential with persistent token settings.
7
+ * If an authentication record has never been saved before, it will authenticate the credential and save the authentication record.
8
+ */
9
+ export declare function getCredential(loginMethod: LoginMethod, cachePath: string): Promise<InteractiveBrowserCredential | DeviceCodeCredential | AzureCliCredential>;
4
10
  //# sourceMappingURL=getCredential.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCredential.d.ts","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AACzG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,4EAcrD"}
1
+ {"version":3,"file":"getCredential.d.ts","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAI7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA4B3D;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qFA4B9E"}
@@ -1,17 +1,51 @@
1
- import { AzureCliCredential, DeviceCodeCredential, InteractiveBrowserCredential } from '@azure/identity';
2
- export function getCredential(loginMethod) {
1
+ import { AzureCliCredential, DeviceCodeCredential, InteractiveBrowserCredential, useIdentityPlugin, } from '@azure/identity';
2
+ import { cachePersistencePlugin } from '../cache-persistance/cachePersistencePlugin.js';
3
+ import { getAuthenticationRecord } from './getAuthenticationRecord.js';
4
+ import { saveAuthenticationRecord } from './saveAuthenticationRecord.js';
5
+ const tokenCachePersistenceOptions = {
6
+ enabled: true,
7
+ name: 'cloudpack',
8
+ };
9
+ function getCredentialInternal(loginMethod, authenticationRecord) {
3
10
  switch (loginMethod) {
4
11
  case 'interactive':
5
12
  return new InteractiveBrowserCredential({
6
13
  redirectUri: 'http://localhost:1337',
14
+ authenticationRecord,
15
+ tokenCachePersistenceOptions,
7
16
  });
8
17
  case 'device-code':
9
- return new DeviceCodeCredential();
10
- case 'azure-cli':
11
- return new AzureCliCredential();
18
+ return new DeviceCodeCredential({
19
+ authenticationRecord,
20
+ tokenCachePersistenceOptions,
21
+ });
12
22
  default:
13
- console.warn('Unknown login method. Using azure-cli as fallback.');
14
- return new AzureCliCredential();
23
+ throw new Error(`Invalid login method: ${loginMethod}`);
24
+ }
25
+ }
26
+ /**
27
+ * Gets a credential for the given login method.
28
+ * If the login method is 'azure-cli', it will return an AzureCliCredential.
29
+ * Otherwise, it will return an InteractiveBrowserCredential or a DeviceCodeCredential with persistent token settings.
30
+ * If an authentication record has never been saved before, it will authenticate the credential and save the authentication record.
31
+ */
32
+ export async function getCredential(loginMethod, cachePath) {
33
+ if (loginMethod == 'azure-cli') {
34
+ return new AzureCliCredential();
35
+ }
36
+ useIdentityPlugin(cachePersistencePlugin);
37
+ let authenticationRecord = getAuthenticationRecord(cachePath);
38
+ const credential = getCredentialInternal(loginMethod, authenticationRecord);
39
+ if (!authenticationRecord) {
40
+ console.warn('Cloudpack requires authentication to access Azure resources.');
41
+ if (loginMethod == 'interactive') {
42
+ console.warn("Prepare to sign in – we're launching a browser page for you. Simply follow the instructions on the login page to seamlessly complete the authentication process.");
43
+ }
44
+ authenticationRecord = await credential.authenticate('https://storage.azure.com/.default');
45
+ if (authenticationRecord) {
46
+ saveAuthenticationRecord(cachePath, authenticationRecord);
47
+ }
15
48
  }
49
+ return credential;
16
50
  }
17
51
  //# sourceMappingURL=getCredential.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCredential.js","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAGzG,MAAM,UAAU,aAAa,CAAC,WAAwB;IACpD,QAAQ,WAAW,EAAE;QACnB,KAAK,aAAa;YAChB,OAAO,IAAI,4BAA4B,CAAC;gBACtC,WAAW,EAAE,uBAAuB;aACrC,CAAC,CAAC;QACL,KAAK,aAAa;YAChB,OAAO,IAAI,oBAAoB,EAAE,CAAC;QACpC,KAAK,WAAW;YACd,OAAO,IAAI,kBAAkB,EAAE,CAAC;QAClC;YACE,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;YACnE,OAAO,IAAI,kBAAkB,EAAE,CAAC;KACnC;AACH,CAAC","sourcesContent":["import { AzureCliCredential, DeviceCodeCredential, InteractiveBrowserCredential } from '@azure/identity';\nimport type { LoginMethod } from '../types/LoginMethod.js';\n\nexport function getCredential(loginMethod: LoginMethod) {\n switch (loginMethod) {\n case 'interactive':\n return new InteractiveBrowserCredential({\n redirectUri: 'http://localhost:1337',\n });\n case 'device-code':\n return new DeviceCodeCredential();\n case 'azure-cli':\n return new AzureCliCredential();\n default:\n console.warn('Unknown login method. Using azure-cli as fallback.');\n return new AzureCliCredential();\n }\n}\n"]}
1
+ {"version":3,"file":"getCredential.js","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,4BAA4B,GAAiC;IACjE,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,WAAW;CAClB,CAAC;AAEF,SAAS,qBAAqB,CAAC,WAAwB,EAAE,oBAA2C;IAClG,QAAQ,WAAW,EAAE;QACnB,KAAK,aAAa;YAChB,OAAO,IAAI,4BAA4B,CAAC;gBACtC,WAAW,EAAE,uBAAuB;gBACpC,oBAAoB;gBACpB,4BAA4B;aAC7B,CAAC,CAAC;QACL,KAAK,aAAa;YAChB,OAAO,IAAI,oBAAoB,CAAC;gBAC9B,oBAAoB;gBACpB,4BAA4B;aAC7B,CAAC,CAAC;QACL;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;KAC3D;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAwB,EAAE,SAAiB;IAC7E,IAAI,WAAW,IAAI,WAAW,EAAE;QAC9B,OAAO,IAAI,kBAAkB,EAAE,CAAC;KACjC;IAED,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAE1C,IAAI,oBAAoB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAE9D,MAAM,UAAU,GAAG,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAE5E,IAAI,CAAC,oBAAoB,EAAE;QACzB,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAE7E,IAAI,WAAW,IAAI,aAAa,EAAE;YAChC,OAAO,CAAC,IAAI,CACV,kKAAkK,CACnK,CAAC;SACH;QAED,oBAAoB,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,oCAAoC,CAAC,CAAC;QAE3F,IAAI,oBAAoB,EAAE;YACxB,wBAAwB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;SAC3D;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import {\n AzureCliCredential,\n DeviceCodeCredential,\n InteractiveBrowserCredential,\n useIdentityPlugin,\n type AuthenticationRecord,\n type TokenCachePersistenceOptions,\n} from '@azure/identity';\nimport type { LoginMethod } from '../types/LoginMethod.js';\nimport { cachePersistencePlugin } from '../cache-persistance/cachePersistencePlugin.js';\nimport { getAuthenticationRecord } from './getAuthenticationRecord.js';\nimport { saveAuthenticationRecord } from './saveAuthenticationRecord.js';\n\nconst tokenCachePersistenceOptions: TokenCachePersistenceOptions = {\n enabled: true,\n name: 'cloudpack',\n};\n\nfunction getCredentialInternal(loginMethod: LoginMethod, authenticationRecord?: AuthenticationRecord) {\n switch (loginMethod) {\n case 'interactive':\n return new InteractiveBrowserCredential({\n redirectUri: 'http://localhost:1337',\n authenticationRecord,\n tokenCachePersistenceOptions,\n });\n case 'device-code':\n return new DeviceCodeCredential({\n authenticationRecord,\n tokenCachePersistenceOptions,\n });\n default:\n throw new Error(`Invalid login method: ${loginMethod}`);\n }\n}\n\n/**\n * Gets a credential for the given login method.\n * If the login method is 'azure-cli', it will return an AzureCliCredential.\n * Otherwise, it will return an InteractiveBrowserCredential or a DeviceCodeCredential with persistent token settings.\n * If an authentication record has never been saved before, it will authenticate the credential and save the authentication record.\n */\nexport async function getCredential(loginMethod: LoginMethod, cachePath: string) {\n if (loginMethod == 'azure-cli') {\n return new AzureCliCredential();\n }\n\n useIdentityPlugin(cachePersistencePlugin);\n\n let authenticationRecord = getAuthenticationRecord(cachePath);\n\n const credential = getCredentialInternal(loginMethod, authenticationRecord);\n\n if (!authenticationRecord) {\n console.warn('Cloudpack requires authentication to access Azure resources.');\n\n if (loginMethod == 'interactive') {\n console.warn(\n \"Prepare to sign in – we're launching a browser page for you. Simply follow the instructions on the login page to seamlessly complete the authentication process.\",\n );\n }\n\n authenticationRecord = await credential.authenticate('https://storage.azure.com/.default');\n\n if (authenticationRecord) {\n saveAuthenticationRecord(cachePath, authenticationRecord);\n }\n }\n\n return credential;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { type AuthenticationRecord } from '@azure/identity';
2
+ /**
3
+ * Saves the provided authentication record to Cloudpack's global cache folder.
4
+ * Creates the cache folder if it doesn't exist.
5
+ * @param cachePath - The path to Cloudpack's cache folder.
6
+ * @param authRecord - The authentication record to save.
7
+ */
8
+ export declare function saveAuthenticationRecord(cachePath: string, authRecord: AuthenticationRecord): void;
9
+ //# sourceMappingURL=saveAuthenticationRecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveAuthenticationRecord.d.ts","sourceRoot":"","sources":["../../src/authentication/saveAuthenticationRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAI3F;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,QAQ3F"}
@@ -0,0 +1,17 @@
1
+ import { serializeAuthenticationRecord } from '@azure/identity';
2
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
3
+ import { getAuthenticationRecordPath } from './getAuthenticationRecordPath.js';
4
+ /**
5
+ * Saves the provided authentication record to Cloudpack's global cache folder.
6
+ * Creates the cache folder if it doesn't exist.
7
+ * @param cachePath - The path to Cloudpack's cache folder.
8
+ * @param authRecord - The authentication record to save.
9
+ */
10
+ export function saveAuthenticationRecord(cachePath, authRecord) {
11
+ const content = serializeAuthenticationRecord(authRecord);
12
+ if (!existsSync(cachePath)) {
13
+ mkdirSync(cachePath, { recursive: true });
14
+ }
15
+ writeFileSync(getAuthenticationRecordPath(cachePath), content);
16
+ }
17
+ //# sourceMappingURL=saveAuthenticationRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveAuthenticationRecord.js","sourceRoot":"","sources":["../../src/authentication/saveAuthenticationRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAA6B,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAiB,EAAE,UAAgC;IAC1F,MAAM,OAAO,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAE1D,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC1B,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KAC3C;IAED,aAAa,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { serializeAuthenticationRecord, type AuthenticationRecord } from '@azure/identity';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { getAuthenticationRecordPath } from './getAuthenticationRecordPath.js';\n\n/**\n * Saves the provided authentication record to Cloudpack's global cache folder.\n * Creates the cache folder if it doesn't exist.\n * @param cachePath - The path to Cloudpack's cache folder.\n * @param authRecord - The authentication record to save.\n */\nexport function saveAuthenticationRecord(cachePath: string, authRecord: AuthenticationRecord) {\n const content = serializeAuthenticationRecord(authRecord);\n\n if (!existsSync(cachePath)) {\n mkdirSync(cachePath, { recursive: true });\n }\n\n writeFileSync(getAuthenticationRecordPath(cachePath), content);\n}\n"]}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ import type { IdentityPlugin } from '@azure/identity';
5
+ /**
6
+ * A plugin that provides persistent token caching for `@azure/identity`
7
+ * credentials. The plugin API is compatible with `@azure/identity` versions
8
+ * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`
9
+ * function, imported from `@azure/identity`.
10
+ *
11
+ * In order to enable this functionality, you must also pass
12
+ * `tokenCachePersistenceOptions` to your credential constructors with an
13
+ * `enabled` property set to true.
14
+ *
15
+ * Example:
16
+ *
17
+ * ```javascript
18
+ * import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
19
+ * import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
20
+ *
21
+ * // Load the plugin
22
+ * useIdentityPlugin(cachePersistencePlugin);
23
+ *
24
+ * const credential = new DeviceCodeCredential({
25
+ * tokenCachePersistenceOptions: {
26
+ * enabled: true
27
+ * }
28
+ * });
29
+ * ```
30
+ */
31
+ export declare const cachePersistencePlugin: IdentityPlugin;
32
+ //# sourceMappingURL=cachePersistencePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cachePersistencePlugin.d.ts","sourceRoot":"","sources":["../../src/cache-persistance/cachePersistencePlugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,sBAAsB,EAAE,cAGpC,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ import { createPersistenceCachePlugin } from './provider.js';
5
+ /**
6
+ * A plugin that provides persistent token caching for `@azure/identity`
7
+ * credentials. The plugin API is compatible with `@azure/identity` versions
8
+ * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`
9
+ * function, imported from `@azure/identity`.
10
+ *
11
+ * In order to enable this functionality, you must also pass
12
+ * `tokenCachePersistenceOptions` to your credential constructors with an
13
+ * `enabled` property set to true.
14
+ *
15
+ * Example:
16
+ *
17
+ * ```javascript
18
+ * import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
19
+ * import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
20
+ *
21
+ * // Load the plugin
22
+ * useIdentityPlugin(cachePersistencePlugin);
23
+ *
24
+ * const credential = new DeviceCodeCredential({
25
+ * tokenCachePersistenceOptions: {
26
+ * enabled: true
27
+ * }
28
+ * });
29
+ * ```
30
+ */
31
+ export const cachePersistencePlugin = (context) => {
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
33
+ context.cachePluginControl.setPersistence(createPersistenceCachePlugin);
34
+ };
35
+ //# sourceMappingURL=cachePersistencePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cachePersistencePlugin.js","sourceRoot":"","sources":["../../src/cache-persistance/cachePersistencePlugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,6IAA6I;IAC5I,OAAe,CAAC,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AACnF,CAAC,CAAC","sourcesContent":["/**\n * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// import { AzurePluginContext } from '../../identity/src/plugins/provider';\nimport type { IdentityPlugin } from '@azure/identity';\nimport { createPersistenceCachePlugin } from './provider.js';\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```javascript\n * import { useIdentityPlugin, DeviceCodeCredential } from \"@azure/identity\";\n * import { cachePersistencePlugin } from \"@azure/identity-cache-persistence\";\n *\n * // Load the plugin\n * useIdentityPlugin(cachePersistencePlugin);\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true\n * }\n * });\n * ```\n */\n\nexport const cachePersistencePlugin: IdentityPlugin = (context) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (context as any).cachePluginControl.setPersistence(createPersistenceCachePlugin);\n};\n"]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ /// <reference types="node" resolution-mode="require"/>
5
+ import { type IPersistence as Persistence } from '@azure/msal-node-extensions';
6
+ import type { TokenCachePersistenceOptions } from '@azure/identity';
7
+ /**
8
+ * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
9
+ * @internal
10
+ */
11
+ export declare const defaultMsalValues: {
12
+ tokenCache: {
13
+ name: string;
14
+ directory: string;
15
+ };
16
+ keyRing: {
17
+ label: string;
18
+ schema: string;
19
+ collection: string;
20
+ attributes: {
21
+ MsalClientID: string;
22
+ 'Microsoft.Developer.IdentityService': string;
23
+ };
24
+ service: string;
25
+ account: string;
26
+ };
27
+ keyChain: {
28
+ service: string;
29
+ account: string;
30
+ };
31
+ };
32
+ /**
33
+ * Options that are used by the underlying MSAL cache provider.
34
+ * @internal
35
+ */
36
+ export type MsalPersistenceOptions = Omit<TokenCachePersistenceOptions, 'enabled'>;
37
+ /**
38
+ * A function that returns a persistent token cache instance.
39
+ * @internal
40
+ */
41
+ type MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<Persistence>;
42
+ /**
43
+ * Set of the platforms we attempt to deliver persistence on.
44
+ *
45
+ * - On Windows we use DPAPI.
46
+ * - 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.
47
+ * - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
48
+ *
49
+ * Other platforms _are not supported_ at this time.
50
+ *
51
+ * @internal
52
+ */
53
+ export declare const msalPersistencePlatforms: Partial<Record<NodeJS.Platform, MsalPersistenceFactory>>;
54
+ export {};
55
+ //# sourceMappingURL=platforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platforms.d.ts","sourceRoot":"","sources":["../../src/cache-persistance/platforms.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAKH,OAAO,EAML,KAAK,YAAY,IAAI,WAAW,EACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAapE;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAwB7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;AAEnF;;;GAGG;AACH,KAAK,sBAAsB,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAazF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CA2C7F,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ import * as path from 'path';
7
+ import { DataProtectionScope, FilePersistence, FilePersistenceWithDataProtection, KeychainPersistence, LibSecretPersistence, } from '@azure/msal-node-extensions';
8
+ /**
9
+ * Local application data folder
10
+ * Expected values:
11
+ * - Darwin: '/Users/user/'
12
+ * - Windows 8+: 'C:\Users\user\AppData\Local'
13
+ * - Linux: '/home/user/.local/share'
14
+ * @internal
15
+ */
16
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
+ const localApplicationDataFolder = process.env.APPDATA?.replace?.(/(.Roaming)*$/, '\\Local') ?? process.env.HOME;
18
+ /**
19
+ * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
20
+ * @internal
21
+ */
22
+ export const defaultMsalValues = {
23
+ tokenCache: {
24
+ name: 'msal.cache',
25
+ // Expected values:
26
+ // - Darwin: '/Users/user/.IdentityService'
27
+ // - Windows 8+: 'C:\Users\user\AppData\Local\.IdentityService'
28
+ // - Linux: '/home/user/.IdentityService'
29
+ directory: path.join(localApplicationDataFolder, '.IdentityService'),
30
+ },
31
+ keyRing: {
32
+ label: 'MSALCache',
33
+ schema: 'msal.cache',
34
+ collection: 'default',
35
+ attributes: {
36
+ MsalClientID: 'Microsoft.Developer.IdentityService',
37
+ 'Microsoft.Developer.IdentityService': '1.0.0.0',
38
+ },
39
+ service: 'Microsoft.Developer.IdentityService',
40
+ account: 'MSALCache',
41
+ },
42
+ keyChain: {
43
+ service: 'Microsoft.Developer.IdentityService',
44
+ account: 'MSALCache',
45
+ },
46
+ };
47
+ /**
48
+ * Expected responses:
49
+ * - Darwin: '/Users/user/.IdentityService/<name>'
50
+ * - Windows 8+: 'C:\Users\user\AppData\Local\.IdentityService\<name>'
51
+ * - Linux: '/home/user/.IdentityService/<name>'
52
+ * @internal
53
+ */
54
+ function getPersistencePath(name) {
55
+ return path.join(defaultMsalValues.tokenCache.directory, name);
56
+ }
57
+ /**
58
+ * Set of the platforms we attempt to deliver persistence on.
59
+ *
60
+ * - On Windows we use DPAPI.
61
+ * - 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.
62
+ * - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
63
+ *
64
+ * Other platforms _are not supported_ at this time.
65
+ *
66
+ * @internal
67
+ */
68
+ export const msalPersistencePlatforms = {
69
+ win32: ({ name = defaultMsalValues.tokenCache.name } = {}) => FilePersistenceWithDataProtection.create(getPersistencePath(name), DataProtectionScope.CurrentUser),
70
+ darwin: async (options = {}) => {
71
+ const { name, unsafeAllowUnencryptedStorage } = options;
72
+ const { service, account } = defaultMsalValues.keyChain;
73
+ const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
74
+ try {
75
+ const persistence = await KeychainPersistence.create(persistencePath, service, account);
76
+ // If we don't encounter an error when trying to read from the keychain, then we should be good to go.
77
+ await persistence.load();
78
+ return persistence;
79
+ }
80
+ catch {
81
+ // If we got an error while trying to read from the keyring,
82
+ // we will proceed only if the user has specified that unencrypted storage is allowed.
83
+ if (!unsafeAllowUnencryptedStorage) {
84
+ throw new Error('Unable to read from the macOS Keychain.');
85
+ }
86
+ return FilePersistence.create(persistencePath);
87
+ }
88
+ },
89
+ linux: async (options = {}) => {
90
+ const { name, unsafeAllowUnencryptedStorage } = options;
91
+ const { service, account } = defaultMsalValues.keyRing;
92
+ const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
93
+ try {
94
+ const persistence = await LibSecretPersistence.create(persistencePath, service, account);
95
+ // If we don't encounter an error when trying to read from the keyring, then we should be good to go.
96
+ await persistence.load();
97
+ return persistence;
98
+ }
99
+ catch {
100
+ // If we got an error while trying to read from the keyring,
101
+ // we will proceed only if the user has specified that unencrypted storage is allowed.
102
+ if (!unsafeAllowUnencryptedStorage) {
103
+ throw new Error('Unable to read from the system keyring (libsecret).');
104
+ }
105
+ return FilePersistence.create(persistencePath);
106
+ }
107
+ },
108
+ };
109
+ //# sourceMappingURL=platforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../src/cache-persistance/platforms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,iCAAiC,EACjC,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AAGrC;;;;;;;GAOG;AACH,oEAAoE;AACpE,MAAM,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAK,CAAC;AAElH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,UAAU,EAAE;QACV,IAAI,EAAE,YAAY;QAClB,mBAAmB;QACnB,2CAA2C;QAC3C,+DAA+D;QAC/D,yCAAyC;QACzC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,kBAAkB,CAAC;KACrE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,YAAY;QACpB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE;YACV,YAAY,EAAE,qCAAqC;YACnD,qCAAqC,EAAE,SAAS;SACjD;QACD,OAAO,EAAE,qCAAqC;QAC9C,OAAO,EAAE,WAAW;KACrB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,qCAAqC;QAC9C,OAAO,EAAE,WAAW;KACrB;CACF,CAAC;AAcF;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA6D;IAChG,KAAK,EAAE,CAAC,EAAE,IAAI,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,EAAwB,EAAE,CACjF,iCAAiC,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC;IAErG,MAAM,EAAE,KAAK,EAAE,UAAkC,EAAE,EAAwB,EAAE;QAC3E,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC;QACxD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,QAAQ,CAAC;QACxD,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,IAAI,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEtF,IAAI;YACF,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACxF,sGAAsG;YACtG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;YACzB,OAAO,WAAW,CAAC;SACpB;QAAC,MAAM;YACN,4DAA4D;YAC5D,sFAAsF;YACtF,IAAI,CAAC,6BAA6B,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;aAC5D;YACD,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SAChD;IACH,CAAC;IAED,KAAK,EAAE,KAAK,EAAE,UAAkC,EAAE,EAAwB,EAAE;QAC1E,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC;QACxD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,IAAI,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEtF,IAAI;YACF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACzF,qGAAqG;YACrG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;YACzB,OAAO,WAAW,CAAC;SACpB;QAAC,MAAM;YACN,4DAA4D;YAC5D,sFAAsF;YACtF,IAAI,CAAC,6BAA6B,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;aACxE;YACD,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SAChD;IACH,CAAC;CACF,CAAC","sourcesContent":["/**\n * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport * as path from 'path';\nimport {\n DataProtectionScope,\n FilePersistence,\n FilePersistenceWithDataProtection,\n KeychainPersistence,\n LibSecretPersistence,\n type IPersistence as Persistence,\n} from '@azure/msal-node-extensions';\nimport type { TokenCachePersistenceOptions } from '@azure/identity';\n\n/**\n * Local application data folder\n * Expected values:\n * - Darwin: '/Users/user/'\n * - Windows 8+: 'C:\\Users\\user\\AppData\\Local'\n * - Linux: '/home/user/.local/share'\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\nconst localApplicationDataFolder = process.env.APPDATA?.replace?.(/(.Roaming)*$/, '\\\\Local') ?? process.env.HOME!;\n\n/**\n * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.\n * @internal\n */\nexport const defaultMsalValues = {\n tokenCache: {\n name: 'msal.cache',\n // Expected values:\n // - Darwin: '/Users/user/.IdentityService'\n // - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService'\n // - Linux: '/home/user/.IdentityService'\n directory: path.join(localApplicationDataFolder, '.IdentityService'),\n },\n keyRing: {\n label: 'MSALCache',\n schema: 'msal.cache',\n collection: 'default',\n attributes: {\n MsalClientID: 'Microsoft.Developer.IdentityService',\n 'Microsoft.Developer.IdentityService': '1.0.0.0',\n },\n service: 'Microsoft.Developer.IdentityService',\n account: 'MSALCache',\n },\n keyChain: {\n service: 'Microsoft.Developer.IdentityService',\n account: 'MSALCache',\n },\n};\n\n/**\n * Options that are used by the underlying MSAL cache provider.\n * @internal\n */\nexport type MsalPersistenceOptions = Omit<TokenCachePersistenceOptions, 'enabled'>;\n\n/**\n * A function that returns a persistent token cache instance.\n * @internal\n */\ntype MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<Persistence>;\n\n/**\n * Expected responses:\n * - Darwin: '/Users/user/.IdentityService/<name>'\n * - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'\n * - Linux: '/home/user/.IdentityService/<name>'\n * @internal\n */\nfunction getPersistencePath(name: string): string {\n return path.join(defaultMsalValues.tokenCache.directory, name);\n}\n\n/**\n * Set of the platforms we attempt to deliver persistence on.\n *\n * - On Windows we use DPAPI.\n * - 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.\n * - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.\n *\n * Other platforms _are not supported_ at this time.\n *\n * @internal\n */\nexport const msalPersistencePlatforms: Partial<Record<NodeJS.Platform, MsalPersistenceFactory>> = {\n win32: ({ name = defaultMsalValues.tokenCache.name } = {}): Promise<Persistence> =>\n FilePersistenceWithDataProtection.create(getPersistencePath(name), DataProtectionScope.CurrentUser),\n\n darwin: async (options: MsalPersistenceOptions = {}): Promise<Persistence> => {\n const { name, unsafeAllowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyChain;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n try {\n const persistence = await KeychainPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keychain, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!unsafeAllowUnencryptedStorage) {\n throw new Error('Unable to read from the macOS Keychain.');\n }\n return FilePersistence.create(persistencePath);\n }\n },\n\n linux: async (options: MsalPersistenceOptions = {}): Promise<Persistence> => {\n const { name, unsafeAllowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyRing;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n try {\n const persistence = await LibSecretPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keyring, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!unsafeAllowUnencryptedStorage) {\n throw new Error('Unable to read from the system keyring (libsecret).');\n }\n return FilePersistence.create(persistencePath);\n }\n },\n};\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ import type { MsalPersistenceOptions } from './platforms.js';
5
+ import type { IPersistence as Persistence } from '@azure/msal-node-extensions';
6
+ import type { ICachePlugin as CachePlugin } from '@azure/msal-node';
7
+ /**
8
+ * This is used to gain access to the underlying Persistence instance, which we use for testing
9
+ *
10
+ * @returns a raw persistence instance
11
+ * @internal
12
+ */
13
+ export declare function createPersistence(options: MsalPersistenceOptions): Promise<Persistence>;
14
+ export declare function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin>;
15
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/cache-persistance/provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/E,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAQ7F;AAED,wBAAsB,4BAA4B,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAOzG"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
3
+ */
4
+ import { msalPersistencePlatforms } from './platforms.js';
5
+ import { PersistenceCachePlugin } from '@azure/msal-node-extensions';
6
+ /**
7
+ * This is used to gain access to the underlying Persistence instance, which we use for testing
8
+ *
9
+ * @returns a raw persistence instance
10
+ * @internal
11
+ */
12
+ export async function createPersistence(options) {
13
+ const persistence = await msalPersistencePlatforms[process.platform]?.(options);
14
+ if (persistence === undefined) {
15
+ throw new Error('no persistence providers are available on this platform');
16
+ }
17
+ return persistence;
18
+ }
19
+ export async function createPersistenceCachePlugin(options) {
20
+ const persistence = await createPersistence(options ?? {});
21
+ return new PersistenceCachePlugin(persistence, {
22
+ retryNumber: 100,
23
+ retryDelay: 50,
24
+ });
25
+ }
26
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/cache-persistance/provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA+B;IACrE,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IAEhF,IAAI,WAAW,KAAK,SAAS,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAAgC;IACjF,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAE3D,OAAO,IAAI,sBAAsB,CAAC,WAAW,EAAE;QAC7C,WAAW,EAAE,GAAG;QAChB,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { MsalPersistenceOptions } from './platforms.js';\nimport { msalPersistencePlatforms } from './platforms.js';\nimport type { IPersistence as Persistence } from '@azure/msal-node-extensions';\nimport { PersistenceCachePlugin } from '@azure/msal-node-extensions';\nimport type { ICachePlugin as CachePlugin } from '@azure/msal-node';\n\n/**\n * This is used to gain access to the underlying Persistence instance, which we use for testing\n *\n * @returns a raw persistence instance\n * @internal\n */\nexport async function createPersistence(options: MsalPersistenceOptions): Promise<Persistence> {\n const persistence = await msalPersistencePlatforms[process.platform]?.(options);\n\n if (persistence === undefined) {\n throw new Error('no persistence providers are available on this platform');\n }\n\n return persistence;\n}\n\nexport async function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin> {\n const persistence = await createPersistence(options ?? {});\n\n return new PersistenceCachePlugin(persistence, {\n retryNumber: 100,\n retryDelay: 50,\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function createBlobStorageUrl(storageAccount: string): string;
2
+ //# sourceMappingURL=createBlobStorageUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createBlobStorageUrl.d.ts","sourceRoot":"","sources":["../src/createBlobStorageUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,UAE1D"}
@@ -0,0 +1,4 @@
1
+ export function createBlobStorageUrl(storageAccount) {
2
+ return `https://${storageAccount}.blob.core.windows.net`;
3
+ }
4
+ //# sourceMappingURL=createBlobStorageUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createBlobStorageUrl.js","sourceRoot":"","sources":["../src/createBlobStorageUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,cAAsB;IACzD,OAAO,WAAW,cAAc,wBAAwB,CAAC;AAC3D,CAAC","sourcesContent":["export function createBlobStorageUrl(storageAccount: string) {\n return `https://${storageAccount}.blob.core.windows.net`;\n}\n"]}