@powersync/service-module-postgres-storage 0.0.0-dev-20250116115804

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 (157) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +67 -0
  3. package/README.md +67 -0
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/@types/index.d.ts +7 -0
  6. package/dist/@types/migrations/PostgresMigrationAgent.d.ts +12 -0
  7. package/dist/@types/migrations/PostgresMigrationStore.d.ts +14 -0
  8. package/dist/@types/migrations/migration-utils.d.ts +3 -0
  9. package/dist/@types/migrations/scripts/1684951997326-init.d.ts +3 -0
  10. package/dist/@types/module/PostgresStorageModule.d.ts +6 -0
  11. package/dist/@types/storage/PostgresBucketStorageFactory.d.ts +42 -0
  12. package/dist/@types/storage/PostgresCompactor.d.ts +40 -0
  13. package/dist/@types/storage/PostgresStorageProvider.d.ts +5 -0
  14. package/dist/@types/storage/PostgresSyncRulesStorage.d.ts +46 -0
  15. package/dist/@types/storage/PostgresTestStorageFactoryGenerator.d.ts +13 -0
  16. package/dist/@types/storage/batch/OperationBatch.d.ts +47 -0
  17. package/dist/@types/storage/batch/PostgresBucketBatch.d.ts +90 -0
  18. package/dist/@types/storage/batch/PostgresPersistedBatch.d.ts +64 -0
  19. package/dist/@types/storage/checkpoints/PostgresWriteCheckpointAPI.d.ts +20 -0
  20. package/dist/@types/storage/storage-index.d.ts +5 -0
  21. package/dist/@types/storage/sync-rules/PostgresPersistedSyncRulesContent.d.ts +17 -0
  22. package/dist/@types/types/codecs.d.ts +61 -0
  23. package/dist/@types/types/models/ActiveCheckpoint.d.ts +12 -0
  24. package/dist/@types/types/models/ActiveCheckpointNotification.d.ts +19 -0
  25. package/dist/@types/types/models/BucketData.d.ts +22 -0
  26. package/dist/@types/types/models/BucketParameters.d.ts +11 -0
  27. package/dist/@types/types/models/CurrentData.d.ts +22 -0
  28. package/dist/@types/types/models/Instance.d.ts +6 -0
  29. package/dist/@types/types/models/Migration.d.ts +12 -0
  30. package/dist/@types/types/models/SourceTable.d.ts +31 -0
  31. package/dist/@types/types/models/SyncRules.d.ts +47 -0
  32. package/dist/@types/types/models/WriteCheckpoint.d.ts +15 -0
  33. package/dist/@types/types/models/models-index.d.ts +10 -0
  34. package/dist/@types/types/types.d.ts +96 -0
  35. package/dist/@types/utils/bson.d.ts +6 -0
  36. package/dist/@types/utils/bucket-data.d.ts +18 -0
  37. package/dist/@types/utils/db.d.ts +8 -0
  38. package/dist/@types/utils/ts-codec.d.ts +5 -0
  39. package/dist/@types/utils/utils-index.d.ts +4 -0
  40. package/dist/index.js +8 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/migrations/PostgresMigrationAgent.js +36 -0
  43. package/dist/migrations/PostgresMigrationAgent.js.map +1 -0
  44. package/dist/migrations/PostgresMigrationStore.js +60 -0
  45. package/dist/migrations/PostgresMigrationStore.js.map +1 -0
  46. package/dist/migrations/migration-utils.js +13 -0
  47. package/dist/migrations/migration-utils.js.map +1 -0
  48. package/dist/migrations/scripts/1684951997326-init.js +196 -0
  49. package/dist/migrations/scripts/1684951997326-init.js.map +1 -0
  50. package/dist/module/PostgresStorageModule.js +23 -0
  51. package/dist/module/PostgresStorageModule.js.map +1 -0
  52. package/dist/storage/PostgresBucketStorageFactory.js +433 -0
  53. package/dist/storage/PostgresBucketStorageFactory.js.map +1 -0
  54. package/dist/storage/PostgresCompactor.js +298 -0
  55. package/dist/storage/PostgresCompactor.js.map +1 -0
  56. package/dist/storage/PostgresStorageProvider.js +35 -0
  57. package/dist/storage/PostgresStorageProvider.js.map +1 -0
  58. package/dist/storage/PostgresSyncRulesStorage.js +619 -0
  59. package/dist/storage/PostgresSyncRulesStorage.js.map +1 -0
  60. package/dist/storage/PostgresTestStorageFactoryGenerator.js +110 -0
  61. package/dist/storage/PostgresTestStorageFactoryGenerator.js.map +1 -0
  62. package/dist/storage/batch/OperationBatch.js +93 -0
  63. package/dist/storage/batch/OperationBatch.js.map +1 -0
  64. package/dist/storage/batch/PostgresBucketBatch.js +732 -0
  65. package/dist/storage/batch/PostgresBucketBatch.js.map +1 -0
  66. package/dist/storage/batch/PostgresPersistedBatch.js +367 -0
  67. package/dist/storage/batch/PostgresPersistedBatch.js.map +1 -0
  68. package/dist/storage/checkpoints/PostgresWriteCheckpointAPI.js +148 -0
  69. package/dist/storage/checkpoints/PostgresWriteCheckpointAPI.js.map +1 -0
  70. package/dist/storage/storage-index.js +6 -0
  71. package/dist/storage/storage-index.js.map +1 -0
  72. package/dist/storage/sync-rules/PostgresPersistedSyncRulesContent.js +58 -0
  73. package/dist/storage/sync-rules/PostgresPersistedSyncRulesContent.js.map +1 -0
  74. package/dist/types/codecs.js +97 -0
  75. package/dist/types/codecs.js.map +1 -0
  76. package/dist/types/models/ActiveCheckpoint.js +12 -0
  77. package/dist/types/models/ActiveCheckpoint.js.map +1 -0
  78. package/dist/types/models/ActiveCheckpointNotification.js +8 -0
  79. package/dist/types/models/ActiveCheckpointNotification.js.map +1 -0
  80. package/dist/types/models/BucketData.js +23 -0
  81. package/dist/types/models/BucketData.js.map +1 -0
  82. package/dist/types/models/BucketParameters.js +11 -0
  83. package/dist/types/models/BucketParameters.js.map +1 -0
  84. package/dist/types/models/CurrentData.js +16 -0
  85. package/dist/types/models/CurrentData.js.map +1 -0
  86. package/dist/types/models/Instance.js +5 -0
  87. package/dist/types/models/Instance.js.map +1 -0
  88. package/dist/types/models/Migration.js +12 -0
  89. package/dist/types/models/Migration.js.map +1 -0
  90. package/dist/types/models/SourceTable.js +24 -0
  91. package/dist/types/models/SourceTable.js.map +1 -0
  92. package/dist/types/models/SyncRules.js +47 -0
  93. package/dist/types/models/SyncRules.js.map +1 -0
  94. package/dist/types/models/WriteCheckpoint.js +13 -0
  95. package/dist/types/models/WriteCheckpoint.js.map +1 -0
  96. package/dist/types/models/models-index.js +11 -0
  97. package/dist/types/models/models-index.js.map +1 -0
  98. package/dist/types/types.js +46 -0
  99. package/dist/types/types.js.map +1 -0
  100. package/dist/utils/bson.js +16 -0
  101. package/dist/utils/bson.js.map +1 -0
  102. package/dist/utils/bucket-data.js +25 -0
  103. package/dist/utils/bucket-data.js.map +1 -0
  104. package/dist/utils/db.js +24 -0
  105. package/dist/utils/db.js.map +1 -0
  106. package/dist/utils/ts-codec.js +11 -0
  107. package/dist/utils/ts-codec.js.map +1 -0
  108. package/dist/utils/utils-index.js +5 -0
  109. package/dist/utils/utils-index.js.map +1 -0
  110. package/package.json +50 -0
  111. package/src/index.ts +10 -0
  112. package/src/migrations/PostgresMigrationAgent.ts +46 -0
  113. package/src/migrations/PostgresMigrationStore.ts +70 -0
  114. package/src/migrations/migration-utils.ts +14 -0
  115. package/src/migrations/scripts/1684951997326-init.ts +141 -0
  116. package/src/module/PostgresStorageModule.ts +30 -0
  117. package/src/storage/PostgresBucketStorageFactory.ts +496 -0
  118. package/src/storage/PostgresCompactor.ts +366 -0
  119. package/src/storage/PostgresStorageProvider.ts +42 -0
  120. package/src/storage/PostgresSyncRulesStorage.ts +666 -0
  121. package/src/storage/PostgresTestStorageFactoryGenerator.ts +61 -0
  122. package/src/storage/batch/OperationBatch.ts +101 -0
  123. package/src/storage/batch/PostgresBucketBatch.ts +885 -0
  124. package/src/storage/batch/PostgresPersistedBatch.ts +441 -0
  125. package/src/storage/checkpoints/PostgresWriteCheckpointAPI.ts +176 -0
  126. package/src/storage/storage-index.ts +5 -0
  127. package/src/storage/sync-rules/PostgresPersistedSyncRulesContent.ts +67 -0
  128. package/src/types/codecs.ts +136 -0
  129. package/src/types/models/ActiveCheckpoint.ts +15 -0
  130. package/src/types/models/ActiveCheckpointNotification.ts +14 -0
  131. package/src/types/models/BucketData.ts +26 -0
  132. package/src/types/models/BucketParameters.ts +14 -0
  133. package/src/types/models/CurrentData.ts +23 -0
  134. package/src/types/models/Instance.ts +8 -0
  135. package/src/types/models/Migration.ts +19 -0
  136. package/src/types/models/SourceTable.ts +32 -0
  137. package/src/types/models/SyncRules.ts +50 -0
  138. package/src/types/models/WriteCheckpoint.ts +20 -0
  139. package/src/types/models/models-index.ts +10 -0
  140. package/src/types/types.ts +73 -0
  141. package/src/utils/bson.ts +17 -0
  142. package/src/utils/bucket-data.ts +25 -0
  143. package/src/utils/db.ts +27 -0
  144. package/src/utils/ts-codec.ts +14 -0
  145. package/src/utils/utils-index.ts +4 -0
  146. package/test/src/__snapshots__/storage.test.ts.snap +9 -0
  147. package/test/src/__snapshots__/storage_sync.test.ts.snap +332 -0
  148. package/test/src/env.ts +6 -0
  149. package/test/src/migrations.test.ts +34 -0
  150. package/test/src/setup.ts +16 -0
  151. package/test/src/storage.test.ts +131 -0
  152. package/test/src/storage_compacting.test.ts +5 -0
  153. package/test/src/storage_sync.test.ts +12 -0
  154. package/test/src/util.ts +34 -0
  155. package/test/tsconfig.json +20 -0
  156. package/tsconfig.json +36 -0
  157. package/vitest.config.ts +13 -0
