@powersync/service-core 0.13.0 → 0.15.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 (181) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/entry/commands/compact-action.js +14 -14
  3. package/dist/entry/commands/compact-action.js.map +1 -1
  4. package/dist/entry/commands/migrate-action.js +15 -4
  5. package/dist/entry/commands/migrate-action.js.map +1 -1
  6. package/dist/index.d.ts +1 -3
  7. package/dist/index.js +1 -3
  8. package/dist/index.js.map +1 -1
  9. package/dist/migrations/PowerSyncMigrationManager.d.ts +17 -0
  10. package/dist/migrations/PowerSyncMigrationManager.js +21 -0
  11. package/dist/migrations/PowerSyncMigrationManager.js.map +1 -0
  12. package/dist/migrations/ensure-automatic-migrations.d.ts +4 -0
  13. package/dist/migrations/ensure-automatic-migrations.js +14 -0
  14. package/dist/migrations/ensure-automatic-migrations.js.map +1 -0
  15. package/dist/migrations/migrations-index.d.ts +2 -3
  16. package/dist/migrations/migrations-index.js +2 -3
  17. package/dist/migrations/migrations-index.js.map +1 -1
  18. package/dist/routes/configure-fastify.d.ts +12 -12
  19. package/dist/routes/endpoints/admin.d.ts +24 -24
  20. package/dist/storage/BucketStorage.d.ts +51 -3
  21. package/dist/storage/BucketStorage.js +26 -0
  22. package/dist/storage/BucketStorage.js.map +1 -1
  23. package/dist/storage/bson.d.ts +24 -0
  24. package/dist/storage/bson.js +73 -0
  25. package/dist/storage/bson.js.map +1 -0
  26. package/dist/storage/storage-index.d.ts +3 -14
  27. package/dist/storage/storage-index.js +3 -14
  28. package/dist/storage/storage-index.js.map +1 -1
  29. package/dist/sync/sync.js +3 -1
  30. package/dist/sync/sync.js.map +1 -1
  31. package/dist/system/ServiceContext.d.ts +3 -0
  32. package/dist/system/ServiceContext.js +11 -3
  33. package/dist/system/ServiceContext.js.map +1 -1
  34. package/dist/util/config/types.d.ts +2 -2
  35. package/dist/util/utils.d.ts +17 -1
  36. package/dist/util/utils.js +49 -1
  37. package/dist/util/utils.js.map +1 -1
  38. package/package.json +7 -8
  39. package/src/entry/commands/compact-action.ts +19 -14
  40. package/src/entry/commands/migrate-action.ts +17 -4
  41. package/src/index.ts +1 -4
  42. package/src/migrations/PowerSyncMigrationManager.ts +42 -0
  43. package/src/migrations/ensure-automatic-migrations.ts +15 -0
  44. package/src/migrations/migrations-index.ts +2 -3
  45. package/src/storage/BucketStorage.ts +59 -3
  46. package/src/storage/bson.ts +78 -0
  47. package/src/storage/storage-index.ts +3 -15
  48. package/src/sync/sync.ts +3 -1
  49. package/src/system/ServiceContext.ts +17 -4
  50. package/src/util/config/types.ts +2 -2
  51. package/src/util/utils.ts +47 -1
  52. package/test/src/env.ts +0 -1
  53. package/tsconfig.tsbuildinfo +1 -1
  54. package/dist/db/db-index.d.ts +0 -1
  55. package/dist/db/db-index.js +0 -2
  56. package/dist/db/db-index.js.map +0 -1
  57. package/dist/db/mongo.d.ts +0 -35
  58. package/dist/db/mongo.js +0 -73
  59. package/dist/db/mongo.js.map +0 -1
  60. package/dist/locks/LockManager.d.ts +0 -10
  61. package/dist/locks/LockManager.js +0 -7
  62. package/dist/locks/LockManager.js.map +0 -1
  63. package/dist/locks/MongoLocks.d.ts +0 -36
  64. package/dist/locks/MongoLocks.js +0 -81
  65. package/dist/locks/MongoLocks.js.map +0 -1
  66. package/dist/locks/locks-index.d.ts +0 -2
  67. package/dist/locks/locks-index.js +0 -3
  68. package/dist/locks/locks-index.js.map +0 -1
  69. package/dist/migrations/db/migrations/1684951997326-init.d.ts +0 -3
  70. package/dist/migrations/db/migrations/1684951997326-init.js +0 -33
  71. package/dist/migrations/db/migrations/1684951997326-init.js.map +0 -1
  72. package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.d.ts +0 -2
  73. package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.js +0 -5
  74. package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.js.map +0 -1
  75. package/dist/migrations/db/migrations/1702295701188-sync-rule-state.d.ts +0 -3
  76. package/dist/migrations/db/migrations/1702295701188-sync-rule-state.js +0 -56
  77. package/dist/migrations/db/migrations/1702295701188-sync-rule-state.js.map +0 -1
  78. package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.d.ts +0 -3
  79. package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.js +0 -29
  80. package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.js.map +0 -1
  81. package/dist/migrations/db/migrations/1727099539247-custom-write-checkpoint-index.d.ts +0 -3
  82. package/dist/migrations/db/migrations/1727099539247-custom-write-checkpoint-index.js +0 -31
  83. package/dist/migrations/db/migrations/1727099539247-custom-write-checkpoint-index.js.map +0 -1
  84. package/dist/migrations/definitions.d.ts +0 -18
  85. package/dist/migrations/definitions.js +0 -6
  86. package/dist/migrations/definitions.js.map +0 -1
  87. package/dist/migrations/executor.d.ts +0 -16
  88. package/dist/migrations/executor.js +0 -64
  89. package/dist/migrations/executor.js.map +0 -1
  90. package/dist/migrations/migrations.d.ts +0 -18
  91. package/dist/migrations/migrations.js +0 -110
  92. package/dist/migrations/migrations.js.map +0 -1
  93. package/dist/migrations/store/migration-store.d.ts +0 -11
  94. package/dist/migrations/store/migration-store.js +0 -46
  95. package/dist/migrations/store/migration-store.js.map +0 -1
  96. package/dist/storage/MongoBucketStorage.d.ts +0 -48
  97. package/dist/storage/MongoBucketStorage.js +0 -427
  98. package/dist/storage/MongoBucketStorage.js.map +0 -1
  99. package/dist/storage/mongo/MongoBucketBatch.d.ts +0 -74
  100. package/dist/storage/mongo/MongoBucketBatch.js +0 -683
  101. package/dist/storage/mongo/MongoBucketBatch.js.map +0 -1
  102. package/dist/storage/mongo/MongoCompactor.d.ts +0 -40
  103. package/dist/storage/mongo/MongoCompactor.js +0 -310
  104. package/dist/storage/mongo/MongoCompactor.js.map +0 -1
  105. package/dist/storage/mongo/MongoIdSequence.d.ts +0 -12
  106. package/dist/storage/mongo/MongoIdSequence.js +0 -21
  107. package/dist/storage/mongo/MongoIdSequence.js.map +0 -1
  108. package/dist/storage/mongo/MongoPersistedSyncRules.d.ts +0 -9
  109. package/dist/storage/mongo/MongoPersistedSyncRules.js +0 -9
  110. package/dist/storage/mongo/MongoPersistedSyncRules.js.map +0 -1
  111. package/dist/storage/mongo/MongoPersistedSyncRulesContent.d.ts +0 -20
  112. package/dist/storage/mongo/MongoPersistedSyncRulesContent.js +0 -26
  113. package/dist/storage/mongo/MongoPersistedSyncRulesContent.js.map +0 -1
  114. package/dist/storage/mongo/MongoStorageProvider.d.ts +0 -5
  115. package/dist/storage/mongo/MongoStorageProvider.js +0 -26
  116. package/dist/storage/mongo/MongoStorageProvider.js.map +0 -1
  117. package/dist/storage/mongo/MongoSyncBucketStorage.d.ts +0 -38
  118. package/dist/storage/mongo/MongoSyncBucketStorage.js +0 -534
  119. package/dist/storage/mongo/MongoSyncBucketStorage.js.map +0 -1
  120. package/dist/storage/mongo/MongoSyncRulesLock.d.ts +0 -16
  121. package/dist/storage/mongo/MongoSyncRulesLock.js +0 -65
  122. package/dist/storage/mongo/MongoSyncRulesLock.js.map +0 -1
  123. package/dist/storage/mongo/MongoWriteCheckpointAPI.d.ts +0 -20
  124. package/dist/storage/mongo/MongoWriteCheckpointAPI.js +0 -104
  125. package/dist/storage/mongo/MongoWriteCheckpointAPI.js.map +0 -1
  126. package/dist/storage/mongo/OperationBatch.d.ts +0 -35
  127. package/dist/storage/mongo/OperationBatch.js +0 -119
  128. package/dist/storage/mongo/OperationBatch.js.map +0 -1
  129. package/dist/storage/mongo/PersistedBatch.d.ts +0 -46
  130. package/dist/storage/mongo/PersistedBatch.js +0 -223
  131. package/dist/storage/mongo/PersistedBatch.js.map +0 -1
  132. package/dist/storage/mongo/config.d.ts +0 -19
  133. package/dist/storage/mongo/config.js +0 -26
  134. package/dist/storage/mongo/config.js.map +0 -1
  135. package/dist/storage/mongo/db.d.ts +0 -36
  136. package/dist/storage/mongo/db.js +0 -47
  137. package/dist/storage/mongo/db.js.map +0 -1
  138. package/dist/storage/mongo/models.d.ts +0 -163
  139. package/dist/storage/mongo/models.js +0 -27
  140. package/dist/storage/mongo/models.js.map +0 -1
  141. package/dist/storage/mongo/util.d.ts +0 -54
  142. package/dist/storage/mongo/util.js +0 -190
  143. package/dist/storage/mongo/util.js.map +0 -1
  144. package/src/db/db-index.ts +0 -1
  145. package/src/db/mongo.ts +0 -81
  146. package/src/locks/LockManager.ts +0 -16
  147. package/src/locks/MongoLocks.ts +0 -142
  148. package/src/locks/locks-index.ts +0 -2
  149. package/src/migrations/db/migrations/1684951997326-init.ts +0 -38
  150. package/src/migrations/db/migrations/1688556755264-initial-sync-rules.ts +0 -5
  151. package/src/migrations/db/migrations/1702295701188-sync-rule-state.ts +0 -102
  152. package/src/migrations/db/migrations/1711543888062-write-checkpoint-index.ts +0 -34
  153. package/src/migrations/db/migrations/1727099539247-custom-write-checkpoint-index.ts +0 -37
  154. package/src/migrations/definitions.ts +0 -21
  155. package/src/migrations/executor.ts +0 -87
  156. package/src/migrations/migrations.ts +0 -142
  157. package/src/migrations/store/migration-store.ts +0 -63
  158. package/src/storage/MongoBucketStorage.ts +0 -541
  159. package/src/storage/mongo/MongoBucketBatch.ts +0 -900
  160. package/src/storage/mongo/MongoCompactor.ts +0 -393
  161. package/src/storage/mongo/MongoIdSequence.ts +0 -24
  162. package/src/storage/mongo/MongoPersistedSyncRules.ts +0 -16
  163. package/src/storage/mongo/MongoPersistedSyncRulesContent.ts +0 -50
  164. package/src/storage/mongo/MongoStorageProvider.ts +0 -31
  165. package/src/storage/mongo/MongoSyncBucketStorage.ts +0 -640
  166. package/src/storage/mongo/MongoSyncRulesLock.ts +0 -85
  167. package/src/storage/mongo/MongoWriteCheckpointAPI.ts +0 -154
  168. package/src/storage/mongo/OperationBatch.ts +0 -131
  169. package/src/storage/mongo/PersistedBatch.ts +0 -285
  170. package/src/storage/mongo/config.ts +0 -40
  171. package/src/storage/mongo/db.ts +0 -88
  172. package/src/storage/mongo/models.ts +0 -187
  173. package/src/storage/mongo/util.ts +0 -203
  174. package/test/src/__snapshots__/sync.test.ts.snap +0 -332
  175. package/test/src/bucket_validation.test.ts +0 -143
  176. package/test/src/bucket_validation.ts +0 -60
  177. package/test/src/compacting.test.ts +0 -295
  178. package/test/src/data_storage.test.ts +0 -1569
  179. package/test/src/stream_utils.ts +0 -42
  180. package/test/src/sync.test.ts +0 -511
  181. package/test/src/util.ts +0 -150
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @powersync/service-core
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9d9ff08: Updated BucketStorageFactory to use AsyncDisposable
8
+ - 9d9ff08: Initial release of Postgres bucket storage.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [9d9ff08]
13
+ - @powersync/lib-services-framework@0.4.0
14
+ - @powersync/service-rsocket-router@0.0.16
15
+
16
+ ## 0.14.0
17
+
18
+ ### Minor Changes
19
+
20
+ - fea550f: Moved MongoDB sync bucket storage implementation to the MongoDB module.
21
+
22
+ ### Patch Changes
23
+
24
+ - fea550f: Updated ts-codec to 1.3.0 for better decode error responses
25
+ - 48320b5: MongoDB: Fix replication of undefined values causing missing documents
26
+ - Updated dependencies [fea550f]
27
+ - Updated dependencies [fea550f]
28
+ - Updated dependencies [fea550f]
29
+ - @powersync/lib-services-framework@0.3.0
30
+ - @powersync/service-sync-rules@0.23.1
31
+ - @powersync/service-types@0.7.0
32
+ - @powersync/service-rsocket-router@0.0.15
33
+
3
34
  ## 0.13.0
