@ms-cloudpack/remote-cache 0.5.1-beta.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/lib/AzureRemoteCacheClient.d.ts.map +1 -0
  2. package/lib/AzureRemoteCacheClient.js +51 -0
  3. package/lib/AzureRemoteCacheClient.js.map +1 -0
  4. package/lib/Task.d.ts.map +1 -0
  5. package/lib/Task.js +2 -0
  6. package/lib/Task.js.map +1 -0
  7. package/lib/authentication/getAuthenticationRecord.d.ts.map +1 -0
  8. package/lib/authentication/getAuthenticationRecord.js +17 -0
  9. package/lib/authentication/getAuthenticationRecord.js.map +1 -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.map +1 -0
  14. package/lib/authentication/getCredential.js +61 -0
  15. package/lib/authentication/getCredential.js.map +1 -0
  16. package/lib/authentication/saveAuthenticationRecord.d.ts.map +1 -0
  17. package/lib/authentication/saveAuthenticationRecord.js +17 -0
  18. package/lib/authentication/saveAuthenticationRecord.js.map +1 -0
  19. package/lib/cache-persistance/cachePersistencePlugin.d.ts.map +1 -0
  20. package/lib/cache-persistance/cachePersistencePlugin.js +35 -0
  21. package/lib/cache-persistance/cachePersistencePlugin.js.map +1 -0
  22. package/lib/cache-persistance/platforms.d.ts.map +1 -0
  23. package/lib/cache-persistance/platforms.js +109 -0
  24. package/lib/cache-persistance/platforms.js.map +1 -0
  25. package/lib/cache-persistance/provider.d.ts.map +1 -0
  26. package/lib/cache-persistance/provider.js +26 -0
  27. package/lib/cache-persistance/provider.js.map +1 -0
  28. package/lib/createBlobStorageUrl.d.ts.map +1 -0
  29. package/lib/createBlobStorageUrl.js +4 -0
  30. package/lib/createBlobStorageUrl.js.map +1 -0
  31. package/lib/createRemoteCacheClient.d.ts.map +1 -0
  32. package/lib/createRemoteCacheClient.js +27 -0
  33. package/lib/createRemoteCacheClient.js.map +1 -0
  34. package/lib/decorators/InMemoryDecorator.d.ts.map +1 -0
  35. package/lib/decorators/InMemoryDecorator.js +29 -0
  36. package/lib/decorators/InMemoryDecorator.js.map +1 -0
  37. package/lib/decorators/ReporterDecorator.d.ts +1 -1
  38. package/lib/decorators/ReporterDecorator.d.ts.map +1 -0
  39. package/lib/decorators/ReporterDecorator.js +126 -0
  40. package/lib/decorators/ReporterDecorator.js.map +1 -0
  41. package/lib/decorators/RetryDecorator.d.ts.map +1 -0
  42. package/lib/decorators/RetryDecorator.js +27 -0
  43. package/lib/decorators/RetryDecorator.js.map +1 -0
  44. package/lib/getListOfBlobs.d.ts.map +1 -0
  45. package/lib/getListOfBlobs.js +15 -0
  46. package/lib/getListOfBlobs.js.map +1 -0
  47. package/lib/index.d.ts.map +1 -0
  48. package/lib/index.js +2 -0
  49. package/lib/index.js.map +1 -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 +11 -0
  54. package/lib/types/LoginMethod.d.ts.map +1 -0
  55. package/lib/types/LoginMethod.js +2 -0
  56. package/lib/types/LoginMethod.js.map +1 -0
  57. package/lib/types/RemoteCacheClient.d.ts.map +1 -0
  58. package/lib/types/RemoteCacheClient.js +2 -0
  59. package/lib/types/RemoteCacheClient.js.map +1 -0
  60. package/lib/types/RemoteCacheClientOptions.d.ts.map +1 -0
  61. package/lib/types/RemoteCacheClientOptions.js +2 -0
  62. package/lib/types/RemoteCacheClientOptions.js.map +1 -0
  63. package/lib/types/RetryPolicy.d.ts.map +1 -0
  64. package/lib/types/RetryPolicy.js +2 -0
  65. package/lib/types/RetryPolicy.js.map +1 -0
  66. package/package.json +13 -14
  67. package/dist/AzureRemoteCacheClient-AE2VSZ7M.js +0 -52517
  68. package/dist/ReporterDecorator-IPB43LAC.js +0 -127
  69. package/dist/chunk-7DWZ2KJB.js +0 -49702
  70. package/dist/chunk-IG2LEA6S.js +0 -185
  71. package/dist/chunk-N2VHZU53.js +0 -63
  72. package/dist/chunk-X5NZ4TUB.js +0 -1075
  73. package/dist/chunk-YE3TMZ3A.js +0 -13
  74. package/dist/getCredential-63JEO57N.js +0 -24180
  75. package/dist/getListOfBlobs-BZCK6WJA.js +0 -27
  76. package/dist/index.js +0 -103
  77. package/lib/decorators/InMemoryDecorator.test.d.ts +0 -2
  78. package/lib/decorators/RetryDecorator.test.d.ts +0 -2
