@contentrain/query 7.0.15 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -0
- package/dist/astro/index.cjs +142 -0
- package/dist/astro/index.d.cts +81 -0
- package/dist/astro/index.d.cts.map +1 -0
- package/dist/astro/index.d.mts +81 -0
- package/dist/astro/index.d.mts.map +1 -0
- package/dist/astro/index.mjs +143 -0
- package/dist/astro/index.mjs.map +1 -0
- package/dist/cdn/index.d.mts +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/frontmatter-CVjPyhOq.mjs +248 -0
- package/dist/frontmatter-CVjPyhOq.mjs.map +1 -0
- package/dist/frontmatter-DSFLOTwS.cjs +287 -0
- package/dist/{generate-mpKW9Y8v.mjs → generate-B7jooE0f.mjs} +4 -244
- package/dist/generate-B7jooE0f.mjs.map +1 -0
- package/dist/{generate-DN3mAbvC.cjs → generate-D3C6itur.cjs} +14 -254
- package/dist/generator/generate.cjs +1 -1
- package/dist/generator/generate.mjs +1 -1
- package/dist/{index-TgljULTn.d.mts → index-DYWwX7xL.d.mts} +1 -1
- package/dist/{index-TgljULTn.d.mts.map → index-DYWwX7xL.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +38 -14
- package/dist/generate-mpKW9Y8v.mjs.map +0 -1
|
@@ -1,149 +1,6 @@
|
|
|
1
|
+
const require_frontmatter = require("./frontmatter-DSFLOTwS.cjs");
|
|
1
2
|
let node_path = require("node:path");
|
|
2
3
|
let node_fs_promises = require("node:fs/promises");
|
|
3
|
-
//#region src/generator/utils.ts
|
|
4
|
-
async function readJson(filePath) {
|
|
5
|
-
try {
|
|
6
|
-
const raw = await (0, node_fs_promises.readFile)(filePath, "utf-8");
|
|
7
|
-
return JSON.parse(raw);
|
|
8
|
-
} catch {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
async function readDir(dirPath) {
|
|
13
|
-
try {
|
|
14
|
-
return await (0, node_fs_promises.readdir)(dirPath);
|
|
15
|
-
} catch {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async function readText(filePath) {
|
|
20
|
-
try {
|
|
21
|
-
return await (0, node_fs_promises.readFile)(filePath, "utf-8");
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function writeText(filePath, content) {
|
|
27
|
-
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(filePath), { recursive: true });
|
|
28
|
-
await (0, node_fs_promises.writeFile)(filePath, content, "utf-8");
|
|
29
|
-
}
|
|
30
|
-
function contentrainDir(projectRoot) {
|
|
31
|
-
return (0, node_path.join)(projectRoot, ".contentrain");
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/generator/config-reader.ts
|
|
35
|
-
async function readProjectManifest(projectRoot) {
|
|
36
|
-
const crDir = contentrainDir(projectRoot);
|
|
37
|
-
const rawConfig = await readJson((0, node_path.join)(crDir, "config.json"));
|
|
38
|
-
const config = {
|
|
39
|
-
version: rawConfig?.version ?? 1,
|
|
40
|
-
stack: rawConfig?.stack ?? "other",
|
|
41
|
-
workflow: rawConfig?.workflow ?? "auto-merge",
|
|
42
|
-
locales: {
|
|
43
|
-
default: rawConfig?.locales?.default ?? "en",
|
|
44
|
-
supported: rawConfig?.locales?.supported ?? [rawConfig?.locales?.default ?? "en"]
|
|
45
|
-
},
|
|
46
|
-
domains: rawConfig?.domains ?? [],
|
|
47
|
-
repository: rawConfig?.repository,
|
|
48
|
-
assets_path: rawConfig?.assets_path,
|
|
49
|
-
cdn: rawConfig?.cdn,
|
|
50
|
-
branchRetention: rawConfig?.branchRetention
|
|
51
|
-
};
|
|
52
|
-
const modelsDir = (0, node_path.join)(crDir, "models");
|
|
53
|
-
const modelFiles = (await readDir(modelsDir)).filter((f) => f.endsWith(".json"));
|
|
54
|
-
const models = (await Promise.all(modelFiles.map((file) => readJson((0, node_path.join)(modelsDir, file))))).filter((m) => m != null && Boolean(m.id)).toSorted((a, b) => a.id.localeCompare(b.id, "en"));
|
|
55
|
-
return {
|
|
56
|
-
config,
|
|
57
|
-
models,
|
|
58
|
-
contentFiles: (await Promise.all(models.map((model) => mapContentFiles(projectRoot, model, config)))).flat()
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function getContentDir(projectRoot, model) {
|
|
62
|
-
if (model.content_path) return (0, node_path.join)(projectRoot, model.content_path);
|
|
63
|
-
return (0, node_path.join)(contentrainDir(projectRoot), "content", model.domain, model.id);
|
|
64
|
-
}
|
|
65
|
-
function getLocaleStrategy(model) {
|
|
66
|
-
return model.locale_strategy ?? "file";
|
|
67
|
-
}
|
|
68
|
-
function jsonFilePath(dir, model, locale) {
|
|
69
|
-
switch (getLocaleStrategy(model)) {
|
|
70
|
-
case "suffix": return (0, node_path.join)(dir, `${model.id}.${locale}.json`);
|
|
71
|
-
case "directory": return (0, node_path.join)(dir, locale, `${model.id}.json`);
|
|
72
|
-
case "none": return (0, node_path.join)(dir, `${model.id}.json`);
|
|
73
|
-
default: return (0, node_path.join)(dir, `${locale}.json`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async function mapContentFiles(projectRoot, model, config) {
|
|
77
|
-
const dir = getContentDir(projectRoot, model);
|
|
78
|
-
if (model.kind === "document") return mapDocumentFiles(dir, model, config);
|
|
79
|
-
if (model.i18n) return (await Promise.all(config.locales.supported.map(async (locale) => {
|
|
80
|
-
const filePath = jsonFilePath(dir, model, locale);
|
|
81
|
-
if (await readJson(filePath) === null) return null;
|
|
82
|
-
return {
|
|
83
|
-
modelId: model.id,
|
|
84
|
-
locale,
|
|
85
|
-
filePath,
|
|
86
|
-
kind: model.kind
|
|
87
|
-
};
|
|
88
|
-
}))).filter(Boolean);
|
|
89
|
-
const filePath = (0, node_path.join)(dir, "data.json");
|
|
90
|
-
if (await readJson(filePath) === null) return [];
|
|
91
|
-
return [{
|
|
92
|
-
modelId: model.id,
|
|
93
|
-
locale: null,
|
|
94
|
-
filePath,
|
|
95
|
-
kind: model.kind
|
|
96
|
-
}];
|
|
97
|
-
}
|
|
98
|
-
async function mapDocumentFiles(dir, model, config) {
|
|
99
|
-
const strategy = getLocaleStrategy(model);
|
|
100
|
-
if (!model.i18n) return (await readDir(dir)).filter((f) => f.endsWith(".md")).map((f) => ({
|
|
101
|
-
modelId: model.id,
|
|
102
|
-
locale: null,
|
|
103
|
-
filePath: (0, node_path.join)(dir, f),
|
|
104
|
-
kind: "document",
|
|
105
|
-
slug: f.replace(".md", "")
|
|
106
|
-
}));
|
|
107
|
-
return (await Promise.all(config.locales.supported.map((locale) => mapDocumentLocale(dir, model, locale, strategy)))).flat();
|
|
108
|
-
}
|
|
109
|
-
async function mapDocumentLocale(dir, model, locale, strategy) {
|
|
110
|
-
if (strategy === "file") {
|
|
111
|
-
const entries = await readDir(dir);
|
|
112
|
-
return (await Promise.all(entries.map(async (entry) => {
|
|
113
|
-
const filePath = (0, node_path.join)(dir, entry, `${locale}.md`);
|
|
114
|
-
if (await readText(filePath) === null) return null;
|
|
115
|
-
return {
|
|
116
|
-
modelId: model.id,
|
|
117
|
-
locale,
|
|
118
|
-
filePath,
|
|
119
|
-
kind: "document",
|
|
120
|
-
slug: entry
|
|
121
|
-
};
|
|
122
|
-
}))).filter(Boolean);
|
|
123
|
-
}
|
|
124
|
-
if (strategy === "directory") {
|
|
125
|
-
const localeDir = (0, node_path.join)(dir, locale);
|
|
126
|
-
return (await readDir(localeDir)).filter((f) => f.endsWith(".md")).map((f) => ({
|
|
127
|
-
modelId: model.id,
|
|
128
|
-
locale,
|
|
129
|
-
filePath: (0, node_path.join)(localeDir, f),
|
|
130
|
-
kind: "document",
|
|
131
|
-
slug: f.replace(".md", "")
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
if (strategy === "suffix") {
|
|
135
|
-
const suffix = `.${locale}.md`;
|
|
136
|
-
return (await readDir(dir)).filter((f) => f.endsWith(suffix)).map((f) => ({
|
|
137
|
-
modelId: model.id,
|
|
138
|
-
locale,
|
|
139
|
-
filePath: (0, node_path.join)(dir, f),
|
|
140
|
-
kind: "document",
|
|
141
|
-
slug: f.slice(0, -suffix.length)
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
4
|
//#region src/generator/type-emitter.ts
|
|
148
5
|
function emitTypes(models, hasMedia = false) {
|
|
149
6
|
const lines = [
|
|
@@ -358,7 +215,7 @@ async function emitSingleModule(ref, models) {
|
|
|
358
215
|
const localeSuffix = ref.locale ? `.${ref.locale}` : "";
|
|
359
216
|
switch (model.kind) {
|
|
360
217
|
case "collection": {
|
|
361
|
-
const raw = await readJson(ref.filePath);
|
|
218
|
+
const raw = await require_frontmatter.readJson(ref.filePath);
|
|
362
219
|
if (!raw) return null;
|
|
363
220
|
const entries = Object.entries(raw).toSorted(([a], [b]) => a.localeCompare(b, "en")).map(([id, fields]) => Object.assign({ id }, fields));
|
|
364
221
|
return {
|
|
@@ -367,7 +224,7 @@ async function emitSingleModule(ref, models) {
|
|
|
367
224
|
};
|
|
368
225
|
}
|
|
369
226
|
case "singleton": {
|
|
370
|
-
const raw = await readJson(ref.filePath);
|
|
227
|
+
const raw = await require_frontmatter.readJson(ref.filePath);
|
|
371
228
|
if (!raw) return null;
|
|
372
229
|
return {
|
|
373
230
|
fileName: `${model.id}${localeSuffix}.mjs`,
|
|
@@ -375,7 +232,7 @@ async function emitSingleModule(ref, models) {
|
|
|
375
232
|
};
|
|
376
233
|
}
|
|
377
234
|
case "dictionary": {
|
|
378
|
-
const raw = await readJson(ref.filePath);
|
|
235
|
+
const raw = await require_frontmatter.readJson(ref.filePath);
|
|
379
236
|
if (!raw) return null;
|
|
380
237
|
return {
|
|
381
238
|
fileName: `${model.id}${localeSuffix}.mjs`,
|
|
@@ -383,9 +240,9 @@ async function emitSingleModule(ref, models) {
|
|
|
383
240
|
};
|
|
384
241
|
}
|
|
385
242
|
case "document": {
|
|
386
|
-
const rawText = await readText(ref.filePath);
|
|
243
|
+
const rawText = await require_frontmatter.readText(ref.filePath);
|
|
387
244
|
if (!rawText) return null;
|
|
388
|
-
const { frontmatter, body } = parseFrontmatter(rawText, stringLikeFieldKeys(model));
|
|
245
|
+
const { frontmatter, body } = require_frontmatter.parseFrontmatter(rawText, require_frontmatter.stringLikeFieldKeys(model));
|
|
389
246
|
const slug = ref.slug ?? model.id;
|
|
390
247
|
const data = {
|
|
391
248
|
slug,
|
|
@@ -400,103 +257,6 @@ async function emitSingleModule(ref, models) {
|
|
|
400
257
|
default: return null;
|
|
401
258
|
}
|
|
402
259
|
}
|
|
403
|
-
const STRING_LIKE_TYPES = new Set([
|
|
404
|
-
"string",
|
|
405
|
-
"text",
|
|
406
|
-
"email",
|
|
407
|
-
"url",
|
|
408
|
-
"slug",
|
|
409
|
-
"color",
|
|
410
|
-
"phone",
|
|
411
|
-
"code",
|
|
412
|
-
"icon",
|
|
413
|
-
"markdown",
|
|
414
|
-
"richtext",
|
|
415
|
-
"date",
|
|
416
|
-
"datetime",
|
|
417
|
-
"image",
|
|
418
|
-
"video",
|
|
419
|
-
"file",
|
|
420
|
-
"select",
|
|
421
|
-
"relation"
|
|
422
|
-
]);
|
|
423
|
-
function stringLikeFieldKeys(model) {
|
|
424
|
-
const keys = /* @__PURE__ */ new Set();
|
|
425
|
-
if (model.fields) {
|
|
426
|
-
for (const [name, field] of Object.entries(model.fields)) if (STRING_LIKE_TYPES.has(field.type)) keys.add(name);
|
|
427
|
-
}
|
|
428
|
-
return keys;
|
|
429
|
-
}
|
|
430
|
-
function parseFrontmatter(text, stringKeys = /* @__PURE__ */ new Set()) {
|
|
431
|
-
const normalized = text.replace(/\r\n/g, "\n");
|
|
432
|
-
const match = normalized.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
433
|
-
if (!match) return {
|
|
434
|
-
frontmatter: {},
|
|
435
|
-
body: normalized
|
|
436
|
-
};
|
|
437
|
-
const fmStr = match[1];
|
|
438
|
-
const body = match[2].trim();
|
|
439
|
-
const frontmatter = {};
|
|
440
|
-
const lines = fmStr.split("\n");
|
|
441
|
-
const stack = [{
|
|
442
|
-
obj: frontmatter,
|
|
443
|
-
indent: -1
|
|
444
|
-
}];
|
|
445
|
-
for (const line of lines) {
|
|
446
|
-
if (line.trim() === "") continue;
|
|
447
|
-
const arrayMatch = line.match(/^(\s*)-\s+(.*)$/);
|
|
448
|
-
if (arrayMatch) {
|
|
449
|
-
const arrIndent = arrayMatch[1].length;
|
|
450
|
-
const value = arrayMatch[2].trim();
|
|
451
|
-
while (stack.length > 1 && stack[stack.length - 1].indent >= arrIndent) stack.pop();
|
|
452
|
-
const parent = stack[stack.length - 1].obj;
|
|
453
|
-
const lastKey = Object.keys(parent).pop();
|
|
454
|
-
if (lastKey && Array.isArray(parent[lastKey])) parent[lastKey].push(parseValue(value));
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
const kvMatch = line.match(/^(\s*)([\w][\w.-]*)\s*:\s*(.*)$/);
|
|
458
|
-
if (!kvMatch) continue;
|
|
459
|
-
const kvIndent = kvMatch[1].length;
|
|
460
|
-
const key = kvMatch[2];
|
|
461
|
-
const rawValue = kvMatch[3].trim();
|
|
462
|
-
while (stack.length > 1 && stack[stack.length - 1].indent >= kvIndent) stack.pop();
|
|
463
|
-
const current = stack[stack.length - 1].obj;
|
|
464
|
-
if (rawValue === "") {
|
|
465
|
-
const nextLineIdx = lines.indexOf(line) + 1;
|
|
466
|
-
if ((nextLineIdx < lines.length ? lines[nextLineIdx] : "").trim().startsWith("-")) current[key] = [];
|
|
467
|
-
else {
|
|
468
|
-
const nested = {};
|
|
469
|
-
current[key] = nested;
|
|
470
|
-
stack.push({
|
|
471
|
-
obj: nested,
|
|
472
|
-
indent: kvIndent
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
continue;
|
|
476
|
-
}
|
|
477
|
-
if (rawValue.startsWith("[") && rawValue.endsWith("]")) {
|
|
478
|
-
current[key] = rawValue.slice(1, -1).split(",").map((s) => s.trim()).filter(Boolean);
|
|
479
|
-
continue;
|
|
480
|
-
}
|
|
481
|
-
current[key] = parseValue(rawValue, current === frontmatter && stringKeys.has(key));
|
|
482
|
-
}
|
|
483
|
-
return {
|
|
484
|
-
frontmatter,
|
|
485
|
-
body
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
function parseValue(raw, forceString = false) {
|
|
489
|
-
const isQuoted = raw.startsWith("\"") && raw.endsWith("\"") || raw.startsWith("'") && raw.endsWith("'");
|
|
490
|
-
const unquoted = isQuoted ? raw.slice(1, -1) : raw;
|
|
491
|
-
if (forceString) return unquoted;
|
|
492
|
-
if (isQuoted) return unquoted;
|
|
493
|
-
if (raw === "true") return true;
|
|
494
|
-
if (raw === "false") return false;
|
|
495
|
-
if (raw === "null") return null;
|
|
496
|
-
if (/^-?\d+$/.test(raw)) return parseInt(raw, 10);
|
|
497
|
-
if (/^-?\d+\.\d+$/.test(raw)) return parseFloat(raw);
|
|
498
|
-
return raw;
|
|
499
|
-
}
|
|
500
260
|
//#endregion
|
|
501
261
|
//#region src/generator/runtime-emitter.ts
|
|
502
262
|
function emitRuntimeModule(models, dataModules, defaultLocale, cdnBaseUrl) {
|
|
@@ -891,7 +651,7 @@ const IMPORTS_CONFIG = {
|
|
|
891
651
|
};
|
|
892
652
|
async function injectImports(projectRoot) {
|
|
893
653
|
const pkgPath = (0, node_path.join)(projectRoot, "package.json");
|
|
894
|
-
const pkg = await readJson(pkgPath);
|
|
654
|
+
const pkg = await require_frontmatter.readJson(pkgPath);
|
|
895
655
|
if (!pkg) return false;
|
|
896
656
|
const existing = pkg["imports"] ?? {};
|
|
897
657
|
const updated = {
|
|
@@ -900,7 +660,7 @@ async function injectImports(projectRoot) {
|
|
|
900
660
|
};
|
|
901
661
|
if (JSON.stringify(existing["#contentrain"]) === JSON.stringify(IMPORTS_CONFIG["#contentrain"]) && JSON.stringify(existing["#contentrain/*"]) === JSON.stringify(IMPORTS_CONFIG["#contentrain/*"])) return false;
|
|
902
662
|
pkg["imports"] = updated;
|
|
903
|
-
await writeText(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
663
|
+
await require_frontmatter.writeText(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
904
664
|
return true;
|
|
905
665
|
}
|
|
906
666
|
//#endregion
|
|
@@ -909,7 +669,7 @@ async function generate(options) {
|
|
|
909
669
|
const { projectRoot } = options;
|
|
910
670
|
const clientDir = (0, node_path.join)(projectRoot, ".contentrain", "client");
|
|
911
671
|
const dataDir = (0, node_path.join)(clientDir, "data");
|
|
912
|
-
const manifest = await readProjectManifest(projectRoot);
|
|
672
|
+
const manifest = await require_frontmatter.readProjectManifest(projectRoot);
|
|
913
673
|
const cdnBaseUrl = options.cdnBaseUrl ?? manifest.config.cdn?.url;
|
|
914
674
|
const hasMedia = Boolean(cdnBaseUrl);
|
|
915
675
|
const dataModules = await emitDataModules(manifest.models, manifest.contentFiles);
|
|
@@ -918,15 +678,15 @@ async function generate(options) {
|
|
|
918
678
|
const cjsContent = emitCjsWrapper(manifest.models, hasMedia);
|
|
919
679
|
const newFileNames = new Set(dataModules.map((dm) => dm.fileName));
|
|
920
680
|
try {
|
|
921
|
-
const existing = await readDir(dataDir);
|
|
681
|
+
const existing = await require_frontmatter.readDir(dataDir);
|
|
922
682
|
await Promise.all(existing.filter((f) => !newFileNames.has(f)).map((f) => (0, node_fs_promises.rm)((0, node_path.join)(dataDir, f), { force: true })));
|
|
923
683
|
} catch {}
|
|
924
684
|
const dataFileNames = dataModules.map((dm) => `data/${dm.fileName}`);
|
|
925
685
|
await Promise.all([
|
|
926
|
-
writeText((0, node_path.join)(clientDir, "index.d.ts"), typesContent),
|
|
927
|
-
writeText((0, node_path.join)(clientDir, "index.mjs"), runtimeContent),
|
|
928
|
-
writeText((0, node_path.join)(clientDir, "index.cjs"), cjsContent),
|
|
929
|
-
...dataModules.map((dm) => writeText((0, node_path.join)(dataDir, dm.fileName), dm.content))
|
|
686
|
+
require_frontmatter.writeText((0, node_path.join)(clientDir, "index.d.ts"), typesContent),
|
|
687
|
+
require_frontmatter.writeText((0, node_path.join)(clientDir, "index.mjs"), runtimeContent),
|
|
688
|
+
require_frontmatter.writeText((0, node_path.join)(clientDir, "index.cjs"), cjsContent),
|
|
689
|
+
...dataModules.map((dm) => require_frontmatter.writeText((0, node_path.join)(dataDir, dm.fileName), dm.content))
|
|
930
690
|
]);
|
|
931
691
|
const packageJsonUpdated = await injectImports(projectRoot);
|
|
932
692
|
return {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as generate } from "../generate-
|
|
1
|
+
import { t as generate } from "../generate-B7jooE0f.mjs";
|
|
2
2
|
export { generate };
|
|
@@ -328,4 +328,4 @@ declare function createContentrain(config: ContentrainCDNConfig): {
|
|
|
328
328
|
};
|
|
329
329
|
//#endregion
|
|
330
330
|
export { applyWhere as A, CdnDocumentQuery as C, EntryMeta as D, CdnCollectionQuery as E, DocumentDataSource as F, DocumentIndexEntry as I, SingletonDataSource as L, TransportConfig as M, CollectionDataSource as N, WhereClause as O, DictionaryDataSource as P, MediaManifest as S, CdnSingletonAccessor as T, FormsClient as _, ConversationClient as a, MediaAsset as b, ConversationHistory as c, ConversationSendOptions as d, ConversationToolResult as f, FormSubmitResult as g, FormFieldConfig as h, ContentrainError as i, HttpTransport as j, WhereOp as k, ConversationMessage as l, FormConfig as m, ContentrainCDNConfig as n, ConversationClientConfig as o, ConversationUsage as p, createContentrain as r, ConversationContext as s, ContentrainCDNClient as t, ConversationResponse as u, FormsClientConfig as v, CdnDictionaryAccessor as w, MediaAssetMeta as x, MediaAccessor as y };
|
|
331
|
-
//# sourceMappingURL=index-
|
|
331
|
+
//# sourceMappingURL=index-DYWwX7xL.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DYWwX7xL.d.mts","names":[],"sources":["../src/cdn/data-source.ts","../src/cdn/http-transport.ts","../src/shared/where.ts","../src/cdn/collection-query.ts","../src/cdn/singleton-accessor.ts","../src/cdn/dictionary-accessor.ts","../src/cdn/document-query.ts","../src/cdn/media-accessor.ts","../src/cdn/forms-client.ts","../src/cdn/conversation-client.ts","../src/cdn/errors.ts","../src/cdn/index.ts"],"mappings":";UAAiB,oBAAA;EACf,MAAA,CAAO,MAAA,WAAiB,OAAA,CAAQ,CAAA;EAChC,MAAA,CAAO,EAAA,UAAY,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAG7B,mBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGd,oBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,MAAA;AAAA;;;;;;;;;;;;;AAL/B;KAqBY,kBAAA,MAAwB,IAAA,CAAK,CAAA;AAAA,UAExB,kBAAA;EACf,QAAA,CAAS,MAAA,WAAiB,OAAA,CAAQ,kBAAA,CAAmB,CAAA;EACrD,SAAA,CAAU,IAAA,UAAc,MAAA,WAAiB,OAAA;IAAU,WAAA,EAAa,CAAA;IAAG,IAAA;IAAc,IAAA;EAAA;AAAA;;;UCtBlE,eAAA;EACf,OAAA;EACA,SAAA;EACA,MAAA;EDVwB;ECYxB,MAAA;IAAqB,YAAA;EAAA;EACrB,aAAA;AAAA;AAAA,cAkBW,aAAA;EAAA,QACH,QAAA;EAAA,QACA,UAAA;EAAA,QACA,OAAA;EAAA,QACA,MAAA;EAAA,QACA,WAAA;EAAA,QACA,aAAA;EAAA,QACA,cAAA;EAAA,QACA,OAAA;EAAA,QACA,QAAA;cAEI,MAAA,EAAQ,eAAA;EAUpB,QAAA,CAAS,IAAA;EDhDyB;ECqD5B,OAAA,CAAQ,MAAA,YAAkB,OAAA;EAO1B,KAAA,GAAA,CAAS,IAAA,WAAe,OAAA,CAAQ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as EntryMeta, I as DocumentIndexEntry, O as WhereClause, S as MediaManifest, _ as FormsClient, a as ConversationClient, b as MediaAsset, c as ConversationHistory, g as FormSubmitResult, h as FormFieldConfig, i as ContentrainError, k as WhereOp, l as ConversationMessage, m as FormConfig, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as FormsClientConfig, x as MediaAssetMeta, y as MediaAccessor } from "./index-
|
|
1
|
+
import { A as applyWhere, D as EntryMeta, I as DocumentIndexEntry, O as WhereClause, S as MediaManifest, _ as FormsClient, a as ConversationClient, b as MediaAsset, c as ConversationHistory, g as FormSubmitResult, h as FormFieldConfig, i as ContentrainError, k as WhereOp, l as ConversationMessage, m as FormConfig, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as FormsClientConfig, x as MediaAssetMeta, y as MediaAccessor } from "./index-DYWwX7xL.mjs";
|
|
2
2
|
import { ContentStatus, ContentrainConfig, FieldDef, FieldType, ModelDefinition, ModelKind } from "@contentrain/types";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/query.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentrain/query",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Optional type-safe query SDK for Contentrain — generated TypeScript client for platform-independent JSON content",
|
|
6
6
|
"type": "module",
|
|
@@ -39,26 +39,50 @@
|
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
41
41
|
".": {
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/index.d.mts",
|
|
44
|
+
"default": "./dist/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/index.d.cts",
|
|
48
|
+
"default": "./dist/index.cjs"
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
51
|
"./generate": {
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/generator/generate.d.mts",
|
|
54
|
+
"default": "./dist/generator/generate.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/generator/generate.d.cts",
|
|
58
|
+
"default": "./dist/generator/generate.cjs"
|
|
59
|
+
}
|
|
51
60
|
},
|
|
52
61
|
"./cdn": {
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./dist/cdn/index.d.mts",
|
|
64
|
+
"default": "./dist/cdn/index.mjs"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./dist/cdn/index.d.cts",
|
|
68
|
+
"default": "./dist/cdn/index.cjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"./astro": {
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./dist/astro/index.d.mts",
|
|
74
|
+
"default": "./dist/astro/index.mjs"
|
|
75
|
+
},
|
|
76
|
+
"require": {
|
|
77
|
+
"types": "./dist/astro/index.d.cts",
|
|
78
|
+
"default": "./dist/astro/index.cjs"
|
|
79
|
+
}
|
|
56
80
|
},
|
|
57
81
|
"./skills/*": "./skills/*"
|
|
58
82
|
},
|
|
59
83
|
"main": "./dist/index.cjs",
|
|
60
84
|
"module": "./dist/index.mjs",
|
|
61
|
-
"types": "./dist/index.d.
|
|
85
|
+
"types": "./dist/index.d.cts",
|
|
62
86
|
"sideEffects": false,
|
|
63
87
|
"files": [
|
|
64
88
|
"dist",
|
|
@@ -74,8 +98,8 @@
|
|
|
74
98
|
"vitest": "^3.0.0"
|
|
75
99
|
},
|
|
76
100
|
"scripts": {
|
|
77
|
-
"build": "tsdown src/index.ts src/cdn/index.ts src/generator/generate.ts src/cli.ts --format esm,cjs --dts",
|
|
78
|
-
"dev": "tsdown src/index.ts src/cdn/index.ts src/generator/generate.ts src/cli.ts --format esm,cjs --dts --watch",
|
|
101
|
+
"build": "tsdown src/index.ts src/cdn/index.ts src/astro/index.ts src/generator/generate.ts src/cli.ts --format esm,cjs --dts",
|
|
102
|
+
"dev": "tsdown src/index.ts src/cdn/index.ts src/astro/index.ts src/generator/generate.ts src/cli.ts --format esm,cjs --dts --watch",
|
|
79
103
|
"test": "vitest run",
|
|
80
104
|
"typecheck": "tsc --noEmit",
|
|
81
105
|
"clean": "rm -rf dist"
|