@powersync/common 0.0.0-dev-20260216124709 → 0.0.0-dev-20260305092446
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.
- package/dist/bundle.cjs +48 -49
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +49 -49
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +48 -49
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +49 -49
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +130 -80
- package/lib/client/triggers/TriggerManager.d.ts +5 -0
- package/lib/client/triggers/TriggerManagerImpl.d.ts +1 -1
- package/lib/client/triggers/TriggerManagerImpl.js +6 -4
- package/lib/client/triggers/TriggerManagerImpl.js.map +1 -1
- package/lib/db/schema/RawTable.d.ts +61 -26
- package/lib/db/schema/RawTable.js +1 -32
- package/lib/db/schema/RawTable.js.map +1 -1
- package/lib/db/schema/Schema.d.ts +14 -7
- package/lib/db/schema/Schema.js +25 -3
- package/lib/db/schema/Schema.js.map +1 -1
- package/lib/db/schema/Table.d.ts +13 -8
- package/lib/db/schema/Table.js +3 -8
- package/lib/db/schema/Table.js.map +1 -1
- package/lib/db/schema/internal.d.ts +12 -0
- package/lib/db/schema/internal.js +15 -0
- package/lib/db/schema/internal.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/triggers/TriggerManager.ts +6 -0
- package/src/client/triggers/TriggerManagerImpl.ts +6 -3
- package/src/db/schema/RawTable.ts +66 -31
- package/src/db/schema/Schema.ts +27 -2
- package/src/db/schema/Table.ts +11 -11
- package/src/db/schema/internal.ts +17 -0
- package/src/index.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1452,68 +1452,6 @@ declare class Column {
|
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
1454
|
|
|
1455
|
-
/**
|
|
1456
|
-
* A pending variant of a {@link RawTable} that doesn't have a name (because it would be inferred when creating the
|
|
1457
|
-
* schema).
|
|
1458
|
-
*/
|
|
1459
|
-
type RawTableType = {
|
|
1460
|
-
/**
|
|
1461
|
-
* The statement to run when PowerSync detects that a row needs to be inserted or updated.
|
|
1462
|
-
*/
|
|
1463
|
-
put: PendingStatement;
|
|
1464
|
-
/**
|
|
1465
|
-
* The statement to run when PowerSync detects that a row needs to be deleted.
|
|
1466
|
-
*/
|
|
1467
|
-
delete: PendingStatement;
|
|
1468
|
-
};
|
|
1469
|
-
/**
|
|
1470
|
-
* A parameter to use as part of {@link PendingStatement}.
|
|
1471
|
-
*
|
|
1472
|
-
* For delete statements, only the `"Id"` value is supported - the sync client will replace it with the id of the row to
|
|
1473
|
-
* be synced.
|
|
1474
|
-
*
|
|
1475
|
-
* For insert and replace operations, the values of columns in the table are available as parameters through
|
|
1476
|
-
* `{Column: 'name'}`.
|
|
1477
|
-
*/
|
|
1478
|
-
type PendingStatementParameter = 'Id' | {
|
|
1479
|
-
Column: string;
|
|
1480
|
-
};
|
|
1481
|
-
/**
|
|
1482
|
-
* A statement that the PowerSync client should use to insert or delete data into a table managed by the user.
|
|
1483
|
-
*/
|
|
1484
|
-
type PendingStatement = {
|
|
1485
|
-
sql: string;
|
|
1486
|
-
params: PendingStatementParameter[];
|
|
1487
|
-
};
|
|
1488
|
-
/**
|
|
1489
|
-
* Instructs PowerSync to sync data into a "raw" table.
|
|
1490
|
-
*
|
|
1491
|
-
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
1492
|
-
* using client-side table and column constraints.
|
|
1493
|
-
*
|
|
1494
|
-
* To collect local writes to raw tables with PowerSync, custom triggers are required. See
|
|
1495
|
-
* {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
|
|
1496
|
-
* using raw tables.
|
|
1497
|
-
*
|
|
1498
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
1499
|
-
*
|
|
1500
|
-
* @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
|
|
1501
|
-
* stability guarantees.
|
|
1502
|
-
*/
|
|
1503
|
-
declare class RawTable implements RawTableType {
|
|
1504
|
-
/**
|
|
1505
|
-
* The name of the table.
|
|
1506
|
-
*
|
|
1507
|
-
* This does not have to match the actual table name in the schema - {@link put} and {@link delete} are free to use
|
|
1508
|
-
* another table. Instead, this name is used by the sync client to recognize that operations on this table (as it
|
|
1509
|
-
* appears in the source / backend database) are to be handled specially.
|
|
1510
|
-
*/
|
|
1511
|
-
name: string;
|
|
1512
|
-
put: PendingStatement;
|
|
1513
|
-
delete: PendingStatement;
|
|
1514
|
-
constructor(name: string, type: RawTableType);
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
1455
|
interface IndexColumnOptions {
|
|
1518
1456
|
name: string;
|
|
1519
1457
|
ascending?: boolean;
|
|
@@ -1561,14 +1499,19 @@ declare class Index {
|
|
|
1561
1499
|
declare class TableV2<Columns extends ColumnsType = ColumnsType> extends Table<Columns> {
|
|
1562
1500
|
}
|
|
1563
1501
|
|
|
1564
|
-
|
|
1502
|
+
/**
|
|
1503
|
+
* Options that apply both to JSON-based tables and raw tables.
|
|
1504
|
+
*/
|
|
1505
|
+
interface TableOrRawTableOptions {
|
|
1565
1506
|
localOnly?: boolean;
|
|
1566
1507
|
insertOnly?: boolean;
|
|
1567
|
-
viewName?: string;
|
|
1568
1508
|
trackPrevious?: boolean | TrackPreviousOptions;
|
|
1569
1509
|
trackMetadata?: boolean;
|
|
1570
1510
|
ignoreEmptyUpdates?: boolean;
|
|
1571
1511
|
}
|
|
1512
|
+
interface SharedTableOptions extends TableOrRawTableOptions {
|
|
1513
|
+
viewName?: string;
|
|
1514
|
+
}
|
|
1572
1515
|
/** Whether to include previous column values when PowerSync tracks local changes.
|
|
1573
1516
|
*
|
|
1574
1517
|
* Including old values may be helpful for some backend connector implementations, which is
|
|
@@ -1692,14 +1635,14 @@ declare class Table<Columns extends ColumnsType = ColumnsType> {
|
|
|
1692
1635
|
get validName(): boolean;
|
|
1693
1636
|
validate(): void;
|
|
1694
1637
|
toJSON(): {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
local_only: boolean;
|
|
1698
|
-
insert_only: boolean;
|
|
1638
|
+
local_only: boolean | undefined;
|
|
1639
|
+
insert_only: boolean | undefined;
|
|
1699
1640
|
include_old: any;
|
|
1700
1641
|
include_old_only_when_changed: boolean;
|
|
1701
|
-
include_metadata: boolean;
|
|
1702
|
-
ignore_empty_update: boolean;
|
|
1642
|
+
include_metadata: boolean | undefined;
|
|
1643
|
+
ignore_empty_update: boolean | undefined;
|
|
1644
|
+
name: string;
|
|
1645
|
+
view_name: string;
|
|
1703
1646
|
columns: {
|
|
1704
1647
|
name: string;
|
|
1705
1648
|
type: ColumnType | undefined;
|
|
@@ -1715,6 +1658,101 @@ declare class Table<Columns extends ColumnsType = ColumnsType> {
|
|
|
1715
1658
|
};
|
|
1716
1659
|
}
|
|
1717
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* Instructs PowerSync to sync data into a "raw" table.
|
|
1663
|
+
*
|
|
1664
|
+
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
1665
|
+
* using client-side table and column constraints.
|
|
1666
|
+
*
|
|
1667
|
+
* To collect local writes to raw tables with PowerSync, custom triggers are required. See
|
|
1668
|
+
* {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
|
|
1669
|
+
* using raw tables.
|
|
1670
|
+
*
|
|
1671
|
+
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
1672
|
+
*
|
|
1673
|
+
* @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
|
|
1674
|
+
* stability guarantees.
|
|
1675
|
+
*/
|
|
1676
|
+
type RawTableType = RawTableTypeWithStatements | InferredRawTableType;
|
|
1677
|
+
interface RawTableTypeWithStatements {
|
|
1678
|
+
/**
|
|
1679
|
+
* The statement to run when PowerSync detects that a row needs to be inserted or updated.
|
|
1680
|
+
*/
|
|
1681
|
+
put: PendingStatement;
|
|
1682
|
+
/**
|
|
1683
|
+
* The statement to run when PowerSync detects that a row needs to be deleted.
|
|
1684
|
+
*/
|
|
1685
|
+
delete: PendingStatement;
|
|
1686
|
+
/**
|
|
1687
|
+
* An optional statement to run when `disconnectAndClear()` is called on a PowerSync database.
|
|
1688
|
+
*/
|
|
1689
|
+
clear?: string;
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* The schema of a {@link RawTableType} in the local database.
|
|
1693
|
+
*
|
|
1694
|
+
* This information is optional when declaring raw tables. However, providing it allows the sync client to infer `put`
|
|
1695
|
+
* and `delete` statements automatically.
|
|
1696
|
+
*/
|
|
1697
|
+
interface RawTableSchema extends TableOrRawTableOptions {
|
|
1698
|
+
/**
|
|
1699
|
+
* The actual name of the raw table in the local schema.
|
|
1700
|
+
*
|
|
1701
|
+
* Unlike {@link RawTable.name}, which describes the name of synced tables to match, this reflects the SQLite table
|
|
1702
|
+
* name. This is used to infer {@link RawTableType.put} and {@link RawTableType.delete} statements for the sync
|
|
1703
|
+
* client. It can also be used to auto-generate triggers forwarding writes on raw tables into the CRUD upload queue
|
|
1704
|
+
* (using the `powersync_create_raw_table_crud_trigger` SQL function).
|
|
1705
|
+
*
|
|
1706
|
+
* When absent, defaults to {@link RawTable.name}.
|
|
1707
|
+
*/
|
|
1708
|
+
tableName?: string;
|
|
1709
|
+
/**
|
|
1710
|
+
* An optional filter of columns that should be synced.
|
|
1711
|
+
*
|
|
1712
|
+
* By default, all columns in a raw table are considered for sync. If a filter is specified, PowerSync treats
|
|
1713
|
+
* unmatched columns as local-only and will not attempt to sync them.
|
|
1714
|
+
*/
|
|
1715
|
+
syncedColumns?: string[];
|
|
1716
|
+
}
|
|
1717
|
+
interface InferredRawTableType extends Partial<RawTableTypeWithStatements> {
|
|
1718
|
+
schema: RawTableSchema;
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* A parameter to use as part of {@link PendingStatement}.
|
|
1722
|
+
*
|
|
1723
|
+
* For delete statements, only the `"Id"` value is supported - the sync client will replace it with the id of the row to
|
|
1724
|
+
* be synced.
|
|
1725
|
+
*
|
|
1726
|
+
* For insert and replace operations, the values of columns in the table are available as parameters through
|
|
1727
|
+
* `{Column: 'name'}`.
|
|
1728
|
+
* The `"Rest"` parameter gets resolved to a JSON object covering all values from the synced row that haven't been
|
|
1729
|
+
* covered by a `Column` parameter.
|
|
1730
|
+
*/
|
|
1731
|
+
type PendingStatementParameter = 'Id' | {
|
|
1732
|
+
Column: string;
|
|
1733
|
+
} | 'Rest';
|
|
1734
|
+
/**
|
|
1735
|
+
* A statement that the PowerSync client should use to insert or delete data into a table managed by the user.
|
|
1736
|
+
*/
|
|
1737
|
+
type PendingStatement = {
|
|
1738
|
+
sql: string;
|
|
1739
|
+
params: PendingStatementParameter[];
|
|
1740
|
+
};
|
|
1741
|
+
/**
|
|
1742
|
+
* @internal
|
|
1743
|
+
*/
|
|
1744
|
+
type RawTable<T extends RawTableType = RawTableType> = T & {
|
|
1745
|
+
/**
|
|
1746
|
+
* The name of the table.
|
|
1747
|
+
*
|
|
1748
|
+
* This does not have to match the actual table name in the schema - {@link RawTableType.put} and
|
|
1749
|
+
* {@link RawTableType.delete} are free to use another table. Instead, this name is used by the sync client to
|
|
1750
|
+
* recognize that operations on this table (as it appears in the source / backend database) are to be handled
|
|
1751
|
+
* specially.
|
|
1752
|
+
*/
|
|
1753
|
+
name: string;
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1718
1756
|
type SchemaType = Record<string, Table<any>>;
|
|
1719
1757
|
type SchemaTableType<S extends SchemaType> = {
|
|
1720
1758
|
[K in keyof S]: RowType<S[K]>;
|
|
@@ -1742,14 +1780,14 @@ declare class Schema<S extends SchemaType = SchemaType> {
|
|
|
1742
1780
|
validate(): void;
|
|
1743
1781
|
toJSON(): {
|
|
1744
1782
|
tables: {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
local_only: boolean;
|
|
1748
|
-
insert_only: boolean;
|
|
1783
|
+
local_only: boolean | undefined;
|
|
1784
|
+
insert_only: boolean | undefined;
|
|
1749
1785
|
include_old: any;
|
|
1750
1786
|
include_old_only_when_changed: boolean;
|
|
1751
|
-
include_metadata: boolean;
|
|
1752
|
-
ignore_empty_update: boolean;
|
|
1787
|
+
include_metadata: boolean | undefined;
|
|
1788
|
+
ignore_empty_update: boolean | undefined;
|
|
1789
|
+
name: string;
|
|
1790
|
+
view_name: string;
|
|
1753
1791
|
columns: {
|
|
1754
1792
|
name: string;
|
|
1755
1793
|
type: ColumnType | undefined;
|
|
@@ -1763,8 +1801,15 @@ declare class Schema<S extends SchemaType = SchemaType> {
|
|
|
1763
1801
|
}[];
|
|
1764
1802
|
}[];
|
|
1765
1803
|
}[];
|
|
1766
|
-
raw_tables:
|
|
1804
|
+
raw_tables: unknown[];
|
|
1767
1805
|
};
|
|
1806
|
+
/**
|
|
1807
|
+
* Returns a representation of the raw table that is understood by the PowerSync SQLite core extension.
|
|
1808
|
+
*
|
|
1809
|
+
* The output of this can be passed through `JSON.serialize` and then used in `powersync_create_raw_table_crud_trigger`
|
|
1810
|
+
* to define triggers for this table.
|
|
1811
|
+
*/
|
|
1812
|
+
static rawTableToJson(table: RawTable): unknown;
|
|
1768
1813
|
}
|
|
1769
1814
|
|
|
1770
1815
|
interface PowerSyncBackendConnector {
|
|
@@ -2639,6 +2684,11 @@ interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions {
|
|
|
2639
2684
|
* This table will be dropped once the trigger is removed.
|
|
2640
2685
|
*/
|
|
2641
2686
|
destination: string;
|
|
2687
|
+
/**
|
|
2688
|
+
* The destination table persists beyond this trigger's lifetime and is not automatically dropped when the trigger is removed.
|
|
2689
|
+
* Additionally, if the trigger already exists with the same destination, it will be reused instead of failing with a name conflict error.
|
|
2690
|
+
*/
|
|
2691
|
+
persistDestination?: boolean;
|
|
2642
2692
|
}
|
|
2643
2693
|
/**
|
|
2644
2694
|
* @experimental
|
|
@@ -2929,7 +2979,7 @@ declare class TriggerManagerImpl implements TriggerManager {
|
|
|
2929
2979
|
* Cleanup any SQLite triggers or tables that are no longer in use.
|
|
2930
2980
|
*/
|
|
2931
2981
|
cleanupResources(): Promise<void>;
|
|
2932
|
-
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<() => Promise<void>>;
|
|
2982
|
+
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(force?: boolean) => Promise<void>>;
|
|
2933
2983
|
trackTableDiff(options: TrackDiffOptions): Promise<TriggerRemoveCallback>;
|
|
2934
2984
|
}
|
|
2935
2985
|
|
|
@@ -4268,5 +4318,5 @@ interface ParsedQuery {
|
|
|
4268
4318
|
}
|
|
4269
4319
|
declare const parseQuery: <T>(query: string | CompilableQuery<T>, parameters: any[]) => ParsedQuery;
|
|
4270
4320
|
|
|
4271
|
-
export { ATTACHMENT_TABLE, AbortOperation, AbstractPowerSyncDatabase, AbstractPowerSyncDatabaseOpenFactory, AbstractQueryProcessor, AbstractRemote, AbstractStreamingSyncImplementation, ArrayComparator, AttachmentContext, AttachmentQueue, AttachmentService, AttachmentState, AttachmentTable, BaseObserver, Column, ColumnType, ConnectionClosedError, ConnectionManager, ControlledExecutor, CrudBatch, CrudEntry, CrudTransaction, DEFAULT_CRUD_BATCH_LIMIT, DEFAULT_CRUD_UPLOAD_THROTTLE_MS, DEFAULT_INDEX_COLUMN_OPTIONS, DEFAULT_INDEX_OPTIONS, DEFAULT_LOCK_TIMEOUT_MS, DEFAULT_POWERSYNC_CLOSE_OPTIONS, DEFAULT_POWERSYNC_DB_OPTIONS, DEFAULT_PRESSURE_LIMITS, DEFAULT_REMOTE_LOGGER, DEFAULT_REMOTE_OPTIONS, DEFAULT_RETRY_DELAY_MS, DEFAULT_ROW_COMPARATOR, DEFAULT_STREAMING_SYNC_OPTIONS, DEFAULT_STREAM_CONNECTION_OPTIONS, DEFAULT_SYNC_CLIENT_IMPLEMENTATION, DEFAULT_TABLE_OPTIONS, DEFAULT_WATCH_QUERY_OPTIONS, DEFAULT_WATCH_THROTTLE_MS, DataStream, DiffTriggerOperation, DifferentialQueryProcessor, EMPTY_DIFFERENTIAL, EncodingType, FalsyComparator, FetchImplementationProvider, FetchStrategy, GetAllQuery, Index, IndexedColumn, InvalidSQLCharacters, LockType, LogLevel, MAX_AMOUNT_OF_COLUMNS, MAX_OP_ID, MEMORY_TRIGGER_CLAIM_MANAGER, OnChangeQueryProcessor, OpType, OpTypeEnum, OplogEntry, PSInternalTable, PowerSyncControlCommand,
|
|
4272
|
-
export type { AbstractQueryProcessorOptions, AbstractRemoteOptions, AbstractStreamingSyncImplementationOptions, AdditionalConnectionOptions, ArrayComparatorOptions, ArrayQueryDefinition, AttachmentData, AttachmentErrorHandler, AttachmentRecord, AttachmentTableOptions, BSONImplementation, BaseColumnType, BaseConnectionOptions, BaseListener, BaseObserverInterface, BasePowerSyncDatabaseOptions, BaseTriggerDiffRecord, BatchedUpdateNotification, BucketChecksum, BucketDescription, BucketOperationProgress, BucketRequest, BucketState, BucketStorageAdapter, BucketStorageListener, Checkpoint, ChecksumCache, ColumnOptions, ColumnsType, CompilableQuery, CompilableQueryWatchHandler, CompiledQuery, ConnectionManagerListener, ConnectionManagerOptions, ConnectionManagerSyncImplementationResult, ContinueCheckpointRequest, ControlledExecutorOptions, CreateDiffTriggerOptions, CreateLoggerOptions, CreateSyncImplementationOptions, CrudRequest, CrudResponse, CrudUploadNotification, DBAdapter, DBAdapterListener, DBGetUtils, DBLockOptions, DataStreamCallback, DataStreamListener, DataStreamOptions, DifferentialQueryProcessorOptions, DifferentialWatchedQuery, DifferentialWatchedQueryComparator, DifferentialWatchedQueryListener, DifferentialWatchedQueryOptions, DifferentialWatchedQuerySettings, DisconnectAndClearOptions, Disposable, ExtractColumnValueType, ExtractedTriggerDiffRecord, FetchImplementation, GetAllQueryOptions, IndexColumnOptions, IndexOptions, IndexShorthand, InternalConnectionOptions, InternalSubscriptionAdapter, LinkQueryOptions, LocalStorageAdapter, LockContext, LockOptions, MutableWatchedQueryState, OnChangeQueryProcessorOptions, OpId, OpTypeJSON, OplogEntryJSON, ParsedQuery, PendingStatement, PendingStatementParameter, PowerSyncBackendConnector, PowerSyncCloseOptions, PowerSyncConnectionOptions, PowerSyncCredentials, PowerSyncDBListener, PowerSyncDatabaseOptions, PowerSyncDatabaseOptionsWithDBAdapter, PowerSyncDatabaseOptionsWithOpenFactory, PowerSyncDatabaseOptionsWithSettings, PowerSyncOpenFactoryOptions, ProgressWithOperations, Query, QueryParam, QueryResult, RawTableType, RemoteConnector, RemoteStorageAdapter, RequiredAdditionalConnectionOptions, RequiredPowerSyncConnectionOptions, RowType, SQLOnChangeOptions, SQLOpenFactory, SQLOpenOptions, SQLWatchOptions, SavedProgress, SchemaTableType, SocketSyncStreamOptions, StandardWatchedQuery, StandardWatchedQueryOptions, StreamingSyncCheckpoint, StreamingSyncCheckpointComplete, StreamingSyncCheckpointDiff, StreamingSyncCheckpointPartiallyComplete, StreamingSyncDataJSON, StreamingSyncImplementation, StreamingSyncImplementationListener, StreamingSyncKeepalive, StreamingSyncLine, StreamingSyncLineOrCrudUploadComplete, StreamingSyncRequest, StreamingSyncRequestParameterType, SubscribedStream, SyncDataBucketJSON, SyncDataFlowStatus, SyncLocalDatabaseResult, SyncNewCheckpointRequest, SyncPriorityStatus, SyncRequest, SyncResponse, SyncStatusOptions, SyncStream, SyncStreamDescription, SyncStreamOptions, SyncStreamStatus, SyncStreamSubscribeOptions, SyncStreamSubscription, SyncSubscriptionDescription, TableOptions, TableUpdateOperation, TableV2Options, TrackDiffOptions, TrackPreviousOptions, Transaction, TriggerClaimManager, TriggerCreationHooks, TriggerDiffDeleteRecord, TriggerDiffHandlerContext, TriggerDiffInsertRecord, TriggerDiffRecord, TriggerDiffUpdateRecord, TriggerManager, TriggerManagerConfig, TriggerRemoveCallback, UpdateNotification, WatchCompatibleQuery, WatchExecuteOptions, WatchHandler, WatchOnChangeEvent, WatchOnChangeHandler, WatchedAttachmentItem, WatchedQuery, WatchedQueryComparator, WatchedQueryDifferential, WatchedQueryListener, WatchedQueryOptions, WatchedQueryRowDifferential, WatchedQuerySettings, WatchedQueryState, WithDiffOptions };
|
|
4321
|
+
export { ATTACHMENT_TABLE, AbortOperation, AbstractPowerSyncDatabase, AbstractPowerSyncDatabaseOpenFactory, AbstractQueryProcessor, AbstractRemote, AbstractStreamingSyncImplementation, ArrayComparator, AttachmentContext, AttachmentQueue, AttachmentService, AttachmentState, AttachmentTable, BaseObserver, Column, ColumnType, ConnectionClosedError, ConnectionManager, ControlledExecutor, CrudBatch, CrudEntry, CrudTransaction, DEFAULT_CRUD_BATCH_LIMIT, DEFAULT_CRUD_UPLOAD_THROTTLE_MS, DEFAULT_INDEX_COLUMN_OPTIONS, DEFAULT_INDEX_OPTIONS, DEFAULT_LOCK_TIMEOUT_MS, DEFAULT_POWERSYNC_CLOSE_OPTIONS, DEFAULT_POWERSYNC_DB_OPTIONS, DEFAULT_PRESSURE_LIMITS, DEFAULT_REMOTE_LOGGER, DEFAULT_REMOTE_OPTIONS, DEFAULT_RETRY_DELAY_MS, DEFAULT_ROW_COMPARATOR, DEFAULT_STREAMING_SYNC_OPTIONS, DEFAULT_STREAM_CONNECTION_OPTIONS, DEFAULT_SYNC_CLIENT_IMPLEMENTATION, DEFAULT_TABLE_OPTIONS, DEFAULT_WATCH_QUERY_OPTIONS, DEFAULT_WATCH_THROTTLE_MS, DataStream, DiffTriggerOperation, DifferentialQueryProcessor, EMPTY_DIFFERENTIAL, EncodingType, FalsyComparator, FetchImplementationProvider, FetchStrategy, GetAllQuery, Index, IndexedColumn, InvalidSQLCharacters, LockType, LogLevel, MAX_AMOUNT_OF_COLUMNS, MAX_OP_ID, MEMORY_TRIGGER_CLAIM_MANAGER, OnChangeQueryProcessor, OpType, OpTypeEnum, OplogEntry, PSInternalTable, PowerSyncControlCommand, RowUpdateType, Schema, SqliteBucketStorage, SyncClientImplementation, SyncDataBatch, SyncDataBucket, SyncProgress, SyncStatus, SyncStreamConnectionMethod, SyncingService, Table, TableV2, TriggerManagerImpl, UpdateType, UploadQueueStats, WatchedQueryListenerEvent, attachmentFromSql, column, compilableQueryWatch, createBaseLogger, createLogger, extractTableUpdates, isBatchedUpdateNotification, isContinueCheckpointRequest, isDBAdapter, isPowerSyncDatabaseOptionsWithSettings, isSQLOpenFactory, isSQLOpenOptions, isStreamingKeepalive, isStreamingSyncCheckpoint, isStreamingSyncCheckpointComplete, isStreamingSyncCheckpointDiff, isStreamingSyncCheckpointPartiallyComplete, isStreamingSyncData, isSyncNewCheckpointRequest, mutexRunExclusive, parseQuery, runOnSchemaChange, sanitizeSQL, sanitizeUUID };
|
|
4322
|
+
export type { AbstractQueryProcessorOptions, AbstractRemoteOptions, AbstractStreamingSyncImplementationOptions, AdditionalConnectionOptions, ArrayComparatorOptions, ArrayQueryDefinition, AttachmentData, AttachmentErrorHandler, AttachmentRecord, AttachmentTableOptions, BSONImplementation, BaseColumnType, BaseConnectionOptions, BaseListener, BaseObserverInterface, BasePowerSyncDatabaseOptions, BaseTriggerDiffRecord, BatchedUpdateNotification, BucketChecksum, BucketDescription, BucketOperationProgress, BucketRequest, BucketState, BucketStorageAdapter, BucketStorageListener, Checkpoint, ChecksumCache, ColumnOptions, ColumnsType, CompilableQuery, CompilableQueryWatchHandler, CompiledQuery, ConnectionManagerListener, ConnectionManagerOptions, ConnectionManagerSyncImplementationResult, ContinueCheckpointRequest, ControlledExecutorOptions, CreateDiffTriggerOptions, CreateLoggerOptions, CreateSyncImplementationOptions, CrudRequest, CrudResponse, CrudUploadNotification, DBAdapter, DBAdapterListener, DBGetUtils, DBLockOptions, DataStreamCallback, DataStreamListener, DataStreamOptions, DifferentialQueryProcessorOptions, DifferentialWatchedQuery, DifferentialWatchedQueryComparator, DifferentialWatchedQueryListener, DifferentialWatchedQueryOptions, DifferentialWatchedQuerySettings, DisconnectAndClearOptions, Disposable, ExtractColumnValueType, ExtractedTriggerDiffRecord, FetchImplementation, GetAllQueryOptions, IndexColumnOptions, IndexOptions, IndexShorthand, InternalConnectionOptions, InternalSubscriptionAdapter, LinkQueryOptions, LocalStorageAdapter, LockContext, LockOptions, MutableWatchedQueryState, OnChangeQueryProcessorOptions, OpId, OpTypeJSON, OplogEntryJSON, ParsedQuery, PendingStatement, PendingStatementParameter, PowerSyncBackendConnector, PowerSyncCloseOptions, PowerSyncConnectionOptions, PowerSyncCredentials, PowerSyncDBListener, PowerSyncDatabaseOptions, PowerSyncDatabaseOptionsWithDBAdapter, PowerSyncDatabaseOptionsWithOpenFactory, PowerSyncDatabaseOptionsWithSettings, PowerSyncOpenFactoryOptions, ProgressWithOperations, Query, QueryParam, QueryResult, RawTableType, RemoteConnector, RemoteStorageAdapter, RequiredAdditionalConnectionOptions, RequiredPowerSyncConnectionOptions, RowType, SQLOnChangeOptions, SQLOpenFactory, SQLOpenOptions, SQLWatchOptions, SavedProgress, SchemaTableType, SocketSyncStreamOptions, StandardWatchedQuery, StandardWatchedQueryOptions, StreamingSyncCheckpoint, StreamingSyncCheckpointComplete, StreamingSyncCheckpointDiff, StreamingSyncCheckpointPartiallyComplete, StreamingSyncDataJSON, StreamingSyncImplementation, StreamingSyncImplementationListener, StreamingSyncKeepalive, StreamingSyncLine, StreamingSyncLineOrCrudUploadComplete, StreamingSyncRequest, StreamingSyncRequestParameterType, SubscribedStream, SyncDataBucketJSON, SyncDataFlowStatus, SyncLocalDatabaseResult, SyncNewCheckpointRequest, SyncPriorityStatus, SyncRequest, SyncResponse, SyncStatusOptions, SyncStream, SyncStreamDescription, SyncStreamOptions, SyncStreamStatus, SyncStreamSubscribeOptions, SyncStreamSubscription, SyncSubscriptionDescription, TableOptions, TableOrRawTableOptions, TableUpdateOperation, TableV2Options, TrackDiffOptions, TrackPreviousOptions, Transaction, TriggerClaimManager, TriggerCreationHooks, TriggerDiffDeleteRecord, TriggerDiffHandlerContext, TriggerDiffInsertRecord, TriggerDiffRecord, TriggerDiffUpdateRecord, TriggerManager, TriggerManagerConfig, TriggerRemoveCallback, UpdateNotification, WatchCompatibleQuery, WatchExecuteOptions, WatchHandler, WatchOnChangeEvent, WatchOnChangeHandler, WatchedAttachmentItem, WatchedQuery, WatchedQueryComparator, WatchedQueryDifferential, WatchedQueryListener, WatchedQueryOptions, WatchedQueryRowDifferential, WatchedQuerySettings, WatchedQueryState, WithDiffOptions };
|
|
@@ -198,6 +198,11 @@ export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions {
|
|
|
198
198
|
* This table will be dropped once the trigger is removed.
|
|
199
199
|
*/
|
|
200
200
|
destination: string;
|
|
201
|
+
/**
|
|
202
|
+
* The destination table persists beyond this trigger's lifetime and is not automatically dropped when the trigger is removed.
|
|
203
|
+
* Additionally, if the trigger already exists with the same destination, it will be reused instead of failing with a name conflict error.
|
|
204
|
+
*/
|
|
205
|
+
persistDestination?: boolean;
|
|
201
206
|
}
|
|
202
207
|
/**
|
|
203
208
|
* @experimental
|
|
@@ -34,6 +34,6 @@ export declare class TriggerManagerImpl implements TriggerManager {
|
|
|
34
34
|
* Cleanup any SQLite triggers or tables that are no longer in use.
|
|
35
35
|
*/
|
|
36
36
|
cleanupResources(): Promise<void>;
|
|
37
|
-
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<() => Promise<void>>;
|
|
37
|
+
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(force?: boolean) => Promise<void>>;
|
|
38
38
|
trackTableDiff(options: TrackDiffOptions): Promise<TriggerRemoveCallback>;
|
|
39
39
|
}
|
|
@@ -141,7 +141,7 @@ export class TriggerManagerImpl {
|
|
|
141
141
|
}
|
|
142
142
|
async createDiffTrigger(options) {
|
|
143
143
|
await this.db.waitForReady();
|
|
144
|
-
const { source, destination, columns, when, hooks,
|
|
144
|
+
const { source, destination, columns, when, hooks, persistDestination = false,
|
|
145
145
|
// Fall back to the provided default if not given on this level
|
|
146
146
|
useStorage = this.defaultConfig.useStorageByDefault } = options;
|
|
147
147
|
const operations = Object.keys(when);
|
|
@@ -196,11 +196,13 @@ export class TriggerManagerImpl {
|
|
|
196
196
|
* we need to ensure we can cleanup the created resources.
|
|
197
197
|
* We unfortunately cannot rely on transaction rollback.
|
|
198
198
|
*/
|
|
199
|
-
const cleanup = async () => {
|
|
199
|
+
const cleanup = async (force) => {
|
|
200
200
|
disposeWarningListener();
|
|
201
201
|
return this.db.writeLock(async (tx) => {
|
|
202
202
|
await this.removeTriggers(tx, triggerIds);
|
|
203
|
-
|
|
203
|
+
if (!persistDestination || force) {
|
|
204
|
+
await tx.execute(/* sql */ `DROP TABLE IF EXISTS ${destination};`);
|
|
205
|
+
}
|
|
204
206
|
await releaseStorageClaim?.();
|
|
205
207
|
});
|
|
206
208
|
};
|
|
@@ -208,7 +210,7 @@ export class TriggerManagerImpl {
|
|
|
208
210
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
209
211
|
await hooks?.beforeCreate?.(tx);
|
|
210
212
|
await tx.execute(/* sql */ `
|
|
211
|
-
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
213
|
+
CREATE ${tableTriggerTypeClause} TABLE ${persistDestination ? 'IF NOT EXISTS ' : ''}${destination} (
|
|
212
214
|
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
213
215
|
id TEXT,
|
|
214
216
|
operation TEXT,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerManagerImpl.js","sourceRoot":"","sources":["../../../src/client/triggers/TriggerManagerImpl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAEL,oBAAoB,EAMrB,MAAM,qBAAqB,CAAC;AAW7B,MAAM,CAAC,MAAM,qCAAqC,GAAoC;IACpF,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAqBF,MAAM,2BAA2B,GAAG,OAAO,CAAC,CAAC,YAAY;AAEzD;;;GAGG;AAC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G,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gCAC3F,CAAC,CAAC,EAAE;;;;;0BAKE,WAAW;;;wBAGb,KAAK;iBACZ,CAAC;4BACF,OAAO,EAAE,CAAC,MAAM,CAAI,YAAY,EAAE,MAAM,CAAC,CAAC;wBAC5C,CAAC;qBACF,CAAC,CAAC;oBAEH,+CAA+C;oBAC/C,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,eAAe,WAAW,GAAG,CAAC,CAAC;oBAC1D,OAAO,cAAc,CAAC;gBACxB,CAAC,CAAC,CAAC;YACL,CAAC;SACF,EACD,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,CACtE,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC;gBACjD,MAAM;gBACN,WAAW;gBACX,OAAO,EAAE,cAAc;gBACvB,IAAI;gBACJ,KAAK;aACN,CAAC,CAAC;YAEH,OAAO,KAAK,IAAI,EAAE;gBAChB,aAAa,EAAE,CAAC;gBAChB,MAAM,aAAa,EAAE,CAAC;YACxB,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,aAAa,EAAE,CAAC;YAClB,CAAC;YAAC,OAAO,YAAY,EAAE,CAAC;gBACtB,MAAM,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,oCAAoC,CAAC,CAAC;YACxF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { TableOrRawTableOptions } from './Table.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* Instructs PowerSync to sync data into a "raw" table.
|
|
4
|
+
*
|
|
5
|
+
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
6
|
+
* using client-side table and column constraints.
|
|
7
|
+
*
|
|
8
|
+
* To collect local writes to raw tables with PowerSync, custom triggers are required. See
|
|
9
|
+
* {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
|
|
10
|
+
* using raw tables.
|
|
11
|
+
*
|
|
12
|
+
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
13
|
+
*
|
|
14
|
+
* @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
|
|
15
|
+
* stability guarantees.
|
|
4
16
|
*/
|
|
5
|
-
export type RawTableType =
|
|
17
|
+
export type RawTableType = RawTableTypeWithStatements | InferredRawTableType;
|
|
18
|
+
interface RawTableTypeWithStatements {
|
|
6
19
|
/**
|
|
7
20
|
* The statement to run when PowerSync detects that a row needs to be inserted or updated.
|
|
8
21
|
*/
|
|
@@ -11,7 +24,40 @@ export type RawTableType = {
|
|
|
11
24
|
* The statement to run when PowerSync detects that a row needs to be deleted.
|
|
12
25
|
*/
|
|
13
26
|
delete: PendingStatement;
|
|
14
|
-
|
|
27
|
+
/**
|
|
28
|
+
* An optional statement to run when `disconnectAndClear()` is called on a PowerSync database.
|
|
29
|
+
*/
|
|
30
|
+
clear?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The schema of a {@link RawTableType} in the local database.
|
|
34
|
+
*
|
|
35
|
+
* This information is optional when declaring raw tables. However, providing it allows the sync client to infer `put`
|
|
36
|
+
* and `delete` statements automatically.
|
|
37
|
+
*/
|
|
38
|
+
interface RawTableSchema extends TableOrRawTableOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The actual name of the raw table in the local schema.
|
|
41
|
+
*
|
|
42
|
+
* Unlike {@link RawTable.name}, which describes the name of synced tables to match, this reflects the SQLite table
|
|
43
|
+
* name. This is used to infer {@link RawTableType.put} and {@link RawTableType.delete} statements for the sync
|
|
44
|
+
* client. It can also be used to auto-generate triggers forwarding writes on raw tables into the CRUD upload queue
|
|
45
|
+
* (using the `powersync_create_raw_table_crud_trigger` SQL function).
|
|
46
|
+
*
|
|
47
|
+
* When absent, defaults to {@link RawTable.name}.
|
|
48
|
+
*/
|
|
49
|
+
tableName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* An optional filter of columns that should be synced.
|
|
52
|
+
*
|
|
53
|
+
* By default, all columns in a raw table are considered for sync. If a filter is specified, PowerSync treats
|
|
54
|
+
* unmatched columns as local-only and will not attempt to sync them.
|
|
55
|
+
*/
|
|
56
|
+
syncedColumns?: string[];
|
|
57
|
+
}
|
|
58
|
+
interface InferredRawTableType extends Partial<RawTableTypeWithStatements> {
|
|
59
|
+
schema: RawTableSchema;
|
|
60
|
+
}
|
|
15
61
|
/**
|
|
16
62
|
* A parameter to use as part of {@link PendingStatement}.
|
|
17
63
|
*
|
|
@@ -20,10 +66,12 @@ export type RawTableType = {
|
|
|
20
66
|
*
|
|
21
67
|
* For insert and replace operations, the values of columns in the table are available as parameters through
|
|
22
68
|
* `{Column: 'name'}`.
|
|
69
|
+
* The `"Rest"` parameter gets resolved to a JSON object covering all values from the synced row that haven't been
|
|
70
|
+
* covered by a `Column` parameter.
|
|
23
71
|
*/
|
|
24
72
|
export type PendingStatementParameter = 'Id' | {
|
|
25
73
|
Column: string;
|
|
26
|
-
};
|
|
74
|
+
} | 'Rest';
|
|
27
75
|
/**
|
|
28
76
|
* A statement that the PowerSync client should use to insert or delete data into a table managed by the user.
|
|
29
77
|
*/
|
|
@@ -32,30 +80,17 @@ export type PendingStatement = {
|
|
|
32
80
|
params: PendingStatementParameter[];
|
|
33
81
|
};
|
|
34
82
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
38
|
-
* using client-side table and column constraints.
|
|
39
|
-
*
|
|
40
|
-
* To collect local writes to raw tables with PowerSync, custom triggers are required. See
|
|
41
|
-
* {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
|
|
42
|
-
* using raw tables.
|
|
43
|
-
*
|
|
44
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
45
|
-
*
|
|
46
|
-
* @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
|
|
47
|
-
* stability guarantees.
|
|
83
|
+
* @internal
|
|
48
84
|
*/
|
|
49
|
-
export
|
|
85
|
+
export type RawTable<T extends RawTableType = RawTableType> = T & {
|
|
50
86
|
/**
|
|
51
87
|
* The name of the table.
|
|
52
88
|
*
|
|
53
|
-
* This does not have to match the actual table name in the schema - {@link put} and
|
|
54
|
-
* another table. Instead, this name is used by the sync client to
|
|
55
|
-
* appears in the source / backend database) are to be handled
|
|
89
|
+
* This does not have to match the actual table name in the schema - {@link RawTableType.put} and
|
|
90
|
+
* {@link RawTableType.delete} are free to use another table. Instead, this name is used by the sync client to
|
|
91
|
+
* recognize that operations on this table (as it appears in the source / backend database) are to be handled
|
|
92
|
+
* specially.
|
|
56
93
|
*/
|
|
57
94
|
name: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
constructor(name: string, type: RawTableType);
|
|
61
|
-
}
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Instructs PowerSync to sync data into a "raw" table.
|
|
3
|
-
*
|
|
4
|
-
* Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
|
|
5
|
-
* using client-side table and column constraints.
|
|
6
|
-
*
|
|
7
|
-
* To collect local writes to raw tables with PowerSync, custom triggers are required. See
|
|
8
|
-
* {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
|
|
9
|
-
* using raw tables.
|
|
10
|
-
*
|
|
11
|
-
* Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
|
|
12
|
-
*
|
|
13
|
-
* @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
|
|
14
|
-
* stability guarantees.
|
|
15
|
-
*/
|
|
16
|
-
export class RawTable {
|
|
17
|
-
/**
|
|
18
|
-
* The name of the table.
|
|
19
|
-
*
|
|
20
|
-
* This does not have to match the actual table name in the schema - {@link put} and {@link delete} are free to use
|
|
21
|
-
* another table. Instead, this name is used by the sync client to recognize that operations on this table (as it
|
|
22
|
-
* appears in the source / backend database) are to be handled specially.
|
|
23
|
-
*/
|
|
24
|
-
name;
|
|
25
|
-
put;
|
|
26
|
-
delete;
|
|
27
|
-
constructor(name, type) {
|
|
28
|
-
this.name = name;
|
|
29
|
-
this.put = type.put;
|
|
30
|
-
this.delete = type.delete;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
export {};
|
|
33
2
|
//# sourceMappingURL=RawTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RawTable.js","sourceRoot":"","sources":["../../../src/db/schema/RawTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RawTable.js","sourceRoot":"","sources":["../../../src/db/schema/RawTable.ts"],"names":[],"mappings":""}
|
|
@@ -27,14 +27,14 @@ export declare class Schema<S extends SchemaType = SchemaType> {
|
|
|
27
27
|
validate(): void;
|
|
28
28
|
toJSON(): {
|
|
29
29
|
tables: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
local_only: boolean;
|
|
33
|
-
insert_only: boolean;
|
|
30
|
+
local_only: boolean | undefined;
|
|
31
|
+
insert_only: boolean | undefined;
|
|
34
32
|
include_old: any;
|
|
35
33
|
include_old_only_when_changed: boolean;
|
|
36
|
-
include_metadata: boolean;
|
|
37
|
-
ignore_empty_update: boolean;
|
|
34
|
+
include_metadata: boolean | undefined;
|
|
35
|
+
ignore_empty_update: boolean | undefined;
|
|
36
|
+
name: string;
|
|
37
|
+
view_name: string;
|
|
38
38
|
columns: {
|
|
39
39
|
name: string;
|
|
40
40
|
type: import("./Column.js").ColumnType | undefined;
|
|
@@ -48,7 +48,14 @@ export declare class Schema<S extends SchemaType = SchemaType> {
|
|
|
48
48
|
}[];
|
|
49
49
|
}[];
|
|
50
50
|
}[];
|
|
51
|
-
raw_tables:
|
|
51
|
+
raw_tables: unknown[];
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Returns a representation of the raw table that is understood by the PowerSync SQLite core extension.
|
|
55
|
+
*
|
|
56
|
+
* The output of this can be passed through `JSON.serialize` and then used in `powersync_create_raw_table_crud_trigger`
|
|
57
|
+
* to define triggers for this table.
|
|
58
|
+
*/
|
|
59
|
+
static rawTableToJson(table: RawTable): unknown;
|
|
53
60
|
}
|
|
54
61
|
export {};
|
package/lib/db/schema/Schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { encodeTableOptions } from './internal.js';
|
|
2
2
|
/**
|
|
3
3
|
* A schema is a collection of tables. It is used to define the structure of a database.
|
|
4
4
|
*/
|
|
@@ -43,7 +43,7 @@ export class Schema {
|
|
|
43
43
|
*/
|
|
44
44
|
withRawTables(tables) {
|
|
45
45
|
for (const [name, rawTableDefinition] of Object.entries(tables)) {
|
|
46
|
-
this.rawTables.push(
|
|
46
|
+
this.rawTables.push({ name, ...rawTableDefinition });
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
validate() {
|
|
@@ -54,8 +54,30 @@ export class Schema {
|
|
|
54
54
|
toJSON() {
|
|
55
55
|
return {
|
|
56
56
|
tables: this.tables.map((t) => t.toJSON()),
|
|
57
|
-
raw_tables: this.rawTables
|
|
57
|
+
raw_tables: this.rawTables.map(Schema.rawTableToJson)
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns a representation of the raw table that is understood by the PowerSync SQLite core extension.
|
|
62
|
+
*
|
|
63
|
+
* The output of this can be passed through `JSON.serialize` and then used in `powersync_create_raw_table_crud_trigger`
|
|
64
|
+
* to define triggers for this table.
|
|
65
|
+
*/
|
|
66
|
+
static rawTableToJson(table) {
|
|
67
|
+
const serialized = {
|
|
68
|
+
name: table.name,
|
|
69
|
+
put: table.put,
|
|
70
|
+
delete: table.delete,
|
|
71
|
+
clear: table.clear
|
|
72
|
+
};
|
|
73
|
+
if ('schema' in table) {
|
|
74
|
+
// We have schema options, those are flattened into the outer JSON object for the core extension.
|
|
75
|
+
const schema = table.schema;
|
|
76
|
+
serialized.table_name = schema.tableName ?? table.name;
|
|
77
|
+
serialized.synced_columns = schema.syncedColumns;
|
|
78
|
+
Object.assign(serialized, encodeTableOptions(table.schema));
|
|
79
|
+
}
|
|
80
|
+
return serialized;
|
|
81
|
+
}
|
|
60
82
|
}
|
|
61
83
|
//# sourceMappingURL=Schema.js.map
|