@ms-cloudpack/remote-cache 0.1.3 → 0.1.5

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 (95) hide show
  1. package/README.md +2 -7
  2. package/lib/{RemoteCacheClient.d.ts → AzureRemoteCacheClient.d.ts} +5 -4
  3. package/lib/AzureRemoteCacheClient.d.ts.map +1 -0
  4. package/lib/{RemoteCacheClient.js → AzureRemoteCacheClient.js} +18 -6
  5. package/lib/AzureRemoteCacheClient.js.map +1 -0
  6. package/lib/authentication/acquireSasToken.d.ts +1 -1
  7. package/lib/authentication/acquireSasToken.d.ts.map +1 -1
  8. package/lib/authentication/acquireSasToken.js +3 -5
  9. package/lib/authentication/acquireSasToken.js.map +1 -1
  10. package/lib/authentication/getAuthenticatedConnectionString.d.ts.map +1 -1
  11. package/lib/authentication/getAuthenticatedConnectionString.js +8 -2
  12. package/lib/authentication/getAuthenticatedConnectionString.js.map +1 -1
  13. package/lib/authentication/getCredential.d.ts +3 -0
  14. package/lib/authentication/getCredential.d.ts.map +1 -0
  15. package/lib/authentication/getCredential.js +10 -0
  16. package/lib/authentication/getCredential.js.map +1 -0
  17. package/lib/authentication/getSasToken.d.ts +1 -1
  18. package/lib/authentication/getSasToken.d.ts.map +1 -1
  19. package/lib/authentication/getSasToken.js +2 -2
  20. package/lib/authentication/getSasToken.js.map +1 -1
  21. package/lib/createRemoteCacheClient.d.ts +7 -10
  22. package/lib/createRemoteCacheClient.d.ts.map +1 -1
  23. package/lib/createRemoteCacheClient.js +20 -10
  24. package/lib/createRemoteCacheClient.js.map +1 -1
  25. package/lib/decorators/InMemoryDecorator.d.ts +15 -0
  26. package/lib/decorators/InMemoryDecorator.d.ts.map +1 -0
  27. package/lib/decorators/InMemoryDecorator.js +29 -0
  28. package/lib/decorators/InMemoryDecorator.js.map +1 -0
  29. package/lib/decorators/ReporterDecorator.d.ts +10 -0
  30. package/lib/decorators/ReporterDecorator.d.ts.map +1 -0
  31. package/lib/decorators/ReporterDecorator.js +64 -0
  32. package/lib/decorators/ReporterDecorator.js.map +1 -0
  33. package/lib/decorators/RetryDecorator.d.ts +17 -0
  34. package/lib/decorators/RetryDecorator.d.ts.map +1 -0
  35. package/lib/decorators/RetryDecorator.js +27 -0
  36. package/lib/decorators/RetryDecorator.js.map +1 -0
  37. package/lib/getListOfBlobs.d.ts +6 -0
  38. package/lib/getListOfBlobs.d.ts.map +1 -0
  39. package/lib/getListOfBlobs.js +14 -0
  40. package/lib/getListOfBlobs.js.map +1 -0
  41. package/lib/index.d.ts +4 -4
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/index.js +1 -2
  44. package/lib/index.js.map +1 -1
  45. package/lib/retry/RetryManager.d.ts +20 -0
  46. package/lib/retry/RetryManager.d.ts.map +1 -0
  47. package/lib/retry/RetryManager.js +47 -0
  48. package/lib/retry/RetryManager.js.map +1 -0
  49. package/lib/retry/blockListIsInvalidRetryPolicy.d.ts +3 -0
  50. package/lib/retry/blockListIsInvalidRetryPolicy.d.ts.map +1 -0
  51. package/lib/retry/blockListIsInvalidRetryPolicy.js +8 -0
  52. package/lib/retry/blockListIsInvalidRetryPolicy.js.map +1 -0
  53. package/lib/tsdoc-metadata.json +1 -1
  54. package/lib/types/ConnectionStringOptions.d.ts +2 -0
  55. package/lib/types/ConnectionStringOptions.d.ts.map +1 -1
  56. package/lib/types/ConnectionStringOptions.js.map +1 -1
  57. package/lib/types/RemoteCacheClient.d.ts +11 -0
  58. package/lib/types/RemoteCacheClient.d.ts.map +1 -0
  59. package/lib/types/RemoteCacheClient.js +2 -0
  60. package/lib/types/RemoteCacheClient.js.map +1 -0
  61. package/lib/types/RetryPolicy.d.ts +15 -0
  62. package/lib/types/RetryPolicy.d.ts.map +1 -0
  63. package/lib/types/RetryPolicy.js +2 -0
  64. package/lib/types/RetryPolicy.js.map +1 -0
  65. package/package.json +1 -3
  66. package/lib/RemoteCacheClient.d.ts.map +0 -1
  67. package/lib/RemoteCacheClient.js.map +0 -1
  68. package/lib/createDownloadTask.d.ts +0 -5
  69. package/lib/createDownloadTask.d.ts.map +0 -1
  70. package/lib/createDownloadTask.js +0 -21
  71. package/lib/createDownloadTask.js.map +0 -1
  72. package/lib/createUploadTask.d.ts +0 -5
  73. package/lib/createUploadTask.d.ts.map +0 -1
  74. package/lib/createUploadTask.js +0 -18
  75. package/lib/createUploadTask.js.map +0 -1
  76. package/lib/getPackagesToSync.d.ts +0 -4
  77. package/lib/getPackagesToSync.d.ts.map +0 -1
  78. package/lib/getPackagesToSync.js +0 -18
  79. package/lib/getPackagesToSync.js.map +0 -1
  80. package/lib/performance/markers.d.ts +0 -13
  81. package/lib/performance/markers.d.ts.map +0 -1
  82. package/lib/performance/markers.js +0 -15
  83. package/lib/performance/markers.js.map +0 -1
  84. package/lib/syncToLocal.d.ts +0 -3
  85. package/lib/syncToLocal.d.ts.map +0 -1
  86. package/lib/syncToLocal.js +0 -21
  87. package/lib/syncToLocal.js.map +0 -1
  88. package/lib/syncToRemote.d.ts +0 -15
  89. package/lib/syncToRemote.d.ts.map +0 -1
  90. package/lib/syncToRemote.js +0 -25
  91. package/lib/syncToRemote.js.map +0 -1
  92. package/lib/types/SyncContext.d.ts +0 -24
  93. package/lib/types/SyncContext.d.ts.map +0 -1
  94. package/lib/types/SyncContext.js +0 -2
  95. package/lib/types/SyncContext.js.map +0 -1