4
35
 
5
36
  ### Minor Changes
@@ -50,10 +50,11 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
50
50
  var e = new Error(message);
51
51
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
52
  });
53
- import { logger } from '@powersync/lib-services-framework';
53
+ import { container, logger } from '@powersync/lib-services-framework';
54
54
  import * as v8 from 'v8';
55
- import * as storage from '../../storage/storage-index.js';
55
+ import * as system from '../../system/system-index.js';
56
56
  import * as utils from '../../util/util-index.js';
57
+ import { modules } from '../../index.js';
57
58
  import { extractRunnerOptions, wrapConfigCommand } from './config-command.js';
58
59
  const COMMAND_NAME = 'compact';
59
60
  /**
@@ -77,22 +78,20 @@ export function registerCompactAction(program) {
77
78
  logger.info('Compacting storage for all buckets...');
78
79
  }
79
80
  else {
80
- logger.info(`Compacting storage for ${buckets.join(', ')}...`);
81
+ logger.info(`Compacting storage for ${buckets?.join(', ')}...`);
81
82
  }
82
- const runnerConfig = extractRunnerOptions(options);
83
- const configuration = await utils.loadConfig(runnerConfig);
84
- logger.info('Successfully loaded configuration...');
85
- const { storage: storageConfig } = configuration;
83
+ const config = await utils.loadConfig(extractRunnerOptions(options));
84
+ const serviceContext = new system.ServiceContextContainer(config);
85
+ // Register modules in order to allow custom module compacting
86
+ const moduleManager = container.getImplementation(modules.ModuleManager);
87
+ await moduleManager.initialize(serviceContext);
86
88
  logger.info('Connecting to storage...');
87
- const psdb = storage.createPowerSyncMongo(storageConfig);
88
- const client = psdb.client;
89
- await client.connect();
90
89
  try {
91
90
  const env_1 = { stack: [], error: void 0, hasError: false };
92
91
  try {
93
- const bucketStorage = new storage.MongoBucketStorage(psdb, {
94
- slot_name_prefix: configuration.slot_name_prefix
95
- });
92
+ // Start the storage engine in order to create the appropriate BucketStorage
93
+ await serviceContext.lifeCycleEngine.start();
94
+ const bucketStorage = serviceContext.storageEngine.activeBucketStorage;
96
95
  const active = await bucketStorage.getActiveSyncRulesContent();
97
96
  if (active == null) {
98
97
  logger.info('No active instance to compact');
@@ -113,10 +112,11 @@ export function registerCompactAction(program) {
113
112
  }
114
113
  catch (e) {
115
114
  logger.error(`Failed to compact: ${e.toString()}`);
115
+ // Indirectly triggers lifeCycleEngine.stop
116
116
  process.exit(1);
117
117
  }
118
118
  finally {
119
- await client.close();
119
+ // Indirectly triggers lifeCycleEngine.stop
120
120
  process.exit(0);
121
121
  }
122
122
  });
@@ -1 +1 @@
1
- {"version":3,"file":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;;SAChD;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACnD,2CAA2C;YAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,2CAA2C;YAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +1,7 @@
1
- import { logger } from '@powersync/lib-services-framework';
2
- import * as migrations from '../../migrations/migrations-index.js';
1
+ import { container, logger } from '@powersync/lib-services-framework';
2
+ import * as modules from '../../modules/modules-index.js';
3
+ import * as system from '../../system/system-index.js';
4
+ import * as utils from '../../util/util-index.js';
3
5
  import { extractRunnerOptions, wrapConfigCommand } from './config-command.js';
4
6
  const COMMAND_NAME = 'migrate';
5
7
  export function registerMigrationAction(program) {
@@ -9,11 +11,20 @@ export function registerMigrationAction(program) {
9
11
  .description('Run migrations')
10
12
  .argument('<direction>', 'Migration direction. `up` or `down`')
11
13
  .action(async (direction, options) => {
14
+ const config = await utils.loadConfig(extractRunnerOptions(options));
15
+ const serviceContext = new system.ServiceContextContainer(config);
16
+ // Register modules in order to allow custom module migrations
17
+ const moduleManager = container.getImplementation(modules.ModuleManager);
18
+ await moduleManager.initialize(serviceContext);
12
19
  try {
13
- await migrations.migrate({
20
+ await serviceContext.migrations.migrate({
14
21
  direction,
15
- runner_config: extractRunnerOptions(options)
22
+ // Give the migrations access to the service context
23
+ migrationContext: {
24
+ service_context: serviceContext
25
+ }
16
26
  });
27
+ await serviceContext.migrations[Symbol.asyncDispose]();
17
28
  process.exit(0);
18
29
  }
19
30
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-action.js","sourceRoot":"","sources":["../../../src/entry/commands/migrate-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM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AAS,CAAC;AAE/B,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAEvD,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEpC,OAAO,gBAAgB;SACpB,WAAW,CAAC,gBAAgB,CAAC;SAC7B,QAAQ,CAAC,aAAa,EAAE,qCAAqC,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,SAA+B,EAAE,OAAO,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAElE,8DAA8D;QAC9D,MAAM,aAAa,GAAG,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzE,MAAM,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/C,IAAI,CAAC;YACH,MAAM,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;gBACtC,SAAS;gBACT,oDAAoD;gBACpD,gBAAgB,EAAE;oBAChB,eAAe,EAAE,cAAc;iBAChC;aACF,CAAC,CAAC;YAEH,MAAM,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,15 +2,13 @@ export * from './api/api-index.js';
2
2
  export * as api from './api/api-index.js';
3
3
  export * from './auth/auth-index.js';
4
4
  export * as auth from './auth/auth-index.js';
5
- export * from './db/db-index.js';
6
- export * as db from './db/db-index.js';
7
5
  export * from './entry/entry-index.js';
8
6
  export * as entry from './entry/entry-index.js';
9
7
  export * as framework from '@powersync/lib-services-framework';
10
8
  export * from './metrics/Metrics.js';
11
9
  export * as metrics from './metrics/Metrics.js';
10
+ export * from './migrations/migrations-index.js';
12
11
  export * as migrations from './migrations/migrations-index.js';
13
- export * from './migrations/migrations.js';
14
12
  export * from './modules/modules-index.js';
15
13
  export * as modules from './modules/modules-index.js';
16
14
  export * from './replication/replication-index.js';
package/dist/index.js CHANGED
@@ -3,16 +3,14 @@ export * from './api/api-index.js';
3
3
  export * as api from './api/api-index.js';
4
4
  export * from './auth/auth-index.js';
5
5
  export * as auth from './auth/auth-index.js';
6
- export * from './db/db-index.js';
7
- export * as db from './db/db-index.js';
8
6
  export * from './entry/entry-index.js';
9
7
  export * as entry from './entry/entry-index.js';
10
8
  // Re-export framework for easy use of Container API
11
9
  export * as framework from '@powersync/lib-services-framework';
12
10
  export * from './metrics/Metrics.js';
13
11
  export * as metrics from './metrics/Metrics.js';
12
+ export * from './migrations/migrations-index.js';
14
13
  export * as migrations from './migrations/migrations-index.js';
15
- export * from './migrations/migrations.js';
16
14
  export * from './modules/modules-index.js';
17
15
  export * as modules from './modules/modules-index.js';
18
16
  export * from './replication/replication-index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAE7C,cAAc,kBAAkB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,cAAc,wBAAwB,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,wB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AAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AAEtD,cAAc,oCAAoC,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,oCAAoC,CAAC;AAElE,cAAc,0BAA0B,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAEnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AAEtD,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAE7C,cAAc,0BAA0B,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAEnD,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as framework from '@powersync/lib-services-framework';
2
+ import * as system from '../system/system-index.js';
3
+ /**
4
+ * PowerSync service migrations each have this context available to the `up` and `down` methods.
5
+ */
6
+ export interface PowerSyncMigrationContext {
7
+ service_context: system.ServiceContext;
8
+ }
9
+ export interface PowerSyncMigrationGenerics extends framework.MigrationAgentGenerics {
10
+ MIGRATION_CONTEXT: PowerSyncMigrationContext;
11
+ }
12
+ export type PowerSyncMigrationFunction = framework.MigrationFunction<PowerSyncMigrationContext>;
13
+ export declare abstract class AbstractPowerSyncMigrationAgent extends framework.AbstractMigrationAgent<PowerSyncMigrationGenerics> {
14
+ abstract getInternalScriptsDir(): string;
15
+ loadInternalMigrations(): Promise<framework.Migration<PowerSyncMigrationContext>[]>;
16
+ }
17
+ export type PowerSyncMigrationManager = framework.MigrationManager<PowerSyncMigrationGenerics>;
@@ -0,0 +1,21 @@
1
+ import * as framework from '@powersync/lib-services-framework';
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
+ export class AbstractPowerSyncMigrationAgent extends framework.AbstractMigrationAgent {
5
+ async loadInternalMigrations() {
6
+ const migrationsDir = this.getInternalScriptsDir();
7
+ const files = await fs.readdir(migrationsDir);
8
+ const migrations = files.filter((file) => {
9
+ return '.js' == path.extname(file);
10
+ });
11
+ return await Promise.all(migrations.map(async (migration) => {
12
+ const module = await import(path.resolve(migrationsDir, migration));
13
+ return {
14
+ name: path.basename(migration).replace(path.extname(migration), ''),
15
+ up: module.up,
16
+ down: module.down
17
+ };
18
+ }));
19
+ }
20
+ }
21
+ //# sourceMappingURL=PowerSyncMigrationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PowerSyncMigrationManager.js","sourceRoot":"","sources":["../../src/migrations/PowerSyncMigrationManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAgBxB,MAAM,OAAgB,+BAAgC,SAAQ,SAAS,CAAC,sBAAkD;IAGxH,KAAK,CAAC,sBAAsB;QAC1B,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACvC,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;YACpE,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;gBACnE,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import * as system from '../system/system-index.js';
2
+ export declare const ensureAutomaticMigrations: (options: {
3
+ serviceContext: system.ServiceContext;
4
+ }) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ import * as framework from '@powersync/lib-services-framework';
2
+ export const ensureAutomaticMigrations = async (options) => {
3
+ const { serviceContext } = options;
4
+ if (serviceContext.configuration.migrations?.disable_auto_migration) {
5
+ return;
6
+ }
7
+ await serviceContext.migrations.migrate({
8
+ direction: framework.migrations.Direction.Up,
9
+ migrationContext: {
10
+ service_context: serviceContext
11
+ }
12
+ });
13
+ };
14
+ //# sourceMappingURL=ensure-automatic-migrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-automatic-migrations.js","sourceRoot":"","sources":["../../src/migrations/ensure-automatic-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAG/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAAE,OAAkD,EAAE,EAAE;IACpG,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACnC,IAAI,cAAc,CAAC,aAAa,CAAC,UAAU,EAAE,sBAAsB,EAAE,CAAC;QACpE,OAAO;IACT,CAAC;IACD,MAAM,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;QACtC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC5C,gBAAgB,EAAE;YAChB,eAAe,EAAE,cAAc;SAChC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './definitions.js';
2
- export * from './executor.js';
3
- export * from './migrations.js';
1
+ export * from './ensure-automatic-migrations.js';
2
+ export * from './PowerSyncMigrationManager.js';
@@ -1,4 +1,3 @@
1
- export * from './definitions.js';
2
- export * from './executor.js';
3
- export * from './migrations.js';
1
+ export * from './ensure-automatic-migrations.js';
2
+ export * from './PowerSyncMigrationManager.js';
4
3
  //# sourceMappingURL=migrations-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrations-index.js","sourceRoot":"","sources":["../../src/migrations/migrations-index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"migrations-index.js","sourceRoot":"","sources":["../../src/migrations/migrations-index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC"}
