@ai-matrx/content-ir 0.22.6 → 0.23.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/CHANGELOG.md +21 -0
- package/dist/convert.cjs +36 -292
- package/dist/convert.cjs.map +1 -1
- package/dist/convert.js +35 -291
- package/dist/convert.js.map +1 -1
- package/dist/core.cjs +3 -290
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +2 -289
- package/dist/core.js.map +1 -1
- package/dist/directives.cjs +3 -37
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.js +2 -36
- package/dist/directives.js.map +1 -1
- package/dist/index.cjs +235 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +227 -310
- package/dist/index.js.map +1 -1
- package/dist/json-extract.cjs +942 -0
- package/dist/json-extract.cjs.map +1 -0
- package/dist/json-extract.d.cts +176 -0
- package/dist/json-extract.d.ts +176 -0
- package/dist/json-extract.js +928 -0
- package/dist/json-extract.js.map +1 -0
- package/dist/source.cjs +199 -0
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +138 -1
- package/dist/source.d.ts +138 -1
- package/dist/source.js +193 -1
- package/dist/source.js.map +1 -1
- package/dist/surfaces.cjs +4 -40
- package/dist/surfaces.cjs.map +1 -1
- package/dist/surfaces.js +2 -38
- package/dist/surfaces.js.map +1 -1
- package/package.json +28 -7
- package/dist/text-case.cjs +0 -333
- package/dist/text-case.cjs.map +0 -1
- package/dist/text-case.d.cts +0 -87
- package/dist/text-case.d.ts +0 -87
- package/dist/text-case.js +0 -320
- package/dist/text-case.js.map +0 -1
package/dist/convert.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { formatText } from '@ai-matrx/kit/text-case';
|
|
2
|
+
|
|
1
3
|
// core/kind-schema.types.ts
|
|
2
4
|
var KIND_KEY = "__kind";
|
|
3
5
|
function scalarArrayItemType(type) {
|
|
@@ -5,295 +7,6 @@ function scalarArrayItemType(type) {
|
|
|
5
7
|
if (type === "boolean[]") return "boolean";
|
|
6
8
|
return "string";
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
// text-case.ts
|
|
10
|
-
var DEFAULT_WORD_REPLACEMENTS = {
|
|
11
|
-
// Acronyms & initialisms
|
|
12
|
-
"api": "API",
|
|
13
|
-
"apis": "APIs",
|
|
14
|
-
"ui": "UI",
|
|
15
|
-
"ux": "UX",
|
|
16
|
-
"id": "ID",
|
|
17
|
-
"ids": "IDs",
|
|
18
|
-
"qr": "QR",
|
|
19
|
-
"ssr": "SSR",
|
|
20
|
-
"csr": "CSR",
|
|
21
|
-
"ssg": "SSG",
|
|
22
|
-
"isr": "ISR",
|
|
23
|
-
"spa": "SPA",
|
|
24
|
-
"pwa": "PWA",
|
|
25
|
-
"sdk": "SDK",
|
|
26
|
-
"sdks": "SDKs",
|
|
27
|
-
"cli": "CLI",
|
|
28
|
-
"tty": "TTY",
|
|
29
|
-
"repl": "REPL",
|
|
30
|
-
"ci": "CI",
|
|
31
|
-
"cd": "CD",
|
|
32
|
-
"cpu": "CPU",
|
|
33
|
-
"cpus": "CPUs",
|
|
34
|
-
"gpu": "GPU",
|
|
35
|
-
"gpus": "GPUs",
|
|
36
|
-
"ram": "RAM",
|
|
37
|
-
"rom": "ROM",
|
|
38
|
-
"ssd": "SSD",
|
|
39
|
-
"ssds": "SSDs",
|
|
40
|
-
"hdd": "HDD",
|
|
41
|
-
"hdds": "HDDs",
|
|
42
|
-
"kpi": "KPI",
|
|
43
|
-
"kpis": "KPIs",
|
|
44
|
-
"sla": "SLA",
|
|
45
|
-
"slas": "SLAs",
|
|
46
|
-
"slo": "SLO",
|
|
47
|
-
"slos": "SLOs",
|
|
48
|
-
"sli": "SLI",
|
|
49
|
-
"slis": "SLIs",
|
|
50
|
-
"dom": "DOM",
|
|
51
|
-
// Web, formats, protocols
|
|
52
|
-
"url": "URL",
|
|
53
|
-
"urls": "URLs",
|
|
54
|
-
"uri": "URI",
|
|
55
|
-
"uris": "URIs",
|
|
56
|
-
"http": "HTTP",
|
|
57
|
-
"https": "HTTPS",
|
|
58
|
-
"html": "HTML",
|
|
59
|
-
"css": "CSS",
|
|
60
|
-
"json": "JSON",
|
|
61
|
-
"yaml": "YAML",
|
|
62
|
-
"yml": "YML",
|
|
63
|
-
"toml": "TOML",
|
|
64
|
-
"csv": "CSV",
|
|
65
|
-
"pdf": "PDF",
|
|
66
|
-
"tsv": "TSV",
|
|
67
|
-
"jpg": "JPG",
|
|
68
|
-
"jpeg": "JPEG",
|
|
69
|
-
"png": "PNG",
|
|
70
|
-
"gif": "GIF",
|
|
71
|
-
"webp": "WebP",
|
|
72
|
-
"heic": "HEIC",
|
|
73
|
-
"heif": "HEIF",
|
|
74
|
-
"bmp": "BMP",
|
|
75
|
-
"tiff": "TIFF",
|
|
76
|
-
"ico": "ICO",
|
|
77
|
-
"xml": "XML",
|
|
78
|
-
"sql": "SQL",
|
|
79
|
-
"db": "DB",
|
|
80
|
-
"dbs": "DBs",
|
|
81
|
-
"nosql": "NoSQL",
|
|
82
|
-
"graphql": "GraphQL",
|
|
83
|
-
"grpc": "gRPC",
|
|
84
|
-
"rest": "REST",
|
|
85
|
-
"restful": "RESTful",
|
|
86
|
-
"websocket": "WebSocket",
|
|
87
|
-
"websockets": "WebSockets",
|
|
88
|
-
"webrtc": "WebRTC",
|
|
89
|
-
// Networking
|
|
90
|
-
"ip": "IP",
|
|
91
|
-
"ipv4": "IPv4",
|
|
92
|
-
"ipv6": "IPv6",
|
|
93
|
-
"dns": "DNS",
|
|
94
|
-
"dhcp": "DHCP",
|
|
95
|
-
"nat": "NAT",
|
|
96
|
-
"tcp": "TCP",
|
|
97
|
-
"udp": "UDP",
|
|
98
|
-
"icmp": "ICMP",
|
|
99
|
-
"ttl": "TTL",
|
|
100
|
-
"lan": "LAN",
|
|
101
|
-
"wan": "WAN",
|
|
102
|
-
"vlan": "VLAN",
|
|
103
|
-
"cdn": "CDN",
|
|
104
|
-
"ftp": "FTP",
|
|
105
|
-
"ssh": "SSH",
|
|
106
|
-
"tls": "TLS",
|
|
107
|
-
"ssl": "SSL",
|
|
108
|
-
// Security & crypto
|
|
109
|
-
"jwt": "JWT",
|
|
110
|
-
"jws": "JWS",
|
|
111
|
-
"jwe": "JWE",
|
|
112
|
-
"hmac": "HMAC",
|
|
113
|
-
"rsa": "RSA",
|
|
114
|
-
"ecdsa": "ECDSA",
|
|
115
|
-
"aes": "AES",
|
|
116
|
-
"pbkdf2": "PBKDF2",
|
|
117
|
-
"argon2": "Argon2",
|
|
118
|
-
"scrypt": "scrypt",
|
|
119
|
-
"totp": "TOTP",
|
|
120
|
-
"hotp": "HOTP",
|
|
121
|
-
"mfa": "MFA",
|
|
122
|
-
"2fa": "2FA",
|
|
123
|
-
"csrf": "CSRF",
|
|
124
|
-
"xss": "XSS",
|
|
125
|
-
"ssrf": "SSRF",
|
|
126
|
-
"rce": "RCE",
|
|
127
|
-
"dos": "DoS",
|
|
128
|
-
"ddos": "DDoS",
|
|
129
|
-
"mitm": "MITM",
|
|
130
|
-
"csp": "CSP",
|
|
131
|
-
"cors": "CORS",
|
|
132
|
-
"pii": "PII",
|
|
133
|
-
"phi": "PHI",
|
|
134
|
-
"gdpr": "GDPR",
|
|
135
|
-
"ccpa": "CCPA",
|
|
136
|
-
"hipaa": "HIPAA",
|
|
137
|
-
"rfc": "RFC",
|
|
138
|
-
// Platforms, langs, tools (single-token)
|
|
139
|
-
"javascript": "JavaScript",
|
|
140
|
-
"typescript": "TypeScript",
|
|
141
|
-
"jsx": "JSX",
|
|
142
|
-
"tsx": "TSX",
|
|
143
|
-
"node": "Node",
|
|
144
|
-
// (used when tokenized alone)
|
|
145
|
-
"deno": "Deno",
|
|
146
|
-
"bun": "Bun",
|
|
147
|
-
"react": "React",
|
|
148
|
-
"nextjs": "Next.js",
|
|
149
|
-
// if your tokenizer drops dots, keep this
|
|
150
|
-
"nodejs": "Node.js",
|
|
151
|
-
"postgresql": "PostgreSQL",
|
|
152
|
-
"postgres": "Postgres",
|
|
153
|
-
"mysql": "MySQL",
|
|
154
|
-
"sqlite": "SQLite",
|
|
155
|
-
"redis": "Redis",
|
|
156
|
-
"supabase": "Supabase",
|
|
157
|
-
"docker": "Docker",
|
|
158
|
-
"kubernetes": "Kubernetes",
|
|
159
|
-
"k8s": "Kubernetes",
|
|
160
|
-
"helm": "Helm",
|
|
161
|
-
"npm": "npm",
|
|
162
|
-
"pnpm": "pnpm",
|
|
163
|
-
"yarn": "Yarn",
|
|
164
|
-
"eslint": "ESLint",
|
|
165
|
-
"prettier": "Prettier",
|
|
166
|
-
"vite": "Vite",
|
|
167
|
-
"webpack": "Webpack",
|
|
168
|
-
"babel": "Babel",
|
|
169
|
-
// OS & vendors
|
|
170
|
-
"macos": "macOS",
|
|
171
|
-
"ios": "iOS",
|
|
172
|
-
"ipados": "iPadOS",
|
|
173
|
-
"watchos": "watchOS",
|
|
174
|
-
"tvos": "tvOS",
|
|
175
|
-
"windows": "Windows",
|
|
176
|
-
"linux": "Linux",
|
|
177
|
-
"ubuntu": "Ubuntu",
|
|
178
|
-
"github": "GitHub",
|
|
179
|
-
"gitlab": "GitLab",
|
|
180
|
-
"bitbucket": "Bitbucket",
|
|
181
|
-
// Data & analytics
|
|
182
|
-
"etl": "ETL",
|
|
183
|
-
"elt": "ELT",
|
|
184
|
-
"olap": "OLAP",
|
|
185
|
-
"oltp": "OLTP",
|
|
186
|
-
"bi": "BI",
|
|
187
|
-
// Time & locales
|
|
188
|
-
"utc": "UTC",
|
|
189
|
-
"gmt": "GMT",
|
|
190
|
-
"pst": "PST",
|
|
191
|
-
"pdt": "PDT",
|
|
192
|
-
"pt": "PT",
|
|
193
|
-
// Common “small words” to keep lowercase (unless first/last word)
|
|
194
|
-
"or": "or",
|
|
195
|
-
"and": "and",
|
|
196
|
-
"the": "the",
|
|
197
|
-
"of": "of",
|
|
198
|
-
"in": "in",
|
|
199
|
-
"to": "to",
|
|
200
|
-
"with": "with",
|
|
201
|
-
"as": "as",
|
|
202
|
-
"by": "by",
|
|
203
|
-
"for": "for",
|
|
204
|
-
"on": "on",
|
|
205
|
-
"at": "at",
|
|
206
|
-
"up": "up",
|
|
207
|
-
"a": "a",
|
|
208
|
-
"an": "an",
|
|
209
|
-
"is": "is",
|
|
210
|
-
"are": "are",
|
|
211
|
-
"was": "was",
|
|
212
|
-
"were": "were",
|
|
213
|
-
"be": "be",
|
|
214
|
-
"but": "but",
|
|
215
|
-
"nor": "nor",
|
|
216
|
-
"so": "so",
|
|
217
|
-
"yet": "yet",
|
|
218
|
-
"per": "per",
|
|
219
|
-
"via": "via",
|
|
220
|
-
// Latin abbreviations (tokenized as words in some pipelines)
|
|
221
|
-
"eg": "e.g.",
|
|
222
|
-
"ie": "i.e.",
|
|
223
|
-
"etc": "etc.",
|
|
224
|
-
"aka": "aka",
|
|
225
|
-
"vs": "vs.",
|
|
226
|
-
"v": "v.",
|
|
227
|
-
// Client abbreviations
|
|
228
|
-
"CIC": "CIC",
|
|
229
|
-
"AGR": "AGR",
|
|
230
|
-
"AGER": "AGER",
|
|
231
|
-
"DD": "DD",
|
|
232
|
-
"TS": "TS",
|
|
233
|
-
"TM": "TM",
|
|
234
|
-
"arman": "Arman"
|
|
235
|
-
};
|
|
236
|
-
var DEFAULT_OPTIONS = {
|
|
237
|
-
textCase: "title",
|
|
238
|
-
wordReplacements: DEFAULT_WORD_REPLACEMENTS,
|
|
239
|
-
trim: true
|
|
240
|
-
};
|
|
241
|
-
function formatText(text, options = {}) {
|
|
242
|
-
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
243
|
-
if (!text) return "";
|
|
244
|
-
let normalized = text.replace(/_/g, " ").replace(/-/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ");
|
|
245
|
-
if (opts.trim) {
|
|
246
|
-
normalized = normalized.trim();
|
|
247
|
-
}
|
|
248
|
-
let caseTransformed = normalized;
|
|
249
|
-
switch (opts.textCase) {
|
|
250
|
-
case "title":
|
|
251
|
-
caseTransformed = normalized.replace(
|
|
252
|
-
/\w\S*/g,
|
|
253
|
-
(word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
|
254
|
-
);
|
|
255
|
-
break;
|
|
256
|
-
case "sentence":
|
|
257
|
-
if (normalized.length > 0) {
|
|
258
|
-
caseTransformed = normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();
|
|
259
|
-
}
|
|
260
|
-
break;
|
|
261
|
-
case "lower":
|
|
262
|
-
caseTransformed = normalized.toLowerCase();
|
|
263
|
-
break;
|
|
264
|
-
case "upper":
|
|
265
|
-
caseTransformed = normalized.toUpperCase();
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
let result = caseTransformed;
|
|
269
|
-
if (opts.wordReplacements) {
|
|
270
|
-
Object.entries(opts.wordReplacements).forEach(([key, value]) => {
|
|
271
|
-
const regex = new RegExp(`\\b${key}\\b`, "gi");
|
|
272
|
-
result = result.replace(regex, value);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return result;
|
|
276
|
-
}
|
|
277
|
-
var IDENTIFIER_ACRONYMS = [
|
|
278
|
-
"ID",
|
|
279
|
-
"URL",
|
|
280
|
-
"PDF",
|
|
281
|
-
"HTML",
|
|
282
|
-
"JSON",
|
|
283
|
-
"API",
|
|
284
|
-
"AI",
|
|
285
|
-
"UI",
|
|
286
|
-
"CSV",
|
|
287
|
-
"SMS",
|
|
288
|
-
"SEO",
|
|
289
|
-
"LLM",
|
|
290
|
-
"MCP",
|
|
291
|
-
"UUID",
|
|
292
|
-
"ISO"
|
|
293
|
-
];
|
|
294
|
-
new Set(IDENTIFIER_ACRONYMS.map((a) => a.toLowerCase()));
|
|
295
|
-
|
|
296
|
-
// core/schema-structure.ts
|
|
297
10
|
function formatBlockLabel(key) {
|
|
298
11
|
return formatText(key, { textCase: "title" });
|
|
299
12
|
}
|
|
@@ -515,7 +228,7 @@ function buildAgentSchemaWithRenderBlockSupport(input, rootKindSlug, arrayBindin
|
|
|
515
228
|
}
|
|
516
229
|
function resolveRef(ref, ctx) {
|
|
517
230
|
if (ref === "#" || ref === "#/") {
|
|
518
|
-
return { slug: ctx.schemaName, node: ctx.rootSchema };
|
|
231
|
+
return { slug: ctx.schemaName, node: ctx.rootSchema, declaresKind: true };
|
|
519
232
|
}
|
|
520
233
|
const match = /^#\/(?:\$defs|definitions)\/(.+)$/.exec(ref);
|
|
521
234
|
if (!match) return null;
|
|
@@ -525,7 +238,11 @@ function resolveRef(ref, ctx) {
|
|
|
525
238
|
const node = ctx.defs[name];
|
|
526
239
|
if (!isRecord(node)) return null;
|
|
527
240
|
const declared = isRecord(node.properties) ? readBlockKindFromProperties(node.properties) : null;
|
|
528
|
-
return { slug: declared ?? name, node };
|
|
241
|
+
return { slug: declared ?? name, node, declaresKind: declared !== null };
|
|
242
|
+
}
|
|
243
|
+
function inlineRefNode(refNode, resolved) {
|
|
244
|
+
const { $ref: _ref, ...beside } = refNode;
|
|
245
|
+
return { ...resolved.node, ...beside };
|
|
529
246
|
}
|
|
530
247
|
function refToObjectField(resolved, path, ctx) {
|
|
531
248
|
if (ctx.refsInProgress.has(resolved.slug)) return;
|
|
@@ -595,6 +312,29 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
595
312
|
});
|
|
596
313
|
return null;
|
|
597
314
|
}
|
|
315
|
+
if (!resolved.declaresKind) {
|
|
316
|
+
const guard = `$def:${node.$ref}`;
|
|
317
|
+
if (ctx.refsInProgress.has(guard)) {
|
|
318
|
+
ctx.problems.push({
|
|
319
|
+
severity: "info",
|
|
320
|
+
path,
|
|
321
|
+
message: `Self-referencing structure "${node.$ref}" \u2014 carried as any JSON value (json).`
|
|
322
|
+
});
|
|
323
|
+
return { ...requiredNullableFlags(required), type: "json" };
|
|
324
|
+
}
|
|
325
|
+
ctx.refsInProgress.add(guard);
|
|
326
|
+
try {
|
|
327
|
+
return convertPropertyCore(
|
|
328
|
+
fieldName,
|
|
329
|
+
inlineRefNode(node, resolved),
|
|
330
|
+
required,
|
|
331
|
+
path,
|
|
332
|
+
ctx
|
|
333
|
+
);
|
|
334
|
+
} finally {
|
|
335
|
+
ctx.refsInProgress.delete(guard);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
598
338
|
refToObjectField(resolved, path, ctx);
|
|
599
339
|
return {
|
|
600
340
|
...requiredNullableFlags(required),
|
|
@@ -626,6 +366,10 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
626
366
|
unsupported = true;
|
|
627
367
|
continue;
|
|
628
368
|
}
|
|
369
|
+
if (!resolvedVariant.declaresKind) {
|
|
370
|
+
anonymousObjects.push(inlineRefNode(variant, resolvedVariant));
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
629
373
|
refToObjectField(resolvedVariant, path, ctx);
|
|
630
374
|
memberKinds.push(resolvedVariant.slug);
|
|
631
375
|
continue;
|