@laboverwire/stitch-wasm 0.2.0 → 0.2.2
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/README.md +15 -0
- package/package.json +2 -2
- package/stitch_wasm.d.ts +7 -0
- package/stitch_wasm_bg.js +16 -9
- package/stitch_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -38,6 +38,21 @@ await store.replaceScope("p1");
|
|
|
38
38
|
`remote.url` is a `ws://`/`wss://` MQTT endpoint; `remote.ticket` is a JWT used
|
|
39
39
|
for MQTT v5 enhanced-auth.
|
|
40
40
|
|
|
41
|
+
### Config fields
|
|
42
|
+
|
|
43
|
+
Only `entities` and `scope` are required. The rest are optional overrides; an
|
|
44
|
+
omitted field keeps its default:
|
|
45
|
+
|
|
46
|
+
| Field | Default | Purpose |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| `syncTopicPrefix` | `"$DB"` | Root of the sync topic namespace. |
|
|
49
|
+
| `responseTopicPrefix` | `"$DB/clients"` | Root of the per-request RPC response inbox (`{prefix}/{clientId}/{requestId}`). Override it when the default would collide with a namespace the broker reserves — e.g. set `"_rpc/responses"` for an MQDB broker, which owns `$DB`. |
|
|
50
|
+
| `versionField` | `"version"` | Record field holding the LWW version. |
|
|
51
|
+
| `updatedAtField` | `"updatedAt"` | Record field holding the update timestamp. |
|
|
52
|
+
| `userScopeField` | _unset_ | Record field that scopes offline writes to the authenticated user. |
|
|
53
|
+
| `topLevelEntities` | `[]` | Entities synced outside any scope, each `{ entity, subscriptionPattern }`. |
|
|
54
|
+
| `localOnlyEntities` | `{}` | Entities persisted locally but never synced, same shape as `entities`. |
|
|
55
|
+
|
|
41
56
|
## API surface
|
|
42
57
|
|
|
43
58
|
The `Store` mirrors the TS core:
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"LabOverWire"
|
|
6
6
|
],
|
|
7
7
|
"description": "Browser (wasm-bindgen) bindings for the stitch reactive state-sync store.",
|
|
8
|
-
"version": "0.2.
|
|
8
|
+
"version": "0.2.2",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
"reactive",
|
|
32
32
|
"store"
|
|
33
33
|
]
|
|
34
|
-
}
|
|
34
|
+
}
|
package/stitch_wasm.d.ts
CHANGED
|
@@ -746,6 +746,13 @@ export class WillMessage {
|
|
|
746
746
|
* Build an unopened [`Store`] from a config object
|
|
747
747
|
* (`{ entities, scope: { rootEntity, childEntities, scopeField } }`).
|
|
748
748
|
*
|
|
749
|
+
* The config also accepts optional overrides that otherwise fall back to their
|
|
750
|
+
* defaults: `syncTopicPrefix` (`"$DB"`), `responseTopicPrefix` (`"$DB/clients"`),
|
|
751
|
+
* `versionField` (`"version"`), `updatedAtField` (`"updatedAt"`),
|
|
752
|
+
* `userScopeField` (unset), `topLevelEntities`
|
|
753
|
+
* (`[{ entity, subscriptionPattern }]`), and `localOnlyEntities` (same shape as
|
|
754
|
+
* `entities`).
|
|
755
|
+
*
|
|
749
756
|
* Pass an optional second argument to enable durable IndexedDB persistence
|
|
750
757
|
* and/or remote MQTT-over-WebSocket sync:
|
|
751
758
|
* `{ persistence: { dbName, passphrase? }, remote: { url, clientId?, ticket?, username?, password? } }`.
|
package/stitch_wasm_bg.js
CHANGED
|
@@ -2494,6 +2494,13 @@ if (Symbol.dispose) WillMessage.prototype[Symbol.dispose] = WillMessage.prototyp
|
|
|
2494
2494
|
* Build an unopened [`Store`] from a config object
|
|
2495
2495
|
* (`{ entities, scope: { rootEntity, childEntities, scopeField } }`).
|
|
2496
2496
|
*
|
|
2497
|
+
* The config also accepts optional overrides that otherwise fall back to their
|
|
2498
|
+
* defaults: `syncTopicPrefix` (`"$DB"`), `responseTopicPrefix` (`"$DB/clients"`),
|
|
2499
|
+
* `versionField` (`"version"`), `updatedAtField` (`"updatedAt"`),
|
|
2500
|
+
* `userScopeField` (unset), `topLevelEntities`
|
|
2501
|
+
* (`[{ entity, subscriptionPattern }]`), and `localOnlyEntities` (same shape as
|
|
2502
|
+
* `entities`).
|
|
2503
|
+
*
|
|
2497
2504
|
* Pass an optional second argument to enable durable IndexedDB persistence
|
|
2498
2505
|
* and/or remote MQTT-over-WebSocket sync:
|
|
2499
2506
|
* `{ persistence: { dbName, passphrase? }, remote: { url, clientId?, ticket?, username?, password? } }`.
|
|
@@ -3117,47 +3124,47 @@ export function __wbg_warn_b1370d804fa3e259(arg0) {
|
|
|
3117
3124
|
console.warn(arg0);
|
|
3118
3125
|
}
|
|
3119
3126
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
3120
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3127
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1021, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3121
3128
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___wasm_bindgen_731b86b8850671e1___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_731b86b8850671e1___JsError___true_);
|
|
3122
3129
|
return ret;
|
|
3123
3130
|
}
|
|
3124
3131
|
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
3125
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3132
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 539, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3126
3133
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___wasm_bindgen_731b86b8850671e1___JsValue______true_);
|
|
3127
3134
|
return ret;
|
|
3128
3135
|
}
|
|
3129
3136
|
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
3130
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
3137
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 539, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3131
3138
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___wasm_bindgen_731b86b8850671e1___JsValue______true__2);
|
|
3132
3139
|
return ret;
|
|
3133
3140
|
}
|
|
3134
3141
|
export function __wbindgen_cast_0000000000000004(arg0, arg1) {
|
|
3135
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx:
|
|
3142
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 539, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3136
3143
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___wasm_bindgen_731b86b8850671e1___JsValue______true__3);
|
|
3137
3144
|
return ret;
|
|
3138
3145
|
}
|
|
3139
3146
|
export function __wbindgen_cast_0000000000000005(arg0, arg1) {
|
|
3140
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
3147
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 996, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3141
3148
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___web_sys_946f3154f354a90d___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_);
|
|
3142
3149
|
return ret;
|
|
3143
3150
|
}
|
|
3144
3151
|
export function __wbindgen_cast_0000000000000006(arg0, arg1) {
|
|
3145
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx:
|
|
3152
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 996, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3146
3153
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___web_sys_946f3154f354a90d___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__5);
|
|
3147
3154
|
return ret;
|
|
3148
3155
|
}
|
|
3149
3156
|
export function __wbindgen_cast_0000000000000007(arg0, arg1) {
|
|
3150
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
3157
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 539, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3151
3158
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke___wasm_bindgen_731b86b8850671e1___JsValue______true__6);
|
|
3152
3159
|
return ret;
|
|
3153
3160
|
}
|
|
3154
3161
|
export function __wbindgen_cast_0000000000000008(arg0, arg1) {
|
|
3155
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3162
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 530, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3156
3163
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke_______true_);
|
|
3157
3164
|
return ret;
|
|
3158
3165
|
}
|
|
3159
3166
|
export function __wbindgen_cast_0000000000000009(arg0, arg1) {
|
|
3160
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3167
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 544, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3161
3168
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_731b86b8850671e1___convert__closures_____invoke_______true__1_);
|
|
3162
3169
|
return ret;
|
|
3163
3170
|
}
|
package/stitch_wasm_bg.wasm
CHANGED
|
Binary file
|