@@ -31,11 +31,11 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
31
31
  };
32
32
  connection_id?: string | undefined;
33
33
  }, {
34
+ success: boolean;
34
35
  results: {
35
36
  columns: string[];
36
37
  rows: (string | number | boolean | null)[][];
37
38
  };
38
- success: boolean;
39
39
  error?: string | undefined;
40
40
  }, import("./router.js").Context, import("./router.js").RequestEndpointHandlerPayload<{
41
41
  sql: {
@@ -50,11 +50,11 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
50
50
  };
51
51
  connection_id?: string | undefined;
52
52
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>, {
53
+ success: boolean;
53
54
  results: {
54
55
  columns: string[];
55
56
  rows: (string | number | boolean | null)[][];
56
57
  };
57
- success: boolean;
58
58
  error?: string | undefined;
59
59
  }>> & {
60
60
  path: string;
@@ -80,11 +80,11 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
80
80
  };
81
81
  connection_id?: string | undefined;
82
82
  }, import("./router.js").Context, import("./router.js").BasicRouterRequest>) => Promise<{
83
+ success: boolean;
83
84
  results: {
84
85
  columns: string[];
85
86
  rows: (string | number | boolean | null)[][];
86
87
  };
87
- success: boolean;
88
88
  error?: string | undefined;
89
89
  }>;
