@absolutejs/sync-capacitor 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @absolutejs/sync-capacitor
2
+
3
+ Native persistence and lifecycle wiring for `@absolutejs/sync` applications
4
+ running in Capacitor. It stores confirmed rows, cursors, installation identity,
5
+ and the durable mutation outbox in one principal-partitioned SQLite database.
6
+
7
+ AbsoluteJS provisions this automatically when Mobile, Sync, and Auth are enabled.
8
+ Direct Capacitor applications can opt in explicitly:
9
+
10
+ ```ts
11
+ import { createSyncClient } from '@absolutejs/sync/client';
12
+ import { lifecycle, network } from '@absolutejs/devices';
13
+ import {
14
+ createCapacitorSyncLocalStore,
15
+ installCapacitorSyncLifecycle
16
+ } from '@absolutejs/sync-capacitor';
17
+
18
+ const client = createSyncClient({
19
+ url: 'wss://app.example.com/sync/ws',
20
+ durable: {
21
+ store: createCapacitorSyncLocalStore(),
22
+ namespace: authenticatedPrincipalNamespace
23
+ }
24
+ });
25
+
26
+ const removeLifecycle = await installCapacitorSyncLifecycle({
27
+ client,
28
+ lifecycle,
29
+ network
30
+ });
31
+ ```
32
+
33
+ The namespace must come from a verified Auth principal, never from an untrusted
34
+ route or form value. AbsoluteJS derives an opaque namespace from the verified
35
+ issuer, public client ID, and subject. Signing out locks that partition by
36
+ removing it from the active runtime; it does not silently destroy offline data.
37
+ Signing back in as the same verified principal unlocks the same partition.
38
+
39
+ ## Platform notes
40
+
41
+ - Native Android and iOS use SQLCipher through
42
+ `@capacitor-community/sqlite`, including for unencrypted databases. Review the
43
+ plugin's encryption-export compliance notice before shipping.
44
+ - Web/PWA builds should use `createIndexedDbSyncLocalStore` from
45
+ `@absolutejs/sync/client`; they do not need the plugin's WASM/web component.
46
+ - The adapter serializes transactions so an app cannot overlap two explicit
47
+ transactions on the same Capacitor connection.
48
+
49
+ ## License
50
+
51
+ Apache-2.0.
@@ -0,0 +1,25 @@
1
+ import { type SQLiteDBConnection } from '@capacitor-community/sqlite';
2
+ import type { SyncLocalStore } from '@absolutejs/sync/client';
3
+ import type { DeviceLifecycleCapability, DeviceNetworkCapability, DeviceSubscription } from '@absolutejs/devices';
4
+ import type { SyncClient } from '@absolutejs/sync/client';
5
+ export type CapacitorSyncSqliteConnection = Pick<SQLiteDBConnection, 'beginTransaction' | 'commitTransaction' | 'execute' | 'open' | 'query' | 'rollbackTransaction' | 'run'>;
6
+ export type CapacitorSyncSqliteFactory = () => CapacitorSyncSqliteConnection | Promise<CapacitorSyncSqliteConnection>;
7
+ export type CapacitorSyncLocalStoreOptions = {
8
+ /** Defaults to `absolutejs-sync-local-v1`. */
9
+ databaseName?: string;
10
+ /** Injection seam for tests and custom SQLCipher provisioning. */
11
+ connection?: CapacitorSyncSqliteFactory;
12
+ };
13
+ /**
14
+ * Native SQLite implementation of Sync's principal-partitioned atomic cache
15
+ * and mutation outbox. All calls are serialized because a Capacitor database
16
+ * connection owns one explicit transaction at a time.
17
+ */
18
+ export declare const createCapacitorSyncLocalStore: ({ databaseName, connection: createConnection }?: CapacitorSyncLocalStoreOptions) => SyncLocalStore;
19
+ export type CapacitorSyncLifecycleOptions = {
20
+ client: Pick<SyncClient, 'reconnect'>;
21
+ lifecycle: DeviceLifecycleCapability;
22
+ network: DeviceNetworkCapability;
23
+ };
24
+ /** Refreshes the socket/ticket immediately when the app resumes or reconnects. */
25
+ export declare const installCapacitorSyncLifecycle: ({ client, lifecycle, network }: CapacitorSyncLifecycleOptions) => Promise<DeviceSubscription>;
package/dist/index.js ADDED
@@ -0,0 +1,193 @@
1
+ // src/index.ts
2
+ import {
3
+ CapacitorSQLite,
4
+ SQLiteConnection
5
+ } from "@capacitor-community/sqlite";
6
+ var SCHEMA = `
7
+ CREATE TABLE IF NOT EXISTS absolute_sync_metadata (
8
+ namespace TEXT PRIMARY KEY NOT NULL,
9
+ installation_id TEXT NOT NULL
10
+ );
11
+ CREATE TABLE IF NOT EXISTS absolute_sync_collections (
12
+ namespace TEXT NOT NULL,
13
+ collection_key TEXT NOT NULL,
14
+ record_json TEXT NOT NULL,
15
+ PRIMARY KEY (namespace, collection_key)
16
+ );
17
+ CREATE TABLE IF NOT EXISTS absolute_sync_mutations (
18
+ namespace TEXT NOT NULL,
19
+ operation_id TEXT NOT NULL,
20
+ created_at INTEGER NOT NULL,
21
+ record_json TEXT NOT NULL,
22
+ PRIMARY KEY (namespace, operation_id)
23
+ );
24
+ CREATE INDEX IF NOT EXISTS absolute_sync_mutations_order
25
+ ON absolute_sync_mutations (namespace, created_at, operation_id);
26
+ `;
27
+ var firstString = (rows, field) => {
28
+ const value = rows?.[0]?.[field];
29
+ return typeof value === "string" ? value : undefined;
30
+ };
31
+ var parseRecord = (value, label) => {
32
+ if (value === undefined)
33
+ return;
34
+ if (typeof value !== "string")
35
+ throw new Error(`Capacitor Sync SQLite returned invalid ${label} JSON.`);
36
+ try {
37
+ return JSON.parse(value);
38
+ } catch (cause) {
39
+ throw new Error(`Capacitor Sync SQLite could not parse ${label} JSON.`, {
40
+ cause
41
+ });
42
+ }
43
+ };
44
+ var defaultConnection = async (databaseName) => {
45
+ const sqlite = new SQLiteConnection(CapacitorSQLite);
46
+ const existing = await sqlite.isConnection(databaseName, false);
47
+ const connection = existing.result ? await sqlite.retrieveConnection(databaseName, false) : await sqlite.createConnection(databaseName, false, "no-encryption", 1, false);
48
+ await connection.open();
49
+ return connection;
50
+ };
51
+ var requireNamespace = (namespace) => {
52
+ if (namespace.length === 0)
53
+ throw new Error("Sync local-store namespace must not be empty");
54
+ };
55
+ var createCapacitorSyncLocalStore = ({
56
+ databaseName = "absolutejs-sync-local-v1",
57
+ connection: createConnection = () => defaultConnection(databaseName)
58
+ } = {}) => {
59
+ if (databaseName.length === 0)
60
+ throw new TypeError("Capacitor Sync databaseName cannot be empty.");
61
+ let connectionPromise;
62
+ const connection = () => {
63
+ connectionPromise ??= Promise.resolve(createConnection()).then(async (database) => {
64
+ await database.execute(SCHEMA);
65
+ return database;
66
+ });
67
+ return connectionPromise;
68
+ };
69
+ let tail = Promise.resolve();
70
+ const locked = async (run) => {
71
+ let release;
72
+ const previous = tail;
73
+ tail = new Promise((resolve) => {
74
+ release = resolve;
75
+ });
76
+ await previous;
77
+ try {
78
+ return await run();
79
+ } finally {
80
+ release();
81
+ }
82
+ };
83
+ const transaction = async (namespace, mode, run) => {
84
+ requireNamespace(namespace);
85
+ return locked(async () => {
86
+ const database = await connection();
87
+ await database.beginTransaction();
88
+ const writable = () => {
89
+ if (mode !== "readwrite")
90
+ throw new Error("Cannot write in a readonly Sync local transaction");
91
+ };
92
+ const tx = {
93
+ getInstallationId: async () => firstString((await database.query("SELECT installation_id FROM absolute_sync_metadata WHERE namespace = ? LIMIT 1", [namespace])).values, "installation_id"),
94
+ setInstallationId: async (installationId) => {
95
+ writable();
96
+ if (installationId.length === 0)
97
+ throw new Error("Sync installation id must not be empty");
98
+ await database.run("INSERT INTO absolute_sync_metadata (namespace, installation_id) VALUES (?, ?) ON CONFLICT(namespace) DO UPDATE SET installation_id = excluded.installation_id", [namespace, installationId], false);
99
+ },
100
+ getCollection: async (key) => parseRecord((await database.query("SELECT record_json FROM absolute_sync_collections WHERE namespace = ? AND collection_key = ? LIMIT 1", [namespace, key])).values?.[0]?.record_json, "collection"),
101
+ putCollection: async (key, record) => {
102
+ writable();
103
+ await database.run("INSERT INTO absolute_sync_collections (namespace, collection_key, record_json) VALUES (?, ?, ?) ON CONFLICT(namespace, collection_key) DO UPDATE SET record_json = excluded.record_json", [namespace, key, JSON.stringify(record)], false);
104
+ },
105
+ deleteCollection: async (key) => {
106
+ writable();
107
+ await database.run("DELETE FROM absolute_sync_collections WHERE namespace = ? AND collection_key = ?", [namespace, key], false);
108
+ },
109
+ listMutations: async () => {
110
+ const rows = (await database.query("SELECT record_json FROM absolute_sync_mutations WHERE namespace = ? ORDER BY created_at ASC, operation_id ASC", [namespace])).values;
111
+ return (rows ?? []).map((row) => parseRecord(row.record_json, "mutation")).filter((record) => record !== undefined);
112
+ },
113
+ getMutation: async (operationId) => parseRecord((await database.query("SELECT record_json FROM absolute_sync_mutations WHERE namespace = ? AND operation_id = ? LIMIT 1", [namespace, operationId])).values?.[0]?.record_json, "mutation"),
114
+ putMutation: async (record) => {
115
+ writable();
116
+ await database.run("INSERT INTO absolute_sync_mutations (namespace, operation_id, created_at, record_json) VALUES (?, ?, ?, ?) ON CONFLICT(namespace, operation_id) DO UPDATE SET created_at = excluded.created_at, record_json = excluded.record_json", [
117
+ namespace,
118
+ record.operationId,
119
+ record.createdAt,
120
+ JSON.stringify(record)
121
+ ], false);
122
+ },
123
+ deleteMutation: async (operationId) => {
124
+ writable();
125
+ await database.run("DELETE FROM absolute_sync_mutations WHERE namespace = ? AND operation_id = ?", [namespace, operationId], false);
126
+ }
127
+ };
128
+ try {
129
+ const result = await run(tx);
130
+ await database.commitTransaction();
131
+ return result;
132
+ } catch (error) {
133
+ try {
134
+ await database.rollbackTransaction();
135
+ } catch (rollbackError) {
136
+ throw new AggregateError([error, rollbackError], "Capacitor Sync SQLite transaction and rollback both failed");
137
+ }
138
+ throw error;
139
+ }
140
+ });
141
+ };
142
+ return {
143
+ transaction,
144
+ deleteNamespace: async (namespace) => {
145
+ requireNamespace(namespace);
146
+ await locked(async () => {
147
+ const database = await connection();
148
+ await database.beginTransaction();
149
+ try {
150
+ for (const table of [
151
+ "absolute_sync_metadata",
152
+ "absolute_sync_collections",
153
+ "absolute_sync_mutations"
154
+ ])
155
+ await database.run(`DELETE FROM ${table} WHERE namespace = ?`, [namespace], false);
156
+ await database.commitTransaction();
157
+ } catch (error) {
158
+ await database.rollbackTransaction();
159
+ throw error;
160
+ }
161
+ });
162
+ }
163
+ };
164
+ };
165
+ var installCapacitorSyncLifecycle = async ({
166
+ client,
167
+ lifecycle,
168
+ network
169
+ }) => {
170
+ const removers = await Promise.all([
171
+ lifecycle.onResume?.(() => client.reconnect()) ?? (() => {
172
+ return;
173
+ }),
174
+ network.onChange((status) => {
175
+ if (status.connected)
176
+ client.reconnect();
177
+ })
178
+ ]);
179
+ let active = true;
180
+ return async () => {
181
+ if (!active)
182
+ return;
183
+ active = false;
184
+ await Promise.all(removers.map((remove) => remove()));
185
+ };
186
+ };
187
+ export {
188
+ installCapacitorSyncLifecycle,
189
+ createCapacitorSyncLocalStore
190
+ };
191
+
192
+ //# debugId=B0CCE5A9EF60D39564756E2164756E21
193
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": [
5
+ "import {\n\tCapacitorSQLite,\n\tSQLiteConnection,\n\ttype SQLiteDBConnection\n} from '@capacitor-community/sqlite';\nimport type {\n\tLocalCollectionRecord,\n\tLocalMutationRecord,\n\tSyncLocalStore,\n\tSyncLocalStoreMode,\n\tSyncLocalTransaction\n} from '@absolutejs/sync/client';\nimport type {\n\tDeviceLifecycleCapability,\n\tDeviceNetworkCapability,\n\tDeviceSubscription\n} from '@absolutejs/devices';\nimport type { SyncClient } from '@absolutejs/sync/client';\n\nexport type CapacitorSyncSqliteConnection = Pick<\n\tSQLiteDBConnection,\n\t| 'beginTransaction'\n\t| 'commitTransaction'\n\t| 'execute'\n\t| 'open'\n\t| 'query'\n\t| 'rollbackTransaction'\n\t| 'run'\n>;\n\nexport type CapacitorSyncSqliteFactory = () =>\n\t| CapacitorSyncSqliteConnection\n\t| Promise<CapacitorSyncSqliteConnection>;\n\nexport type CapacitorSyncLocalStoreOptions = {\n\t/** Defaults to `absolutejs-sync-local-v1`. */\n\tdatabaseName?: string;\n\t/** Injection seam for tests and custom SQLCipher provisioning. */\n\tconnection?: CapacitorSyncSqliteFactory;\n};\n\nconst SCHEMA = `\nCREATE TABLE IF NOT EXISTS absolute_sync_metadata (\n namespace TEXT PRIMARY KEY NOT NULL,\n installation_id TEXT NOT NULL\n);\nCREATE TABLE IF NOT EXISTS absolute_sync_collections (\n namespace TEXT NOT NULL,\n collection_key TEXT NOT NULL,\n record_json TEXT NOT NULL,\n PRIMARY KEY (namespace, collection_key)\n);\nCREATE TABLE IF NOT EXISTS absolute_sync_mutations (\n namespace TEXT NOT NULL,\n operation_id TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n record_json TEXT NOT NULL,\n PRIMARY KEY (namespace, operation_id)\n);\nCREATE INDEX IF NOT EXISTS absolute_sync_mutations_order\n ON absolute_sync_mutations (namespace, created_at, operation_id);\n`;\n\ntype SqliteRow = Record<string, unknown>;\n\nconst firstString = (rows: SqliteRow[] | undefined, field: string) => {\n\tconst value = rows?.[0]?.[field];\n\treturn typeof value === 'string' ? value : undefined;\n};\n\nconst parseRecord = <T>(value: unknown, label: string): T | undefined => {\n\tif (value === undefined) return undefined;\n\tif (typeof value !== 'string')\n\t\tthrow new Error(\n\t\t\t`Capacitor Sync SQLite returned invalid ${label} JSON.`\n\t\t);\n\ttry {\n\t\treturn JSON.parse(value) as T;\n\t} catch (cause) {\n\t\tthrow new Error(\n\t\t\t`Capacitor Sync SQLite could not parse ${label} JSON.`,\n\t\t\t{\n\t\t\t\tcause\n\t\t\t}\n\t\t);\n\t}\n};\n\nconst defaultConnection = async (\n\tdatabaseName: string\n): Promise<CapacitorSyncSqliteConnection> => {\n\tconst sqlite = new SQLiteConnection(CapacitorSQLite);\n\tconst existing = await sqlite.isConnection(databaseName, false);\n\tconst connection = existing.result\n\t\t? await sqlite.retrieveConnection(databaseName, false)\n\t\t: await sqlite.createConnection(\n\t\t\t\tdatabaseName,\n\t\t\t\tfalse,\n\t\t\t\t'no-encryption',\n\t\t\t\t1,\n\t\t\t\tfalse\n\t\t\t);\n\tawait connection.open();\n\treturn connection;\n};\n\nconst requireNamespace = (namespace: string) => {\n\tif (namespace.length === 0)\n\t\tthrow new Error('Sync local-store namespace must not be empty');\n};\n\n/**\n * Native SQLite implementation of Sync's principal-partitioned atomic cache\n * and mutation outbox. All calls are serialized because a Capacitor database\n * connection owns one explicit transaction at a time.\n */\nexport const createCapacitorSyncLocalStore = ({\n\tdatabaseName = 'absolutejs-sync-local-v1',\n\tconnection: createConnection = () => defaultConnection(databaseName)\n}: CapacitorSyncLocalStoreOptions = {}): SyncLocalStore => {\n\tif (databaseName.length === 0)\n\t\tthrow new TypeError('Capacitor Sync databaseName cannot be empty.');\n\tlet connectionPromise: Promise<CapacitorSyncSqliteConnection> | undefined;\n\tconst connection = () => {\n\t\tconnectionPromise ??= Promise.resolve(createConnection()).then(\n\t\t\tasync (database) => {\n\t\t\t\tawait database.execute(SCHEMA);\n\t\t\t\treturn database;\n\t\t\t}\n\t\t);\n\t\treturn connectionPromise;\n\t};\n\tlet tail = Promise.resolve();\n\tconst locked = async <R>(run: () => Promise<R>): Promise<R> => {\n\t\tlet release!: () => void;\n\t\tconst previous = tail;\n\t\ttail = new Promise<void>((resolve) => {\n\t\t\trelease = resolve;\n\t\t});\n\t\tawait previous;\n\t\ttry {\n\t\t\treturn await run();\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t};\n\n\tconst transaction = async <R>(\n\t\tnamespace: string,\n\t\tmode: SyncLocalStoreMode,\n\t\trun: (tx: SyncLocalTransaction) => Promise<R>\n\t): Promise<R> => {\n\t\trequireNamespace(namespace);\n\t\treturn locked(async () => {\n\t\t\tconst database = await connection();\n\t\t\tawait database.beginTransaction();\n\t\t\tconst writable = () => {\n\t\t\t\tif (mode !== 'readwrite')\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Cannot write in a readonly Sync local transaction'\n\t\t\t\t\t);\n\t\t\t};\n\t\t\tconst tx: SyncLocalTransaction = {\n\t\t\t\tgetInstallationId: async () =>\n\t\t\t\t\tfirstString(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tawait database.query(\n\t\t\t\t\t\t\t\t'SELECT installation_id FROM absolute_sync_metadata WHERE namespace = ? LIMIT 1',\n\t\t\t\t\t\t\t\t[namespace]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).values,\n\t\t\t\t\t\t'installation_id'\n\t\t\t\t\t),\n\t\t\t\tsetInstallationId: async (installationId) => {\n\t\t\t\t\twritable();\n\t\t\t\t\tif (installationId.length === 0)\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t'Sync installation id must not be empty'\n\t\t\t\t\t\t);\n\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t'INSERT INTO absolute_sync_metadata (namespace, installation_id) VALUES (?, ?) ON CONFLICT(namespace) DO UPDATE SET installation_id = excluded.installation_id',\n\t\t\t\t\t\t[namespace, installationId],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tgetCollection: async <T>(key: string) =>\n\t\t\t\t\tparseRecord<LocalCollectionRecord<T>>(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tawait database.query(\n\t\t\t\t\t\t\t\t'SELECT record_json FROM absolute_sync_collections WHERE namespace = ? AND collection_key = ? LIMIT 1',\n\t\t\t\t\t\t\t\t[namespace, key]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).values?.[0]?.record_json,\n\t\t\t\t\t\t'collection'\n\t\t\t\t\t),\n\t\t\t\tputCollection: async (key, record) => {\n\t\t\t\t\twritable();\n\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t'INSERT INTO absolute_sync_collections (namespace, collection_key, record_json) VALUES (?, ?, ?) ON CONFLICT(namespace, collection_key) DO UPDATE SET record_json = excluded.record_json',\n\t\t\t\t\t\t[namespace, key, JSON.stringify(record)],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tdeleteCollection: async (key) => {\n\t\t\t\t\twritable();\n\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t'DELETE FROM absolute_sync_collections WHERE namespace = ? AND collection_key = ?',\n\t\t\t\t\t\t[namespace, key],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tlistMutations: async () => {\n\t\t\t\t\tconst rows = (\n\t\t\t\t\t\tawait database.query(\n\t\t\t\t\t\t\t'SELECT record_json FROM absolute_sync_mutations WHERE namespace = ? ORDER BY created_at ASC, operation_id ASC',\n\t\t\t\t\t\t\t[namespace]\n\t\t\t\t\t\t)\n\t\t\t\t\t).values;\n\t\t\t\t\treturn (rows ?? [])\n\t\t\t\t\t\t.map((row) =>\n\t\t\t\t\t\t\tparseRecord<LocalMutationRecord>(\n\t\t\t\t\t\t\t\trow.record_json,\n\t\t\t\t\t\t\t\t'mutation'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(record): record is LocalMutationRecord =>\n\t\t\t\t\t\t\t\trecord !== undefined\n\t\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tgetMutation: async (operationId) =>\n\t\t\t\t\tparseRecord<LocalMutationRecord>(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tawait database.query(\n\t\t\t\t\t\t\t\t'SELECT record_json FROM absolute_sync_mutations WHERE namespace = ? AND operation_id = ? LIMIT 1',\n\t\t\t\t\t\t\t\t[namespace, operationId]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).values?.[0]?.record_json,\n\t\t\t\t\t\t'mutation'\n\t\t\t\t\t),\n\t\t\t\tputMutation: async (record) => {\n\t\t\t\t\twritable();\n\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t'INSERT INTO absolute_sync_mutations (namespace, operation_id, created_at, record_json) VALUES (?, ?, ?, ?) ON CONFLICT(namespace, operation_id) DO UPDATE SET created_at = excluded.created_at, record_json = excluded.record_json',\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\trecord.operationId,\n\t\t\t\t\t\t\trecord.createdAt,\n\t\t\t\t\t\t\tJSON.stringify(record)\n\t\t\t\t\t\t],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tdeleteMutation: async (operationId) => {\n\t\t\t\t\twritable();\n\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t'DELETE FROM absolute_sync_mutations WHERE namespace = ? AND operation_id = ?',\n\t\t\t\t\t\t[namespace, operationId],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst result = await run(tx);\n\t\t\t\tawait database.commitTransaction();\n\t\t\t\treturn result;\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait database.rollbackTransaction();\n\t\t\t\t} catch (rollbackError) {\n\t\t\t\t\tthrow new AggregateError(\n\t\t\t\t\t\t[error, rollbackError],\n\t\t\t\t\t\t'Capacitor Sync SQLite transaction and rollback both failed'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t});\n\t};\n\n\treturn {\n\t\ttransaction,\n\t\tdeleteNamespace: async (namespace) => {\n\t\t\trequireNamespace(namespace);\n\t\t\tawait locked(async () => {\n\t\t\t\tconst database = await connection();\n\t\t\t\tawait database.beginTransaction();\n\t\t\t\ttry {\n\t\t\t\t\tfor (const table of [\n\t\t\t\t\t\t'absolute_sync_metadata',\n\t\t\t\t\t\t'absolute_sync_collections',\n\t\t\t\t\t\t'absolute_sync_mutations'\n\t\t\t\t\t])\n\t\t\t\t\t\tawait database.run(\n\t\t\t\t\t\t\t`DELETE FROM ${table} WHERE namespace = ?`,\n\t\t\t\t\t\t\t[namespace],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\tawait database.commitTransaction();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait database.rollbackTransaction();\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n};\n\nexport type CapacitorSyncLifecycleOptions = {\n\tclient: Pick<SyncClient, 'reconnect'>;\n\tlifecycle: DeviceLifecycleCapability;\n\tnetwork: DeviceNetworkCapability;\n};\n\n/** Refreshes the socket/ticket immediately when the app resumes or reconnects. */\nexport const installCapacitorSyncLifecycle = async ({\n\tclient,\n\tlifecycle,\n\tnetwork\n}: CapacitorSyncLifecycleOptions): Promise<DeviceSubscription> => {\n\tconst removers = await Promise.all([\n\t\tlifecycle.onResume?.(() => client.reconnect()) ?? (() => undefined),\n\t\tnetwork.onChange((status) => {\n\t\t\tif (status.connected) client.reconnect();\n\t\t})\n\t]);\n\tlet active = true;\n\treturn async () => {\n\t\tif (!active) return;\n\t\tactive = false;\n\t\tawait Promise.all(removers.map((remove) => remove()));\n\t};\n};\n"
6
+ ],
7
+ "mappings": ";AAAA;AAAA;AAAA;AAAA;AAyCA,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBf,IAAM,cAAc,CAAC,MAA+B,UAAkB;AAAA,EACrE,MAAM,QAAQ,OAAO,KAAK;AAAA,EAC1B,OAAO,OAAO,UAAU,WAAW,QAAQ;AAAA;AAG5C,IAAM,cAAc,CAAI,OAAgB,UAAiC;AAAA,EACxE,IAAI,UAAU;AAAA,IAAW;AAAA,EACzB,IAAI,OAAO,UAAU;AAAA,IACpB,MAAM,IAAI,MACT,0CAA0C,aAC3C;AAAA,EACD,IAAI;AAAA,IACH,OAAO,KAAK,MAAM,KAAK;AAAA,IACtB,OAAO,OAAO;AAAA,IACf,MAAM,IAAI,MACT,yCAAyC,eACzC;AAAA,MACC;AAAA,IACD,CACD;AAAA;AAAA;AAIF,IAAM,oBAAoB,OACzB,iBAC4C;AAAA,EAC5C,MAAM,SAAS,IAAI,iBAAiB,eAAe;AAAA,EACnD,MAAM,WAAW,MAAM,OAAO,aAAa,cAAc,KAAK;AAAA,EAC9D,MAAM,aAAa,SAAS,SACzB,MAAM,OAAO,mBAAmB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AM,QAAQ,IAAI,SAAS,IAAI,CAAC,WAAW,OAAO,CAAC,CAAC;AAAA;AAAA;",
8
+ "debugId": "B0CCE5A9EF60D39564756E2164756E21",
9
+ "names": []
10
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@absolutejs/sync-capacitor",
3
+ "version": "0.1.0",
4
+ "description": "Transactional Capacitor SQLite local store and native lifecycle adapter for @absolutejs/sync",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/absolutejs/sync-adapters.git",
8
+ "directory": "capacitor"
9
+ },
10
+ "homepage": "https://github.com/absolutejs/sync-adapters/tree/main/capacitor",
11
+ "bugs": {
12
+ "url": "https://github.com/absolutejs/sync-adapters/issues"
13
+ },
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "type": "module",
18
+ "license": "Apache-2.0",
19
+ "author": "Alex Kahn",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "keywords": [
24
+ "absolutejs",
25
+ "sync",
26
+ "capacitor",
27
+ "sqlite",
28
+ "offline",
29
+ "mobile"
30
+ ],
31
+ "scripts": {
32
+ "build": "rm -rf dist && bun build src/index.ts --outdir dist --sourcemap --target=browser --external @absolutejs/sync --external @absolutejs/devices --external @capacitor-community/sqlite && tsc --project tsconfig.build.json",
33
+ "test": "bun test",
34
+ "typecheck": "tsc --noEmit",
35
+ "format": "prettier --write \"./**/*.{ts,json,md}\"",
36
+ "release": "bun run format && bun run typecheck && bun test && bun run build && npm publish"
37
+ },
38
+ "peerDependencies": {
39
+ "@absolutejs/devices": ">=0.0.2 <0.1.0",
40
+ "@absolutejs/sync": ">=2.20.0 <3",
41
+ "@capacitor-community/sqlite": ">=8.1.1 <9"
42
+ },
43
+ "devDependencies": {
44
+ "@absolutejs/devices": "0.0.2",
45
+ "@absolutejs/sync": "2.20.0",
46
+ "@capacitor-community/sqlite": "8.1.1",
47
+ "@types/bun": "1.3.14",
48
+ "prettier": "3.5.3",
49
+ "typescript": "5.9.3"
50
+ },
51
+ "exports": {
52
+ ".": {
53
+ "types": "./dist/index.d.ts",
54
+ "import": "./dist/index.js",
55
+ "default": "./dist/index.js"
56
+ }
57
+ },
58
+ "files": [
59
+ "dist",
60
+ "LICENSE",
61
+ "README.md"
62
+ ]
63
+ }