@ms-cloudpack/remote-cache 0.1.7 → 0.1.9
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/lib/authentication/acquireSasToken.d.ts.map +1 -1
- package/lib/authentication/acquireSasToken.js +0 -1
- package/lib/authentication/acquireSasToken.js.map +1 -1
- package/lib/authentication/getCredential.d.ts +2 -2
- package/lib/authentication/getCredential.d.ts.map +1 -1
- package/lib/authentication/getCredential.js +2 -2
- package/lib/authentication/getCredential.js.map +1 -1
- package/lib/authentication/getSasToken.d.ts +1 -1
- package/lib/authentication/getSasToken.d.ts.map +1 -1
- package/lib/authentication/getSasToken.js +2 -1
- package/lib/authentication/getSasToken.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquireSasToken.d.ts","sourceRoot":"","sources":["../../src/authentication/acquireSasToken.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAInF,wBAAsB,eAAe,CAAC,EACpC,cAAc,EAAE,OAAO,EACvB,SAAS,EACT,WAAW,EACX,kBAAkB,GACnB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"acquireSasToken.d.ts","sourceRoot":"","sources":["../../src/authentication/acquireSasToken.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAInF,wBAAsB,eAAe,CAAC,EACpC,cAAc,EAAE,OAAO,EACvB,SAAS,EACT,WAAW,EACX,kBAAkB,GACnB,EAAE,uBAAuB,mBAwBzB"}
|
|
@@ -14,7 +14,6 @@ export async function acquireSasToken({ storageAccount: account, container, perm
|
|
|
14
14
|
permissions: ContainerSASPermissions.from(permissions),
|
|
15
15
|
expiresOn,
|
|
16
16
|
startsOn,
|
|
17
|
-
ipRange: { start: '0.0.0.0', end: '255.255.255.255' },
|
|
18
17
|
protocol: SASProtocol.Https,
|
|
19
18
|
}, userDelegationKey, account);
|
|
20
19
|
return sasQueryParams.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquireSasToken.js","sourceRoot":"","sources":["../../src/authentication/acquireSasToken.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,cAAc,EAAE,OAAO,EACvB,SAAS,EACT,WAAW,EACX,kBAAkB,GACM;IACxB,MAAM,UAAU,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;IACrF,MAAM,eAAe,GAAG,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM;IACnC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,mBAAmB,CAAC,CAAC,CAAC,cAAc;IAEpF,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,8BAA8B,CACnD;QACE,aAAa,EAAE,eAAe,CAAC,aAAa;QAC5C,WAAW,EAAE,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC;QACtD,SAAS;QACT,QAAQ;QACR,
|
|
1
|
+
{"version":3,"file":"acquireSasToken.js","sourceRoot":"","sources":["../../src/authentication/acquireSasToken.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,cAAc,EAAE,OAAO,EACvB,SAAS,EACT,WAAW,EACX,kBAAkB,GACM;IACxB,MAAM,UAAU,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;IACrF,MAAM,eAAe,GAAG,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM;IACnC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,mBAAmB,CAAC,CAAC,CAAC,cAAc;IAEpF,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,8BAA8B,CACnD;QACE,aAAa,EAAE,eAAe,CAAC,aAAa;QAC5C,WAAW,EAAE,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC;QACtD,SAAS;QACT,QAAQ;QACR,QAAQ,EAAE,WAAW,CAAC,KAAK;KAC5B,EACD,iBAAiB,EACjB,OAAO,CACR,CAAC;IAEF,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import {\n BlobServiceClient,\n ContainerSASPermissions,\n SASProtocol,\n generateBlobSASQueryParameters,\n} from '@azure/storage-blob';\nimport type { ConnectionStringOptions } from '../types/ConnectionStringOptions.js';\nimport { createBlobStorageUrl } from './createBlobStorageUrl.js';\nimport { getCredential } from './getCredential.js';\n\nexport async function acquireSasToken({\n storageAccount: account,\n container,\n permissions,\n isInteractiveLogin,\n}: ConnectionStringOptions) {\n const credential = getCredential(isInteractiveLogin);\n const blobStorage = new BlobServiceClient(createBlobStorageUrl(account), credential);\n const containerClient = blobStorage.getContainerClient(container);\n\n const startsOn = new Date(); // now\n const twentyFourHoursInMs = 86400000;\n const expiresOn = new Date(startsOn.valueOf() + twentyFourHoursInMs); // in 24 hours\n\n const userDelegationKey = await blobStorage.getUserDelegationKey(startsOn, expiresOn);\n\n const sasQueryParams = generateBlobSASQueryParameters(\n {\n containerName: containerClient.containerName,\n permissions: ContainerSASPermissions.from(permissions),\n expiresOn,\n startsOn,\n protocol: SASProtocol.Https,\n },\n userDelegationKey,\n account,\n );\n\n return sasQueryParams.toString();\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getCredential(isInteractiveLogin: boolean): InteractiveBrowserCredential |
|
|
1
|
+
import { AzureCliCredential, InteractiveBrowserCredential } from '@azure/identity';
|
|
2
|
+
export declare function getCredential(isInteractiveLogin: boolean): InteractiveBrowserCredential | AzureCliCredential;
|
|
3
3
|
//# 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,
|
|
1
|
+
{"version":3,"file":"getCredential.d.ts","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAEnF,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,OAAO,qDAOxD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AzureCliCredential, InteractiveBrowserCredential } from '@azure/identity';
|
|
2
2
|
export function getCredential(isInteractiveLogin) {
|
|
3
3
|
if (isInteractiveLogin) {
|
|
4
4
|
return new InteractiveBrowserCredential({
|
|
5
5
|
redirectUri: 'http://localhost:1337',
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
|
-
return new
|
|
8
|
+
return new AzureCliCredential();
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=getCredential.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCredential.js","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getCredential.js","sourceRoot":"","sources":["../../src/authentication/getCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,UAAU,aAAa,CAAC,kBAA2B;IACvD,IAAI,kBAAkB,EAAE;QACtB,OAAO,IAAI,4BAA4B,CAAC;YACtC,WAAW,EAAE,uBAAuB;SACrC,CAAC,CAAC;KACJ;IACD,OAAO,IAAI,kBAAkB,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { AzureCliCredential, InteractiveBrowserCredential } from '@azure/identity';\n\nexport function getCredential(isInteractiveLogin: boolean) {\n if (isInteractiveLogin) {\n return new InteractiveBrowserCredential({\n redirectUri: 'http://localhost:1337',\n });\n }\n return new AzureCliCredential();\n}\n"]}
|
|
@@ -8,5 +8,5 @@ export interface GetSasTokenDependencies {
|
|
|
8
8
|
acquireSasToken: (options: ConnectionStringOptions) => Promise<string>;
|
|
9
9
|
isExpired: (token: string) => boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare function getSasToken({ connectionStringOptions }: GetSasTokenOptions, { tokenCache, acquireSasToken, isExpired }: GetSasTokenDependencies): Promise<string
|
|
11
|
+
export declare function getSasToken({ connectionStringOptions }: GetSasTokenOptions, { tokenCache, acquireSasToken, isExpired }: GetSasTokenDependencies): Promise<string>;
|
|
12
12
|
//# sourceMappingURL=getSasToken.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSasToken.d.ts","sourceRoot":"","sources":["../../src/authentication/getSasToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IACjC,uBAAuB,EAAE,uBAAuB,CAAC;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,eAAe,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,wBAAsB,WAAW,CAC/B,EAAE,uBAAuB,EAAE,EAAE,kBAAkB,EAC/C,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,uBAAuB
|
|
1
|
+
{"version":3,"file":"getSasToken.d.ts","sourceRoot":"","sources":["../../src/authentication/getSasToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IACjC,uBAAuB,EAAE,uBAAuB,CAAC;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,eAAe,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,wBAAsB,WAAW,CAC/B,EAAE,uBAAuB,EAAE,EAAE,kBAAkB,EAC/C,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,uBAAuB,mBAepE"}
|
|
@@ -9,7 +9,8 @@ export async function getSasToken({ connectionStringOptions }, { tokenCache, acq
|
|
|
9
9
|
return token;
|
|
10
10
|
}
|
|
11
11
|
catch (error) {
|
|
12
|
-
console.error(`Failed to get SAS token for storage account
|
|
12
|
+
console.error(`Failed to get SAS token for storage account.`, error);
|
|
13
|
+
throw error;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=getSasToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSasToken.js","sourceRoot":"","sources":["../../src/authentication/getSasToken.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,EAAE,uBAAuB,EAAsB,EAC/C,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAA2B;IAEnE,IAAI;QACF,MAAM,UAAU,GAAG,UAAU,EAAE,GAAG,EAAE,CAAC;QACrC,IAAI,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;YACxC,OAAO,UAAU,CAAC;SACnB;QAED,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,uBAAuB,CAAC,CAAC;QAC7D,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getSasToken.js","sourceRoot":"","sources":["../../src/authentication/getSasToken.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,EAAE,uBAAuB,EAAsB,EAC/C,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAA2B;IAEnE,IAAI;QACF,MAAM,UAAU,GAAG,UAAU,EAAE,GAAG,EAAE,CAAC;QACrC,IAAI,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;YACxC,OAAO,UAAU,CAAC;SACnB;QAED,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,uBAAuB,CAAC,CAAC;QAC7D,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC;KACd;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QACrE,MAAM,KAAK,CAAC;KACb;AACH,CAAC","sourcesContent":["import type { LocalTokenCacheProvider } from '../types/LocalTokenCacheProvider.js';\nimport type { ConnectionStringOptions } from '../types/ConnectionStringOptions.js';\n\nexport interface GetSasTokenOptions {\n connectionStringOptions: ConnectionStringOptions;\n}\n\nexport interface GetSasTokenDependencies {\n tokenCache?: LocalTokenCacheProvider;\n acquireSasToken: (options: ConnectionStringOptions) => Promise<string>;\n isExpired: (token: string) => boolean;\n}\n\nexport async function getSasToken(\n { connectionStringOptions }: GetSasTokenOptions,\n { tokenCache, acquireSasToken, isExpired }: GetSasTokenDependencies,\n) {\n try {\n const localToken = tokenCache?.get();\n if (localToken && !isExpired(localToken)) {\n return localToken;\n }\n\n const token = await acquireSasToken(connectionStringOptions);\n tokenCache?.set(token);\n return token;\n } catch (error) {\n console.error(`Failed to get SAS token for storage account.`, error);\n throw error;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@azure/identity": "^3.2.3",
|
|
34
34
|
"@azure/storage-blob": "^12.15.0",
|
|
35
35
|
"@napi-rs/keyring": "^1.1.3",
|
|
36
|
-
"backfill": "^6.1
|
|
37
|
-
"backfill-config": "^6.
|
|
36
|
+
"backfill": "^6.2.1",
|
|
37
|
+
"backfill-config": "^6.4.1"
|
|
38
38
|
}
|
|
39
39
|
}
|