90
90
  }) | (import("@powersync/lib-services-framework").Endpoint<{
@@ -426,8 +426,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
426
426
  level: "warning" | "fatal";
427
427
  }[];
428
428
  connections: {
429
- id: string;
430
429
  tag: string;
430
+ id: string;
431
431
  slot_name: string;
432
432
  initial_replication_done: boolean;
433
433
  tables: {
@@ -442,9 +442,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
442
442
  parameter_queries: boolean;
443
443
  pattern?: string | undefined;
444
444
  }[];
445
- last_checkpoint_ts?: string | undefined;
446
- last_keepalive_ts?: string | undefined;
447
445
  last_lsn?: string | undefined;
446
+ last_keepalive_ts?: string | undefined;
447
+ last_checkpoint_ts?: string | undefined;
448
448
  replication_lag_bytes?: number | undefined;
449
449
  }[];
450
450
  content?: string | undefined;
@@ -458,8 +458,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
458
458
  level: "warning" | "fatal";
459
459
  }[];
460
460
  connections: {
461
- id: string;
462
461
  tag: string;
462
+ id: string;
463
463
  slot_name: string;
464
464
  initial_replication_done: boolean;
465
465
  tables: {
@@ -474,9 +474,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
474
474
  parameter_queries: boolean;
475
475
  pattern?: string | undefined;
476
476
  }[];
477
- last_checkpoint_ts?: string | undefined;
478
- last_keepalive_ts?: string | undefined;
479
477
  last_lsn?: string | undefined;
478
+ last_keepalive_ts?: string | undefined;
479
+ last_checkpoint_ts?: string | undefined;
480
480
  replication_lag_bytes?: number | undefined;
481
481
  }[];
