@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/deno.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"publish":{"exclude":["**/*_test.ts","testing.ts","parity.ts","declared.ts","**/*_bench.ts","fixtures/"]},"name":"@yaks/sqlite","version":"0.2.36","license":"Apache-2.0","description":"SQLite storage for a graph: builds a schema from a vocabulary, reads queries as bundles, and applies transactional patches.","exports":{".":"./mod.ts","./vocab":"./vocab.ts","./tools":"./tools.ts","./db":"./db.ts","./cache":"./cache.ts","./service":"./service.ts","./unit":"./unit.ts","./trash":"./trash.ts","./reader":"./reader.ts","./read-db":"./read-db.ts","./budget":"./budget.ts","./physical":"./physical.ts","./migration":"./migration.ts","./follow":"./follow.ts","./meta":"./meta.ts","./owe":"./owe.ts","./survey":"./survey.ts","./read-store":"./read-store.ts","./statements":"./statements.ts"},"imports":{"@yaks/sqlite":"./mod.ts","@yaks/sqlite/vocab":"./vocab.ts","@yaks/sqlite/tools":"./tools.ts","@yaks/sqlite/db":"./db.ts","@yaks/sqlite/cache":"./cache.ts","@yaks/sqlite/service":"./service.ts","@yaks/sqlite/unit":"./unit.ts","@yaks/sqlite/trash":"./trash.ts","@yaks/sqlite/reader":"./reader.ts","@yaks/sqlite/read-db":"./read-db.ts","@yaks/sqlite/budget":"./budget.ts","@yaks/sqlite/physical":"./physical.ts","@yaks/sqlite/migration":"./migration.ts","@yaks/sqlite/follow":"./follow.ts","@yaks/sqlite/meta":"./meta.ts","@yaks/sqlite/owe":"./owe.ts","@yaks/sqlite/survey":"./survey.ts","@yaks/sqlite/read-store":"./read-store.ts","@yaks/sqlite/statements":"./statements.ts"}}
|
package/doom.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The stored death cascade, asked by the writable graph inside its transaction.
|
|
2
|
+
import { ARMS, DEEP, doomSql, looseSql, narrow, STOCK_DEPTH } from "@yaks/sql";
|
|
3
|
+
/**
|
|
4
|
+
* The whole death cascade, computed by one statement rather than walked:
|
|
5
|
+
* everything that dies with these entities, and every soft reference that has
|
|
6
|
+
* to let go of them (@yaks/sql's `doomSql`/`looseSql`). @yaks/graph would
|
|
7
|
+
* otherwise read once per rung of the chain — free here, a round trip each over
|
|
8
|
+
* a network — and that walk is what an adapter unable to compile this still
|
|
9
|
+
* gets.
|
|
10
|
+
*
|
|
11
|
+
* Each statement fits the engine's compound SELECT and CTE cursor limits.
|
|
12
|
+
* A vocabulary too wide for one statement (@yaks/sql `narrow`) is
|
|
13
|
+
* queried in rounds: each statement is transitive within its own tables, so
|
|
14
|
+
* the result is complete when a round turns up nothing the last one had not.
|
|
15
|
+
*
|
|
16
|
+
* Asked inside the transaction, after the batch's patches have gone in, which
|
|
17
|
+
* is what makes the result the one the cascade wants: who points at the dying
|
|
18
|
+
* as the batch leaves the graph. `lacks` is what the file does not hold yet of
|
|
19
|
+
* the vocabulary's schema (./survey.ts), which the statements do not name.
|
|
20
|
+
*/ export let doom = (driver, vocab, eids, lacks = {})=>{
|
|
21
|
+
let ask = (s)=>driver.query(s);
|
|
22
|
+
let terms = driver.arms ?? ARMS;
|
|
23
|
+
let depth = new Map();
|
|
24
|
+
let gone = [];
|
|
25
|
+
let seed = eids;
|
|
26
|
+
let base = 0;
|
|
27
|
+
for(;;){
|
|
28
|
+
let fresh = [];
|
|
29
|
+
let least = DEEP;
|
|
30
|
+
for (let s of doomSql(vocab, seed, terms, lacks, STOCK_DEPTH)){
|
|
31
|
+
for (let r of ask(s)){
|
|
32
|
+
let eid = String(r.eid);
|
|
33
|
+
if (depth.has(eid)) continue;
|
|
34
|
+
let rung = base + Number(r.depth);
|
|
35
|
+
depth.set(eid, rung);
|
|
36
|
+
gone.push({
|
|
37
|
+
eid,
|
|
38
|
+
depth: rung
|
|
39
|
+
});
|
|
40
|
+
if (base || !seed.includes(eid)) fresh.push(eid);
|
|
41
|
+
least = Math.min(least, rung);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (narrow(vocab, terms, STOCK_DEPTH) || !fresh.length) break;
|
|
45
|
+
seed = fresh;
|
|
46
|
+
base = least;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
gone,
|
|
50
|
+
loose: looseSql(vocab, [
|
|
51
|
+
...depth.keys()
|
|
52
|
+
], terms, lacks, STOCK_DEPTH).flatMap((s)=>ask(s).map((r)=>({
|
|
53
|
+
eid: String(r.eid),
|
|
54
|
+
comp: String(r.comp),
|
|
55
|
+
prop: String(r.prop)
|
|
56
|
+
})))
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=doom.js.map
|
package/doom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doom.js","sources":["./doom.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAGhF,SACE,IAAI,EACJ,IAAI,EACJ,OAAO,EAGP,QAAQ,EACR,MAAM,EAEN,WAAW,yBACgB;AAE7B;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,IAAI,OAAO,CAChB,QACA,OACA,MACA,QAAe,CAAC,CAAC;EAEjB,IAAI,MAAM,CAAC,IAAW,OAAO,KAAK,CAAC;EACnC,IAAI,QAAQ,OAAO,IAAI,IAAI;EAC3B,IAAI,QAAQ,IAAI;EAChB,IAAI,OAAe,EAAE;EACrB,IAAI,OAAO;EACX,IAAI,OAAO;EACX,OAAS;IACP,IAAI,QAAkB,EAAE;IACxB,IAAI,QAAQ;IACZ,KAAK,IAAI,KAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,aAAc;MAC7D,KAAK,IAAI,KAAK,IAAI,GAAI;QACpB,IAAI,MAAM,OAAO,EAAE,GAAG;QACtB,IAAI,MAAM,GAAG,CAAC,MAAM;QACpB,IAAI,OAAO,OAAO,OAAO,EAAE,KAAK;QAChC,MAAM,GAAG,CAAC,KAAK;QACf,KAAK,IAAI,CAAC;UAAE;UAAK,OAAO;QAAK;QAC7B,IAAI,QAAQ,CAAC,KAAK,QAAQ,CAAC,MAAM,MAAM,IAAI,CAAC;QAC5C,QAAQ,KAAK,GAAG,CAAC,OAAO;MAC1B;IACF;IACA,IAAI,OAAO,OAAO,OAAO,gBAAgB,CAAC,MAAM,MAAM,EAAE;IACxD,OAAO;IACP,OAAO;EACT;EACA,OAAO;IACL;IACA,OAAO,SAAS,OAAO;SAAI,MAAM,IAAI;KAAG,EAAE,OAAO,OAAO,aACrD,OAAO,CAAC,CAAC,IACR,IAAI,GAAG,GAAG,CAAC,CAAC,IAAM,CAAC;UACjB,KAAK,OAAO,EAAE,GAAG;UACjB,MAAM,OAAO,EAAE,IAAI;UACnB,MAAM,OAAO,EAAE,IAAI;QACrB,CAAC;EAEP;AACF,EAAC"}
|
package/doom.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// The stored death cascade, asked by the writable graph inside its transaction.
|
|
2
|
+
import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
3
|
+
import type { Doom, Gone } from 'jsr:@yaks/graph@0.2.36'
|
|
4
|
+
import {
|
|
5
|
+
ARMS,
|
|
6
|
+
DEEP,
|
|
7
|
+
doomSql,
|
|
8
|
+
type Driver,
|
|
9
|
+
type Lacks,
|
|
10
|
+
looseSql,
|
|
11
|
+
narrow,
|
|
12
|
+
type Raw,
|
|
13
|
+
STOCK_DEPTH,
|
|
14
|
+
} from '@yaks/sql'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The whole death cascade, computed by one statement rather than walked:
|
|
18
|
+
* everything that dies with these entities, and every soft reference that has
|
|
19
|
+
* to let go of them (@yaks/sql's `doomSql`/`looseSql`). @yaks/graph would
|
|
20
|
+
* otherwise read once per rung of the chain — free here, a round trip each over
|
|
21
|
+
* a network — and that walk is what an adapter unable to compile this still
|
|
22
|
+
* gets.
|
|
23
|
+
*
|
|
24
|
+
* Each statement fits the engine's compound SELECT and CTE cursor limits.
|
|
25
|
+
* A vocabulary too wide for one statement (@yaks/sql `narrow`) is
|
|
26
|
+
* queried in rounds: each statement is transitive within its own tables, so
|
|
27
|
+
* the result is complete when a round turns up nothing the last one had not.
|
|
28
|
+
*
|
|
29
|
+
* Asked inside the transaction, after the batch's patches have gone in, which
|
|
30
|
+
* is what makes the result the one the cascade wants: who points at the dying
|
|
31
|
+
* as the batch leaves the graph. `lacks` is what the file does not hold yet of
|
|
32
|
+
* the vocabulary's schema (./survey.ts), which the statements do not name.
|
|
33
|
+
*/
|
|
34
|
+
export let doom = (
|
|
35
|
+
driver: Driver,
|
|
36
|
+
vocab: Vocab,
|
|
37
|
+
eids: string[],
|
|
38
|
+
lacks: Lacks = {},
|
|
39
|
+
): Doom => {
|
|
40
|
+
let ask = (s: Raw) => driver.query(s)
|
|
41
|
+
let terms = driver.arms ?? ARMS
|
|
42
|
+
let depth = new Map<string, number>()
|
|
43
|
+
let gone: Gone[] = []
|
|
44
|
+
let seed = eids
|
|
45
|
+
let base = 0
|
|
46
|
+
for (;;) {
|
|
47
|
+
let fresh: string[] = []
|
|
48
|
+
let least = DEEP
|
|
49
|
+
for (let s of doomSql(vocab, seed, terms, lacks, STOCK_DEPTH)) {
|
|
50
|
+
for (let r of ask(s)) {
|
|
51
|
+
let eid = String(r.eid)
|
|
52
|
+
if (depth.has(eid)) continue
|
|
53
|
+
let rung = base + Number(r.depth)
|
|
54
|
+
depth.set(eid, rung)
|
|
55
|
+
gone.push({ eid, depth: rung })
|
|
56
|
+
if (base || !seed.includes(eid)) fresh.push(eid)
|
|
57
|
+
least = Math.min(least, rung)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (narrow(vocab, terms, STOCK_DEPTH) || !fresh.length) break
|
|
61
|
+
seed = fresh
|
|
62
|
+
base = least
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
gone,
|
|
66
|
+
loose: looseSql(vocab, [...depth.keys()], terms, lacks, STOCK_DEPTH)
|
|
67
|
+
.flatMap((s) =>
|
|
68
|
+
ask(s).map((r) => ({
|
|
69
|
+
eid: String(r.eid),
|
|
70
|
+
comp: String(r.comp),
|
|
71
|
+
prop: String(r.prop),
|
|
72
|
+
}))
|
|
73
|
+
),
|
|
74
|
+
}
|
|
75
|
+
}
|
package/driver.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Statements and tracing are shared by the native writer and file reader;
|
|
2
|
+
// preparing, binding and decoding belong to their engine boundaries.
|
|
3
|
+
import { context, leaf, peek } from "@yaks/trace";
|
|
4
|
+
import { asWritten, excerpt, labeled, renderStable, statement, STOCK, STOCK_DEPTH, STOCK_VARIABLES, writing } from "@yaks/sql/core";
|
|
5
|
+
// A statement SQLite will not compile or run says which it was: the message
|
|
6
|
+
// names the fault, and only the statement shows where it is, once the error
|
|
7
|
+
// has crossed a worker and reached its caller and the tracker (its enumerable
|
|
8
|
+
// properties do). A kept statement is compiled again at its step when the
|
|
9
|
+
// schema moved under it, so a fault of compiling can surface there too.
|
|
10
|
+
let naming = (run)=>(sql, params)=>{
|
|
11
|
+
try {
|
|
12
|
+
return run(sql, params);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
throw error instanceof Error ? Object.assign(error, {
|
|
15
|
+
statement: sql
|
|
16
|
+
}) : error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
// An embedded SQLite's limits are the stock ones.
|
|
20
|
+
let render = (s, v)=>renderStable(s, STOCK_VARIABLES, STOCK_DEPTH, v);
|
|
21
|
+
export let driver = (ran, opts)=>{
|
|
22
|
+
let run = naming(ran);
|
|
23
|
+
let stored = {};
|
|
24
|
+
// Rows come back, and a refusal is told, under the names the statement
|
|
25
|
+
// wrote (@yaks/sql `asWritten`, `labeled`).
|
|
26
|
+
let query = (s)=>labeled(()=>asWritten(s, ask(s), stored.v), stored.v);
|
|
27
|
+
let ask = (s)=>{
|
|
28
|
+
opts.before?.(s);
|
|
29
|
+
if (s.t == 'rollback' && s.ifActive && opts.inTransaction?.() === false) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
// Each statement is kept by its text (./native.ts `prepared`), and a list
|
|
33
|
+
// costs no rows here: every collection binds as one JSON array.
|
|
34
|
+
let rendered = render(s, stored.v), { sql, params } = rendered;
|
|
35
|
+
let at = context();
|
|
36
|
+
let c = at?.channel ?? peek(d);
|
|
37
|
+
if (!c) return run(sql, params);
|
|
38
|
+
let wrote = writing(s), n = 0;
|
|
39
|
+
return leaf(c.begin({
|
|
40
|
+
kind: 'sql',
|
|
41
|
+
name: statement(s),
|
|
42
|
+
package: '@yaks/sqlite',
|
|
43
|
+
parent: at?.channel == c ? at.parent : undefined,
|
|
44
|
+
sql: excerpt(rendered)
|
|
45
|
+
}), ()=>{
|
|
46
|
+
let rows = run(sql, params);
|
|
47
|
+
n = wrote ? opts.changes?.() ?? 0 : rows.length;
|
|
48
|
+
return rows;
|
|
49
|
+
}, ()=>({
|
|
50
|
+
statements: 1,
|
|
51
|
+
rowsRead: wrote ? 0 : n,
|
|
52
|
+
rowsWritten: wrote ? n : 0
|
|
53
|
+
}), ()=>({
|
|
54
|
+
rows: n
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
let d = {
|
|
58
|
+
query,
|
|
59
|
+
render,
|
|
60
|
+
stored,
|
|
61
|
+
inTransaction: opts.inTransaction,
|
|
62
|
+
file: opts.file,
|
|
63
|
+
statistics: opts.file ? 'sampled' : undefined,
|
|
64
|
+
arms: STOCK,
|
|
65
|
+
stable: true
|
|
66
|
+
};
|
|
67
|
+
return d;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=driver.js.map
|
package/driver.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.js","sources":["./driver.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,SAAS,OAAO,EAAE,IAAI,EAAE,IAAI,2BAAgC;AAE5D,SACE,SAAS,EAET,OAAO,EACP,OAAO,EAEP,YAAY,EAEZ,SAAS,EAET,KAAK,EACL,WAAW,EACX,eAAe,EACf,OAAO,8BACyB;AAElC,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,wEAAwE;AACxE,IAAI,SACF,CAAC,MACD,CAAC,KAAa;IACZ,IAAI;MACF,OAAO,IAAI,KAAK;IAClB,EAAE,OAAO,OAAO;MACd,MAAM,iBAAiB,QACnB,OAAO,MAAM,CAAC,OAAO;QAAE,WAAW;MAAI,KACtC;IACN;EACF;AAEF,kDAAkD;AAClD,IAAI,SAAS,CAAC,GAAS,IACrB,aAAa,GAAG,iBAAiB,aAAa;AAEhD,OAAO,IAAI,SAAS,CAClB,KACA;EAOA,IAAI,MAAM,OAAO;EACjB,IAAI,SAAwB,CAAC;EAC7B,uEAAuE;EACvE,4CAA4C;EAC5C,IAAI,QAAQ,CAAC,IACX,QAAQ,IAAM,UAAU,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,OAAO,CAAC;EACxD,IAAI,MAAM,CAAC;IACT,KAAK,MAAM,GAAG;IACd,IAAI,EAAE,CAAC,IAAI,cAAc,EAAE,QAAQ,IAAI,KAAK,aAAa,SAAS,OAAO;MACvE,OAAO,EAAE;IACX;IACA,0EAA0E;IAC1E,gEAAgE;IAChE,IAAI,WAAW,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IACtD,IAAI,KAAK;IACT,IAAI,IAAI,IAAI,WAAW,KAAK;IAC5B,IAAI,CAAC,GAAG,OAAO,IAAI,KAAK;IACxB,IAAI,QAAQ,QAAQ,IAAI,IAAI;IAC5B,OAAO,KACL,EAAE,KAAK,CAAC;MACN,MAAM;MACN,MAAM,UAAU;MAChB,SAAS;MACT,QAAQ,IAAI,WAAW,IAAI,GAAG,MAAM,GAAG;MACvC,KAAK,QAAQ;IACf,IACA;MACE,IAAI,OAAO,IAAI,KAAK;MACpB,IAAI,QAAQ,KAAK,OAAO,QAAQ,IAAI,KAAK,MAAM;MAC/C,OAAO;IACT,GACA,IAAM,CAAC;QACL,YAAY;QACZ,UAAU,QAAQ,IAAI;QACtB,aAAa,QAAQ,IAAI;MAC3B,CAAC,GACD,IAAM,CAAC;QAAE,MAAM;MAAE,CAAC;EAEtB;EACA,IAAI,IAAY;IACd;IACA;IACA;IACA,eAAe,KAAK,aAAa;IACjC,MAAM,KAAK,IAAI;IACf,YAAY,KAAK,IAAI,GAAG,YAAY;IACpC,MAAM;IACN,QAAQ;EACV;EACA,OAAO;AACT,EAAC"}
|
package/driver.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Statements and tracing are shared by the native writer and file reader;
|
|
2
|
+
// preparing, binding and decoding belong to their engine boundaries.
|
|
3
|
+
import { context, leaf, peek } from '@yaks/trace'
|
|
4
|
+
import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
5
|
+
import {
|
|
6
|
+
asWritten,
|
|
7
|
+
type Driver,
|
|
8
|
+
excerpt,
|
|
9
|
+
labeled,
|
|
10
|
+
type Param,
|
|
11
|
+
renderStable,
|
|
12
|
+
type Row,
|
|
13
|
+
statement,
|
|
14
|
+
type Stmt,
|
|
15
|
+
STOCK,
|
|
16
|
+
STOCK_DEPTH,
|
|
17
|
+
STOCK_VARIABLES,
|
|
18
|
+
writing,
|
|
19
|
+
} from '@yaks/sql/core'
|
|
20
|
+
|
|
21
|
+
// A statement SQLite will not compile or run says which it was: the message
|
|
22
|
+
// names the fault, and only the statement shows where it is, once the error
|
|
23
|
+
// has crossed a worker and reached its caller and the tracker (its enumerable
|
|
24
|
+
// properties do). A kept statement is compiled again at its step when the
|
|
25
|
+
// schema moved under it, so a fault of compiling can surface there too.
|
|
26
|
+
let naming =
|
|
27
|
+
(run: (sql: string, params: Param[]) => Row[]) =>
|
|
28
|
+
(sql: string, params: Param[]): Row[] => {
|
|
29
|
+
try {
|
|
30
|
+
return run(sql, params)
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw error instanceof Error
|
|
33
|
+
? Object.assign(error, { statement: sql })
|
|
34
|
+
: error
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// An embedded SQLite's limits are the stock ones.
|
|
39
|
+
let render = (s: Stmt, v?: Vocab) =>
|
|
40
|
+
renderStable(s, STOCK_VARIABLES, STOCK_DEPTH, v)
|
|
41
|
+
|
|
42
|
+
export let driver = (
|
|
43
|
+
ran: (sql: string, params: Param[]) => Row[],
|
|
44
|
+
opts: {
|
|
45
|
+
file: boolean
|
|
46
|
+
before?: (s: Stmt) => void
|
|
47
|
+
changes?: () => number
|
|
48
|
+
inTransaction?: () => boolean
|
|
49
|
+
},
|
|
50
|
+
): Driver => {
|
|
51
|
+
let run = naming(ran)
|
|
52
|
+
let stored: { v?: Vocab } = {}
|
|
53
|
+
// Rows come back, and a refusal is told, under the names the statement
|
|
54
|
+
// wrote (@yaks/sql `asWritten`, `labeled`).
|
|
55
|
+
let query = (s: Stmt): Row[] =>
|
|
56
|
+
labeled(() => asWritten(s, ask(s), stored.v), stored.v)
|
|
57
|
+
let ask = (s: Stmt): Row[] => {
|
|
58
|
+
opts.before?.(s)
|
|
59
|
+
if (s.t == 'rollback' && s.ifActive && opts.inTransaction?.() === false) {
|
|
60
|
+
return []
|
|
61
|
+
}
|
|
62
|
+
// Each statement is kept by its text (./native.ts `prepared`), and a list
|
|
63
|
+
// costs no rows here: every collection binds as one JSON array.
|
|
64
|
+
let rendered = render(s, stored.v), { sql, params } = rendered
|
|
65
|
+
let at = context()
|
|
66
|
+
let c = at?.channel ?? peek(d)
|
|
67
|
+
if (!c) return run(sql, params)
|
|
68
|
+
let wrote = writing(s), n = 0
|
|
69
|
+
return leaf(
|
|
70
|
+
c.begin({
|
|
71
|
+
kind: 'sql',
|
|
72
|
+
name: statement(s),
|
|
73
|
+
package: '@yaks/sqlite',
|
|
74
|
+
parent: at?.channel == c ? at.parent : undefined,
|
|
75
|
+
sql: excerpt(rendered),
|
|
76
|
+
}),
|
|
77
|
+
() => {
|
|
78
|
+
let rows = run(sql, params)
|
|
79
|
+
n = wrote ? opts.changes?.() ?? 0 : rows.length
|
|
80
|
+
return rows
|
|
81
|
+
},
|
|
82
|
+
() => ({
|
|
83
|
+
statements: 1,
|
|
84
|
+
rowsRead: wrote ? 0 : n,
|
|
85
|
+
rowsWritten: wrote ? n : 0,
|
|
86
|
+
}),
|
|
87
|
+
() => ({ rows: n }),
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
let d: Driver = {
|
|
91
|
+
query,
|
|
92
|
+
render,
|
|
93
|
+
stored,
|
|
94
|
+
inTransaction: opts.inTransaction,
|
|
95
|
+
file: opts.file,
|
|
96
|
+
statistics: opts.file ? 'sampled' : undefined,
|
|
97
|
+
arms: STOCK,
|
|
98
|
+
stable: true,
|
|
99
|
+
}
|
|
100
|
+
return d
|
|
101
|
+
}
|
package/error.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Lock contention is recoverable only where no transaction has started.
|
|
2
|
+
export let busy = (e)=>e instanceof Error && /database is (locked|busy)/.test(e.message);
|
|
3
|
+
/** A file SQLite cannot read as a database: its pages or its header are
|
|
4
|
+
* damaged. Rebuildable data in it is discarded, never repaired. */ export let malformed = (e)=>e instanceof Error && /database disk image is malformed|file is not a database/.test(e.message);
|
|
5
|
+
/** A stored entity has no archetype. The writer reports and classifies it
|
|
6
|
+
* before retrying; a reader cannot discover its components instead. */ export class Unpointed extends Error {
|
|
7
|
+
eids;
|
|
8
|
+
constructor(eids){
|
|
9
|
+
super(`${eids.length} ${eids.length == 1 ? 'entity has' : 'entities have'} ` + `no archetype: ${eids.slice(0, 8).join(', ')}`), this.eids = eids;
|
|
10
|
+
this.name = 'Unpointed';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** A write whose body went async inside a transaction that commits when the
|
|
14
|
+
* body returns (`Driver.tx`, a Durable Object's `transactionSync`): what it
|
|
15
|
+
* did before its first `await` committed then, and the rest ran outside any
|
|
16
|
+
* transaction, so a later throw rolled none of it back. One wording, so it is
|
|
17
|
+
* one bug wherever it happens. Its stack is the write's, deep enough to pass
|
|
18
|
+
* the driver's wrappers and reach the code that asked for the write. */ export let halfway = ()=>{
|
|
19
|
+
let errors = Error;
|
|
20
|
+
let limit = errors.stackTraceLimit;
|
|
21
|
+
errors.stackTraceLimit = 50;
|
|
22
|
+
try {
|
|
23
|
+
return Object.assign(new Error('a write went async inside a transaction that commits when its body ' + 'returns: what it did after its first await is outside the ' + 'transaction'), {
|
|
24
|
+
name: 'Halfway'
|
|
25
|
+
});
|
|
26
|
+
} finally{
|
|
27
|
+
errors.stackTraceLimit = limit;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=error.js.map
|
package/error.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sources":["./error.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,IAAI,OAAO,CAAC,IACjB,aAAa,SAAS,4BAA4B,IAAI,CAAC,EAAE,OAAO,EAAC;AAEnE;iEACiE,GACjE,OAAO,IAAI,YAAY,CAAC,IACtB,aAAa,SACb,0DAA0D,IAAI,CAAC,EAAE,OAAO,EAAC;AAE3E;qEACqE,GACrE,OAAO,MAAM,kBAAkB;;EAC7B,YAAY,AAAS,IAAc,CAAE;IACnC,KAAK,CACH,GAAG,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM,IAAI,IAAI,eAAe,gBAAgB,CAAC,CAAC,GACpE,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,QAH/B,OAAA;IAKnB,IAAI,CAAC,IAAI,GAAG;EACd;AACF;AAEA;;;;;sEAKsE,GACtE,OAAO,IAAI,UAAU;EACnB,IAAI,SAAS;EACb,IAAI,QAAQ,OAAO,eAAe;EAClC,OAAO,eAAe,GAAG;EACzB,IAAI;IACF,OAAO,OAAO,MAAM,CAClB,IAAI,MACF,wEACE,+DACA,gBAEJ;MAAE,MAAM;IAAU;EAEtB,SAAU;IACR,OAAO,eAAe,GAAG;EAC3B;AACF,EAAC"}
|
package/error.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Lock contention is recoverable only where no transaction has started.
|
|
2
|
+
|
|
3
|
+
export let busy = (e: unknown): e is Error =>
|
|
4
|
+
e instanceof Error && /database is (locked|busy)/.test(e.message)
|
|
5
|
+
|
|
6
|
+
/** A file SQLite cannot read as a database: its pages or its header are
|
|
7
|
+
* damaged. Rebuildable data in it is discarded, never repaired. */
|
|
8
|
+
export let malformed = (e: unknown): e is Error =>
|
|
9
|
+
e instanceof Error &&
|
|
10
|
+
/database disk image is malformed|file is not a database/.test(e.message)
|
|
11
|
+
|
|
12
|
+
/** A stored entity has no archetype. The writer reports and classifies it
|
|
13
|
+
* before retrying; a reader cannot discover its components instead. */
|
|
14
|
+
export class Unpointed extends Error {
|
|
15
|
+
constructor(readonly eids: string[]) {
|
|
16
|
+
super(
|
|
17
|
+
`${eids.length} ${eids.length == 1 ? 'entity has' : 'entities have'} ` +
|
|
18
|
+
`no archetype: ${eids.slice(0, 8).join(', ')}`,
|
|
19
|
+
)
|
|
20
|
+
this.name = 'Unpointed'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A write whose body went async inside a transaction that commits when the
|
|
25
|
+
* body returns (`Driver.tx`, a Durable Object's `transactionSync`): what it
|
|
26
|
+
* did before its first `await` committed then, and the rest ran outside any
|
|
27
|
+
* transaction, so a later throw rolled none of it back. One wording, so it is
|
|
28
|
+
* one bug wherever it happens. Its stack is the write's, deep enough to pass
|
|
29
|
+
* the driver's wrappers and reach the code that asked for the write. */
|
|
30
|
+
export let halfway = (): Error => {
|
|
31
|
+
let errors = Error as ErrorConstructor & { stackTraceLimit?: number }
|
|
32
|
+
let limit = errors.stackTraceLimit
|
|
33
|
+
errors.stackTraceLimit = 50
|
|
34
|
+
try {
|
|
35
|
+
return Object.assign(
|
|
36
|
+
new Error(
|
|
37
|
+
'a write went async inside a transaction that commits when its body ' +
|
|
38
|
+
'returns: what it did after its first await is outside the ' +
|
|
39
|
+
'transaction',
|
|
40
|
+
),
|
|
41
|
+
{ name: 'Halfway' },
|
|
42
|
+
)
|
|
43
|
+
} finally {
|
|
44
|
+
errors.stackTraceLimit = limit
|
|
45
|
+
}
|
|
46
|
+
}
|
package/ffi/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 2022 DjDeveloperr
|
|
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.
|