@duckcodeailabs/dql-project 0.8.16 → 0.10.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest-cache.d.ts +63 -0
- package/dist/manifest-cache.d.ts.map +1 -0
- package/dist/manifest-cache.js +150 -0
- package/dist/manifest-cache.js.map +1 -0
- package/dist/manifest-cache.test.d.ts +2 -0
- package/dist/manifest-cache.test.d.ts.map +1 -0
- package/dist/manifest-cache.test.js +95 -0
- package/dist/manifest-cache.test.js.map +1 -0
- package/package.json +10 -9
- package/LICENSE +0 -123
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export { RegistrySync } from './sync.js';
|
|
|
5
5
|
export type { SyncResult, SyncOptions, ParsedBlock } from './sync.js';
|
|
6
6
|
export { MemoryStorage } from './memory-storage.js';
|
|
7
7
|
export { SQLiteStorage } from './sqlite-storage.js';
|
|
8
|
+
export { ManifestCache } from './manifest-cache.js';
|
|
9
|
+
export type { TrackedFile, CacheHit, CacheMiss, CacheLookup, ManifestCacheOptions, } from './manifest-cache.js';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { VersionManager } from './version-manager.js';
|
|
|
3
3
|
export { RegistrySync } from './sync.js';
|
|
4
4
|
export { MemoryStorage } from './memory-storage.js';
|
|
5
5
|
export { SQLiteStorage } from './sqlite-storage.js';
|
|
6
|
+
export { ManifestCache } from './manifest-cache.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** A tracked input file — the cache hashes its mtime+size cheaply, content on demand. */
|
|
2
|
+
export interface TrackedFile {
|
|
3
|
+
/** Relative path from project root (stable cache key component). */
|
|
4
|
+
path: string;
|
|
5
|
+
/** SHA-256 of file contents. Computed by the cache if omitted. */
|
|
6
|
+
contentHash?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Result of a fingerprint lookup. */
|
|
9
|
+
export interface CacheHit<T> {
|
|
10
|
+
hit: true;
|
|
11
|
+
value: T;
|
|
12
|
+
fingerprint: string;
|
|
13
|
+
builtAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CacheMiss {
|
|
16
|
+
hit: false;
|
|
17
|
+
/** Files whose content hash differs from the last stored build (empty if this is a cold cache). */
|
|
18
|
+
changedFiles: string[];
|
|
19
|
+
}
|
|
20
|
+
export type CacheLookup<T> = CacheHit<T> | CacheMiss;
|
|
21
|
+
export interface ManifestCacheOptions {
|
|
22
|
+
/** Path to the SQLite file. Caller is responsible for choosing a project-scoped location. */
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* SQLite-backed cache for compiled manifests.
|
|
27
|
+
*
|
|
28
|
+
* Schema
|
|
29
|
+
* - `manifest_entries`: one row per fingerprint, holds the serialized manifest
|
|
30
|
+
* - `file_hashes`: the last-seen content hash for each tracked file, used to
|
|
31
|
+
* compute a dirty set on cold paths
|
|
32
|
+
*/
|
|
33
|
+
export declare class ManifestCache {
|
|
34
|
+
private db;
|
|
35
|
+
constructor(options: ManifestCacheOptions);
|
|
36
|
+
private initSchema;
|
|
37
|
+
/**
|
|
38
|
+
* Compute a stable fingerprint over a set of tracked files. The caller
|
|
39
|
+
* should include every file whose contents could change the manifest
|
|
40
|
+
* (all `.dql`, `.dqlnb`, semantic YAML, and dbt `manifest.json`).
|
|
41
|
+
*
|
|
42
|
+
* Fingerprint = sha256 of `path\0hash\n` joined for a lexicographically
|
|
43
|
+
* sorted file list. Missing content hashes are filled in from disk.
|
|
44
|
+
*/
|
|
45
|
+
fingerprint(files: TrackedFile[]): string;
|
|
46
|
+
/**
|
|
47
|
+
* Look up a previously-cached manifest by fingerprint. On miss, returns the
|
|
48
|
+
* set of file paths whose current content hash differs from the last stored
|
|
49
|
+
* hash — callers can use this to rebuild only affected subgraphs.
|
|
50
|
+
*/
|
|
51
|
+
lookup<T>(fingerprint: string, files: TrackedFile[]): CacheLookup<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Persist a newly-built manifest under `fingerprint`, and record the per-file
|
|
54
|
+
* content hashes so the next miss can report a precise dirty set.
|
|
55
|
+
*/
|
|
56
|
+
put<T>(fingerprint: string, value: T, files: TrackedFile[]): void;
|
|
57
|
+
/** Return the files whose current content hash differs from the stored one. */
|
|
58
|
+
diffFiles(files: TrackedFile[]): string[];
|
|
59
|
+
/** Clear all cached manifests and file hashes. Useful for `dql compile --no-cache`. */
|
|
60
|
+
clear(): void;
|
|
61
|
+
close(): void;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=manifest-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-cache.d.ts","sourceRoot":"","sources":["../src/manifest-cache.ts"],"names":[],"mappings":"AAkBA,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,sCAAsC;AACtC,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,EAAE,IAAI,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,KAAK,CAAC;IACX,mGAAmG;IACnG,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AACD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;CACd;AAOD;;;;;;;GAOG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAAoB;gBAElB,OAAO,EAAE,oBAAoB;IAOzC,OAAO,CAAC,UAAU;IAgBlB;;;;;;;OAOG;IACH,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM;IAezC;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;IAiBpE;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI;IAuBjE,+EAA+E;IAC/E,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE;IAgBzC,uFAAuF;IACvF,KAAK,IAAI,IAAI;IAIb,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest cache — persistent, hash-keyed store for compiled DQLManifest artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Lives at `.dql/cache/manifest.sqlite` by default. Keyed by a deterministic
|
|
5
|
+
* fingerprint over every input file that contributed to the build (all `.dql`,
|
|
6
|
+
* `.dqlnb`, semantic YAML, and the dbt `manifest.json`). A cache hit returns
|
|
7
|
+
* the previous manifest JSON untouched; a miss signals the builder to do a
|
|
8
|
+
* full rebuild and `put()` the result.
|
|
9
|
+
*
|
|
10
|
+
* File-level hashes are stored separately so callers (e.g. `dql sync dbt`,
|
|
11
|
+
* incremental rebuilders) can detect *which* files changed since last build
|
|
12
|
+
* without reading every file's contents.
|
|
13
|
+
*/
|
|
14
|
+
import Database from 'better-sqlite3';
|
|
15
|
+
import { createHash } from 'node:crypto';
|
|
16
|
+
import { readFileSync, statSync, mkdirSync, existsSync } from 'node:fs';
|
|
17
|
+
import { dirname } from 'node:path';
|
|
18
|
+
/**
|
|
19
|
+
* SQLite-backed cache for compiled manifests.
|
|
20
|
+
*
|
|
21
|
+
* Schema
|
|
22
|
+
* - `manifest_entries`: one row per fingerprint, holds the serialized manifest
|
|
23
|
+
* - `file_hashes`: the last-seen content hash for each tracked file, used to
|
|
24
|
+
* compute a dirty set on cold paths
|
|
25
|
+
*/
|
|
26
|
+
export class ManifestCache {
|
|
27
|
+
db;
|
|
28
|
+
constructor(options) {
|
|
29
|
+
ensureDirExists(options.path);
|
|
30
|
+
this.db = new Database(options.path);
|
|
31
|
+
this.db.pragma('journal_mode = WAL');
|
|
32
|
+
this.initSchema();
|
|
33
|
+
}
|
|
34
|
+
initSchema() {
|
|
35
|
+
this.db.exec(`
|
|
36
|
+
CREATE TABLE IF NOT EXISTS manifest_entries (
|
|
37
|
+
fingerprint TEXT PRIMARY KEY,
|
|
38
|
+
payload TEXT NOT NULL,
|
|
39
|
+
built_at TEXT NOT NULL
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
CREATE TABLE IF NOT EXISTS file_hashes (
|
|
43
|
+
path TEXT PRIMARY KEY,
|
|
44
|
+
content_hash TEXT NOT NULL,
|
|
45
|
+
updated_at TEXT NOT NULL
|
|
46
|
+
);
|
|
47
|
+
`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compute a stable fingerprint over a set of tracked files. The caller
|
|
51
|
+
* should include every file whose contents could change the manifest
|
|
52
|
+
* (all `.dql`, `.dqlnb`, semantic YAML, and dbt `manifest.json`).
|
|
53
|
+
*
|
|
54
|
+
* Fingerprint = sha256 of `path\0hash\n` joined for a lexicographically
|
|
55
|
+
* sorted file list. Missing content hashes are filled in from disk.
|
|
56
|
+
*/
|
|
57
|
+
fingerprint(files) {
|
|
58
|
+
const resolved = files
|
|
59
|
+
.map((f) => ({ path: f.path, contentHash: f.contentHash ?? hashFile(f.path) }))
|
|
60
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
61
|
+
const hash = createHash('sha256');
|
|
62
|
+
for (const f of resolved) {
|
|
63
|
+
hash.update(f.path);
|
|
64
|
+
hash.update('\0');
|
|
65
|
+
hash.update(f.contentHash);
|
|
66
|
+
hash.update('\n');
|
|
67
|
+
}
|
|
68
|
+
return hash.digest('hex');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Look up a previously-cached manifest by fingerprint. On miss, returns the
|
|
72
|
+
* set of file paths whose current content hash differs from the last stored
|
|
73
|
+
* hash — callers can use this to rebuild only affected subgraphs.
|
|
74
|
+
*/
|
|
75
|
+
lookup(fingerprint, files) {
|
|
76
|
+
const row = this.db
|
|
77
|
+
.prepare('SELECT payload, built_at FROM manifest_entries WHERE fingerprint = ?')
|
|
78
|
+
.get(fingerprint);
|
|
79
|
+
if (row) {
|
|
80
|
+
return {
|
|
81
|
+
hit: true,
|
|
82
|
+
value: JSON.parse(row.payload),
|
|
83
|
+
fingerprint,
|
|
84
|
+
builtAt: row.built_at,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { hit: false, changedFiles: this.diffFiles(files) };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Persist a newly-built manifest under `fingerprint`, and record the per-file
|
|
91
|
+
* content hashes so the next miss can report a precise dirty set.
|
|
92
|
+
*/
|
|
93
|
+
put(fingerprint, value, files) {
|
|
94
|
+
const now = new Date().toISOString();
|
|
95
|
+
const payload = JSON.stringify(value);
|
|
96
|
+
const resolved = files.map((f) => ({
|
|
97
|
+
path: f.path,
|
|
98
|
+
content_hash: f.contentHash ?? hashFile(f.path),
|
|
99
|
+
}));
|
|
100
|
+
const writeEntry = this.db.prepare('INSERT OR REPLACE INTO manifest_entries (fingerprint, payload, built_at) VALUES (?, ?, ?)');
|
|
101
|
+
const writeFile = this.db.prepare('INSERT OR REPLACE INTO file_hashes (path, content_hash, updated_at) VALUES (?, ?, ?)');
|
|
102
|
+
const tx = this.db.transaction(() => {
|
|
103
|
+
writeEntry.run(fingerprint, payload, now);
|
|
104
|
+
for (const f of resolved)
|
|
105
|
+
writeFile.run(f.path, f.content_hash, now);
|
|
106
|
+
});
|
|
107
|
+
tx();
|
|
108
|
+
}
|
|
109
|
+
/** Return the files whose current content hash differs from the stored one. */
|
|
110
|
+
diffFiles(files) {
|
|
111
|
+
if (files.length === 0)
|
|
112
|
+
return [];
|
|
113
|
+
const stored = new Map();
|
|
114
|
+
const rows = this.db.prepare('SELECT path, content_hash FROM file_hashes').all();
|
|
115
|
+
for (const r of rows)
|
|
116
|
+
stored.set(r.path, r.content_hash);
|
|
117
|
+
const changed = [];
|
|
118
|
+
for (const f of files) {
|
|
119
|
+
const current = f.contentHash ?? hashFile(f.path);
|
|
120
|
+
const prior = stored.get(f.path);
|
|
121
|
+
if (prior !== current)
|
|
122
|
+
changed.push(f.path);
|
|
123
|
+
}
|
|
124
|
+
return changed;
|
|
125
|
+
}
|
|
126
|
+
/** Clear all cached manifests and file hashes. Useful for `dql compile --no-cache`. */
|
|
127
|
+
clear() {
|
|
128
|
+
this.db.exec('DELETE FROM manifest_entries; DELETE FROM file_hashes;');
|
|
129
|
+
}
|
|
130
|
+
close() {
|
|
131
|
+
this.db.close();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Compute sha256 of a file's contents. Returns a sentinel if the file is missing. */
|
|
135
|
+
function hashFile(path) {
|
|
136
|
+
try {
|
|
137
|
+
// stat first so we can short-circuit on zero-byte files without reading
|
|
138
|
+
statSync(path);
|
|
139
|
+
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return 'missing';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function ensureDirExists(filePath) {
|
|
146
|
+
const dir = dirname(filePath);
|
|
147
|
+
if (!existsSync(dir))
|
|
148
|
+
mkdirSync(dir, { recursive: true });
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=manifest-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-cache.js","sourceRoot":"","sources":["../src/manifest-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCpC;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IAChB,EAAE,CAAoB;IAE9B,YAAY,OAA6B;QACvC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QA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M,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-cache.test.d.ts","sourceRoot":"","sources":["../src/manifest-cache.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { ManifestCache } from './manifest-cache.js';
|
|
6
|
+
describe('ManifestCache', () => {
|
|
7
|
+
let tmpDir;
|
|
8
|
+
let dbPath;
|
|
9
|
+
let cache;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
tmpDir = mkdtempSync(join(tmpdir(), 'dql-cache-'));
|
|
12
|
+
dbPath = join(tmpDir, 'cache', 'manifest.sqlite');
|
|
13
|
+
cache = new ManifestCache({ path: dbPath });
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cache.close();
|
|
17
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
function writeFile(name, content) {
|
|
20
|
+
const p = join(tmpDir, name);
|
|
21
|
+
writeFileSync(p, content, 'utf-8');
|
|
22
|
+
return p;
|
|
23
|
+
}
|
|
24
|
+
it('creates the SQLite file on first use', () => {
|
|
25
|
+
// Constructor already ran — if file is missing, lookup would throw.
|
|
26
|
+
const lookup = cache.lookup('nope', []);
|
|
27
|
+
expect(lookup.hit).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
it('miss on empty cache returns no changed files when none tracked', () => {
|
|
30
|
+
const result = cache.lookup('abc', []);
|
|
31
|
+
expect(result).toEqual({ hit: false, changedFiles: [] });
|
|
32
|
+
});
|
|
33
|
+
it('roundtrips a manifest payload under its fingerprint', () => {
|
|
34
|
+
const a = writeFile('a.dql', 'block a {}');
|
|
35
|
+
const b = writeFile('b.dql', 'block b {}');
|
|
36
|
+
const files = [{ path: a }, { path: b }];
|
|
37
|
+
const fp = cache.fingerprint(files);
|
|
38
|
+
const manifest = { project: 'demo', blocks: { a: {}, b: {} } };
|
|
39
|
+
cache.put(fp, manifest, files);
|
|
40
|
+
const result = cache.lookup(fp, files);
|
|
41
|
+
expect(result.hit).toBe(true);
|
|
42
|
+
if (result.hit) {
|
|
43
|
+
expect(result.value).toEqual(manifest);
|
|
44
|
+
expect(result.fingerprint).toBe(fp);
|
|
45
|
+
expect(result.builtAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
it('produces a different fingerprint when a file changes', () => {
|
|
49
|
+
const a = writeFile('a.dql', 'v1');
|
|
50
|
+
const fp1 = cache.fingerprint([{ path: a }]);
|
|
51
|
+
writeFileSync(a, 'v2', 'utf-8');
|
|
52
|
+
const fp2 = cache.fingerprint([{ path: a }]);
|
|
53
|
+
expect(fp1).not.toBe(fp2);
|
|
54
|
+
});
|
|
55
|
+
it('fingerprint is stable regardless of input file order', () => {
|
|
56
|
+
const a = writeFile('a.dql', 'aaa');
|
|
57
|
+
const b = writeFile('b.dql', 'bbb');
|
|
58
|
+
const fp1 = cache.fingerprint([{ path: a }, { path: b }]);
|
|
59
|
+
const fp2 = cache.fingerprint([{ path: b }, { path: a }]);
|
|
60
|
+
expect(fp1).toBe(fp2);
|
|
61
|
+
});
|
|
62
|
+
it('diffFiles reports which specific files changed since last put', () => {
|
|
63
|
+
const a = writeFile('a.dql', 'v1');
|
|
64
|
+
const b = writeFile('b.dql', 'v1');
|
|
65
|
+
const files = [{ path: a }, { path: b }];
|
|
66
|
+
cache.put(cache.fingerprint(files), { any: true }, files);
|
|
67
|
+
writeFileSync(b, 'v2-changed', 'utf-8');
|
|
68
|
+
const changed = cache.diffFiles(files);
|
|
69
|
+
expect(changed).toEqual([b]);
|
|
70
|
+
});
|
|
71
|
+
it('missing files hash to a sentinel so their absence is cacheable', () => {
|
|
72
|
+
const ghost = join(tmpDir, 'does-not-exist.dql');
|
|
73
|
+
const fp1 = cache.fingerprint([{ path: ghost }]);
|
|
74
|
+
const fp2 = cache.fingerprint([{ path: ghost }]);
|
|
75
|
+
expect(fp1).toBe(fp2);
|
|
76
|
+
});
|
|
77
|
+
it('clear() removes all entries and file hashes', () => {
|
|
78
|
+
const a = writeFile('a.dql', 'x');
|
|
79
|
+
const files = [{ path: a }];
|
|
80
|
+
const fp = cache.fingerprint(files);
|
|
81
|
+
cache.put(fp, { ok: 1 }, files);
|
|
82
|
+
cache.clear();
|
|
83
|
+
const result = cache.lookup(fp, files);
|
|
84
|
+
expect(result.hit).toBe(false);
|
|
85
|
+
expect(cache.diffFiles(files)).toEqual([a]); // a is now "new" again
|
|
86
|
+
});
|
|
87
|
+
it('accepts a caller-supplied content hash and does not read the file', () => {
|
|
88
|
+
const ghost = join(tmpDir, 'never-created.dql');
|
|
89
|
+
const fp = cache.fingerprint([{ path: ghost, contentHash: 'deadbeef' }]);
|
|
90
|
+
// Same precomputed hash → same fingerprint, even though the file doesn't exist
|
|
91
|
+
const fp2 = cache.fingerprint([{ path: ghost, contentHash: 'deadbeef' }]);
|
|
92
|
+
expect(fp).toBe(fp2);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=manifest-cache.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-cache.test.js","sourceRoot":"","sources":["../src/manifest-cache.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,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KAAK,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAEhC,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAChD,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACzE,+EAA+E;QAC/E,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duckcodeailabs/dql-project",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "DQL project and block registry primitives: block metadata, versions, sync, and storage adapters",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -b",
|
|
17
|
+
"test": "vitest run --passWithNoTests",
|
|
18
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
19
|
+
"prepublishOnly": "pnpm run build"
|
|
20
|
+
},
|
|
15
21
|
"files": [
|
|
16
22
|
"dist"
|
|
17
23
|
],
|
|
@@ -24,8 +30,8 @@
|
|
|
24
30
|
"access": "public"
|
|
25
31
|
},
|
|
26
32
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
33
|
+
"@duckcodeailabs/dql-core": "workspace:*",
|
|
34
|
+
"better-sqlite3": "^11.7.0"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
37
|
"@types/better-sqlite3": "^7.6.0",
|
|
@@ -34,10 +40,5 @@
|
|
|
34
40
|
},
|
|
35
41
|
"engines": {
|
|
36
42
|
"node": ">=18.0.0"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -b",
|
|
40
|
-
"test": "vitest run --passWithNoTests",
|
|
41
|
-
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
42
43
|
}
|
|
43
|
-
}
|
|
44
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
-
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
13
|
-
owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
16
|
-
that control, are controlled by, or are under common control with that entity.
|
|
17
|
-
For the purposes of this definition, "control" means (i) the power, direct or
|
|
18
|
-
indirect, to cause the direction or management of such entity, whether by
|
|
19
|
-
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
-
|
|
22
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
-
permissions granted by this License.
|
|
24
|
-
|
|
25
|
-
"Source" form shall mean the preferred form for making modifications, including
|
|
26
|
-
but not limited to software source code, documentation source, and configuration
|
|
27
|
-
files.
|
|
28
|
-
|
|
29
|
-
"Object" form shall mean any form resulting from mechanical transformation or
|
|
30
|
-
translation of a Source form, including but not limited to compiled object code,
|
|
31
|
-
generated documentation, and conversions to other media types.
|
|
32
|
-
|
|
33
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
|
34
|
-
available under the License, as indicated by a copyright notice that is included
|
|
35
|
-
in or attached to the work.
|
|
36
|
-
|
|
37
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
38
|
-
is based on (or derived from) the Work and for which the editorial revisions,
|
|
39
|
-
annotations, elaborations, or other modifications represent, as a whole, an
|
|
40
|
-
original work of authorship.
|
|
41
|
-
|
|
42
|
-
"Contribution" shall mean any work of authorship, including the original version
|
|
43
|
-
of the Work and any modifications or additions to that Work or Derivative Works
|
|
44
|
-
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
45
|
-
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
46
|
-
on behalf of the copyright owner.
|
|
47
|
-
|
|
48
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
49
|
-
of whom a Contribution has been received by Licensor and subsequently
|
|
50
|
-
incorporated within the Work.
|
|
51
|
-
|
|
52
|
-
2. Grant of Copyright License.
|
|
53
|
-
|
|
54
|
-
Subject to the terms and conditions of this License, each Contributor hereby
|
|
55
|
-
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
56
|
-
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
57
|
-
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
58
|
-
Derivative Works in Source or Object form.
|
|
59
|
-
|
|
60
|
-
3. Grant of Patent License.
|
|
61
|
-
|
|
62
|
-
Subject to the terms and conditions of this License, each Contributor hereby
|
|
63
|
-
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
64
|
-
irrevocable patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
-
and otherwise transfer the Work.
|
|
66
|
-
|
|
67
|
-
4. Redistribution.
|
|
68
|
-
|
|
69
|
-
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
70
|
-
in any medium, with or without modifications, and in Source or Object form,
|
|
71
|
-
provided that You meet the following conditions:
|
|
72
|
-
|
|
73
|
-
(a) You must give any other recipients of the Work or Derivative Works a copy of
|
|
74
|
-
this License; and
|
|
75
|
-
|
|
76
|
-
(b) You must cause any modified files to carry prominent notices stating that
|
|
77
|
-
You changed the files; and
|
|
78
|
-
|
|
79
|
-
(c) You must retain, in the Source form of any Derivative Works that You
|
|
80
|
-
distribute, all copyright, patent, trademark, and attribution notices from the
|
|
81
|
-
Source form of the Work, excluding those notices that do not pertain to any part
|
|
82
|
-
of the Derivative Works; and
|
|
83
|
-
|
|
84
|
-
(d) If the Work includes a "NOTICE" text file as part of its distribution, then
|
|
85
|
-
any Derivative Works that You distribute must include a readable copy of the
|
|
86
|
-
attribution notices contained within such NOTICE file, excluding those notices
|
|
87
|
-
that do not pertain to any part of the Derivative Works.
|
|
88
|
-
|
|
89
|
-
5. Submission of Contributions.
|
|
90
|
-
|
|
91
|
-
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
92
|
-
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
93
|
-
conditions of this License, without any additional terms or conditions.
|
|
94
|
-
|
|
95
|
-
6. Trademarks.
|
|
96
|
-
|
|
97
|
-
This License does not grant permission to use the trade names, trademarks,
|
|
98
|
-
service marks, or product names of the Licensor, except as required for
|
|
99
|
-
reasonable and customary use in describing the origin of the Work.
|
|
100
|
-
|
|
101
|
-
7. Disclaimer of Warranty.
|
|
102
|
-
|
|
103
|
-
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
104
|
-
Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
105
|
-
express or implied, including, without limitation, any warranties or conditions
|
|
106
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
|
|
107
|
-
PURPOSE.
|
|
108
|
-
|
|
109
|
-
8. Limitation of Liability.
|
|
110
|
-
|
|
111
|
-
In no event and under no legal theory, whether in tort (including negligence),
|
|
112
|
-
contract, or otherwise, unless required by applicable law, shall any Contributor
|
|
113
|
-
be liable to You for damages, including any direct, indirect, special,
|
|
114
|
-
incidental, or consequential damages of any character arising as a result of this
|
|
115
|
-
License or out of the use or inability to use the Work.
|
|
116
|
-
|
|
117
|
-
9. Accepting Warranty or Additional Liability.
|
|
118
|
-
|
|
119
|
-
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
120
|
-
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
121
|
-
other liability obligations and/or rights consistent with this License.
|
|
122
|
-
|
|
123
|
-
END OF TERMS AND CONDITIONS
|