482
482
  content?: string | undefined;
@@ -501,8 +501,8 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
501
501
  level: "warning" | "fatal";
502
502
  }[];
503
503
  connections: {
504
- id: string;
505
504
  tag: string;
505
+ id: string;
506
506
  slot_name: string;
507
507
  initial_replication_done: boolean;
508
508
  tables: {
@@ -517,9 +517,9 @@ export declare const DEFAULT_ROUTE_OPTIONS: {
517
517
  parameter_queries: boolean;
518
518
  pattern?: string | undefined;
519
519
  }[];
520
- last_checkpoint_ts?: string | undefined;
521
- last_keepalive_ts?: string | undefined;
522
520
  last_lsn?: string | undefined;
521
+ last_keepalive_ts?: string | undefined;
522
+ last_checkpoint_ts?: string | undefined;
523
523
  replication_lag_bytes?: number | undefined;
524
524
  }[];
525
525
  content?: string | undefined;
@@ -6,11 +6,11 @@ export declare const executeSql: router.Endpoint<{
6
6
  };
7
7
  connection_id?: string | undefined;
8
8
  }, {
9
+ success: boolean;
9
10
  results: {
10
11
  columns: string[];
11
12
  rows: (string | number | boolean | null)[][];
12
13
  };
13
- success: boolean;
14
14
  error?: string | undefined;
15
15
  }, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