@@ -1,27 +0,0 @@
1
- import {
2
- createBlobStorageUrl
3
- } from "./chunk-YE3TMZ3A.js";
4
- import {
5
- require_dist
6
- } from "./chunk-7DWZ2KJB.js";
7
- import "./chunk-X5NZ4TUB.js";
8
- import {
9
- __toESM,
10
- init_esbuildCjsShims
11
- } from "./chunk-N2VHZU53.js";
12
-
13
- // src/getListOfBlobs.ts
14
- init_esbuildCjsShims();
15
- var import_storage_blob = __toESM(require_dist(), 1);
16
- async function getListOfBlobs({ container, storageAccount, credential }) {
17
- const blobStorageClient = new import_storage_blob.BlobServiceClient(createBlobStorageUrl(storageAccount), credential);
18
- const containerClient = blobStorageClient.getContainerClient(container);
19
- const blobs = /* @__PURE__ */ new Set();
20
- for await (const blob of containerClient.listBlobsFlat()) {
21
- blobs.add(blob.name);
22
- }
23
- return blobs;
24
- }
25
- export {
26
- getListOfBlobs
27
- };
package/dist/index.js DELETED
@@ -1,103 +0,0 @@
1
- import {
2
- init_esbuildCjsShims
3
- } from "./chunk-N2VHZU53.js";
4
-
5
- // src/index.ts
6
- init_esbuildCjsShims();
7
-
8
- // src/createRemoteCacheClient.ts
9
- init_esbuildCjsShims();
10
-
11
- // src/decorators/InMemoryDecorator.ts
12
- init_esbuildCjsShims();
13
- var InMemoryDecorator = class {
14
- constructor(options) {
15
- this.cacheClient = options.cacheClient;
16
- this.list = options.getList();
17
- }
18
- async uploadFolder(options) {
19
- if ((await this.list).has(options.id)) {
20
- return "already-exist";
21
- }
22
- const result = await this.cacheClient.uploadFolder(options);
23
- if (result === "success") {
24
- (await this.list).add(options.id);
25
- }
26
- return result;
27
- }
28
- async downloadFolder(options) {
29
- if (!(await this.list).has(options.id)) {
30
- return "not-found";
31
- }
32
- return this.cacheClient.downloadFolder(options);
33
- }
34
- };
35
-
36
- // src/decorators/RetryDecorator.ts
37
- init_esbuildCjsShims();
38
- var RetryDecorator = class {
39
- constructor(options) {
40
- this.cacheClient = options.cacheClient;
41
- this.retryManager = options.retryManager;
42
- }
43
- printRetryContext(operationName, options, retryContext) {
44
- if (retryContext) {
45
- console.warn(
46
- `Retrying ${operationName} ${options.friendlyName} ... [${retryContext.retryAttempt}/${retryContext.maxRetries}]`
47
- );
48
- }
49
- }
50
- async uploadFolder(options) {
51
- return this.retryManager.retry((retryContext) => {
52
- this.printRetryContext("upload", options, retryContext);
53
- return this.cacheClient.uploadFolder(options);
54
- });
55
- }
56
- async downloadFolder(options) {
57
- return this.retryManager.retry((retryContext) => {
58
- this.printRetryContext("download", options, retryContext);
59
- return this.cacheClient.downloadFolder(options);
60
- });
61
- }
62
- };
63
-
64
- // src/retry/blockListIsInvalidRetryPolicy.ts
65
- init_esbuildCjsShims();
66
- var blockListIsInvalidRetryPolicy = {
67
- maxRetries: 1,
68
- handle: (error) => {
69
- return error instanceof Error && error.message.indexOf("The specified block list is invalid.") > -1;
70
- },
71
- wait: () => 0
72
- };
73
-
74
- // src/createRemoteCacheClient.ts
75
- import { RetryManager } from "@ms-cloudpack/retry";
76
- async function createRemoteCacheClient(params) {
77
- const { context, options } = params;
78
- const { container, loginMethod, storageAccount, cachePath } = options;
79
- const { getCredential } = await import("./getCredential-63JEO57N.js");
80
- const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-AE2VSZ7M.js");
81
- const { ReporterDecorator } = await import("./ReporterDecorator-IPB43LAC.js");
82
- const { getListOfBlobs } = await import("./getListOfBlobs-BZCK6WJA.js");
83
- const credential = await getCredential(loginMethod, cachePath);
84
- const remoteCacheClientOptions = {
85
- storageAccount,
86
- container,
87
- credential
88
- };
89
- const client = new ReporterDecorator(
90
- new RetryDecorator({
91
- retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),
92
- cacheClient: new InMemoryDecorator({
93
- cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),
94
- getList: () => getListOfBlobs(remoteCacheClientOptions)
95
- })
96
- }),
97
- context
98
- );
99
- return client;
100
- }
101
- export {
102
- createRemoteCacheClient
103
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=InMemoryDecorator.test.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RetryDecorator.test.d.ts.map