package/lib/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export { syncToLocal } from './syncToLocal.js';
2
- export { syncToRemote } from './syncToRemote.js';
1
+ export { createRemoteCacheClient } from './createRemoteCacheClient.js';
3
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { syncToLocal } from './syncToLocal.js';\nexport { syncToRemote } from './syncToRemote.js';\n\nexport type { SyncContext } from './types/SyncContext.js';\nexport type { PackageToSync } from './types/PackageToSync.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export { createRemoteCacheClient } from './createRemoteCacheClient.js';\n\nexport type {\n RemoteCacheClient,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientOperationResult,\n} from './types/RemoteCacheClient.js';\nexport type { ConnectionStringOptions } from './types/ConnectionStringOptions.js';\nexport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\n"]}
@@ -0,0 +1,20 @@
1
+ import type { RetryPolicy } from '../types/RetryPolicy.js';
2
+ /**
3
+ * A manager that handles the retry logic.
4
+ */
5
+ export declare class RetryManager {
6
+ private readonly policies;
7
+ constructor(policies: RetryPolicy[]);
8
+ private findPolicy;
9
+ private sleep;
10
+ /**
11
+ * If the operation call fails and there is an applicable retry policy, it will retry the operation.
12
+ * @param operation The operation to call. The retry context is passed to the operation if it is in retry.
13
+ * @returns
14
+ */
15
+ retry<T>(operation: (retryContext?: {
16
+ retryAttempt: number;
17
+ maxRetries: number;
18
+ }) => Promise<T>): Promise<T>;
19
+ }
20
+ //# sourceMappingURL=RetryManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RetryManager.d.ts","sourceRoot":"","sources":["../../src/retry/RetryManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAAE;IAEpD,OAAO,CAAC,UAAU,CAOhB;IAEF,OAAO,CAAC,KAAK;IAIb;;;;OAIG;IACU,KAAK,CAAC,CAAC,EAClB,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GACrF,OAAO,CAAC,CAAC,CAAC;CAyBd"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A manager that handles the retry logic.
3
+ */
4
+ export class RetryManager {
5
+ constructor(policies) {
6
+ this.policies = policies;
7
+ this.findPolicy = (error) => {
8
+ for (const policy of this.policies) {
9
+ if (policy.handle(error)) {
10
+ return policy;
11
+ }
12
+ }
13
+ return undefined;
14
+ };
15
+ }
16
+ sleep(ms) {
17
+ return new Promise((resolve) => setTimeout(resolve, ms));
18
+ }
19
+ /**
20
+ * If the operation call fails and there is an applicable retry policy, it will retry the operation.
21
+ * @param operation The operation to call. The retry context is passed to the operation if it is in retry.
22
+ * @returns
23
+ */
24
+ async retry(operation) {
25
+ let retryAttempt = 0;
26
+ let previousPolicy = undefined;
27
+ do {
28
+ try {
29
+ const retryContext = previousPolicy ? { retryAttempt, maxRetries: previousPolicy.maxRetries } : undefined;
30
+ return await operation(retryContext);
31
+ }
32
+ catch (e) {
33
+ const policy = this.findPolicy(e);
34
+ if (previousPolicy !== policy) {
35
+ retryAttempt = 0;
36
+ previousPolicy = policy;
37
+ }
38
+ if (!policy || retryAttempt++ >= policy.maxRetries) {
39
+ throw e;
40
+ }
41
+ await this.sleep(policy.wait(retryAttempt));
42
+ }
43
+ // eslint-disable-next-line no-constant-condition
44
+ } while (true);
45
+ }
46
+ }
47
+ //# sourceMappingURL=RetryManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RetryManager.js","sourceRoot":"","sources":["../../src/retry/RetryManager.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;QAE5C,eAAU,GAAG,CAAC,KAAc,EAA2B,EAAE;YAC/D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAClC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;oBACxB,OAAO,MAAM,CAAC;iBACf;aACF;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;IATqD,CAAC;IAWhD,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAChB,SAAsF;QAEtF,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,cAAc,GAA4B,SAAS,CAAC;QAExD,GAAG;YACD,IAAI;gBACF,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBAE1G,OAAO,MAAM,SAAS,CAAC,YAAY,CAAC,CAAC;aACtC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAClC,IAAI,cAAc,KAAK,MAAM,EAAE;oBAC7B,YAAY,GAAG,CAAC,CAAC;oBACjB,cAAc,GAAG,MAAM,CAAC;iBACzB;gBAED,IAAI,CAAC,MAAM,IAAI,YAAY,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE;oBAClD,MAAM,CAAC,CAAC;iBACT;gBAED,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;aAC7C;YACD,iDAAiD;SAClD,QAAQ,IAAI,EAAE;IACjB,CAAC;CACF","sourcesContent":["import type { RetryPolicy } from '../types/RetryPolicy.js';\n\n/**\n * A manager that handles the retry logic.\n */\nexport class RetryManager {\n constructor(private readonly policies: RetryPolicy[]) {}\n\n private findPolicy = (error: unknown): RetryPolicy | undefined => {\n for (const policy of this.policies) {\n if (policy.handle(error)) {\n return policy;\n }\n }\n return undefined;\n };\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n /**\n * If the operation call fails and there is an applicable retry policy, it will retry the operation.\n * @param operation The operation to call. The retry context is passed to the operation if it is in retry.\n * @returns\n */\n public async retry<T>(\n operation: (retryContext?: { retryAttempt: number; maxRetries: number }) => Promise<T>,\n ): Promise<T> {\n let retryAttempt = 0;\n let previousPolicy: RetryPolicy | undefined = undefined;\n\n do {\n try {\n const retryContext = previousPolicy ? { retryAttempt, maxRetries: previousPolicy.maxRetries } : undefined;\n\n return await operation(retryContext);\n } catch (e) {\n const policy = this.findPolicy(e);\n if (previousPolicy !== policy) {\n retryAttempt = 0;\n previousPolicy = policy;\n }\n\n if (!policy || retryAttempt++ >= policy.maxRetries) {\n throw e;\n }\n\n await this.sleep(policy.wait(retryAttempt));\n }\n // eslint-disable-next-line no-constant-condition\n } while (true);\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { RetryPolicy } from '../types/RetryPolicy.js';
2
+ export declare const blockListIsInvalidRetryPolicy: RetryPolicy;
3
+ //# sourceMappingURL=blockListIsInvalidRetryPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockListIsInvalidRetryPolicy.d.ts","sourceRoot":"","sources":["../../src/retry/blockListIsInvalidRetryPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,eAAO,MAAM,6BAA6B,EAAE,WAM3C,CAAC"}
@@ -0,0 +1,8 @@
1
+ export const blockListIsInvalidRetryPolicy = {
2
+ maxRetries: 1,
3
+ handle: (error) => {
4
+ return error instanceof Error && error.message.indexOf('The specified block list is invalid.') > -1;
5
+ },
6
+ wait: () => 0,
7
+ };
8
+ //# sourceMappingURL=blockListIsInvalidRetryPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockListIsInvalidRetryPolicy.js","sourceRoot":"","sources":["../../src/retry/blockListIsInvalidRetryPolicy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAgB;IACxD,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QAChB,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,sCAAsC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtG,CAAC;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;CACd,CAAC","sourcesContent":["import type { RetryPolicy } from '../types/RetryPolicy.js';\n\nexport const blockListIsInvalidRetryPolicy: RetryPolicy = {\n maxRetries: 1,\n handle: (error) => {\n return error instanceof Error && error.message.indexOf('The specified block list is invalid.') > -1;\n },\n wait: () => 0,\n};\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.36.3"
8
+ "packageVersion": "7.36.4"
9
9
  }