16
16
  sql: {
@@ -25,11 +25,11 @@ export declare const executeSql: router.Endpoint<{
25
25
  };
26
26
  connection_id?: string | undefined;
27
27
  }, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
28
+ success: boolean;
28
29
  results: {
29
30
  columns: string[];
30
31
  rows: (string | number | boolean | null)[][];
31
32
  };
32
- success: boolean;
33
33
  error?: string | undefined;
34
34
  }>> & {
35
35
  path: string;
@@ -55,11 +55,11 @@ export declare const executeSql: router.Endpoint<{
55
55
  };
56
56
  connection_id?: string | undefined;
57
57
  }, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
58
+ success: boolean;
58
59
  results: {
59
60
  columns: string[];
60
61
  rows: (string | number | boolean | null)[][];
61
62
  };
62
- success: boolean;
63
63
  error?: string | undefined;
64
64
  }>;
65
65
  };
@@ -405,8 +405,8 @@ export declare const validate: router.Endpoint<{
405
405
  level: "warning" | "fatal";
406
406
  }[];
407
407
  connections: {
408
- id: string;
409
408
  tag: string;
409
+ id: string;
410
410
  slot_name: string;
411
411
  initial_replication_done: boolean;
412
412
  tables: {
@@ -421,9 +421,9 @@ export declare const validate: router.Endpoint<{
421
421
  parameter_queries: boolean;
422
422
  pattern?: string | undefined;
423
423
  }[];
424
- last_checkpoint_ts?: string | undefined;
425
- last_keepalive_ts?: string | undefined;
426
424
  last_lsn?: string | undefined;
425
+ last_keepalive_ts?: string | undefined;
426
+ last_checkpoint_ts?: string | undefined;
427
427
  replication_lag_bytes?: number | undefined;
428
428
  }[];
429
429
  content?: string | undefined;
@@ -437,8 +437,8 @@ export declare const validate: router.Endpoint<{
437
437
  level: "warning" | "fatal";
438
438
  }[];
439
439
  connections: {
440
- id: string;
441
440
  tag: string;
441
+ id: string;
442
442
  slot_name: string;
443
443
  initial_replication_done: boolean;
444
444
  tables: {
@@ -453,9 +453,9 @@ export declare const validate: router.Endpoint<{
453
453
  parameter_queries: boolean;
454
454
  pattern?: string | undefined;
455
455
  }[];
456
- last_checkpoint_ts?: string | undefined;
457
- last_keepalive_ts?: string | undefined;
458
456
  last_lsn?: string | undefined;
457
+ last_keepalive_ts?: string | undefined;
458
+ last_checkpoint_ts?: string | undefined;
459
459
  replication_lag_bytes?: number | undefined;
460
460
  }[];
461
461
  content?: string | undefined;
@@ -480,8 +480,8 @@ export declare const validate: router.Endpoint<{
480
480
  level: "warning" | "fatal";
481
481
  }[];
482
482
  connections: {
483
- id: string;
484
483
  tag: string;
484
+ id: string;
485
485
  slot_name: string;
486
486
  initial_replication_done: boolean;
487
487
  tables: {
@@ -496,9 +496,9 @@ export declare const validate: router.Endpoint<{
496
496
  parameter_queries: boolean;
497
497
  pattern?: string | undefined;
498
498
  }[];
499
- last_checkpoint_ts?: string | undefined;
500
- last_keepalive_ts?: string | undefined;
501
499
  last_lsn?: string | undefined;
500
+ last_keepalive_ts?: string | undefined;
501
+ last_checkpoint_ts?: string | undefined;
502
502
  replication_lag_bytes?: number | undefined;
503
503
  }[];
504
504
  content?: string | undefined;
@@ -511,11 +511,11 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
511
511
  };
512
512
  connection_id?: string | undefined;
513
513
  }, {
514
+ success: boolean;
514
515
  results: {
515
516
  columns: string[];
516
517
  rows: (string | number | boolean | null)[][];
517
518
  };
518
- success: boolean;
519
519
  error?: string | undefined;
520
520
  }, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
521
521
  sql: {
@@ -530,11 +530,11 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
530
530
  };
531
531
  connection_id?: string | undefined;
532
532
  }, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
