@powersync/common 0.0.0-dev-20240920103931 → 0.0.0-dev-20250207081035

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.
@@ -1,6 +1,6 @@
1
1
  import { RowType, Table } from './Table.js';
2
2
  type SchemaType = Record<string, Table<any>>;
3
- type SchemaTableType<S extends SchemaType> = {
3
+ export type SchemaTableType<S extends SchemaType> = {
4
4
  [K in keyof S]: RowType<S[K]>;
5
5
  };
6
6
  /**
@@ -11,6 +11,16 @@ export class Schema {
11
11
  tables;
12
12
  constructor(tables) {
13
13
  if (Array.isArray(tables)) {
14
+ /*
15
+ We need to validate that the tables have a name here because a user could pass in an array
16
+ of Tables that don't have a name because they are using the V2 syntax.
17
+ Therefore, 'convertToClassicTables' won't be called on the tables resulting in a runtime error.
18
+ */
19
+ for (const table of tables) {
20
+ if (table.name === '') {
21
+ throw new Error("It appears you are trying to create a new Schema with an array instead of an object. Passing in an object instead of an array into 'new Schema()' may resolve your issue.");
22
+ }
23
+ }
14
24
  this.tables = tables;
15
25
  }
16
26
  else {
package/lib/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export * from './client/SQLOpenFactory.js';
4
4
  export * from './client/connection/PowerSyncBackendConnector.js';
5
5
  export * from './client/connection/PowerSyncCredentials.js';
6
6
  export * from './client/sync/bucket/BucketStorageAdapter.js';
7
+ export { runOnSchemaChange } from './client/runOnSchemaChange.js';
8
+ export { CompilableQueryWatchHandler, compilableQueryWatch } from './client/compilableQueryWatch.js';
7
9
  export { UpdateType, CrudEntry, OpId } from './client/sync/bucket/CrudEntry.js';
8
10
  export * from './client/sync/bucket/SqliteBucketStorage.js';
9
11
  export * from './client/sync/bucket/CrudBatch.js';
package/lib/index.js CHANGED
@@ -4,6 +4,8 @@ export * from './client/SQLOpenFactory.js';
4
4
  export * from './client/connection/PowerSyncBackendConnector.js';
5
5
  export * from './client/connection/PowerSyncCredentials.js';
6
6
  export * from './client/sync/bucket/BucketStorageAdapter.js';
7
+ export { runOnSchemaChange } from './client/runOnSchemaChange.js';
8
+ export { compilableQueryWatch } from './client/compilableQueryWatch.js';
7
9
  export { UpdateType, CrudEntry } from './client/sync/bucket/CrudEntry.js';
8
10
  export * from './client/sync/bucket/SqliteBucketStorage.js';
9
11
  export * from './client/sync/bucket/CrudBatch.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "0.0.0-dev-20240920103931",
3
+ "version": "0.0.0-dev-20250207081035",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -59,7 +59,7 @@
59
59
  "scripts": {
60
60
  "build": "tsc -b && rollup -c rollup.config.mjs",
61
61
  "build:prod": "tsc -b --sourceMap false && rollup -c rollup.config.mjs --sourceMap false",
62
- "clean": "rm -rf lib dist tsconfig.tsbuildinfo",
62
+ "clean": "rm -rf lib dist tsconfig.tsbuildinfo node_modules",
63
63
  "test": "vitest"
64
64
  }
65
65
  }