@futdevpro/nts-dynamo 1.15.57 → 1.15.60
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/.dynamo/logs/cicd-pipeline/output.log +1637 -3567
- package/.dynamo/logs/cicd-pipeline/status.json +42 -344
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.d.ts +110 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.js +419 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.d.ts +50 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.js +3 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/index.d.ts +2 -0
- package/build/_modules/ai/_modules/document-ai/index.d.ts.map +1 -1
- package/build/_modules/ai/_modules/document-ai/index.js +2 -0
- package/build/_modules/ai/_modules/document-ai/index.js.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.d.ts +81 -0
- package/build/_modules/ai/_services/ai-embedding-mock.service.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-embedding-mock.service.js +167 -0
- package/build/_modules/ai/_services/ai-embedding-mock.service.js.map +1 -0
- package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts +52 -0
- package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-embedding-provider.registry.js +79 -0
- package/build/_modules/ai/_services/ai-embedding-provider.registry.js.map +1 -0
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.d.ts +111 -0
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.d.ts.map +1 -0
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.js +298 -0
- package/build/_modules/ai/_services/lmstudio-embedding.control-service.js.map +1 -0
- package/build/_modules/ai/index.d.ts +5 -0
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +8 -0
- package/build/_modules/ai/index.js.map +1 -1
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.d.ts +59 -0
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.d.ts.map +1 -0
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.js +169 -0
- package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.js.map +1 -0
- package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.d.ts +32 -0
- package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.d.ts.map +1 -0
- package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.js +8 -0
- package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.js.map +1 -0
- package/build/_modules/data-readers/index.d.ts +3 -0
- package/build/_modules/data-readers/index.d.ts.map +1 -0
- package/build/_modules/data-readers/index.js +11 -0
- package/build/_modules/data-readers/index.js.map +1 -0
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.d.ts +36 -0
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.d.ts.map +1 -0
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.js +54 -0
- package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.js.map +1 -0
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.d.ts +70 -0
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.d.ts.map +1 -0
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.js +123 -0
- package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.js.map +1 -0
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.d.ts +43 -0
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.d.ts.map +1 -0
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.js +72 -0
- package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.js.map +1 -0
- package/build/_modules/local-vector-search/index.d.ts +3 -0
- package/build/_modules/local-vector-search/index.d.ts.map +1 -1
- package/build/_modules/local-vector-search/index.js +4 -0
- package/build/_modules/local-vector-search/index.js.map +1 -1
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.d.ts +109 -0
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.d.ts.map +1 -0
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.js +14 -0
- package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.js.map +1 -0
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.d.ts +71 -0
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.d.ts.map +1 -0
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.js +99 -0
- package/build/_modules/mcp/_services/dynts-mcp-server.service-base.js.map +1 -0
- package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts +57 -0
- package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts.map +1 -0
- package/build/_modules/mcp/_services/dynts-mcp.adapter.js +139 -0
- package/build/_modules/mcp/_services/dynts-mcp.adapter.js.map +1 -0
- package/build/_modules/mcp/index.d.ts +4 -0
- package/build/_modules/mcp/index.d.ts.map +1 -0
- package/build/_modules/mcp/index.js +13 -0
- package/build/_modules/mcp/index.js.map +1 -0
- package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.d.ts +19 -0
- package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.d.ts.map +1 -0
- package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.js +23 -0
- package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.js.map +1 -0
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.d.ts +44 -0
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.d.ts.map +1 -0
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.js +68 -0
- package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.js.map +1 -0
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.d.ts +89 -0
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.d.ts.map +1 -0
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.js +12 -0
- package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.js.map +1 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.d.ts +84 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.d.ts.map +1 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.js +220 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.js.map +1 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.d.ts +54 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.d.ts.map +1 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.js +76 -0
- package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.js.map +1 -0
- package/build/_modules/scoped-config/index.d.ts +6 -0
- package/build/_modules/scoped-config/index.d.ts.map +1 -0
- package/build/_modules/scoped-config/index.js +15 -0
- package/build/_modules/scoped-config/index.js.map +1 -0
- package/package.json +58 -2
- package/pnpm-workspace.yaml +1 -0
- package/src/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.spec.ts +295 -0
- package/src/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.ts +552 -0
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.ts +68 -0
- package/src/_modules/ai/_modules/document-ai/index.ts +2 -0
- package/src/_modules/ai/_services/ai-embedding-mock.service.spec.ts +115 -0
- package/src/_modules/ai/_services/ai-embedding-mock.service.ts +233 -0
- package/src/_modules/ai/_services/ai-embedding-provider.registry.spec.ts +110 -0
- package/src/_modules/ai/_services/ai-embedding-provider.registry.ts +114 -0
- package/src/_modules/ai/_services/lmstudio-embedding.control-service.spec.ts +197 -0
- package/src/_modules/ai/_services/lmstudio-embedding.control-service.ts +399 -0
- package/src/_modules/ai/index.ts +10 -0
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.spec.ts +176 -0
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.ts +203 -0
- package/src/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.ts +33 -0
- package/src/_modules/data-readers/index.ts +11 -0
- package/src/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.ts +60 -0
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.spec.ts +198 -0
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.ts +150 -0
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.spec.ts +167 -0
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.ts +108 -0
- package/src/_modules/local-vector-search/index.ts +6 -1
- package/src/_modules/mcp/_models/interfaces/dynts-mcp.interface.ts +111 -0
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.spec.ts +151 -0
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.ts +125 -0
- package/src/_modules/mcp/_services/dynts-mcp.adapter.ts +168 -0
- package/src/_modules/mcp/index.ts +13 -0
- package/src/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.ts +22 -0
- package/src/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.ts +82 -0
- package/src/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.ts +107 -0
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.spec.ts +312 -0
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.ts +311 -0
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.spec.ts +123 -0
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.ts +108 -0
- package/src/_modules/scoped-config/index.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.60",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "server-package",
|
|
@@ -57,7 +57,11 @@
|
|
|
57
57
|
"audit:eslintrc": "dynamo-eslintrc-audit",
|
|
58
58
|
"fix": "dynamo-fix",
|
|
59
59
|
"fix:return-types": "dynamo-fix-return-types",
|
|
60
|
-
"prepare": "husky"
|
|
60
|
+
"prepare": "husky",
|
|
61
|
+
"ldp": "dc ldp",
|
|
62
|
+
"ldp:status": "dc ldp-status",
|
|
63
|
+
"ldp:stop": "dc ldp-stop",
|
|
64
|
+
"ldp:clear": "dc ldp-clear"
|
|
61
65
|
},
|
|
62
66
|
"main": "./build/index.js",
|
|
63
67
|
"module": "./build/index.js",
|
|
@@ -136,6 +140,12 @@
|
|
|
136
140
|
"types": "./build/_modules/custom-data/index.d.ts",
|
|
137
141
|
"typings": "./build/_modules/custom-data/index.d.ts"
|
|
138
142
|
},
|
|
143
|
+
"./data-readers": {
|
|
144
|
+
"default": "./build/_modules/data-readers/index.js",
|
|
145
|
+
"module": "./build/_modules/data-readers/index.js",
|
|
146
|
+
"types": "./build/_modules/data-readers/index.d.ts",
|
|
147
|
+
"typings": "./build/_modules/data-readers/index.d.ts"
|
|
148
|
+
},
|
|
139
149
|
"./defaults": {
|
|
140
150
|
"default": "./build/_modules/defaults/index.js",
|
|
141
151
|
"module": "./build/_modules/defaults/index.js",
|
|
@@ -178,6 +188,12 @@
|
|
|
178
188
|
"types": "./build/_modules/messaging/_modules/agent/index.d.ts",
|
|
179
189
|
"typings": "./build/_modules/messaging/_modules/agent/index.d.ts"
|
|
180
190
|
},
|
|
191
|
+
"./mcp": {
|
|
192
|
+
"default": "./build/_modules/mcp/index.js",
|
|
193
|
+
"module": "./build/_modules/mcp/index.js",
|
|
194
|
+
"types": "./build/_modules/mcp/index.d.ts",
|
|
195
|
+
"typings": "./build/_modules/mcp/index.d.ts"
|
|
196
|
+
},
|
|
181
197
|
"./mock": {
|
|
182
198
|
"default": "./build/_mock/index.js",
|
|
183
199
|
"module": "./build/_mock/index.js",
|
|
@@ -202,6 +218,12 @@
|
|
|
202
218
|
"types": "./build/_modules/rate-limit/index.d.ts",
|
|
203
219
|
"typings": "./build/_modules/rate-limit/index.d.ts"
|
|
204
220
|
},
|
|
221
|
+
"./scoped-config": {
|
|
222
|
+
"default": "./build/_modules/scoped-config/index.js",
|
|
223
|
+
"module": "./build/_modules/scoped-config/index.js",
|
|
224
|
+
"types": "./build/_modules/scoped-config/index.d.ts",
|
|
225
|
+
"typings": "./build/_modules/scoped-config/index.d.ts"
|
|
226
|
+
},
|
|
205
227
|
"./server": {
|
|
206
228
|
"default": "./build/_modules/server/index.js",
|
|
207
229
|
"module": "./build/_modules/server/index.js",
|
|
@@ -262,6 +284,9 @@
|
|
|
262
284
|
"custom-data": [
|
|
263
285
|
"build/_modules/custom-data/index.d.ts"
|
|
264
286
|
],
|
|
287
|
+
"data-readers": [
|
|
288
|
+
"build/_modules/data-readers/index.d.ts"
|
|
289
|
+
],
|
|
265
290
|
"defaults": [
|
|
266
291
|
"build/_modules/defaults/index.d.ts"
|
|
267
292
|
],
|
|
@@ -283,6 +308,9 @@
|
|
|
283
308
|
"messaging/agent": [
|
|
284
309
|
"build/_modules/messaging/_modules/agent/index.d.ts"
|
|
285
310
|
],
|
|
311
|
+
"mcp": [
|
|
312
|
+
"build/_modules/mcp/index.d.ts"
|
|
313
|
+
],
|
|
286
314
|
"mock": [
|
|
287
315
|
"build/_modules/mock/index.d.ts"
|
|
288
316
|
],
|
|
@@ -295,6 +323,9 @@
|
|
|
295
323
|
"rate-limit": [
|
|
296
324
|
"build/_modules/rate-limit/index.d.ts"
|
|
297
325
|
],
|
|
326
|
+
"scoped-config": [
|
|
327
|
+
"build/_modules/scoped-config/index.d.ts"
|
|
328
|
+
],
|
|
298
329
|
"server": [
|
|
299
330
|
"build/_modules/server/index.d.ts"
|
|
300
331
|
],
|
|
@@ -317,20 +348,42 @@
|
|
|
317
348
|
"empty": ""
|
|
318
349
|
},
|
|
319
350
|
"peerDependencies": {
|
|
351
|
+
"@anthropic-ai/sdk": "~0.39.0",
|
|
352
|
+
"@modelcontextprotocol/sdk": "~1.29.0",
|
|
353
|
+
"better-sqlite3": "~12.4.1",
|
|
320
354
|
"@futdevpro/fsm-dynamo": "1.15.23",
|
|
321
355
|
"@types/express": "4.17.21",
|
|
322
356
|
"@types/geoip-lite": "~1.4.1",
|
|
323
357
|
"@types/node": "~24.1.0",
|
|
324
358
|
"axios": "~1.8.1",
|
|
325
359
|
"body-parser": "~1.20.2",
|
|
360
|
+
"discord.js": "~14.24.2",
|
|
326
361
|
"dotenv": "~16.5.0",
|
|
327
362
|
"express": "4.21.2",
|
|
328
363
|
"geoip-lite": "~1.4.7",
|
|
329
364
|
"mongoose": "~8.10.1",
|
|
330
365
|
"nodemailer": "~6.9.4",
|
|
366
|
+
"openai": "~5.23.2",
|
|
331
367
|
"rxjs": "7.8.1",
|
|
332
368
|
"ts-node": "~10.9.2"
|
|
333
369
|
},
|
|
370
|
+
"peerDependenciesMeta": {
|
|
371
|
+
"@anthropic-ai/sdk": {
|
|
372
|
+
"optional": true
|
|
373
|
+
},
|
|
374
|
+
"@modelcontextprotocol/sdk": {
|
|
375
|
+
"optional": true
|
|
376
|
+
},
|
|
377
|
+
"better-sqlite3": {
|
|
378
|
+
"optional": true
|
|
379
|
+
},
|
|
380
|
+
"discord.js": {
|
|
381
|
+
"optional": true
|
|
382
|
+
},
|
|
383
|
+
"openai": {
|
|
384
|
+
"optional": true
|
|
385
|
+
}
|
|
386
|
+
},
|
|
334
387
|
"devDependencies": {
|
|
335
388
|
"@futdevpro/dynamo-eslint": "1.15.16",
|
|
336
389
|
"@discordjs/opus": "^0.10.0",
|
|
@@ -339,6 +392,9 @@
|
|
|
339
392
|
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
340
393
|
"@typescript-eslint/parser": "^8.41.0",
|
|
341
394
|
"@anthropic-ai/sdk": "~0.39.0",
|
|
395
|
+
"@modelcontextprotocol/sdk": "~1.29.0",
|
|
396
|
+
"@types/better-sqlite3": "~7.6.13",
|
|
397
|
+
"better-sqlite3": "~12.4.1",
|
|
342
398
|
"crypto-js": "~4.2.0",
|
|
343
399
|
"discord.js": "~14.24.2",
|
|
344
400
|
"eslint": "^9.34.0",
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { DyNTS_DAI_CodeChunking_Util } from './dai-code-chunking.util';
|
|
2
|
+
import { DyNTS_DAI_CodeChunk } from '../_models/interfaces/dai-code-chunk.interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `DyNTS_DAI_CodeChunking_Util` spec-jei (BFR-AM-005) — AST-szemantikus kód-chunking.
|
|
6
|
+
* Tiszta (NEM Mongo / NEM network): minden teszt csak forrás-string-et chunkol.
|
|
7
|
+
*/
|
|
8
|
+
describe('| DyNTS_DAI_CodeChunking_Util', () => {
|
|
9
|
+
|
|
10
|
+
describe('| chunkTs — empty / tiny input', () => {
|
|
11
|
+
it('| should return empty list for empty content', () => {
|
|
12
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunkTs('')).toEqual([]);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('| should return empty list for whitespace-only content', () => {
|
|
16
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunkTs(' \n \t \n ')).toEqual([]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('| should fall back to a single fallback chunk for tiny non-parseable content', () => {
|
|
20
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs('x');
|
|
21
|
+
expect(chunks.length).toBe(1);
|
|
22
|
+
expect(chunks[0].chunkType).toBe('fallback');
|
|
23
|
+
expect(chunks[0].content).toBe('x');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('| chunkTs — import-group', () => {
|
|
28
|
+
it('| should group consecutive imports into a single chunk', () => {
|
|
29
|
+
const code: string = [
|
|
30
|
+
`import { A } from './a';`,
|
|
31
|
+
`import { B } from './b';`,
|
|
32
|
+
`import * as c from './c';`,
|
|
33
|
+
``,
|
|
34
|
+
`export const value: number = 1;`,
|
|
35
|
+
].join('\n');
|
|
36
|
+
|
|
37
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
38
|
+
const importChunks: DyNTS_DAI_CodeChunk[] = chunks.filter((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'imports');
|
|
39
|
+
|
|
40
|
+
expect(importChunks.length).toBe(1);
|
|
41
|
+
expect(importChunks[0].content).toContain(`from './a'`);
|
|
42
|
+
expect(importChunks[0].content).toContain(`from './b'`);
|
|
43
|
+
expect(importChunks[0].content).toContain(`from './c'`);
|
|
44
|
+
expect(importChunks[0].symbolPath).toBe('');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('| should treat re-export (export ... from) as part of the import group', () => {
|
|
48
|
+
const code: string = [
|
|
49
|
+
`import { A } from './a';`,
|
|
50
|
+
`export { B } from './b';`,
|
|
51
|
+
``,
|
|
52
|
+
`function helper(): void {}`,
|
|
53
|
+
].join('\n');
|
|
54
|
+
|
|
55
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
56
|
+
const importChunks: DyNTS_DAI_CodeChunk[] = chunks.filter((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'imports');
|
|
57
|
+
|
|
58
|
+
expect(importChunks.length).toBe(1);
|
|
59
|
+
expect(importChunks[0].content).toContain(`export { B } from './b'`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('| chunkTs — top-level declarations', () => {
|
|
64
|
+
it('| should chunk an interface', () => {
|
|
65
|
+
const code: string = `export interface FooParams {\n a: string;\n b: number;\n}`;
|
|
66
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
67
|
+
|
|
68
|
+
const iface: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'interface');
|
|
69
|
+
expect(iface).toBeDefined();
|
|
70
|
+
expect(iface!.symbolName).toBe('FooParams');
|
|
71
|
+
expect(iface!.symbolPath).toBe('interface:FooParams');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('| should chunk an enum', () => {
|
|
75
|
+
const code: string = `export enum Color {\n red = 'red',\n green = 'green',\n}`;
|
|
76
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
77
|
+
|
|
78
|
+
const en: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'enum');
|
|
79
|
+
expect(en).toBeDefined();
|
|
80
|
+
expect(en!.symbolPath).toBe('enum:Color');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('| should chunk a type-alias', () => {
|
|
84
|
+
const code: string = `export type Id = string | number;`;
|
|
85
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
86
|
+
|
|
87
|
+
const typeChunk: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'type');
|
|
88
|
+
expect(typeChunk).toBeDefined();
|
|
89
|
+
expect(typeChunk!.symbolPath).toBe('type:Id');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('| should chunk a standalone function', () => {
|
|
93
|
+
const code: string = `export function doThing(x: number): number {\n return x + 1;\n}`;
|
|
94
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
95
|
+
|
|
96
|
+
const fn: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'function');
|
|
97
|
+
expect(fn).toBeDefined();
|
|
98
|
+
expect(fn!.symbolPath).toBe('function:doThing');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('| should classify an arrow-const as a function chunk', () => {
|
|
102
|
+
const code: string = `export const adder = (a: number, b: number): number => {\n return a + b;\n};`;
|
|
103
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
104
|
+
|
|
105
|
+
const fn: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'adder');
|
|
106
|
+
expect(fn).toBeDefined();
|
|
107
|
+
expect(fn!.chunkType).toBe('function');
|
|
108
|
+
expect(fn!.symbolPath).toBe('function:adder');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('| chunkTs — class (whole vs method-split)', () => {
|
|
113
|
+
it('| should keep a small class as a single chunk', () => {
|
|
114
|
+
const code: string = [
|
|
115
|
+
`export class Small {`,
|
|
116
|
+
` greet(): string { return 'hi'; }`,
|
|
117
|
+
`}`,
|
|
118
|
+
].join('\n');
|
|
119
|
+
|
|
120
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
121
|
+
const classChunks: DyNTS_DAI_CodeChunk[] = chunks.filter((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'class');
|
|
122
|
+
|
|
123
|
+
// Egyetlen, egész-osztály chunk (nincs metódus-bontás kis méretnél).
|
|
124
|
+
expect(classChunks.length).toBe(1);
|
|
125
|
+
expect(classChunks[0].symbolPath).toBe('class:Small');
|
|
126
|
+
expect(classChunks[0].content).toContain('greet');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('| should split a large class by methods with class:Foo > method:bar symbolPaths', () => {
|
|
130
|
+
// Minden metódus body-ja kellően nagy, hogy az osztály a maxChunkSize fölé nőjön.
|
|
131
|
+
const body: string = ` const v = ${'1 + '.repeat(60)}1;\n return v;`;
|
|
132
|
+
const code: string = [
|
|
133
|
+
`export class BigService {`,
|
|
134
|
+
` alpha(): number {\n${body}\n }`,
|
|
135
|
+
` beta(): number {\n${body}\n }`,
|
|
136
|
+
` gamma(): number {\n${body}\n }`,
|
|
137
|
+
`}`,
|
|
138
|
+
].join('\n');
|
|
139
|
+
|
|
140
|
+
// maxChunkSize=400: minden metódus (~292) belefér egy chunkba, de az egész osztály (~911)
|
|
141
|
+
// NEM → pontosan osztály-fej + 3 metódus-chunk.
|
|
142
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code, { maxChunkSize: 400 });
|
|
143
|
+
|
|
144
|
+
const methodChunks: DyNTS_DAI_CodeChunk[] = chunks.filter((c: DyNTS_DAI_CodeChunk) => c.chunkType === 'method');
|
|
145
|
+
const methodPaths: string[] = methodChunks.map((c: DyNTS_DAI_CodeChunk) => c.symbolPath);
|
|
146
|
+
|
|
147
|
+
expect(methodChunks.length).toBe(3);
|
|
148
|
+
expect(methodPaths).toContain('class:BigService > method:alpha');
|
|
149
|
+
expect(methodPaths).toContain('class:BigService > method:beta');
|
|
150
|
+
expect(methodPaths).toContain('class:BigService > method:gamma');
|
|
151
|
+
|
|
152
|
+
// Az osztály-fej külön chunk, class:BigService symbol-lánccal.
|
|
153
|
+
const classHeader: DyNTS_DAI_CodeChunk | undefined = chunks.find(
|
|
154
|
+
(c: DyNTS_DAI_CodeChunk) => c.chunkType === 'class' && c.symbolPath === 'class:BigService'
|
|
155
|
+
);
|
|
156
|
+
expect(classHeader).toBeDefined();
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe('| chunkTs — JSDoc + decorator bundling', () => {
|
|
161
|
+
it('| should bundle a leading JSDoc with the following node', () => {
|
|
162
|
+
const code: string = [
|
|
163
|
+
`/**`,
|
|
164
|
+
` * Helper function docs.`,
|
|
165
|
+
` */`,
|
|
166
|
+
`export function withDocs(): void {}`,
|
|
167
|
+
].join('\n');
|
|
168
|
+
|
|
169
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
170
|
+
const fn: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'withDocs');
|
|
171
|
+
|
|
172
|
+
expect(fn).toBeDefined();
|
|
173
|
+
expect(fn!.content).toContain('Helper function docs.');
|
|
174
|
+
expect(fn!.content).toContain('export function withDocs');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('| should bundle decorators with the following class node', () => {
|
|
178
|
+
const code: string = [
|
|
179
|
+
`@Injectable()`,
|
|
180
|
+
`@Logged`,
|
|
181
|
+
`export class Decorated {`,
|
|
182
|
+
` run(): void {}`,
|
|
183
|
+
`}`,
|
|
184
|
+
].join('\n');
|
|
185
|
+
|
|
186
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
187
|
+
const cls: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'Decorated');
|
|
188
|
+
|
|
189
|
+
expect(cls).toBeDefined();
|
|
190
|
+
expect(cls!.content).toContain('@Injectable()');
|
|
191
|
+
expect(cls!.content).toContain('@Logged');
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe('| chunkTs — large-node sliding-split', () => {
|
|
196
|
+
it('| should sliding-split a single oversized function into sub-chunks', () => {
|
|
197
|
+
const longBody: string = Array.from({ length: 80 }, (_: unknown, i: number) => ` const x${i} = ${i};`).join('\n');
|
|
198
|
+
const code: string = `export function huge(): void {\n${longBody}\n}`;
|
|
199
|
+
|
|
200
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code, { maxChunkSize: 300, overlap: 50 });
|
|
201
|
+
|
|
202
|
+
// Több sub-chunk, mind ugyanazzal a symbol-lánccal + subChunkIndex-szel.
|
|
203
|
+
expect(chunks.length).toBeGreaterThan(1);
|
|
204
|
+
chunks.forEach((c: DyNTS_DAI_CodeChunk) => {
|
|
205
|
+
expect(c.symbolPath).toBe('function:huge');
|
|
206
|
+
expect(c.subChunkIndex).toBeGreaterThanOrEqual(0);
|
|
207
|
+
expect(c.content.length).toBeLessThanOrEqual(300);
|
|
208
|
+
});
|
|
209
|
+
// A sub-chunk-indexek 0-tól folytonosak.
|
|
210
|
+
expect(chunks[0].subChunkIndex).toBe(0);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe('| chunkTs — positions', () => {
|
|
215
|
+
it('| should report 1-based source line numbers', () => {
|
|
216
|
+
const code: string = [
|
|
217
|
+
`import { A } from './a';`, // line 1
|
|
218
|
+
``, // line 2
|
|
219
|
+
`export function f(): void {`, // line 3
|
|
220
|
+
` return;`, // line 4
|
|
221
|
+
`}`, // line 5
|
|
222
|
+
].join('\n');
|
|
223
|
+
|
|
224
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
225
|
+
const fn: DyNTS_DAI_CodeChunk | undefined = chunks.find((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'f');
|
|
226
|
+
|
|
227
|
+
expect(fn).toBeDefined();
|
|
228
|
+
expect(fn!.lineStart).toBe(3);
|
|
229
|
+
expect(fn!.lineEnd).toBe(5);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('| should assign contiguous 0-based chunkIndex values', () => {
|
|
233
|
+
const code: string = [
|
|
234
|
+
`import { A } from './a';`,
|
|
235
|
+
`export interface I { x: number; }`,
|
|
236
|
+
`export type T = string;`,
|
|
237
|
+
`export function fn(): void {}`,
|
|
238
|
+
].join('\n');
|
|
239
|
+
|
|
240
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
241
|
+
chunks.forEach((c: DyNTS_DAI_CodeChunk, i: number) => {
|
|
242
|
+
expect(c.chunkIndex).toBe(i);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
describe('| chunk — dispatcher routing', () => {
|
|
248
|
+
it('| should route .ts files through the AST chunker', () => {
|
|
249
|
+
const code: string = `export class Routed {\n go(): void {}\n}`;
|
|
250
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunk(code, 'foo.ts');
|
|
251
|
+
|
|
252
|
+
expect(chunks.some((c: DyNTS_DAI_CodeChunk) => c.symbolPath === 'class:Routed')).toBe(true);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('| should route .tsx/.js/.jsx files through the AST chunker', () => {
|
|
256
|
+
const code: string = `export function widget(): void {}`;
|
|
257
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunk(code, 'a.tsx').some((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'widget')).toBe(true);
|
|
258
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunk(code, 'b.js').some((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'widget')).toBe(true);
|
|
259
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunk(code, 'c.jsx').some((c: DyNTS_DAI_CodeChunk) => c.symbolName === 'widget')).toBe(true);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('| should route non-code (.md) content to fallback chunks (no semantic split)', () => {
|
|
263
|
+
const content: string = `# Title\n\nSome markdown text.`;
|
|
264
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunk(content, 'readme.md');
|
|
265
|
+
|
|
266
|
+
expect(chunks.length).toBe(1);
|
|
267
|
+
expect(chunks[0].chunkType).toBe('fallback');
|
|
268
|
+
expect(chunks[0].content).toContain('# Title');
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('| should return empty for empty non-code content', () => {
|
|
272
|
+
expect(DyNTS_DAI_CodeChunking_Util.chunk('', 'readme.md')).toEqual([]);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
describe('| chunkTs — robustness (braces inside strings/templates)', () => {
|
|
277
|
+
it('| should not be confused by braces inside string and template literals (AST-correct)', () => {
|
|
278
|
+
// A FAM regex/brace-depth workaround itt tévedne; az AST helyesen kezeli.
|
|
279
|
+
const code: string = [
|
|
280
|
+
`export function tricky(): string {`,
|
|
281
|
+
' const a = "} not a real close {";',
|
|
282
|
+
' const b = `template ${ a } with } braces {`;',
|
|
283
|
+
` return a + b;`,
|
|
284
|
+
`}`,
|
|
285
|
+
`export interface AfterTricky { ok: boolean; }`,
|
|
286
|
+
].join('\n');
|
|
287
|
+
|
|
288
|
+
const chunks: DyNTS_DAI_CodeChunk[] = DyNTS_DAI_CodeChunking_Util.chunkTs(code);
|
|
289
|
+
|
|
290
|
+
// A függvény ÉS az utána jövő interface is külön, helyes chunk (nem olvad össze).
|
|
291
|
+
expect(chunks.some((c: DyNTS_DAI_CodeChunk) => c.symbolPath === 'function:tricky')).toBe(true);
|
|
292
|
+
expect(chunks.some((c: DyNTS_DAI_CodeChunk) => c.symbolPath === 'interface:AfterTricky')).toBe(true);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
});
|