533
+ success: boolean;
533
534
  results: {
534
535
  columns: string[];
535
536
  rows: (string | number | boolean | null)[][];
536
537
  };
537
- success: boolean;
538
538
  error?: string | undefined;
539
539
  }>> & {
540
540
  path: string;
@@ -560,11 +560,11 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
560
560
  };
561
561
  connection_id?: string | undefined;
562
562
  }, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
563
+ success: boolean;
563
564
  results: {
564
565
  columns: string[];
565
566
  rows: (string | number | boolean | null)[][];
566
567
  };
567
- success: boolean;
568
568
  error?: string | undefined;
569
569
  }>;
570
570
  }) | (router.Endpoint<{
@@ -906,8 +906,8 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
906
906
  level: "warning" | "fatal";
907
907
  }[];
908
908
  connections: {
909
- id: string;
910
909
  tag: string;
910
+ id: string;
911
911
  slot_name: string;
912
912
  initial_replication_done: boolean;
913
913
  tables: {
@@ -922,9 +922,9 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
922
922
  parameter_queries: boolean;
923
923
  pattern?: string | undefined;
924
924
  }[];
925
- last_checkpoint_ts?: string | undefined;
926
- last_keepalive_ts?: string | undefined;
927
925
  last_lsn?: string | undefined;
926
+ last_keepalive_ts?: string | undefined;
927
+ last_checkpoint_ts?: string | undefined;
928
928
  replication_lag_bytes?: number | undefined;
929
929
  }[];
930
930
  content?: string | undefined;
@@ -938,8 +938,8 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
938
938
  level: "warning" | "fatal";
939
939
  }[];
