@yaks/sqlite 0.0.0-stage → 0.2.36
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 +202 -0
- package/README.md +1596 -2
- package/_dist/archetype.d.ts +75 -0
- package/_dist/archetype.d.ts.map +1 -0
- package/_dist/branches.d.ts +23 -0
- package/_dist/branches.d.ts.map +1 -0
- package/_dist/budget.d.ts +52 -0
- package/_dist/budget.d.ts.map +1 -0
- package/_dist/bundle.d.ts +2 -0
- package/_dist/bundle.d.ts.map +1 -0
- package/_dist/cache.d.ts +24 -0
- package/_dist/cache.d.ts.map +1 -0
- package/_dist/catalog.d.ts +9 -0
- package/_dist/catalog.d.ts.map +1 -0
- package/_dist/check.d.ts +4 -0
- package/_dist/check.d.ts.map +1 -0
- package/_dist/db.d.ts +36 -0
- package/_dist/db.d.ts.map +1 -0
- package/_dist/ddl.d.ts +143 -0
- package/_dist/ddl.d.ts.map +1 -0
- package/_dist/doom.d.ts +22 -0
- package/_dist/doom.d.ts.map +1 -0
- package/_dist/follow.d.ts +74 -0
- package/_dist/follow.d.ts.map +1 -0
- package/_dist/history-shapes.d.ts +3 -0
- package/_dist/history-shapes.d.ts.map +1 -0
- package/_dist/history.d.ts +18 -0
- package/_dist/history.d.ts.map +1 -0
- package/_dist/inspect.d.ts +43 -0
- package/_dist/inspect.d.ts.map +1 -0
- package/_dist/jsonb.d.ts +17 -0
- package/_dist/jsonb.d.ts.map +1 -0
- package/_dist/layout.d.ts +7 -0
- package/_dist/layout.d.ts.map +1 -0
- package/_dist/ledger.d.ts +41 -0
- package/_dist/ledger.d.ts.map +1 -0
- package/_dist/meta.d.ts +89 -0
- package/_dist/meta.d.ts.map +1 -0
- package/_dist/migration.d.ts +41 -0
- package/_dist/migration.d.ts.map +1 -0
- package/_dist/mod.d.ts +201 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/mode.d.ts +14 -0
- package/_dist/mode.d.ts.map +1 -0
- package/_dist/overlay.d.ts +30 -0
- package/_dist/overlay.d.ts.map +1 -0
- package/_dist/owe.d.ts +180 -0
- package/_dist/owe.d.ts.map +1 -0
- package/_dist/physical.d.ts +89 -0
- package/_dist/physical.d.ts.map +1 -0
- package/_dist/point.d.ts +10 -0
- package/_dist/point.d.ts.map +1 -0
- package/_dist/raise.d.ts +22 -0
- package/_dist/raise.d.ts.map +1 -0
- package/_dist/read-db.d.ts +9 -0
- package/_dist/read-db.d.ts.map +1 -0
- package/_dist/read-store.d.ts +10 -0
- package/_dist/read-store.d.ts.map +1 -0
- package/_dist/read.d.ts +59 -0
- package/_dist/read.d.ts.map +1 -0
- package/_dist/reader.d.ts +11 -0
- package/_dist/reader.d.ts.map +1 -0
- package/_dist/rules.d.ts +19 -0
- package/_dist/rules.d.ts.map +1 -0
- package/_dist/service.d.ts +12 -0
- package/_dist/service.d.ts.map +1 -0
- package/_dist/shape.d.ts +12 -0
- package/_dist/shape.d.ts.map +1 -0
- package/_dist/statements.d.ts +4 -0
- package/_dist/statements.d.ts.map +1 -0
- package/_dist/survey.d.ts +31 -0
- package/_dist/survey.d.ts.map +1 -0
- package/_dist/tools.d.ts +15 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/trash.d.ts +18 -0
- package/_dist/trash.d.ts.map +1 -0
- package/_dist/unit.d.ts +11 -0
- package/_dist/unit.d.ts.map +1 -0
- package/_dist/vocab.d.ts +6 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/write.d.ts +169 -0
- package/_dist/write.d.ts.map +1 -0
- package/answer.js +110 -0
- package/answer.js.map +1 -0
- package/answer.ts +122 -0
- package/archetype.js +730 -0
- package/archetype.js.map +1 -0
- package/archetype.ts +790 -0
- package/binary_cases.ts +240 -0
- package/branches.js +195 -0
- package/branches.js.map +1 -0
- package/branches.ts +257 -0
- package/budget.js +89 -0
- package/budget.js.map +1 -0
- package/budget.ts +117 -0
- package/builtin.js +34 -0
- package/builtin.js.map +1 -0
- package/builtin.ts +31 -0
- package/bundle.js +21 -0
- package/bundle.js.map +1 -0
- package/bundle.ts +22 -0
- package/buried.js +95 -0
- package/buried.js.map +1 -0
- package/buried.ts +124 -0
- package/cache.js +153 -0
- package/cache.js.map +1 -0
- package/cache.ts +154 -0
- package/cache_worker.ts +16 -0
- package/catalog.js +173 -0
- package/catalog.js.map +1 -0
- package/catalog.ts +224 -0
- package/check.js +80 -0
- package/check.js.map +1 -0
- package/check.ts +92 -0
- package/checkpoint.js +98 -0
- package/checkpoint.js.map +1 -0
- package/checkpoint.ts +129 -0
- package/checkpoint_worker.ts +37 -0
- package/db.js +170 -0
- package/db.js.map +1 -0
- package/db.ts +173 -0
- package/ddl.js +1441 -0
- package/ddl.js.map +1 -0
- package/ddl.ts +1508 -0
- package/deno.json +1 -0
- package/doom.js +59 -0
- package/doom.js.map +1 -0
- package/doom.ts +75 -0
- package/driver.js +69 -0
- package/driver.js.map +1 -0
- package/driver.ts +101 -0
- package/error.js +30 -0
- package/error.js.map +1 -0
- package/error.ts +46 -0
- package/ffi/LICENSE +202 -0
- package/ffi/blob.js +99 -0
- package/ffi/blob.js.map +1 -0
- package/ffi/blob.ts +156 -0
- package/ffi/constants.js +65 -0
- package/ffi/constants.js.map +1 -0
- package/ffi/constants.ts +67 -0
- package/ffi/database.js +613 -0
- package/ffi/database.js.map +1 -0
- package/ffi/database.ts +931 -0
- package/ffi/ffi.js +535 -0
- package/ffi/ffi.js.map +1 -0
- package/ffi/ffi.ts +604 -0
- package/ffi/mod.js +15 -0
- package/ffi/mod.js.map +1 -0
- package/ffi/mod.ts +28 -0
- package/ffi/statement.js +555 -0
- package/ffi/statement.js.map +1 -0
- package/ffi/statement.ts +788 -0
- package/ffi/util.js +32 -0
- package/ffi/util.js.map +1 -0
- package/ffi/util.ts +48 -0
- package/follow.js +342 -0
- package/follow.js.map +1 -0
- package/follow.ts +401 -0
- package/history-branch.js +166 -0
- package/history-branch.js.map +1 -0
- package/history-branch.ts +140 -0
- package/history-shapes.js +254 -0
- package/history-shapes.js.map +1 -0
- package/history-shapes.ts +268 -0
- package/history.js +620 -0
- package/history.js.map +1 -0
- package/history.ts +674 -0
- package/inspect.js +120 -0
- package/inspect.js.map +1 -0
- package/inspect.ts +164 -0
- package/jsonb.js +73 -0
- package/jsonb.js.map +1 -0
- package/jsonb.ts +108 -0
- package/layout.js +22 -0
- package/layout.js.map +1 -0
- package/layout.ts +26 -0
- package/ledger.js +210 -0
- package/ledger.js.map +1 -0
- package/ledger.ts +210 -0
- package/legacy.js +4 -0
- package/legacy.js.map +1 -0
- package/legacy.ts +3 -0
- package/maintenance.js +148 -0
- package/maintenance.js.map +1 -0
- package/maintenance.ts +154 -0
- package/measure.js +133 -0
- package/measure.js.map +1 -0
- package/measure.ts +167 -0
- package/measure_worker.ts +18 -0
- package/memo.js +1250 -0
- package/memo.js.map +1 -0
- package/memo.ts +1480 -0
- package/meta.js +265 -0
- package/meta.js.map +1 -0
- package/meta.ts +321 -0
- package/migration.js +272 -0
- package/migration.js.map +1 -0
- package/migration.ts +286 -0
- package/mod.js +1103 -0
- package/mod.js.map +1 -0
- package/mod.ts +1762 -0
- package/mode.js +192 -0
- package/mode.js.map +1 -0
- package/mode.ts +207 -0
- package/native.js +544 -0
- package/native.js.map +1 -0
- package/native.ts +544 -0
- package/overlay.js +408 -0
- package/overlay.js.map +1 -0
- package/overlay.ts +485 -0
- package/owe.js +719 -0
- package/owe.js.map +1 -0
- package/owe.ts +873 -0
- package/package.json +99 -4
- package/physical.js +350 -0
- package/physical.js.map +1 -0
- package/physical.ts +434 -0
- package/plan.js +78 -0
- package/plan.js.map +1 -0
- package/plan.ts +104 -0
- package/point.js +81 -0
- package/point.js.map +1 -0
- package/point.ts +52 -0
- package/population.js +639 -0
- package/population.js.map +1 -0
- package/population.ts +630 -0
- package/purge.js +117 -0
- package/purge.js.map +1 -0
- package/purge.ts +127 -0
- package/raise.js +270 -0
- package/raise.js.map +1 -0
- package/raise.ts +316 -0
- package/read-db.js +381 -0
- package/read-db.js.map +1 -0
- package/read-db.ts +282 -0
- package/read-store.js +74 -0
- package/read-store.js.map +1 -0
- package/read-store.ts +86 -0
- package/read.js +1100 -0
- package/read.js.map +1 -0
- package/read.ts +1441 -0
- package/reader.js +141 -0
- package/reader.js.map +1 -0
- package/reader.ts +159 -0
- package/rules.js +88 -0
- package/rules.js.map +1 -0
- package/rules.ts +113 -0
- package/service.js +27 -0
- package/service.js.map +1 -0
- package/service.ts +41 -0
- package/shape.js +76 -0
- package/shape.js.map +1 -0
- package/shape.ts +108 -0
- package/sparse_presence_fixture.ts +45 -0
- package/sqlitepath.js +24 -0
- package/sqlitepath.js.map +1 -0
- package/sqlitepath.ts +29 -0
- package/statements.js +78 -0
- package/statements.js.map +1 -0
- package/statements.ts +96 -0
- package/survey.js +135 -0
- package/survey.js.map +1 -0
- package/survey.ts +196 -0
- package/tools.js +17 -0
- package/tools.js.map +1 -0
- package/tools.ts +50 -0
- package/trash.js +144 -0
- package/trash.js.map +1 -0
- package/trash.ts +187 -0
- package/unit.js +215 -0
- package/unit.js.map +1 -0
- package/unit.ts +211 -0
- package/versions.js +115 -0
- package/versions.js.map +1 -0
- package/versions.ts +110 -0
- package/vocab.js +19 -0
- package/vocab.js.map +1 -0
- package/vocab.json +27 -0
- package/vocab.ts +19 -0
- package/watch.js +33 -0
- package/watch.js.map +1 -0
- package/watch.ts +42 -0
- package/write.js +1164 -0
- package/write.js.map +1 -0
- package/write.ts +1356 -0
- package/written.js +200 -0
- package/written.js.map +1 -0
- package/written.ts +202 -0
package/shape.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// A file's layout of its words. A component's table, its columns, indexes and
|
|
2
|
+
// views are named by the word's identity (@yaks/vocab `Vocab.stored`), so a
|
|
3
|
+
// rename moves nothing in storage. A file laid out before identities names
|
|
4
|
+
// them by label, and is read that way until it migrates.
|
|
5
|
+
|
|
6
|
+
import { labelStored, type Vocab } from '@yaks/vocab'
|
|
7
|
+
import {
|
|
8
|
+
columnAsWritten,
|
|
9
|
+
type Driver,
|
|
10
|
+
fullLayout,
|
|
11
|
+
queryPhysical,
|
|
12
|
+
relating,
|
|
13
|
+
storeAs,
|
|
14
|
+
stored,
|
|
15
|
+
} from '@yaks/sql/core'
|
|
16
|
+
import { storedTables } from './physical.js'
|
|
17
|
+
import { BESIDE, BRANCH, FROM, TO } from './history-shapes.js'
|
|
18
|
+
import { BUILDING } from './layout.js'
|
|
19
|
+
|
|
20
|
+
/** The vocabulary as a database keeps its words. An expand release keeps
|
|
21
|
+
* an existing label layout until the migration moves it in one transaction. */
|
|
22
|
+
export let layoutOf = (v: Vocab, tables: readonly string[]): Vocab =>
|
|
23
|
+
tables.some((name) =>
|
|
24
|
+
name != 'entity' && !!v.comp(name) && v.stored(name) != name
|
|
25
|
+
)
|
|
26
|
+
? labelStored(v)
|
|
27
|
+
: v
|
|
28
|
+
|
|
29
|
+
/** The columns a word's table holds in this file, by label, or none where
|
|
30
|
+
* the file never raised it. `v` declares the word, though the connection may
|
|
31
|
+
* be bound to words that do not (a retired word a move still reads): its
|
|
32
|
+
* table is found by the word's identity, or by its label in a file laid out
|
|
33
|
+
* before identities. */
|
|
34
|
+
export let wordColumns = (
|
|
35
|
+
driver: Driver,
|
|
36
|
+
v: Vocab,
|
|
37
|
+
comp: string,
|
|
38
|
+
): string[] => {
|
|
39
|
+
let layout = layoutOf(v, storedTables(driver))
|
|
40
|
+
return queryPhysical(driver, {
|
|
41
|
+
t: 'pragma',
|
|
42
|
+
name: 'table_info',
|
|
43
|
+
arg: stored(layout, comp),
|
|
44
|
+
}).map((c) => columnAsWritten(layout, comp, String(c.name)))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Bind the vocabulary for all statements on this connection. */
|
|
48
|
+
export let bindStorage = (driver: Driver, v: Vocab): Vocab => {
|
|
49
|
+
let layout = v
|
|
50
|
+
if (identified(v)) {
|
|
51
|
+
let current = driver.stored?.v
|
|
52
|
+
let primary = historyLayout(v)
|
|
53
|
+
let labels = labelStored(v)
|
|
54
|
+
let known = current && fullLayout(current)
|
|
55
|
+
layout = known == primary || known == labels
|
|
56
|
+
? known
|
|
57
|
+
: historyLayout(layoutOf(v, storedTables(driver)))
|
|
58
|
+
}
|
|
59
|
+
storeAs(driver, layout)
|
|
60
|
+
return layout
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Whether a vocabulary can distinguish the two layouts. */
|
|
64
|
+
export let identified = (v: Vocab): boolean => {
|
|
65
|
+
let held = identities.get(v)
|
|
66
|
+
if (held == null) {
|
|
67
|
+
identities.set(v, held = v.all.some((c) => v.stored(c) != c))
|
|
68
|
+
}
|
|
69
|
+
return held
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let identities = new WeakMap<Vocab, boolean>()
|
|
73
|
+
|
|
74
|
+
let histories = new WeakMap<Vocab, Vocab>()
|
|
75
|
+
|
|
76
|
+
let historyLayout = (v: Vocab): Vocab => {
|
|
77
|
+
if (!identified(v)) return v
|
|
78
|
+
let held = histories.get(v)
|
|
79
|
+
if (!held) {
|
|
80
|
+
held = relating(
|
|
81
|
+
v,
|
|
82
|
+
v.all.flatMap((comp) =>
|
|
83
|
+
v.comp(comp)?.computed || comp == 'entity' || comp == 'tombstone'
|
|
84
|
+
? []
|
|
85
|
+
: [{
|
|
86
|
+
name: comp + BESIDE,
|
|
87
|
+
comp,
|
|
88
|
+
suffix: BESIDE,
|
|
89
|
+
columns: [BRANCH, FROM, TO],
|
|
90
|
+
}, {
|
|
91
|
+
name: BUILDING + comp,
|
|
92
|
+
comp,
|
|
93
|
+
prefix: BUILDING,
|
|
94
|
+
}]
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
histories.set(v, held)
|
|
98
|
+
histories.set(held, held)
|
|
99
|
+
}
|
|
100
|
+
return held
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Compiled reads on a mode name the relations the mode supplies. */
|
|
104
|
+
export let readingVocab = (driver: Driver, layout: Vocab): Vocab => {
|
|
105
|
+
if (driver.views) return labelStored(layout)
|
|
106
|
+
let known = driver.stored?.v
|
|
107
|
+
return known && fullLayout(known) == layout ? known : layout
|
|
108
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// A tiny public world beside retained history, with real planner statistics.
|
|
2
|
+
import { graph } from 'jsr:@yaks/graph@0.2.36'
|
|
3
|
+
import { archetypeDoc, archetypes } from 'jsr:@yaks/archetype@0.2.36'
|
|
4
|
+
import { loadVocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
5
|
+
import type { Driver } from 'jsr:@yaks/sql@0.2.36'
|
|
6
|
+
import { storage } from './mod.ts'
|
|
7
|
+
import { catalog } from './catalog.ts'
|
|
8
|
+
|
|
9
|
+
export let presenceVocab = loadVocab([archetypeDoc, {
|
|
10
|
+
$defs: {
|
|
11
|
+
den: {
|
|
12
|
+
component: true,
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: { name: { type: 'string' } },
|
|
15
|
+
},
|
|
16
|
+
chosen: { component: true, type: 'object' },
|
|
17
|
+
hidden: { component: true, type: 'object' },
|
|
18
|
+
doc: {
|
|
19
|
+
component: true,
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: { title: { type: 'string' } },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}])
|
|
25
|
+
|
|
26
|
+
export let seedPresence = (d: Driver) => {
|
|
27
|
+
let s = storage(d, presenceVocab)
|
|
28
|
+
s.install()
|
|
29
|
+
let g = graph({ storage: s, vocab: presenceVocab, plugins: [archetypes()] })
|
|
30
|
+
for (let at = 0; at < 10000; at += 500) {
|
|
31
|
+
g.apply(Array.from({ length: 500 }, (_, i) => ({
|
|
32
|
+
entity: { eid: `history-${at + i}` },
|
|
33
|
+
doc: { title: 'retained' },
|
|
34
|
+
})))
|
|
35
|
+
if (at == 4500) {
|
|
36
|
+
g.apply([
|
|
37
|
+
{ entity: { eid: 'world' }, den: { name: 'Mossvale' } },
|
|
38
|
+
{ entity: { eid: 'choice' }, chosen: {} },
|
|
39
|
+
{ entity: { eid: 'secret' }, chosen: {}, hidden: {} },
|
|
40
|
+
])
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
d.query({ t: 'analyze' })
|
|
44
|
+
return catalog(d)!
|
|
45
|
+
}
|
package/sqlitepath.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as system from "@yaks/process/system";
|
|
2
|
+
// Which SQLite library the FFI driver opens (./ffi/ffi.ts): the one the
|
|
3
|
+
// environment names, the checkout's pin, or the system's.
|
|
4
|
+
//
|
|
5
|
+
// Never upstream @db/sqlite's prebuilt. On Linux x86_64 it kills the process
|
|
6
|
+
// the moment it initializes: `sqlite3_initialize` calls through a null pointer
|
|
7
|
+
// inside `sqlite3MallocInit` under Deno 2.9 — a SIGSEGV with an empty stderr,
|
|
8
|
+
// before a line of ours runs. A library linked without -Bsymbolic crashes the
|
|
9
|
+
// same way under a Deno that links the system's libsqlite3 (Homebrew's does):
|
|
10
|
+
// that library's API is in the process first, and the second library's calls
|
|
11
|
+
// to its own functions bind to it. Every platform's system library is fine.
|
|
12
|
+
// This repository's tests name one SQLite built one way, wherever they run
|
|
13
|
+
// (bin/sqlite.ts).
|
|
14
|
+
let paths = {
|
|
15
|
+
linux: 'libsqlite3.so.0',
|
|
16
|
+
darwin: '/usr/lib/libsqlite3.dylib',
|
|
17
|
+
windows: 'sqlite3.dll'
|
|
18
|
+
};
|
|
19
|
+
/** The library the driver opens, with an environment override ahead of the
|
|
20
|
+
* checkout's pin and the platform default. */ export let sqlitePath = system.env.get('DENO_SQLITE_PATH') ?? system.env.get('YAK_SQLITE_PATH') ?? paths[system.os];
|
|
21
|
+
if (!sqlitePath) {
|
|
22
|
+
throw new Error(`No system SQLite library for ${system.os}`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sqlitepath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlitepath.js","sources":["./sqlitepath.ts"],"names":[],"mappings":"AAAA,YAAY,wCAA6C;AACzD,wEAAwE;AACxE,0DAA0D;AAC1D,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,mBAAmB;AAEnB,IAAI,QAAgC;EAClC,OAAO;EACP,QAAQ;EACR,SAAS;AACX;AAEA;4CAC4C,GAC5C,OAAO,IAAI,aAAqB,OAAO,GAAG,CAAC,GAAG,CAAC,uBAC7C,OAAO,GAAG,CAAC,GAAG,CAAC,sBACf,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;AAElB,IAAI,CAAC,YAAY;EACf,MAAM,IAAI,MAAM,CAAC,6BAA6B,EAAE,OAAO,EAAE,EAAE;AAC7D"}
|
package/sqlitepath.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as system from '@yaks/process/system'
|
|
2
|
+
// Which SQLite library the FFI driver opens (./ffi/ffi.ts): the one the
|
|
3
|
+
// environment names, the checkout's pin, or the system's.
|
|
4
|
+
//
|
|
5
|
+
// Never upstream @db/sqlite's prebuilt. On Linux x86_64 it kills the process
|
|
6
|
+
// the moment it initializes: `sqlite3_initialize` calls through a null pointer
|
|
7
|
+
// inside `sqlite3MallocInit` under Deno 2.9 — a SIGSEGV with an empty stderr,
|
|
8
|
+
// before a line of ours runs. A library linked without -Bsymbolic crashes the
|
|
9
|
+
// same way under a Deno that links the system's libsqlite3 (Homebrew's does):
|
|
10
|
+
// that library's API is in the process first, and the second library's calls
|
|
11
|
+
// to its own functions bind to it. Every platform's system library is fine.
|
|
12
|
+
// This repository's tests name one SQLite built one way, wherever they run
|
|
13
|
+
// (bin/sqlite.ts).
|
|
14
|
+
|
|
15
|
+
let paths: Record<string, string> = {
|
|
16
|
+
linux: 'libsqlite3.so.0',
|
|
17
|
+
darwin: '/usr/lib/libsqlite3.dylib',
|
|
18
|
+
windows: 'sqlite3.dll',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The library the driver opens, with an environment override ahead of the
|
|
22
|
+
* checkout's pin and the platform default. */
|
|
23
|
+
export let sqlitePath: string = system.env.get('DENO_SQLITE_PATH') ??
|
|
24
|
+
system.env.get('YAK_SQLITE_PATH') ??
|
|
25
|
+
paths[system.os]
|
|
26
|
+
|
|
27
|
+
if (!sqlitePath) {
|
|
28
|
+
throw new Error(`No system SQLite library for ${system.os}`)
|
|
29
|
+
}
|
package/statements.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { build } from "@yaks/process/platform";
|
|
2
|
+
// SQL-backed storage's statement capability. The connection and native
|
|
3
|
+
// libraries stay here; indexes receive only statements and coherent units.
|
|
4
|
+
import { descriptorHolds, render, revision, tableAsWritten } from "@yaks/sql";
|
|
5
|
+
import { exclusive, owned, unit } from "./unit.js";
|
|
6
|
+
import { descriptor } from "./catalog.js";
|
|
7
|
+
import { enter } from "@yaks/graph/enter";
|
|
8
|
+
let held = new WeakMap();
|
|
9
|
+
let platform = {
|
|
10
|
+
...build,
|
|
11
|
+
arch: {
|
|
12
|
+
x64: 'x86_64',
|
|
13
|
+
arm64: 'aarch64'
|
|
14
|
+
}[build.arch] ?? build.arch
|
|
15
|
+
};
|
|
16
|
+
/** The platform library's path, only when the name resolves to a local file. */ export let vectorPath = (resolve = import.meta.resolve)=>{
|
|
17
|
+
let names = {
|
|
18
|
+
'linux-x86_64': '@sqliteai/sqlite-vector-linux-x86_64',
|
|
19
|
+
'linux-aarch64': '@sqliteai/sqlite-vector-linux-arm64',
|
|
20
|
+
'darwin-x86_64': '@sqliteai/sqlite-vector-darwin-x86_64',
|
|
21
|
+
'darwin-aarch64': '@sqliteai/sqlite-vector-darwin-arm64',
|
|
22
|
+
'windows-x86_64': '@sqliteai/sqlite-vector-win32-x86_64'
|
|
23
|
+
};
|
|
24
|
+
let name = platform && names[`${platform.os}-${platform.arch}`];
|
|
25
|
+
if (!name || !platform) return;
|
|
26
|
+
let ext = platform.os == 'windows' ? 'dll' : platform.os == 'darwin' ? 'dylib' : 'so';
|
|
27
|
+
let base;
|
|
28
|
+
try {
|
|
29
|
+
base = new URL(resolve(name));
|
|
30
|
+
} catch {
|
|
31
|
+
return; // nothing maps the name: no vector library is installed
|
|
32
|
+
}
|
|
33
|
+
if (base.protocol != 'file:') return;
|
|
34
|
+
return new URL(`./vector.${ext}`, base).pathname;
|
|
35
|
+
};
|
|
36
|
+
/** One stable capability per connection, sharing the graph's transaction. */ export let statements = (driver)=>{
|
|
37
|
+
let found = held.get(driver);
|
|
38
|
+
if (found) return found;
|
|
39
|
+
// Observe before lending any statements: wrappers must not bypass revision.
|
|
40
|
+
revision(driver, 'schema');
|
|
41
|
+
let vector = driver.extension && vectorPath();
|
|
42
|
+
let made = {
|
|
43
|
+
render: (s)=>driver.render?.(s, driver.stored?.v) ?? render(s, undefined, undefined, driver.stored?.v),
|
|
44
|
+
tableName: (name)=>tableAsWritten(driver.stored?.v, name),
|
|
45
|
+
holds: (tables, comp)=>descriptorHolds(tables, driver.stored?.v, comp),
|
|
46
|
+
named: (tables)=>descriptor(driver, tables).tables,
|
|
47
|
+
query: (s)=>{
|
|
48
|
+
if ([
|
|
49
|
+
'begin',
|
|
50
|
+
'commit',
|
|
51
|
+
'rollback',
|
|
52
|
+
'savepoint',
|
|
53
|
+
'release'
|
|
54
|
+
].includes(s.t)) {
|
|
55
|
+
throw new Error('storage owns transactions; use statements.atomic');
|
|
56
|
+
}
|
|
57
|
+
return driver.query(s);
|
|
58
|
+
},
|
|
59
|
+
ownership: driver.file ? 'shared' : 'exclusive',
|
|
60
|
+
inside: ()=>owned(driver),
|
|
61
|
+
arms: driver.arms,
|
|
62
|
+
revision: (scope, table)=>revision(driver, scope, table),
|
|
63
|
+
atomic: (body)=>exclusive(driver, ()=>enter((begun)=>unit(driver, ()=>{
|
|
64
|
+
begun();
|
|
65
|
+
return body();
|
|
66
|
+
}, 'write', {
|
|
67
|
+
wait: false
|
|
68
|
+
}))),
|
|
69
|
+
...vector ? {
|
|
70
|
+
facilities: {
|
|
71
|
+
vector: ()=>driver.extension(vector)
|
|
72
|
+
}
|
|
73
|
+
} : {}
|
|
74
|
+
};
|
|
75
|
+
held.set(driver, made);
|
|
76
|
+
return made;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=statements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statements.js","sources":["./statements.ts"],"names":[],"mappings":"AAAA,SAAS,KAAK,sCAA2C;AACzD,uEAAuE;AACvE,2EAA2E;AAC3E,SACE,eAAe,EAEf,MAAM,EACN,QAAQ,EAER,cAAc,yBACa;AAC7B,SAAS,SAAS,EAAE,KAAK,EAAE,IAAI,oBAAmB;AAClD,SAAS,UAAU,uBAAsB;AACzC,SAAS,KAAK,iCAAsC;AAEpD,IAAI,OAAO,IAAI;AACf,IAAI,WAAW;EACb,GAAG,KAAK;EACR,MAAM,AAAC;IAAE,KAAK;IAAU,OAAO;EAAU,CAA4B,CACnE,MAAM,IAAI,CACX,IAAI,MAAM,IAAI;AACjB;AACA,8EAA8E,GAC9E,OAAO,IAAI,aAAa,CACtB,UAAyC,YAAY,OAAO;EAE5D,IAAI,QAAgC;IAClC,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;EACpB;EACA,IAAI,OAAO,YAAY,KAAK,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;EAC/D,IAAI,CAAC,QAAQ,CAAC,UAAU;EACxB,IAAI,MAAM,SAAS,EAAE,IAAI,YACrB,QACA,SAAS,EAAE,IAAI,WACf,UACA;EACJ,IAAI;EACJ,IAAI;IACF,OAAO,IAAI,IAAI,QAAQ;EACzB,EAAE,OAAM;IACN,QAAO,wDAAwD;EACjE;EACA,IAAI,KAAK,QAAQ,IAAI,SAAS;EAC9B,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,QAAQ;AAClD,EAAC;AAED,2EAA2E,GAC3E,OAAO,IAAI,aAAa,CAAC;EACvB,IAAI,QAAQ,KAAK,GAAG,CAAC;EACrB,IAAI,OAAO,OAAO;EAClB,4EAA4E;EAC5E,SAAS,QAAQ;EACjB,IAAI,SAAS,OAAO,SAAS,IAAI;EACjC,IAAI,OAAmB;IACrB,QAAQ,CAAC,IACP,OAAO,MAAM,GAAG,GAAG,OAAO,MAAM,EAAE,MAChC,OAAO,GAAG,WAAW,WAAW,OAAO,MAAM,EAAE;IACnD,WAAW,CAAC,OAAS,eAAe,OAAO,MAAM,EAAE,GAAG;IACtD,OAAO,CAAC,QAAQ,OAAS,gBAAgB,QAAQ,OAAO,MAAM,EAAE,GAAG;IACnE,OAAO,CAAC,SAAW,WAAW,QAAQ,QAAQ,MAAM;IACpD,OAAO,CAAC;MACN,IACE;QAAC;QAAS;QAAU;QAAY;QAAa;OAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,GACpE;QACA,MAAM,IAAI,MAAM;MAClB;MACA,OAAO,OAAO,KAAK,CAAC;IACtB;IACA,WAAW,OAAO,IAAI,GAAG,WAAW;IACpC,QAAQ,IAAM,MAAM;IACpB,MAAM,OAAO,IAAI;IACjB,UAAU,CAAC,OAAO,QAAU,SAAS,QAAQ,OAAO;IACpD,QAAQ,CAAC,OACP,UAAU,QAAQ,IAChB,MAAM,CAAC,QACL,KACE,QACA;YACE;YACA,OAAO;UACT,GACA,SACA;YAAE,MAAM;UAAM;IAGtB,GAAG,SACC;MAAE,YAAY;QAAE,QAAQ,IAAM,OAAO,SAAS,CAAE;MAAQ;IAAE,IAC1D,CAAC,CAAC;EACR;EACA,KAAK,GAAG,CAAC,QAAQ;EACjB,OAAO;AACT,EAAC"}
|
package/statements.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { build } from '@yaks/process/platform'
|
|
2
|
+
// SQL-backed storage's statement capability. The connection and native
|
|
3
|
+
// libraries stay here; indexes receive only statements and coherent units.
|
|
4
|
+
import {
|
|
5
|
+
descriptorHolds,
|
|
6
|
+
type Driver,
|
|
7
|
+
render,
|
|
8
|
+
revision,
|
|
9
|
+
type Statements,
|
|
10
|
+
tableAsWritten,
|
|
11
|
+
} from '@yaks/sql'
|
|
12
|
+
import { exclusive, owned, unit } from './unit.js'
|
|
13
|
+
import { descriptor } from './catalog.js'
|
|
14
|
+
import { enter } from '@yaks/graph/enter'
|
|
15
|
+
|
|
16
|
+
let held = new WeakMap<Driver, Statements>()
|
|
17
|
+
let platform = {
|
|
18
|
+
...build,
|
|
19
|
+
arch: ({ x64: 'x86_64', arm64: 'aarch64' } as Record<string, string>)[
|
|
20
|
+
build.arch
|
|
21
|
+
] ?? build.arch,
|
|
22
|
+
}
|
|
23
|
+
/** The platform library's path, only when the name resolves to a local file. */
|
|
24
|
+
export let vectorPath = (
|
|
25
|
+
resolve: (specifier: string) => string = import.meta.resolve,
|
|
26
|
+
): string | undefined => {
|
|
27
|
+
let names: Record<string, string> = {
|
|
28
|
+
'linux-x86_64': '@sqliteai/sqlite-vector-linux-x86_64',
|
|
29
|
+
'linux-aarch64': '@sqliteai/sqlite-vector-linux-arm64',
|
|
30
|
+
'darwin-x86_64': '@sqliteai/sqlite-vector-darwin-x86_64',
|
|
31
|
+
'darwin-aarch64': '@sqliteai/sqlite-vector-darwin-arm64',
|
|
32
|
+
'windows-x86_64': '@sqliteai/sqlite-vector-win32-x86_64',
|
|
33
|
+
}
|
|
34
|
+
let name = platform && names[`${platform.os}-${platform.arch}`]
|
|
35
|
+
if (!name || !platform) return
|
|
36
|
+
let ext = platform.os == 'windows'
|
|
37
|
+
? 'dll'
|
|
38
|
+
: platform.os == 'darwin'
|
|
39
|
+
? 'dylib'
|
|
40
|
+
: 'so'
|
|
41
|
+
let base: URL
|
|
42
|
+
try {
|
|
43
|
+
base = new URL(resolve(name))
|
|
44
|
+
} catch {
|
|
45
|
+
return // nothing maps the name: no vector library is installed
|
|
46
|
+
}
|
|
47
|
+
if (base.protocol != 'file:') return
|
|
48
|
+
return new URL(`./vector.${ext}`, base).pathname
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One stable capability per connection, sharing the graph's transaction. */
|
|
52
|
+
export let statements = (driver: Driver): Statements => {
|
|
53
|
+
let found = held.get(driver)
|
|
54
|
+
if (found) return found
|
|
55
|
+
// Observe before lending any statements: wrappers must not bypass revision.
|
|
56
|
+
revision(driver, 'schema')
|
|
57
|
+
let vector = driver.extension && vectorPath()
|
|
58
|
+
let made: Statements = {
|
|
59
|
+
render: (s) =>
|
|
60
|
+
driver.render?.(s, driver.stored?.v) ??
|
|
61
|
+
render(s, undefined, undefined, driver.stored?.v),
|
|
62
|
+
tableName: (name) => tableAsWritten(driver.stored?.v, name),
|
|
63
|
+
holds: (tables, comp) => descriptorHolds(tables, driver.stored?.v, comp),
|
|
64
|
+
named: (tables) => descriptor(driver, tables).tables,
|
|
65
|
+
query: (s) => {
|
|
66
|
+
if (
|
|
67
|
+
['begin', 'commit', 'rollback', 'savepoint', 'release'].includes(s.t)
|
|
68
|
+
) {
|
|
69
|
+
throw new Error('storage owns transactions; use statements.atomic')
|
|
70
|
+
}
|
|
71
|
+
return driver.query(s)
|
|
72
|
+
},
|
|
73
|
+
ownership: driver.file ? 'shared' : 'exclusive',
|
|
74
|
+
inside: () => owned(driver),
|
|
75
|
+
arms: driver.arms,
|
|
76
|
+
revision: (scope, table) => revision(driver, scope, table),
|
|
77
|
+
atomic: (body) =>
|
|
78
|
+
exclusive(driver, () =>
|
|
79
|
+
enter((begun) =>
|
|
80
|
+
unit(
|
|
81
|
+
driver,
|
|
82
|
+
() => {
|
|
83
|
+
begun()
|
|
84
|
+
return body()
|
|
85
|
+
},
|
|
86
|
+
'write',
|
|
87
|
+
{ wait: false },
|
|
88
|
+
)
|
|
89
|
+
)),
|
|
90
|
+
...vector
|
|
91
|
+
? { facilities: { vector: () => driver.extension!(vector) } }
|
|
92
|
+
: {},
|
|
93
|
+
}
|
|
94
|
+
held.set(driver, made)
|
|
95
|
+
return made
|
|
96
|
+
}
|
package/survey.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// What a look at a file finds against a vocabulary's schema, kept in the file
|
|
2
|
+
// for every opener after the one that looked. A reader reads what the file
|
|
3
|
+
// holds (./reader.ts): a property whose column the file's table lacks reads
|
|
4
|
+
// as never given, a component whose table it lacks is worn by nothing, and a
|
|
5
|
+
// declared index it lacks is not forced. Memory follows other connections'
|
|
6
|
+
// writes through the log only where every table it keeps has the log's
|
|
7
|
+
// triggers (./written.ts). Finding all that out reads the whole of
|
|
8
|
+
// `sqlite_schema` and renders every table's and trigger's statement to
|
|
9
|
+
// compare: milliseconds in every process that opens a graph, for an answer
|
|
10
|
+
// that changes only when the schema does.
|
|
11
|
+
//
|
|
12
|
+
// So a writer opening the file records what it finds, as the `server_meta`
|
|
13
|
+
// row `surveyed:<print>` (the store's print, ./plan.ts), with the version the
|
|
14
|
+
// schema stood at (`pragma schema_version`), and an opener of the same
|
|
15
|
+
// vocabulary reads the survey there instead. SQLite moves that version, kept
|
|
16
|
+
// in the file's header, on every change to the schema, whoever makes it, so a
|
|
17
|
+
// survey is never read past a column dropped, an index built or a table refit
|
|
18
|
+
// after it: those find it out of date, and look again, until a writer records
|
|
19
|
+
// the next one.
|
|
20
|
+
import { catalogue, lit, revision, tagOf } from "@yaks/sql";
|
|
21
|
+
import { lacking } from "./follow.js";
|
|
22
|
+
import { built } from "./ddl.js";
|
|
23
|
+
import { tables } from "./layout.js";
|
|
24
|
+
import { meta, SURVEYED, surveyedAt } from "./meta.js";
|
|
25
|
+
import { plan } from "./plan.js";
|
|
26
|
+
import { unit } from "./unit.js";
|
|
27
|
+
import { follows } from "./written.js";
|
|
28
|
+
// The tables whose writes the log is asked to follow: the store's own.
|
|
29
|
+
let logs = (vocab)=>[
|
|
30
|
+
'entity',
|
|
31
|
+
'tombstone',
|
|
32
|
+
...tables(vocab)
|
|
33
|
+
];
|
|
34
|
+
/** What a reader binds over the file: the survey's properties, read as never
|
|
35
|
+
* given. */ export let lacked = (vocab, survey)=>Object.fromEntries(survey.lacking.map((key)=>{
|
|
36
|
+
let at = key.indexOf('.');
|
|
37
|
+
let c = vocab.prop(key.slice(0, at), key.slice(at + 1));
|
|
38
|
+
return [
|
|
39
|
+
key,
|
|
40
|
+
{
|
|
41
|
+
tag: tagOf(c),
|
|
42
|
+
expr: ()=>lit(null)
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
}));
|
|
46
|
+
/** What a reader asks of the file itself: its tables, columns and indexes,
|
|
47
|
+
* and not the log's triggers. */ export let glance = (driver, vocab, derived)=>{
|
|
48
|
+
let behind = lacking(driver, vocab, derived, true);
|
|
49
|
+
let objects = new Set(catalogue(driver).map((o)=>o.name));
|
|
50
|
+
return {
|
|
51
|
+
lacking: Object.keys(behind.derived),
|
|
52
|
+
absent: behind.absent,
|
|
53
|
+
unindexed: built(driver, vocab).flatMap((s)=>s.t == 'create index' && !objects.has(s.name) ? [
|
|
54
|
+
s.name
|
|
55
|
+
] : [])
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/** The file looked at, all of it. */ export let look = (driver, vocab, derived)=>({
|
|
59
|
+
...glance(driver, vocab, derived),
|
|
60
|
+
unlogged: logs(vocab).filter((name)=>!follows(driver, [
|
|
61
|
+
name
|
|
62
|
+
]))
|
|
63
|
+
});
|
|
64
|
+
// The version the file's schema stands at now.
|
|
65
|
+
let version = (driver)=>Number(driver.query({
|
|
66
|
+
t: 'pragma',
|
|
67
|
+
name: 'schema_version'
|
|
68
|
+
})[0]?.schema_version);
|
|
69
|
+
// Per driver and print, the survey read while the schema stood at a revision
|
|
70
|
+
// (@yaks/sql `revision`): a reader and memory both ask, and one read of the
|
|
71
|
+
// row answers both.
|
|
72
|
+
let seen = new WeakMap();
|
|
73
|
+
let hold = (driver, print, survey)=>{
|
|
74
|
+
let by = seen.get(driver) ?? new Map();
|
|
75
|
+
seen.set(driver, by);
|
|
76
|
+
by.set(print, {
|
|
77
|
+
schema: revision(driver, 'schema'),
|
|
78
|
+
survey
|
|
79
|
+
});
|
|
80
|
+
return survey;
|
|
81
|
+
};
|
|
82
|
+
/** The survey the file holds of this vocabulary's schema, where it was taken
|
|
83
|
+
* at the version the schema stands at now; undefined where there is none, or
|
|
84
|
+
* the schema has moved since. Read in the snapshot it is asked in. */ export let surveyed = (driver, vocab, derived)=>{
|
|
85
|
+
if (!driver.file) return;
|
|
86
|
+
let print = plan(vocab, derived, true).print;
|
|
87
|
+
let held = seen.get(driver)?.get(print);
|
|
88
|
+
if (held && held.schema === revision(driver, 'schema')) return held.survey;
|
|
89
|
+
let row = surveyedAt(driver, print);
|
|
90
|
+
let { at, ...survey } = row ? JSON.parse(row) : {};
|
|
91
|
+
return hold(driver, print, at === version(driver) ? survey : undefined);
|
|
92
|
+
};
|
|
93
|
+
/** Record what a look at the file finds against this vocabulary's schema,
|
|
94
|
+
* for every opener after this one. Nothing where the file is in memory, or
|
|
95
|
+
* holds a survey of the schema as it stands. */ export let survey = (driver, vocab, derived)=>{
|
|
96
|
+
if (!driver.file || surveyed(driver, vocab, derived)) return;
|
|
97
|
+
unit(driver, ()=>{
|
|
98
|
+
// Another writer may have recorded it while this one waited for the lock.
|
|
99
|
+
if (surveyed(driver, vocab, derived)) return;
|
|
100
|
+
let found = look(driver, vocab, derived);
|
|
101
|
+
let print = plan(vocab, derived, true).print;
|
|
102
|
+
meta(driver).set(SURVEYED + print, JSON.stringify({
|
|
103
|
+
at: version(driver),
|
|
104
|
+
...found
|
|
105
|
+
}));
|
|
106
|
+
hold(driver, print, found);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
/** What a look found, `before`, across the tables a write just raised
|
|
110
|
+
* (./raise.ts): `raised` no longer absent, nor the indexes made with them. A
|
|
111
|
+
* table raised is made whole, its indexes and the log's triggers with it, so
|
|
112
|
+
* nothing else the look found moves. Its indexes kept missing, every read of
|
|
113
|
+
* the component was planned as though it had none: a person's messages walked
|
|
114
|
+
* every titled row for the few knocks a seek of `knock.target` reads (bug
|
|
115
|
+
* 73244693). */ export let raisedOver = (driver, before, raised)=>{
|
|
116
|
+
let gone = new Set(raised);
|
|
117
|
+
let made = new Set(catalogue(driver).map((o)=>o.name));
|
|
118
|
+
return {
|
|
119
|
+
...before,
|
|
120
|
+
absent: before.absent.filter((c)=>!gone.has(c)),
|
|
121
|
+
unindexed: before.unindexed.filter((name)=>!made.has(name))
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/** Keep the survey the file holds standing across the tables a write just
|
|
125
|
+
* raised ({@link raisedOver}). Nothing where there was no survey to keep. */ export let raisedSurvey = (driver, vocab, derived, before, raised)=>{
|
|
126
|
+
if (!driver.file || !before || !raised.length) return;
|
|
127
|
+
let found = raisedOver(driver, before, raised);
|
|
128
|
+
let print = plan(vocab, derived, true).print;
|
|
129
|
+
meta(driver).set(SURVEYED + print, JSON.stringify({
|
|
130
|
+
at: version(driver),
|
|
131
|
+
...found
|
|
132
|
+
}));
|
|
133
|
+
hold(driver, print, found);
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=survey.js.map
|
package/survey.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey.js","sources":["./survey.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,uEAAuE;AACvE,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAC3E,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,uEAAuE;AACvE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,gBAAgB;AAEhB,SACE,SAAS,EAGT,GAAG,EACH,QAAQ,EACR,KAAK,yBACsB;AAE7B,SAAS,OAAO,sBAAqB;AACrC,SAAS,KAAK,mBAAkB;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