fastdb4ts 0.0.2 → 0.2.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/README.md +69 -19
- package/dist/LICENSE +21 -0
- package/dist/THIRD_PARTY_NOTICES.txt +1958 -0
- package/dist/column.d.ts +1 -0
- package/dist/column.js +35 -1
- package/dist/database-buffer.d.ts +20 -0
- package/dist/database-buffer.js +101 -0
- package/dist/feature.d.ts +1 -1
- package/dist/feature.js +47 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/orm.d.ts +4 -2
- package/dist/orm.js +128 -33
- package/dist/payload/abi.d.ts +27 -0
- package/dist/payload/abi.js +160 -0
- package/dist/payload/builder.d.ts +98 -0
- package/dist/payload/builder.js +364 -0
- package/dist/payload/codegen.d.ts +43 -0
- package/dist/payload/codegen.js +182 -0
- package/dist/payload/error.d.ts +9 -0
- package/dist/payload/error.js +53 -0
- package/dist/payload/index.d.ts +9 -0
- package/dist/payload/index.js +9 -0
- package/dist/payload/runtime.d.ts +195 -0
- package/dist/payload/runtime.js +756 -0
- package/dist/payload/spec.d.ts +44 -0
- package/dist/payload/spec.js +220 -0
- package/dist/schema.js +1 -0
- package/dist/serializer.d.ts +2 -1
- package/dist/serializer.js +5 -4
- package/dist/table.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +31 -0
- package/dist/wasm/fastdb4ts.js +1 -1
- package/dist/wasm/fastdb4ts.wasm +0 -0
- package/dist/wasm-loader.d.ts +146 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Browser-oriented TypeScript bindings for `fastdb`, powered by WebAssembly.
|
|
4
4
|
|
|
5
|
-
`fastdb4ts` brings the `fastdb` storage model to TypeScript with a browser-first API centered around typed schemas, structured table access, binary buffer transport
|
|
5
|
+
`fastdb4ts` brings the `fastdb` storage model to TypeScript with a browser-first API centered around typed schemas, structured table access, and binary buffer transport.
|
|
6
6
|
|
|
7
7
|
## What this package provides
|
|
8
8
|
|
|
@@ -12,8 +12,8 @@ Browser-oriented TypeScript bindings for `fastdb`, powered by WebAssembly.
|
|
|
12
12
|
- use `ORM`, `TableDefn`, `Table`, and column accessors
|
|
13
13
|
- **Binary buffer roundtrips**
|
|
14
14
|
- import/export databases as `Uint8Array` / `ArrayBuffer`
|
|
15
|
-
- **
|
|
16
|
-
-
|
|
15
|
+
- **Legacy graph serialization**
|
|
16
|
+
- `FastSerializer` remains available for existing nested-feature and cyclic-reference users, but new cross-runtime integration work should use neutral schema descriptors and explicit codec profiles
|
|
17
17
|
- **Shared native semantics**
|
|
18
18
|
- backed by the same C++ core as `fastdb4py`
|
|
19
19
|
|
|
@@ -26,13 +26,61 @@ Included:
|
|
|
26
26
|
- browser-first WASM runtime
|
|
27
27
|
- `Feature` + `defineSchema(...)`
|
|
28
28
|
- `ORM`, `TableDefn`, `Table`, column access
|
|
29
|
-
- `FastSerializer`
|
|
29
|
+
- `FastSerializer` legacy compatibility APIs
|
|
30
30
|
- `Uint8Array` / `ArrayBuffer` import/export
|
|
31
31
|
|
|
32
32
|
Not included in the current TS package:
|
|
33
33
|
|
|
34
34
|
- shared-memory IPC
|
|
35
35
|
- direct filesystem persistence APIs
|
|
36
|
+
- downstream contract, routing, relay, or transport helper generation
|
|
37
|
+
|
|
38
|
+
## Integration boundary
|
|
39
|
+
|
|
40
|
+
`fastdb4ts` owns generic browser/WASM access to FastDB schemas and binary buffers. External RPC systems may consume those schemas and buffers, but their contract planning, route identity, relay behavior, and generated client helpers belong in those systems rather than in `fastdb4ts`.
|
|
41
|
+
|
|
42
|
+
## Portable payload subpath
|
|
43
|
+
|
|
44
|
+
`fastdb4ts/payload` is the official browser-capable WebAssembly projection of
|
|
45
|
+
the stable `fastdb.payload.v1` C ABI:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { CompiledSpec, Profile, initPayload } from 'fastdb4ts/payload';
|
|
49
|
+
|
|
50
|
+
await initPayload();
|
|
51
|
+
const source = new TextEncoder().encode(
|
|
52
|
+
'{"schema":"fastdb.payload.v1","profile":"record.v1","entries":[],"components":[]}',
|
|
53
|
+
);
|
|
54
|
+
const spec = CompiledSpec.compile(source);
|
|
55
|
+
try {
|
|
56
|
+
console.assert(spec.profile() === Profile.RecordV1);
|
|
57
|
+
} finally {
|
|
58
|
+
spec.dispose();
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The packed subpath includes the reviewed Wasm module and works in browser,
|
|
63
|
+
worker, and Node test hosts without a Node-native FastDB projection. It checks
|
|
64
|
+
the Core ABI version and calls only exported `fdb_payload_v1_*` functions. It
|
|
65
|
+
does not parse portable schemas or binaries, compute canonical identity, plan
|
|
66
|
+
layout, walk graphs, or materialize values in TypeScript; the C++ Core remains
|
|
67
|
+
the sole authority.
|
|
68
|
+
|
|
69
|
+
Owned handles use explicit, idempotent `dispose()` with finalization only as a
|
|
70
|
+
fallback. Safe text and byte methods copy out of scoped Wasm access, graph
|
|
71
|
+
sharing/cycles use Core `(componentIndex, objectId)` coordinates, and detached
|
|
72
|
+
materialization is one Core call. `CompiledSpec.generate(...)` returns an
|
|
73
|
+
explicitly disposable immutable ArtifactSet from the same Core-owned
|
|
74
|
+
C++/Rust/Python/TypeScript generator. Artifact paths, bytes, SHA-256 receipts,
|
|
75
|
+
limits, provenance, and errors come through the Wasm C ABI; TypeScript does not
|
|
76
|
+
render source. The earlier Python-class discovery generator is removed by the
|
|
77
|
+
P5 clean cut rather than extended by this projection.
|
|
78
|
+
|
|
79
|
+
P4 is locally complete. The official WebAssembly projection type-checks and
|
|
80
|
+
executes the four-shape hostile generated-artifact matrix through the same
|
|
81
|
+
ABI-117 Core; TypeScript gains no private parser or renderer.
|
|
82
|
+
P5 local clean cut is complete.
|
|
83
|
+
Hosted execution, versioning, publication, and release evidence remain open.
|
|
36
84
|
|
|
37
85
|
## Installation
|
|
38
86
|
|
|
@@ -79,9 +127,11 @@ console.log(table.get(1).x); // 2.5
|
|
|
79
127
|
|
|
80
128
|
## Defining schemas
|
|
81
129
|
|
|
82
|
-
Unlike `fastdb4py`, the TypeScript
|
|
83
|
-
|
|
84
|
-
|
|
130
|
+
Unlike `fastdb4py`, the standalone TypeScript feature layer uses explicit
|
|
131
|
+
schema definitions rather than Python annotations. These definitions are
|
|
132
|
+
written by the application and are not portable payload authority. Portable
|
|
133
|
+
TypeScript artifacts instead come from a Core-compiled specification through
|
|
134
|
+
the [portable artifact generator](#generating-portable-payload-artifacts).
|
|
85
135
|
|
|
86
136
|
```ts
|
|
87
137
|
import {
|
|
@@ -159,9 +209,9 @@ const copyTable = copy.table(Particle);
|
|
|
159
209
|
console.log(copyTable.get(2).x); // 2.0
|
|
160
210
|
```
|
|
161
211
|
|
|
162
|
-
## FastSerializer
|
|
212
|
+
## FastSerializer Legacy Compatibility
|
|
163
213
|
|
|
164
|
-
`FastSerializer` is the graph-oriented layer for feature graphs that are more naturally represented as nested objects than flat tables.
|
|
214
|
+
`FastSerializer` is the legacy graph-oriented layer for feature graphs that are more naturally represented as nested objects than flat tables. It remains available for compatibility and migration tests, but it is not the foundation for new external RPC integration work.
|
|
165
215
|
|
|
166
216
|
Supported scenarios include:
|
|
167
217
|
|
|
@@ -261,21 +311,22 @@ Serializer interop validation is also available:
|
|
|
261
311
|
npm --prefix ts/fastdb4ts run test:serializer:interop
|
|
262
312
|
```
|
|
263
313
|
|
|
264
|
-
## Generating
|
|
314
|
+
## Generating portable payload artifacts
|
|
265
315
|
|
|
266
|
-
|
|
316
|
+
The `fdb` CLI accepts a portable specification and asks the C++ Core for the
|
|
317
|
+
TypeScript ArtifactSet:
|
|
267
318
|
|
|
268
319
|
```bash
|
|
269
320
|
pip install fastdb4py
|
|
270
|
-
fdb codegen
|
|
321
|
+
fdb codegen specification.json \
|
|
322
|
+
--target typescript \
|
|
323
|
+
--output ./generated-fastdb
|
|
271
324
|
```
|
|
272
325
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
- circular references using lazy refs `ref(() => ClassName)`
|
|
278
|
-
- topological class ordering within each file
|
|
326
|
+
The destination must not already exist. FastDB Core owns the compiled model,
|
|
327
|
+
identifier escaping, source rendering, artifact bytes, and hashes. The Python
|
|
328
|
+
CLI only validates the returned artifact envelope and publishes the complete
|
|
329
|
+
tree with exclusive writes.
|
|
279
330
|
|
|
280
331
|
See the [Python binding README](../../python/README.md) for full codegen documentation.
|
|
281
332
|
|
|
@@ -287,4 +338,3 @@ For fuller project documentation, see:
|
|
|
287
338
|
- TypeScript/WASM binding guide: [`ts/README.md`](../README.md)
|
|
288
339
|
- C++ core guide: [`fastcarto/README.md`](../../fastcarto/README.md)
|
|
289
340
|
- Python binding guide: [`python/README.md`](../../python/README.md)
|
|
290
|
-
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 world-in-progress
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|