940
940
  connections: {
941
- id: string;
942
941
  tag: string;
942
+ id: string;
943
943
  slot_name: string;
944
944
  initial_replication_done: boolean;
945
945
  tables: {
@@ -954,9 +954,9 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
954
954
  parameter_queries: boolean;
955
955
  pattern?: string | undefined;
956
956
  }[];
957
- last_checkpoint_ts?: string | undefined;
958
- last_keepalive_ts?: string | undefined;
959
957
  last_lsn?: string | undefined;
958
+ last_keepalive_ts?: string | undefined;
959
+ last_checkpoint_ts?: string | undefined;
960
960
  replication_lag_bytes?: number | undefined;
961
961
  }[];
962
962
  content?: string | undefined;
@@ -981,8 +981,8 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
981
981
  level: "warning" | "fatal";
982
982
  }[];
983
983
  connections: {
984
- id: string;
985
984
  tag: string;
985
+ id: string;
986
986
  slot_name: string;
987
987
  initial_replication_done: boolean;
988
988
  tables: {
@@ -997,9 +997,9 @@ export declare const ADMIN_ROUTES: ((router.Endpoint<{
997
997
  parameter_queries: boolean;
998
998
  pattern?: string | undefined;
999
999
  }[];
1000
- last_checkpoint_ts?: string | undefined;
1001
- last_keepalive_ts?: string | undefined;
1002
1000
  last_lsn?: string | undefined;
1001
+ last_keepalive_ts?: string | undefined;
1002
+ last_checkpoint_ts?: string | undefined;
1003
1003
  replication_lag_bytes?: number | undefined;
1004
1004
  }[];
1005
1005
  content?: string | undefined;