rac-delta 1.0.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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/core/adapters/index.d.ts +2 -0
  4. package/dist/core/adapters/index.d.ts.map +1 -0
  5. package/dist/core/adapters/index.js +17 -0
  6. package/dist/core/adapters/storage-adapter.d.ts +125 -0
  7. package/dist/core/adapters/storage-adapter.d.ts.map +1 -0
  8. package/dist/core/adapters/storage-adapter.js +14 -0
  9. package/dist/core/config/index.d.ts +2 -0
  10. package/dist/core/config/index.d.ts.map +1 -0
  11. package/dist/core/config/index.js +17 -0
  12. package/dist/core/config/rac-delta-config.d.ts +132 -0
  13. package/dist/core/config/rac-delta-config.d.ts.map +1 -0
  14. package/dist/core/config/rac-delta-config.js +2 -0
  15. package/dist/core/exceptions.d.ts +25 -0
  16. package/dist/core/exceptions.d.ts.map +1 -0
  17. package/dist/core/exceptions.js +51 -0
  18. package/dist/core/models/chunk.d.ts +12 -0
  19. package/dist/core/models/chunk.d.ts.map +1 -0
  20. package/dist/core/models/chunk.js +2 -0
  21. package/dist/core/models/delta-plan.d.ts +12 -0
  22. package/dist/core/models/delta-plan.d.ts.map +1 -0
  23. package/dist/core/models/delta-plan.js +2 -0
  24. package/dist/core/models/file-entry.d.ts +9 -0
  25. package/dist/core/models/file-entry.d.ts.map +1 -0
  26. package/dist/core/models/file-entry.js +2 -0
  27. package/dist/core/models/index.d.ts +5 -0
  28. package/dist/core/models/index.d.ts.map +1 -0
  29. package/dist/core/models/index.js +20 -0
  30. package/dist/core/models/rd-index.d.ts +8 -0
  31. package/dist/core/models/rd-index.d.ts.map +1 -0
  32. package/dist/core/models/rd-index.js +2 -0
  33. package/dist/core/pipelines/download-pipeline.d.ts +142 -0
  34. package/dist/core/pipelines/download-pipeline.d.ts.map +1 -0
  35. package/dist/core/pipelines/download-pipeline.js +64 -0
  36. package/dist/core/pipelines/index.d.ts +3 -0
  37. package/dist/core/pipelines/index.d.ts.map +1 -0
  38. package/dist/core/pipelines/index.js +18 -0
  39. package/dist/core/pipelines/upload-pipeline.d.ts +60 -0
  40. package/dist/core/pipelines/upload-pipeline.d.ts.map +1 -0
  41. package/dist/core/pipelines/upload-pipeline.js +34 -0
  42. package/dist/core/services/delta-service.d.ts +76 -0
  43. package/dist/core/services/delta-service.d.ts.map +1 -0
  44. package/dist/core/services/delta-service.js +2 -0
  45. package/dist/core/services/hasher-service.d.ts +47 -0
  46. package/dist/core/services/hasher-service.d.ts.map +1 -0
  47. package/dist/core/services/hasher-service.js +2 -0
  48. package/dist/core/services/index.d.ts +5 -0
  49. package/dist/core/services/index.d.ts.map +1 -0
  50. package/dist/core/services/index.js +20 -0
  51. package/dist/core/services/reconstruction-service.d.ts +99 -0
  52. package/dist/core/services/reconstruction-service.d.ts.map +1 -0
  53. package/dist/core/services/reconstruction-service.js +4 -0
  54. package/dist/core/services/validation-service.d.ts +18 -0
  55. package/dist/core/services/validation-service.d.ts.map +1 -0
  56. package/dist/core/services/validation-service.js +2 -0
  57. package/dist/core/types/index.d.ts +2 -0
  58. package/dist/core/types/index.d.ts.map +1 -0
  59. package/dist/core/types/index.js +17 -0
  60. package/dist/core/types/types.d.ts +3 -0
  61. package/dist/core/types/types.d.ts.map +1 -0
  62. package/dist/core/types/types.js +2 -0
  63. package/dist/core/utils/index.d.ts +3 -0
  64. package/dist/core/utils/index.d.ts.map +1 -0
  65. package/dist/core/utils/index.js +18 -0
  66. package/dist/core/utils/invariant.d.ts +2 -0
  67. package/dist/core/utils/invariant.d.ts.map +1 -0
  68. package/dist/core/utils/invariant.js +11 -0
  69. package/dist/core/utils/stream-to-buffer.d.ts +3 -0
  70. package/dist/core/utils/stream-to-buffer.d.ts.map +1 -0
  71. package/dist/core/utils/stream-to-buffer.js +10 -0
  72. package/dist/index.d.ts +9 -0
  73. package/dist/index.d.ts.map +1 -0
  74. package/dist/index.js +29 -0
  75. package/dist/infrastructure/adapters/azure-blob-storage-adapter.d.ts +24 -0
  76. package/dist/infrastructure/adapters/azure-blob-storage-adapter.d.ts.map +1 -0
  77. package/dist/infrastructure/adapters/azure-blob-storage-adapter.js +149 -0
  78. package/dist/infrastructure/adapters/gcs-storage-adapter.d.ts +20 -0
  79. package/dist/infrastructure/adapters/gcs-storage-adapter.d.ts.map +1 -0
  80. package/dist/infrastructure/adapters/gcs-storage-adapter.js +101 -0
  81. package/dist/infrastructure/adapters/http-storage-adapter.d.ts +23 -0
  82. package/dist/infrastructure/adapters/http-storage-adapter.d.ts.map +1 -0
  83. package/dist/infrastructure/adapters/http-storage-adapter.js +154 -0
  84. package/dist/infrastructure/adapters/local-storage-adapter.d.ts +23 -0
  85. package/dist/infrastructure/adapters/local-storage-adapter.d.ts.map +1 -0
  86. package/dist/infrastructure/adapters/local-storage-adapter.js +124 -0
  87. package/dist/infrastructure/adapters/s3-storage-adapter.d.ts +24 -0
  88. package/dist/infrastructure/adapters/s3-storage-adapter.d.ts.map +1 -0
  89. package/dist/infrastructure/adapters/s3-storage-adapter.js +139 -0
  90. package/dist/infrastructure/adapters/ssh-storage-adapter.d.ts +28 -0
  91. package/dist/infrastructure/adapters/ssh-storage-adapter.d.ts.map +1 -0
  92. package/dist/infrastructure/adapters/ssh-storage-adapter.js +237 -0
  93. package/dist/infrastructure/adapters/url-storage-adapter.d.ts +14 -0
  94. package/dist/infrastructure/adapters/url-storage-adapter.d.ts.map +1 -0
  95. package/dist/infrastructure/adapters/url-storage-adapter.js +92 -0
  96. package/dist/infrastructure/chunk-sources/disk-chunk-source.d.ts +12 -0
  97. package/dist/infrastructure/chunk-sources/disk-chunk-source.d.ts.map +1 -0
  98. package/dist/infrastructure/chunk-sources/disk-chunk-source.js +61 -0
  99. package/dist/infrastructure/chunk-sources/index.d.ts +4 -0
  100. package/dist/infrastructure/chunk-sources/index.d.ts.map +1 -0
  101. package/dist/infrastructure/chunk-sources/index.js +19 -0
  102. package/dist/infrastructure/chunk-sources/memory-chunk-source.d.ts +9 -0
  103. package/dist/infrastructure/chunk-sources/memory-chunk-source.d.ts.map +1 -0
  104. package/dist/infrastructure/chunk-sources/memory-chunk-source.js +29 -0
  105. package/dist/infrastructure/chunk-sources/storage-chunk-source.d.ts +21 -0
  106. package/dist/infrastructure/chunk-sources/storage-chunk-source.d.ts.map +1 -0
  107. package/dist/infrastructure/chunk-sources/storage-chunk-source.js +150 -0
  108. package/dist/infrastructure/client.d.ts +45 -0
  109. package/dist/infrastructure/client.d.ts.map +1 -0
  110. package/dist/infrastructure/client.js +52 -0
  111. package/dist/infrastructure/factories/pipeline-factory.d.ts +15 -0
  112. package/dist/infrastructure/factories/pipeline-factory.d.ts.map +1 -0
  113. package/dist/infrastructure/factories/pipeline-factory.js +26 -0
  114. package/dist/infrastructure/factories/service-factory.d.ts +11 -0
  115. package/dist/infrastructure/factories/service-factory.d.ts.map +1 -0
  116. package/dist/infrastructure/factories/service-factory.js +17 -0
  117. package/dist/infrastructure/factories/storage-adpater-factory.d.ts +41 -0
  118. package/dist/infrastructure/factories/storage-adpater-factory.d.ts.map +1 -0
  119. package/dist/infrastructure/factories/storage-adpater-factory.js +33 -0
  120. package/dist/infrastructure/pipelines/default-hash-download-pipeline.d.ts +27 -0
  121. package/dist/infrastructure/pipelines/default-hash-download-pipeline.d.ts.map +1 -0
  122. package/dist/infrastructure/pipelines/default-hash-download-pipeline.js +211 -0
  123. package/dist/infrastructure/pipelines/default-hash-upload-pipeline.d.ts +19 -0
  124. package/dist/infrastructure/pipelines/default-hash-upload-pipeline.d.ts.map +1 -0
  125. package/dist/infrastructure/pipelines/default-hash-upload-pipeline.js +170 -0
  126. package/dist/infrastructure/pipelines/default-url-download-pipeline.d.ts +30 -0
  127. package/dist/infrastructure/pipelines/default-url-download-pipeline.d.ts.map +1 -0
  128. package/dist/infrastructure/pipelines/default-url-download-pipeline.js +198 -0
  129. package/dist/infrastructure/pipelines/default-url-upload-pipeline.d.ts +20 -0
  130. package/dist/infrastructure/pipelines/default-url-upload-pipeline.d.ts.map +1 -0
  131. package/dist/infrastructure/pipelines/default-url-upload-pipeline.js +126 -0
  132. package/dist/infrastructure/services/hash-wasm-hasher-service.d.ts +13 -0
  133. package/dist/infrastructure/services/hash-wasm-hasher-service.d.ts.map +1 -0
  134. package/dist/infrastructure/services/hash-wasm-hasher-service.js +113 -0
  135. package/dist/infrastructure/services/memory-delta-service.d.ts +17 -0
  136. package/dist/infrastructure/services/memory-delta-service.d.ts.map +1 -0
  137. package/dist/infrastructure/services/memory-delta-service.js +198 -0
  138. package/dist/infrastructure/services/memory-reconstruction-service.d.ts +25 -0
  139. package/dist/infrastructure/services/memory-reconstruction-service.d.ts.map +1 -0
  140. package/dist/infrastructure/services/memory-reconstruction-service.js +329 -0
  141. package/dist/infrastructure/services/memory-validation-service.d.ts +9 -0
  142. package/dist/infrastructure/services/memory-validation-service.d.ts.map +1 -0
  143. package/dist/infrastructure/services/memory-validation-service.js +33 -0
  144. package/package.json +43 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Raccreative Games
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ Under construction.
@@ -0,0 +1,2 @@
1
+ export * from './storage-adapter';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./storage-adapter"), exports);
@@ -0,0 +1,125 @@
1
+ import { Readable } from 'stream';
2
+ import { Nullish } from '../types';
3
+ import { RDIndex } from '../models';
4
+ export interface BlobInfo {
5
+ hash: string;
6
+ size: number;
7
+ modified?: Nullish<Date>;
8
+ metadata?: Nullish<Record<string, string>>;
9
+ }
10
+ export declare abstract class StorageAdapter {
11
+ abstract readonly type: 'hash' | 'url';
12
+ abstract dispose(): Promise<void>;
13
+ }
14
+ export declare abstract class HashStorageAdapter extends StorageAdapter {
15
+ readonly type: "hash";
16
+ /**
17
+ * Returns a readable stream of the chunk if exists, null otherwise.
18
+ *
19
+ * @param hash the hash of the chunk
20
+ */
21
+ abstract getChunk(hash: string): Promise<Readable | null>;
22
+ /**
23
+ * Upload a chunk from a readable stream
24
+ *
25
+ * @param hash the hash of the chunk
26
+ * @param data the `Readable` stream
27
+ * @param opts.overwrite whether to overwrite chunk if exists or not (depends on the implementation)
28
+ * @param opts.size ContentLength of the chunk, sometimes needed for some adapters
29
+ */
30
+ abstract putChunk(hash: string, data: Readable, opts?: Nullish<{
31
+ overwrite?: Nullish<boolean>;
32
+ size?: Nullish<number>;
33
+ }>): Promise<void>;
34
+ /**
35
+ * Check if chunk exists in the storage
36
+ *
37
+ * @param hash the hash of the chunk
38
+ */
39
+ abstract chunkExists(hash: string): Promise<boolean>;
40
+ /**
41
+ * Deletes a chunk identified by hash
42
+ *
43
+ * @param hash the hash of the chunk to delete
44
+ */
45
+ abstract deleteChunk(hash: string): Promise<void>;
46
+ /**
47
+ * List available chunks (optional)
48
+ *
49
+ * Chunks are always under given-prefix/chunks/
50
+ */
51
+ listChunks?(): Promise<string[]>;
52
+ /**
53
+ * Returns chunk info
54
+ *
55
+ * @param hash the hash of the chunk
56
+ */
57
+ getChunkInfo?(hash: string): Promise<BlobInfo | null>;
58
+ /**
59
+ * Helper to get rd-index.json
60
+ * Should return null if not found.
61
+ *
62
+ * rd-index is always on given-prefix/rd-index.json (root)
63
+ */
64
+ abstract getRemoteIndex(): Promise<RDIndex | null>;
65
+ /**
66
+ * Helper to upload rd-index.json
67
+ *
68
+ * rd-index is always on given-prefix/rd-index.json (root)
69
+ */
70
+ abstract putRemoteIndex(index: RDIndex): Promise<void>;
71
+ }
72
+ export declare abstract class UrlStorageAdapter extends StorageAdapter {
73
+ readonly type: "url";
74
+ /**
75
+ * Returns a readable stream of the chunk if exists by url, null otherwise.
76
+ *
77
+ * @param url the url to get the chunk (example: signed S3 url)
78
+ */
79
+ abstract getChunkByUrl(url: string): Promise<Readable | null>;
80
+ /**
81
+ * Upload a chunk from a readable stream by url
82
+ *
83
+ * @param url the url to put the chunk (example: signed S3 url)
84
+ * @param data the data stream `Readable`
85
+ */
86
+ abstract putChunkByUrl(url: string, data: Readable): Promise<void>;
87
+ /**
88
+ * Deletes a chunk by url.
89
+ *
90
+ * @param url url to delete the chunk (example: signed S3 url)
91
+ */
92
+ abstract deleteChunkByUrl(url: string): Promise<void>;
93
+ /**
94
+ * Check if chunk exists in the storage by url
95
+ *
96
+ * @param url url to check the chunk (example: signed S3 url)
97
+ */
98
+ abstract chunkExistsByUrl(url: string): Promise<boolean>;
99
+ /**
100
+ * List available chunks by url (example: signed S3 url)
101
+ */
102
+ listChunksByUrl?(url: string): Promise<string[]>;
103
+ /**
104
+ * Returns chunk info by url (example: signed S3 url)
105
+ *
106
+ * @param hash the hash of the chunk
107
+ * @param url the url to get the chunk info
108
+ */
109
+ getChunkInfoByUrl?(hash: string, url: string): Promise<BlobInfo | null>;
110
+ /**
111
+ * Get rd-index.json by url (example: signed S3 url)
112
+ * Should return null if not found or not supported.
113
+ *
114
+ * @param url the url to get the index
115
+ */
116
+ abstract getRemoteIndexByUrl(url: string): Promise<RDIndex | null>;
117
+ /**
118
+ * Put rd-index.json by url (example: signed S3 url)
119
+ *
120
+ * @param url the url to put the index
121
+ * @param index the `RDIndex` object
122
+ */
123
+ abstract putRemoteIndexByUrl(url: string, index: RDIndex): Promise<void>;
124
+ }
125
+ //# sourceMappingURL=storage-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/storage-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ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,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CACvD;AAED,8BAAsB,iBAAkB,SAAQ,cAAc;IAC5D,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAU;IAE/B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE7D;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElE;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErD;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAExD;;OAEG;IACH,eAAe,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhD;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAEvE;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAElE;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CACzE"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UrlStorageAdapter = exports.HashStorageAdapter = exports.StorageAdapter = void 0;
4
+ class StorageAdapter {
5
+ }
6
+ exports.StorageAdapter = StorageAdapter;
7
+ class HashStorageAdapter extends StorageAdapter {
8
+ type = 'hash';
9
+ }
10
+ exports.HashStorageAdapter = HashStorageAdapter;
11
+ class UrlStorageAdapter extends StorageAdapter {
12
+ type = 'url';
13
+ }
14
+ exports.UrlStorageAdapter = UrlStorageAdapter;
@@ -0,0 +1,2 @@
1
+ export * from './rac-delta-config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./rac-delta-config"), exports);
@@ -0,0 +1,132 @@
1
+ import { Nullish } from '../types';
2
+ export interface BaseStorageConfig {
3
+ /**
4
+ * Example: my-prefix/updates/42
5
+ */
6
+ pathPrefix?: Nullish<string>;
7
+ }
8
+ export interface S3StorageConfig extends BaseStorageConfig {
9
+ type: 's3';
10
+ endpoint?: Nullish<string>;
11
+ region?: Nullish<string>;
12
+ bucket: string;
13
+ credentials: {
14
+ accessKeyId: string;
15
+ secretAccessKey: string;
16
+ sessionToken?: Nullish<string>;
17
+ expiration?: Nullish<Date>;
18
+ };
19
+ }
20
+ export interface AzureBlobStorageConfig extends BaseStorageConfig {
21
+ type: 'azure';
22
+ container: string;
23
+ endpoint: string;
24
+ credentials: {
25
+ accountName?: Nullish<string>;
26
+ accountKey?: Nullish<string>;
27
+ sasToken?: Nullish<string>;
28
+ };
29
+ }
30
+ export interface GCSStorageConfig extends BaseStorageConfig {
31
+ type: 'gcs';
32
+ bucket: string;
33
+ apiEndpoint?: Nullish<string>;
34
+ credentials: {
35
+ projectId: string;
36
+ clientEmail?: Nullish<string>;
37
+ privateKey?: Nullish<string>;
38
+ };
39
+ }
40
+ export interface HTTPStorageConfig extends BaseStorageConfig {
41
+ type: 'http';
42
+ /**
43
+ * Base URL used for all chunk operations (`GET`, `PUT`, `DELETE`, `HEAD`).
44
+ *
45
+ * Each chunk will be accessed as:
46
+ * ```
47
+ * {endpoint}/{pathPrefix?}/{chunk-hash}
48
+ * ```
49
+ *
50
+ * Example:
51
+ * ```
52
+ * endpoint: "https://ducks.com/api"
53
+ * pathPrefix: "uploads"
54
+ *
55
+ * => https://ducks.com/api/uploads/{chunk-hash}
56
+ * ```
57
+ *
58
+ * This should point to an HTTP server or compatible API that supports
59
+ * binary upload and download via standard HTTP verbs.
60
+ */
61
+ endpoint: string;
62
+ /**
63
+ * Optional path (relative to `endpoint` and `pathPrefix`) where the remote
64
+ * index file (`rd-index.json`) can be found.
65
+ *
66
+ * If omitted, the adapter will automatically look for:
67
+ * ```
68
+ * {endpoint}/{pathPrefix?}/rd-index.json
69
+ * ```
70
+ *
71
+ * Example:
72
+ * ```
73
+ * indexFilePath: "index"
74
+ * => https://ducks.com/api/index
75
+ *
76
+ * indexFilePath: "metadata/rd-index.json"
77
+ * => https://ducks.com/api/metadata/rd-index.json
78
+ * ```
79
+ */
80
+ indexFilePath?: Nullish<string>;
81
+ /**
82
+ * Optional credentials used for authenticated HTTP requests.
83
+ *
84
+ * Supports both Bearer tokens and API keys.
85
+ *
86
+ * Example:
87
+ * ```
88
+ * credentials: {
89
+ * bearerToken: "eyJhbGciOiJIUzI1...",
90
+ * apiKey: "my-secret-key"
91
+ * }
92
+ * ```
93
+ *
94
+ * The adapter automatically includes the corresponding headers:
95
+ * - `Authorization: Bearer <token>`
96
+ * - `x-api-key: <apiKey>`
97
+ */
98
+ credentials?: Nullish<{
99
+ bearerToken?: Nullish<string>;
100
+ apiKey?: Nullish<string>;
101
+ }>;
102
+ }
103
+ export interface URLStorageConfig extends BaseStorageConfig {
104
+ type: 'url';
105
+ }
106
+ export interface SSHStorageConfig extends BaseStorageConfig {
107
+ type: 'ssh';
108
+ host: string;
109
+ port?: Nullish<number>;
110
+ credentials: {
111
+ username: string;
112
+ password?: Nullish<string>;
113
+ privateKey?: Nullish<string>;
114
+ };
115
+ }
116
+ export interface LocalStorageConfig extends BaseStorageConfig {
117
+ type: 'local';
118
+ basePath: string;
119
+ }
120
+ export type StorageConfig = S3StorageConfig | AzureBlobStorageConfig | GCSStorageConfig | HTTPStorageConfig | SSHStorageConfig | LocalStorageConfig | URLStorageConfig;
121
+ export interface RacDeltaConfig {
122
+ /**
123
+ * Recommended: 1MB
124
+ */
125
+ chunkSize: number;
126
+ /**
127
+ * Max concurrency of workers like upload chunks, delete chunks, etc...
128
+ */
129
+ maxConcurrency?: Nullish<number>;
130
+ storage: StorageConfig;
131
+ }
132
+ //# sourceMappingURL=rac-delta-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rac-delta-config.d.ts","sourceRoot":"","sources":["../../../src/core/config/rac-delta-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;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C,CAAC;QAC9B,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC1B,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvB,WAAW,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,sBAAsB,GACtB,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ export declare class GetChunkException extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class PutChunkException extends Error {
5
+ constructor(message: string);
6
+ }
7
+ export declare class DeleteChunkException extends Error {
8
+ constructor(message: string);
9
+ }
10
+ export declare class HeadChunkException extends Error {
11
+ constructor(message: string);
12
+ }
13
+ export declare class GetRemoteIndexException extends Error {
14
+ constructor(message: string);
15
+ }
16
+ export declare class PutRemoteIndexException extends Error {
17
+ constructor(message: string);
18
+ }
19
+ export declare class ChunkAlreadyExistsException extends Error {
20
+ constructor(message: string);
21
+ }
22
+ export declare class ChunkNotFoundException extends Error {
23
+ constructor(message: string);
24
+ }
25
+ //# sourceMappingURL=exceptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/core/exceptions.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAG5B"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChunkNotFoundException = exports.ChunkAlreadyExistsException = exports.PutRemoteIndexException = exports.GetRemoteIndexException = exports.HeadChunkException = exports.DeleteChunkException = exports.PutChunkException = exports.GetChunkException = void 0;
4
+ class GetChunkException extends Error {
5
+ constructor(message) {
6
+ super(`Failed to fetch Chunk: ${message}`);
7
+ }
8
+ }
9
+ exports.GetChunkException = GetChunkException;
10
+ class PutChunkException extends Error {
11
+ constructor(message) {
12
+ super(`Failed to upload Chunk: ${message}`);
13
+ }
14
+ }
15
+ exports.PutChunkException = PutChunkException;
16
+ class DeleteChunkException extends Error {
17
+ constructor(message) {
18
+ super(`Failed to delete Chunk: ${message}`);
19
+ }
20
+ }
21
+ exports.DeleteChunkException = DeleteChunkException;
22
+ class HeadChunkException extends Error {
23
+ constructor(message) {
24
+ super(`Failed to HEAD Chunk: ${message}`);
25
+ }
26
+ }
27
+ exports.HeadChunkException = HeadChunkException;
28
+ class GetRemoteIndexException extends Error {
29
+ constructor(message) {
30
+ super(`Failed to get index: ${message}`);
31
+ }
32
+ }
33
+ exports.GetRemoteIndexException = GetRemoteIndexException;
34
+ class PutRemoteIndexException extends Error {
35
+ constructor(message) {
36
+ super(`Failed to upload index: ${message}`);
37
+ }
38
+ }
39
+ exports.PutRemoteIndexException = PutRemoteIndexException;
40
+ class ChunkAlreadyExistsException extends Error {
41
+ constructor(message) {
42
+ super(`Chunk already exists: ${message}`);
43
+ }
44
+ }
45
+ exports.ChunkAlreadyExistsException = ChunkAlreadyExistsException;
46
+ class ChunkNotFoundException extends Error {
47
+ constructor(message) {
48
+ super(`Chunk not found: ${message}`);
49
+ }
50
+ }
51
+ exports.ChunkNotFoundException = ChunkNotFoundException;
@@ -0,0 +1,12 @@
1
+ export interface Chunk {
2
+ hash: string;
3
+ offset: number;
4
+ size: number;
5
+ }
6
+ export interface ChunkUrlInfo {
7
+ url: string;
8
+ offset: number;
9
+ size: number;
10
+ filePath: string;
11
+ }
12
+ //# sourceMappingURL=chunk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../src/core/models/chunk.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { FileEntry } from './file-entry';
2
+ import { Chunk } from './chunk';
3
+ export interface ChunkEntry extends Chunk {
4
+ filePath: string;
5
+ }
6
+ export interface DeltaPlan {
7
+ newAndModifiedFiles: FileEntry[];
8
+ deletedFiles: string[];
9
+ missingChunks: ChunkEntry[];
10
+ obsoleteChunks: ChunkEntry[];
11
+ }
12
+ //# sourceMappingURL=delta-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-plan.d.ts","sourceRoot":"","sources":["../../../src/core/models/delta-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,UAAW,SAAQ,KAAK;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,mBAAmB,EAAE,SAAS,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,cAAc,EAAE,UAAU,EAAE,CAAC;CAC9B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { Chunk } from './chunk';
2
+ export interface FileEntry {
3
+ path: string;
4
+ size: number;
5
+ hash: string;
6
+ modifiedAt: number;
7
+ chunks: Chunk[];
8
+ }
9
+ //# sourceMappingURL=file-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-entry.d.ts","sourceRoot":"","sources":["../../../src/core/models/file-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export * from './chunk';
2
+ export * from './delta-plan';
3
+ export * from './file-entry';
4
+ export * from './rd-index';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./chunk"), exports);
18
+ __exportStar(require("./delta-plan"), exports);
19
+ __exportStar(require("./file-entry"), exports);
20
+ __exportStar(require("./rd-index"), exports);
@@ -0,0 +1,8 @@
1
+ import { FileEntry } from './file-entry';
2
+ export interface RDIndex {
3
+ version: number;
4
+ createdAt: number;
5
+ chunkSize: number;
6
+ files: FileEntry[];
7
+ }
8
+ //# sourceMappingURL=rd-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rd-index.d.ts","sourceRoot":"","sources":["../../../src/core/models/rd-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });