@inerrata-corporation/errata 2.0.14-dev.3165 → 2.0.14-dev.3236
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/consolidate-worker.mjs +25 -4
- package/errata.mjs +557 -534
- package/package.json +1 -1
- package/pass-worker.mjs +25 -4
package/consolidate-worker.mjs
CHANGED
|
@@ -15735,6 +15735,13 @@ var init_triage_canon = __esm({
|
|
|
15735
15735
|
}
|
|
15736
15736
|
});
|
|
15737
15737
|
|
|
15738
|
+
// ../../packages/shared/src/project-wire-attrs.ts
|
|
15739
|
+
var init_project_wire_attrs = __esm({
|
|
15740
|
+
"../../packages/shared/src/project-wire-attrs.ts"() {
|
|
15741
|
+
"use strict";
|
|
15742
|
+
}
|
|
15743
|
+
});
|
|
15744
|
+
|
|
15738
15745
|
// ../../packages/shared/src/index.ts
|
|
15739
15746
|
var init_src = __esm({
|
|
15740
15747
|
"../../packages/shared/src/index.ts"() {
|
|
@@ -15764,6 +15771,7 @@ var init_src = __esm({
|
|
|
15764
15771
|
init_taxonomy();
|
|
15765
15772
|
init_triage_canon();
|
|
15766
15773
|
init_history_text();
|
|
15774
|
+
init_project_wire_attrs();
|
|
15767
15775
|
}
|
|
15768
15776
|
});
|
|
15769
15777
|
|
|
@@ -16144,9 +16152,10 @@ init_src();
|
|
|
16144
16152
|
|
|
16145
16153
|
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
16146
16154
|
function installHistoryCacheFloor(db) {
|
|
16147
|
-
const key = "history-cache-withdrawal-floor-
|
|
16155
|
+
const key = "history-cache-withdrawal-floor-3";
|
|
16148
16156
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
16149
16157
|
db.transaction(() => {
|
|
16158
|
+
db.exec("DROP TRIGGER IF EXISTS history_cache_nodes_insert; DROP TRIGGER IF EXISTS history_cache_nodes_update;");
|
|
16150
16159
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
16151
16160
|
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
16152
16161
|
}
|
|
@@ -16164,9 +16173,10 @@ function installHistoryCacheFloor(db) {
|
|
|
16164
16173
|
`);
|
|
16165
16174
|
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
16166
16175
|
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
16167
|
-
const
|
|
16176
|
+
const source = `coalesce(json_extract(attrs_json, '$.extractionSource'), extraction_source)`;
|
|
16177
|
+
const description = `CASE WHEN ${privacy} THEN CASE WHEN ${source} = 'history-mined' THEN 'History source withdrawn.' ELSE 'Cloud source withdrawn.' END ELSE description END`;
|
|
16168
16178
|
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
16169
|
-
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource',
|
|
16179
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', ${source},
|
|
16170
16180
|
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
16171
16181
|
'historyCorrectionSeq', ${lookup("seq")})
|
|
16172
16182
|
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
@@ -16179,11 +16189,22 @@ function installHistoryCacheFloor(db) {
|
|
|
16179
16189
|
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
16180
16190
|
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
16181
16191
|
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
16192
|
+
const internal = `key IN ('orgId','teamId','groupId','projectId','aliasTexts','aliasCanonicalIds')
|
|
16193
|
+
OR key GLOB 'mergedFrom*' OR key GLOB '*WitnessKeys' OR key GLOB '*Sessions'
|
|
16194
|
+
OR key GLOB 'authoringSession*' OR key GLOB 'contributor*' OR key GLOB 'witnessKeys*'`;
|
|
16195
|
+
const stripMetadata = (scope) => `UPDATE nodes SET attrs_json=(
|
|
16196
|
+
SELECT json_group_object(key, CASE WHEN type IN ('array','object') THEN json(value)
|
|
16197
|
+
WHEN type IN ('true','false') THEN json(type) ELSE value END)
|
|
16198
|
+
FROM json_each(nodes.attrs_json) WHERE NOT (${internal}))
|
|
16199
|
+
WHERE (${scope}) AND json_extract(attrs_json,'$.source')='cloud'
|
|
16200
|
+
AND EXISTS(SELECT 1 FROM store_meta m WHERE m.key='history-correction:' || coalesce(json_extract(nodes.attrs_json,'$.cloudNodeId'),nodes.id) AND json_valid(m.value))
|
|
16201
|
+
AND EXISTS(SELECT 1 FROM json_each(nodes.attrs_json) WHERE ${internal});`;
|
|
16182
16202
|
for (const operation of ["INSERT", "UPDATE"]) {
|
|
16183
16203
|
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
16184
|
-
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
16204
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} ${stripMetadata("id = NEW.id")} END;`);
|
|
16185
16205
|
}
|
|
16186
16206
|
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
16207
|
+
db.exec(stripMetadata("1=1"));
|
|
16187
16208
|
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
16188
16209
|
});
|
|
16189
16210
|
}
|