@@ -0,0 +1,110 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import { framework } from '@powersync/service-core';
54
+ import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
55
+ import { normalizePostgresStorageConfig } from '../types/types.js';
56
+ import { PostgresBucketStorageFactory } from './PostgresBucketStorageFactory.js';
57
+ export const PostgresTestStorageFactoryGenerator = (factoryOptions) => {
58
+ return async (options) => {
59
+ try {
60
+ const env_1 = { stack: [], error: void 0, hasError: false };
61
+ try {
62
+ const migrationManager = new framework.MigrationManager();
63
+ const BASE_CONFIG = {
64
+ type: 'postgresql',
65
+ uri: factoryOptions.url,
66
+ sslmode: 'disable'
67
+ };
68
+ const TEST_CONNECTION_OPTIONS = normalizePostgresStorageConfig(BASE_CONFIG);
69
+ const migrationAgent = __addDisposableResource(env_1, factoryOptions.migrationAgent
70
+ ? factoryOptions.migrationAgent(BASE_CONFIG)
71
+ : new PostgresMigrationAgent(BASE_CONFIG), true);
72
+ migrationManager.registerMigrationAgent(migrationAgent);
73
+ const mockServiceContext = { configuration: { storage: BASE_CONFIG } };
74
+ if (!options?.doNotClear) {
75
+ await migrationManager.migrate({
76
+ direction: framework.migrations.Direction.Down,
77
+ migrationContext: {
78
+ service_context: mockServiceContext
79
+ }
80
+ });
81
+ }
82
+ await migrationManager.migrate({
83
+ direction: framework.migrations.Direction.Up,
84
+ migrationContext: {
85
+ service_context: mockServiceContext
86
+ }
87
+ });
88
+ return new PostgresBucketStorageFactory({
89
+ config: TEST_CONNECTION_OPTIONS,
90
+ slot_name_prefix: 'test_'
91
+ });
92
+ }
93
+ catch (e_1) {
94
+ env_1.error = e_1;
95
+ env_1.hasError = true;
96
+ }
97
+ finally {
98
+ const result_1 = __disposeResources(env_1);
99
+ if (result_1)
100
+ await result_1;
101
+ }
102
+ }
103
+ catch (ex) {
104
+ // Vitest does not display these errors nicely when using the `await using` syntx
105
+ console.error(ex, ex.cause);
106
+ throw ex;
107
+ }
108
+ };
109
+ };
110
+ //# sourceMappingURL=PostgresTestStorageFactoryGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgresTestStorageFactoryGenerator.js","sourceRoot":"","sources":["../../src/storage/PostgresTestStorageFactoryGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAiE,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAgC,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAWjF,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,cAA0C,EAAE,EAAE;IAChG,OAAO,KAAK,EAAE,OAA4B,EAAE,EAAE;QAC5C,IAAI,CAAC;;;gBACH,MAAM,gBAAgB,GAA8B,IAAI,SAAS,CAAC,gBAAgB,EAAE,CAAC;gBAErF,MAAM,WAAW,GAAG;oBAClB,IAAI,EAAE,YAAqB;oBAC3B,GAAG,EAAE,cAAc,CAAC,GAAG;oBACvB,OAAO,EAAE,SAAkB;iBAC5B,CAAC;gBAEF,MAAM,uBAAuB,GAAG,8BAA8B,CAAC,WAAW,CAAC,CAAC;gBAE5E,MAAY,cAAc,kCAAG,cAAc,CAAC,cAAc;oBACxD,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,WAAW,CAAC;oBAC5C,CAAC,CAAC,IAAI,sBAAsB,CAAC,WAAW,CAAC,OAAA,CAAC;gBAC5C,gBAAgB,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;gBAExD,MAAM,kBAAkB,GAAG,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAA+B,CAAC;gBAEpG,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;oBACzB,MAAM,gBAAgB,CAAC,OAAO,CAAC;wBAC7B,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;wBAC9C,gBAAgB,EAAE;4BAChB,eAAe,EAAE,kBAAkB;yBACpC;qBACF,CAAC,CAAC;gBACL,CAAC;gBAED,MAAM,gBAAgB,CAAC,OAAO,CAAC;oBAC7B,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;oBAC5C,gBAAgB,EAAE;wBAChB,eAAe,EAAE,kBAAkB;qBACpC;iBACF,CAAC,CAAC;gBAEH,OAAO,IAAI,4BAA4B,CAAC;oBACtC,MAAM,EAAE,uBAAuB;oBAC/B,gBAAgB,EAAE,OAAO;iBAC1B,CAAC,CAAC;;;;;;;;;;;SACJ;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,iFAAiF;YACjF,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;YAC5B,MAAM,EAAE,CAAC;QACX,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * TODO share this implementation better in the core package.
3
+ * There are some subtle differences in this implementation.
4
+ */
5
+ import { storage, utils } from '@powersync/service-core';
6
+ /**
7
+ * Batch of input operations.
8
+ *
9
+ * We accumulate operations up to MAX_RECORD_BATCH_SIZE,
10
+ * then further split into sub-batches if MAX_CURRENT_DATA_BATCH_SIZE is exceeded.
11
+ */
12
+ export class OperationBatch {
13
+ options;
14
+ batch = [];
15
+ currentSize = 0;
16
+ maxBatchCount;
17
+ maxRecordSize;
18
+ maxCurrentDataBatchSize;
19
+ get length() {
20
+ return this.batch.length;
21
+ }
22
+ constructor(options) {
23
+ this.options = options;
24
+ this.maxBatchCount = options.max_record_count;
25
+ this.maxRecordSize = options.max_estimated_size;
26
+ this.maxCurrentDataBatchSize = options.max_current_data_batch_size;
27
+ }
28
+ push(op) {
29
+ this.batch.push(op);
30
+ this.currentSize += op.estimatedSize;
31
+ }
32
+ shouldFlush() {
33
+ return this.batch.length >= this.maxBatchCount || this.currentSize > this.maxCurrentDataBatchSize;
34
+ }
35
+ /**
36
+ *
37
+ * @param sizes Map of source key to estimated size of the current_data document, or undefined if current_data is not persisted.
38
+ *
39
+ */
40
+ *batched(sizes) {
41
+ if (sizes == null) {
42
+ yield this.batch;
43
+ return;
44
+ }
45
+ let currentBatch = [];
46
+ let currentBatchSize = 0;
47
+ for (let op of this.batch) {
48
+ const key = op.internalBeforeKey;
49
+ const size = sizes.get(key) ?? 0;
50
+ if (currentBatchSize + size > this.maxCurrentDataBatchSize && currentBatch.length > 0) {
51
+ yield currentBatch;
52
+ currentBatch = [];
53
+ currentBatchSize = 0;
54
+ }
55
+ currentBatchSize += size;
56
+ currentBatch.push(op);
57
+ }
58
+ if (currentBatch.length > 0) {
59
+ yield currentBatch;
60
+ }
61
+ }
62
+ }
63
+ export class RecordOperation {
64
+ record;
65
+ afterId;
66
+ beforeId;
67
+ internalBeforeKey;
68
+ internalAfterKey;
69
+ estimatedSize;
70
+ constructor(record) {
71
+ this.record = record;
72
+ const afterId = record.afterReplicaId ?? null;
73
+ const beforeId = record.beforeReplicaId ?? record.afterReplicaId;
74
+ this.afterId = afterId;
75
+ this.beforeId = beforeId;
76
+ this.internalBeforeKey = cacheKey(record.sourceTable.id, beforeId);
77
+ this.internalAfterKey = afterId ? cacheKey(record.sourceTable.id, afterId) : null;
78
+ this.estimatedSize = utils.estimateRowSize(record.before) + utils.estimateRowSize(record.after);
79
+ }
80
+ }
81
+ /**
82
+ * In-memory cache key - must not be persisted.
83
+ */
84
+ export function cacheKey(sourceTableId, id) {
85
+ return encodedCacheKey(sourceTableId, storage.serializeReplicaId(id));
86
+ }
87
+ /**
88
+ * Calculates a cache key for a stored ReplicaId. This is usually stored as a bytea/Buffer.
89
+ */
90
+ export function encodedCacheKey(sourceTableId, storedKey) {
91
+ return `${sourceTableId}.${storedKey.toString('base64')}`;
92
+ }
93
+ //# sourceMappingURL=OperationBatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationBatch.js","sourceRoot":"","sources":["../../../src/storage/batch/OperationBatch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAYH;IAXtB,KAAK,GAAsB,EAAE,CAAC;IAC9B,WAAW,GAAW,CAAC,CAAC;IAEf,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB,uBAAuB,CAAS;IAEzC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,YAAsB,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;QACzD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAChD,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IACrE,CAAC;IAED,IAAI,CAAC,EAAmB;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpB,IAAI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