10
10
  ]
11
11
  }
@@ -4,6 +4,8 @@ export interface ConnectionStringOptions {
4
4
  permissions: {
5
5
  read: boolean;
6
6
  write: boolean;
7
+ list: boolean;
7
8
  };
9
+ isInteractiveLogin: boolean;
8
10
  }
9
11
  //# sourceMappingURL=ConnectionStringOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionStringOptions.d.ts","sourceRoot":"","sources":["../../src/types/ConnectionStringOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QACX,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH"}
1
+ {"version":3,"file":"ConnectionStringOptions.d.ts","sourceRoot":"","sources":["../../src/types/ConnectionStringOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QACX,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;QACf,IAAI,EAAE,OAAO,CAAC;KACf,CAAC;IACF,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionStringOptions.js","sourceRoot":"","sources":["../../src/types/ConnectionStringOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConnectionStringOptions {\n storageAccount: string;\n container: string;\n permissions: {\n read: boolean;\n write: boolean;\n };\n}\n"]}
1
+ {"version":3,"file":"ConnectionStringOptions.js","sourceRoot":"","sources":["../../src/types/ConnectionStringOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConnectionStringOptions {\n storageAccount: string;\n container: string;\n permissions: {\n read: boolean;\n write: boolean;\n list: boolean;\n };\n isInteractiveLogin: boolean;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export type RemoteCacheClientOperationResult = 'success' | 'not-found' | 'already-exist';
2
+ export interface RemoteCacheClientOperationOptions {
3
+ folderName: string;
4
+ path: string;
5
+ friendlyName: string;
6
+ }
7
+ export interface RemoteCacheClient {
8
+ uploadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
9
+ downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
10
+ }
11
+ //# sourceMappingURL=RemoteCacheClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteCacheClient.d.ts","sourceRoot":"","sources":["../../src/types/RemoteCacheClient.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gCAAgC,GAAG,SAAS,GAAG,WAAW,GAAG,eAAe,CAAC;AAEzF,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACpG,cAAc,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;CACvG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RemoteCacheClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteCacheClient.js","sourceRoot":"","sources":["../../src/types/RemoteCacheClient.ts"],"names":[],"mappings":"","sourcesContent":["export type RemoteCacheClientOperationResult = 'success' | 'not-found' | 'already-exist';\n\nexport interface RemoteCacheClientOperationOptions {\n folderName: string;\n path: string;\n friendlyName: string;\n}\n\nexport interface RemoteCacheClient {\n uploadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;\n downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ export type RetryPolicy = {
2
+ /**
3
+ * The maximum number of retries.
4
+ */
5
+ maxRetries: number;
6
+ /**
7
+ * Given the error, return true if the operation should be handled by this policy.
8
+ */
9
+ handle: (error: unknown) => boolean;
10
+ /**
11
+ * Given the retry attempt, return the number of milliseconds to wait before retrying.
12
+ */
13
+ wait: (retryAttempt: number) => number;
14
+ };
15
+ //# sourceMappingURL=RetryPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RetryPolicy.d.ts","sourceRoot":"","sources":["../../src/types/RetryPolicy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAEpC;;OAEG;IACH,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RetryPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RetryPolicy.js","sourceRoot":"","sources":["../../src/types/RetryPolicy.ts"],"names":[],"mappings":"","sourcesContent":["export type RetryPolicy = {\n /**\n * The maximum number of retries.\n */\n maxRetries: number;\n\n /**\n * Given the error, return true if the operation should be handled by this policy.\n */\n handle: (error: unknown) => boolean;\n\n /**\n * Given the retry attempt, return the number of milliseconds to wait before retrying.\n */\n wait: (retryAttempt: number) => number;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/remote-cache",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,8 +29,6 @@
29
29
  "lib/**/!(*.test.*)"
30
30
  ],
31
31
  "dependencies": {
32
- "@ms-cloudpack/bundler-types": "^0.17.0",
33
- "@ms-cloudpack/package-utilities": "^5.1.1",
34
32
  "@ms-cloudpack/task-reporter": "^0.7.2",
35
33
  "@azure/identity": "^3.2.3",
36
34
  "@azure/storage-blob": "^12.15.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/RemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAKrB;gBAEU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,wBAAwB;IAerE;;;;;OAKG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAI7C;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAGhD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteCacheClient.js","sourceRoot":"","sources":["../src/RemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI7D,MAAM,OAAO,iBAAiB;IAS5B,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAA4B;QARpD,WAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAS3E,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,IAAI;YACxB,mBAAmB,EAAE,EAAE;YACvB,UAAU,EAAE,CAAC,MAAM,CAAC;YACpB,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,gBAAgB;oBAChB,SAAS;iBACV;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,UAAkB,EAAE,IAAY;QAC3C,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,UAAkB,EAAE,IAAY;QAC7C,OAAO,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,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';\n\nexport class 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 outputGlob: string[];\n };\n\n constructor({ container, connectionString }: RemoteCacheClientOptions) {\n this.config = {\n incrementalCaching: true,\n internalCacheFolder: '', // not used by azure-blob\n outputGlob: ['**/*'],\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 * @returns - A promise that resolves when the folder has been uploaded.\n */\n uploadFolder(folderName: string, path: string) {\n return put(path, folderName, this.logger, this.config);\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 downloadFolder(folderName: string, path: string) {\n return fetch(path, folderName, this.logger, this.config);\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- import type { RemoteCacheClient } from './RemoteCacheClient.js';
2
- import type { Task } from './Task.js';
3
- import type { PackageToSync } from './types/PackageToSync.js';
4
- export declare function createDownloadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
- //# sourceMappingURL=createDownloadTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDownloadTask.d.ts","sourceRoot":"","sources":["../src/createDownloadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAmBN"}
@@ -1,21 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { bulletedList } from '@ms-cloudpack/task-reporter';
3
- export function createDownloadTask(client, { folderName, packageName, path, version }) {
4
- return {
5
- name: `Downloading ${packageName}@${version}`,
6
- execute: async () => {
7
- if (existsSync(path)) {
8
- return { status: 'skip', message: 'Package is already exist in the local cache.' };
9
- }
10
- const result = await client.downloadFolder(folderName, path);
11
- if (!result) {
12
- return { status: 'skip', message: `not found in the remote cache.` };
13
- }
14
- return {
15
- status: 'complete',
16
- details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
17
- };
18
- },
19
- };
20
- }
21
- //# sourceMappingURL=createDownloadTask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDownloadTask.js","sourceRoot":"","sources":["../src/createDownloadTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,UAAU,kBAAkB,CAChC,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,eAAe,WAAW,IAAI,OAAO,EAAE;QAC7C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;gBACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;aACpF;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;aACtE;YAED,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from './RemoteCacheClient.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport type { PackageToSync } from './types/PackageToSync.js';\n\nexport function createDownloadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Downloading ${packageName}@${version}`,\n execute: async () => {\n if (existsSync(path)) {\n return { status: 'skip', message: 'Package is already exist in the local cache.' };\n }\n\n const result = await client.downloadFolder(folderName, path);\n if (!result) {\n return { status: 'skip', message: `not found in the remote cache.` };\n }\n\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -1,5 +0,0 @@
1
- import type { RemoteCacheClient } from './RemoteCacheClient.js';
2
- import type { Task } from './Task.js';
3
- import type { PackageToSync } from './types/PackageToSync.js';
4
- export declare function createUploadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
- //# sourceMappingURL=createUploadTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUploadTask.d.ts","sourceRoot":"","sources":["../src/createUploadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAeN"}
@@ -1,18 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { bulletedList } from '@ms-cloudpack/task-reporter';
3
- export function createUploadTask(client, { folderName, packageName, path, version }) {
4
- return {
5
- name: `Uploading ${packageName}@${version}`,
6
- execute: async () => {
7
- if (!existsSync(path)) {
8
- return { status: 'skip', message: `Not found in the local cache.` };
9
- }
10
- await client.uploadFolder(folderName, path);
11
- return {
12
- status: 'complete',
13
- details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
14
- };
15
- },
16
- };
17
- }
18
- //# sourceMappingURL=createUploadTask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUploadTask.js","sourceRoot":"","sources":["../src/createUploadTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,UAAU,gBAAgB,CAC9B,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,aAAa,WAAW,IAAI,OAAO,EAAE;QAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACrB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC;aACrE;YAED,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from './RemoteCacheClient.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport type { PackageToSync } from './types/PackageToSync.js';\n\nexport function createUploadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Uploading ${packageName}@${version}`,\n execute: async () => {\n if (!existsSync(path)) {\n return { status: 'skip', message: `Not found in the local cache.` };\n }\n\n await client.uploadFolder(folderName, path);\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -1,4 +0,0 @@
1
- import type { PackageToSync } from './types/PackageToSync.js';
2
- import type { SyncContext } from './types/SyncContext.js';
3
- export declare function getPackagesToSync({ packages, getBundleDetails, resolveMap, }: SyncContext): Promise<PackageToSync[]>;
4
- //# sourceMappingURL=getPackagesToSync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPackagesToSync.d.ts","sourceRoot":"","sources":["../src/getPackagesToSync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,wBAAsB,iBAAiB,CAAC,EACtC,QAAQ,EACR,gBAAgB,EAChB,UAAU,GACX,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAoBxC"}
@@ -1,18 +0,0 @@
1
- import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
2
- export async function getPackagesToSync({ packages, getBundleDetails, resolveMap, }) {
3
- const list = [];
4
- const packageEntries = Object.keys(resolveMap)
5
- .map((packageName) => findResolveMapEntry({
6
- packageName,
7
- resolveMap,
8
- }))
9
- .filter((item) => item);
10
- for (const { path: packagePath, name, version } of packageEntries) {
11
- const details = await getBundleDetails({ packagePath }, { packages });
12
- if (details.isExternal) {
13
- list.push({ ...details.outputLocation, packageName: name, version });
14
- }
15
- }
16
- return list;
17
- }
18
- //# sourceMappingURL=getPackagesToSync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../src/getPackagesToSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iCAAiC,CAAC;AAI5F,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,QAAQ,EACR,gBAAgB,EAChB,UAAU,GACE;IACZ,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3C,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACnB,mBAAmB,CAAC;QAClB,WAAW;QACX,UAAU;KACX,CAAC,CACH;SACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAsB,CAAC;IAE/C,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,cAAc,EAAE;QACjE,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { findResolveMapEntry, type ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { PackageToSync } from './types/PackageToSync.js';\nimport type { SyncContext } from './types/SyncContext.js';\n\nexport async function getPackagesToSync({\n packages,\n getBundleDetails,\n resolveMap,\n}: SyncContext): Promise<PackageToSync[]> {\n const list: PackageToSync[] = [];\n\n const packageEntries = Object.keys(resolveMap)\n .map((packageName) =>\n findResolveMapEntry({\n packageName,\n resolveMap,\n }),\n )\n .filter((item) => item) as ResolveMapEntry[];\n\n for (const { path: packagePath, name, version } of packageEntries) {\n const details = await getBundleDetails({ packagePath }, { packages });\n if (details.isExternal) {\n list.push({ ...details.outputLocation, packageName: name, version });\n }\n }\n\n return list;\n}\n"]}
@@ -1,13 +0,0 @@
1
- /**
2
- * Marks the start of the sync download/upload operations.
3
- */
4
- export declare const PerfMarkerSyncStart = "SYNC_START";
5
- /**
6
- * Measures the time it takes to complete the download sync operation.
7
- */
8
- export declare const PerfMeasurementSyncDownload = "SYNC_DOWNLOAD";
9
- /**
10
- * Measures the time it takes to complete the upload sync operation.
11
- */
12
- export declare const PerfMeasurementSyncUpload = "SYNC_UPLOAD";
13
- //# sourceMappingURL=markers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../src/performance/markers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAIhD;;GAEG;AACH,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,yBAAyB,gBAAgB,CAAC"}
@@ -1,15 +0,0 @@
1
- // Markers
2
- /**
3
- * Marks the start of the sync download/upload operations.
4
- */
5
- export const PerfMarkerSyncStart = 'SYNC_START';
6
- // Measurements
7
- /**
8
- * Measures the time it takes to complete the download sync operation.
9
- */
10
- export const PerfMeasurementSyncDownload = 'SYNC_DOWNLOAD';
11
- /**
12
- * Measures the time it takes to complete the upload sync operation.
13
- */
14
- export const PerfMeasurementSyncUpload = 'SYNC_UPLOAD';
15
- //# sourceMappingURL=markers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markers.js","sourceRoot":"","sources":["../../src/performance/markers.ts"],"names":[],"mappings":"AAAA,UAAU;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAEhD,eAAe;AAEf;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC","sourcesContent":["// Markers\n\n/**\n * Marks the start of the sync download/upload operations.\n */\nexport const PerfMarkerSyncStart = 'SYNC_START';\n\n// Measurements\n\n/**\n * Measures the time it takes to complete the download sync operation.\n */\nexport const PerfMeasurementSyncDownload = 'SYNC_DOWNLOAD';\n\n/**\n * Measures the time it takes to complete the upload sync operation.\n */\nexport const PerfMeasurementSyncUpload = 'SYNC_UPLOAD';\n"]}
@@ -1,3 +0,0 @@
1
- import type { SyncContext } from './types/SyncContext.js';
2
- export declare function syncToLocal(context: SyncContext): Promise<void>;
3
- //# sourceMappingURL=syncToLocal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syncToLocal.d.ts","sourceRoot":"","sources":["../src/syncToLocal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,iBAmBrD"}
@@ -1,21 +0,0 @@
1
- import { getPackagesToSync } from './getPackagesToSync.js';
2
- import { createDownloadTask } from './createDownloadTask.js';
3
- import { createRemoteCacheClient } from './createRemoteCacheClient.js';
4
- import { performance } from 'perf_hooks';
5
- import { PerfMarkerSyncStart, PerfMeasurementSyncDownload } from './performance/markers.js';
6
- export async function syncToLocal(context) {
7
- const { config, reporter } = context;
8
- performance.mark(PerfMarkerSyncStart);
9
- const client = await createRemoteCacheClient({ config, permissions: { read: true, write: false } });
10
- if (!client) {
11
- return;
12
- }
13
- const list = await getPackagesToSync(context);
14
- const downloads = list.map((item) => {
15
- const { name, execute } = createDownloadTask(client, item);
16
- return reporter.runTask(name, execute);
17
- });
18
- await Promise.all(downloads);
19
- performance.measure(PerfMeasurementSyncDownload, PerfMarkerSyncStart);
20
- }
21
- //# sourceMappingURL=syncToLocal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syncToLocal.js","sourceRoot":"","sources":["../src/syncToLocal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5F,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAoB;IACpD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACrC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IACpG,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3D,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE7B,WAAW,CAAC,OAAO,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { getPackagesToSync } from './getPackagesToSync.js';\nimport { createDownloadTask } from './createDownloadTask.js';\nimport type { SyncContext } from './types/SyncContext.js';\nimport { createRemoteCacheClient } from './createRemoteCacheClient.js';\nimport { performance } from 'perf_hooks';\nimport { PerfMarkerSyncStart, PerfMeasurementSyncDownload } from './performance/markers.js';\n\nexport async function syncToLocal(context: SyncContext) {\n const { config, reporter } = context;\n performance.mark(PerfMarkerSyncStart);\n\n const client = await createRemoteCacheClient({ config, permissions: { read: true, write: false } });\n if (!client) {\n return;\n }\n\n const list = await getPackagesToSync(context);\n\n const downloads = list.map((item) => {\n const { name, execute } = createDownloadTask(client, item);\n return reporter.runTask(name, execute);\n });\n\n await Promise.all(downloads);\n\n performance.measure(PerfMeasurementSyncDownload, PerfMarkerSyncStart);\n}\n"]}
@@ -1,15 +0,0 @@
1
- import type { SyncContext } from './types/SyncContext.js';
2
- import type { TaskReporter } from '@ms-cloudpack/task-reporter';
3
- import type { PackageToSync } from './types/PackageToSync.js';
4
- /**
5
- * Syncs the packages to the remote cache.
6
- * @param syncOptions - The options for the sync command.
7
- * @param context - The task context.
8
- * @returns The number of packages synced.
9
- */
10
- export declare function syncToRemote(options: {
11
- config: SyncContext['config'];
12
- reporter: TaskReporter;
13
- packages: PackageToSync[];
14
- }): Promise<void>;
15
- //# sourceMappingURL=syncToRemote.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syncToRemote.d.ts","sourceRoot":"","sources":["../src/syncToRemote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhB"}
@@ -1,25 +0,0 @@
1
- import { createUploadTask } from './createUploadTask.js';
2
- import { createRemoteCacheClient } from './createRemoteCacheClient.js';
3
- import { performance } from 'perf_hooks';
4
- import { PerfMarkerSyncStart, PerfMeasurementSyncUpload } from './performance/markers.js';
5
- /**
6
- * Syncs the packages to the remote cache.
7
- * @param syncOptions - The options for the sync command.
8
- * @param context - The task context.
9
- * @returns The number of packages synced.
10
- */
11
- export async function syncToRemote(options) {
12
- const { config, reporter, packages } = options;
13
- performance.mark(PerfMarkerSyncStart);
14
- const client = await createRemoteCacheClient({ config, permissions: { read: false, write: true } });
15
- if (!client) {
16
- return;
17
- }
18
- const uploads = packages.map((item) => {
19
- const { name, execute } = createUploadTask(client, item);
20
- return reporter.runTask(name, execute);
21
- });
22
- await Promise.all(uploads);
23
- performance.measure(PerfMeasurementSyncUpload, PerfMarkerSyncStart);
24
- }
25
- //# sourceMappingURL=syncToRemote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syncToRemote.js","sourceRoot":"","sources":["../src/syncToRemote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAI1F;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAIlC;IACC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC/C,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACpG,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzD,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE3B,WAAW,CAAC,OAAO,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { createUploadTask } from './createUploadTask.js';\nimport type { SyncContext } from './types/SyncContext.js';\nimport { createRemoteCacheClient } from './createRemoteCacheClient.js';\nimport { performance } from 'perf_hooks';\nimport { PerfMarkerSyncStart, PerfMeasurementSyncUpload } from './performance/markers.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { PackageToSync } from './types/PackageToSync.js';\n\n/**\n * Syncs the packages to the remote cache.\n * @param syncOptions - The options for the sync command.\n * @param context - The task context.\n * @returns The number of packages synced.\n */\nexport async function syncToRemote(options: {\n config: SyncContext['config'];\n reporter: TaskReporter;\n packages: PackageToSync[];\n}): Promise<void> {\n const { config, reporter, packages } = options;\n performance.mark(PerfMarkerSyncStart);\n\n const client = await createRemoteCacheClient({ config, permissions: { read: false, write: true } });\n if (!client) {\n return;\n }\n\n const uploads = packages.map((item) => {\n const { name, execute } = createUploadTask(client, item);\n return reporter.runTask(name, execute);\n });\n\n await Promise.all(uploads);\n\n performance.measure(PerfMeasurementSyncUpload, PerfMarkerSyncStart);\n}\n"]}
@@ -1,24 +0,0 @@
1
- import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
2
- import type { ResolveMap } from '@ms-cloudpack/package-utilities';
3
- import type { TaskReporter } from '@ms-cloudpack/task-reporter';
4
- export interface SyncContext {
5
- config: {
6
- storageAccount: string;
7
- container: string;
8
- };
9
- reporter: TaskReporter;
10
- resolveMap: ResolveMap;
11
- packages: PackageDefinitionsCache;
12
- getBundleDetails: (options: {
13
- packagePath: string;
14
- }, context: {
15
- packages: PackageDefinitionsCache;
16
- }) => Promise<{
17
- outputLocation: {
18
- folderName: string;
19
- path: string;
20
- };
21
- isExternal: boolean;
22
- }>;
23
- }
24
- //# sourceMappingURL=SyncContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SyncContext.d.ts","sourceRoot":"","sources":["../../src/types/SyncContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,gBAAgB,EAAE,CAChB,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,EAChC,OAAO,EAAE;QAAE,QAAQ,EAAE,uBAAuB,CAAA;KAAE,KAC3C,OAAO,CAAC;QACX,cAAc,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC,CAAC;CACJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=SyncContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SyncContext.js","sourceRoot":"","sources":["../../src/types/SyncContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface SyncContext {\n config: {\n storageAccount: string;\n container: string;\n };\n reporter: TaskReporter;\n resolveMap: ResolveMap;\n packages: PackageDefinitionsCache;\n getBundleDetails: (\n options: { packagePath: string },\n context: { packages: PackageDefinitionsCache },\n ) => Promise<{\n outputLocation: { folderName: string; path: string };\n isExternal: boolean;\n }>;\n}\n"]}