@dereekb/dbx-components-mcp 13.11.4 → 13.11.6
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/dbx-components-mcp.js +427 -279
- package/generated/dereekb-dbx-form.forge-fields.mcp.generated.json +12 -0
- package/generated/dereekb-dbx-web.css-utilities.mcp.generated.json +72 -7
- package/generated/dereekb-dbx-web.ui-components.mcp.generated.json +9 -9
- package/generated/dereekb-demo.dbx-docs-ui-examples.mcp.generated.json +58 -0
- package/generated/rule-catalog.generated.json +10 -0
- package/package.json +11 -11
package/dbx-components-mcp.js
CHANGED
|
@@ -5,7 +5,7 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
// packages/dbx-components-mcp/package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@dereekb/dbx-components-mcp",
|
|
8
|
-
version: "13.11.
|
|
8
|
+
version: "13.11.6",
|
|
9
9
|
type: "module",
|
|
10
10
|
bin: {
|
|
11
11
|
"dbx-components-mcp": "dbx-components-mcp.js"
|
|
@@ -20,20 +20,20 @@ var package_default = {
|
|
|
20
20
|
"@angular/core": "21.2.11",
|
|
21
21
|
"@angular/forms": "21.2.11",
|
|
22
22
|
"@angular/material": "^21.2.9",
|
|
23
|
-
"@dereekb/dbx-cli": "13.11.
|
|
24
|
-
"@dereekb/dbx-core": "13.11.
|
|
25
|
-
"@dereekb/dbx-firebase": "13.11.
|
|
26
|
-
"@dereekb/dbx-form": "13.11.
|
|
27
|
-
"@dereekb/dbx-web": "13.11.
|
|
28
|
-
"@dereekb/firebase": "13.11.
|
|
29
|
-
"@dereekb/firebase-server": "13.11.
|
|
30
|
-
"@dereekb/rxjs": "13.11.
|
|
31
|
-
"@dereekb/util": "13.11.
|
|
23
|
+
"@dereekb/dbx-cli": "13.11.6",
|
|
24
|
+
"@dereekb/dbx-core": "13.11.6",
|
|
25
|
+
"@dereekb/dbx-firebase": "13.11.6",
|
|
26
|
+
"@dereekb/dbx-form": "13.11.6",
|
|
27
|
+
"@dereekb/dbx-web": "13.11.6",
|
|
28
|
+
"@dereekb/firebase": "13.11.6",
|
|
29
|
+
"@dereekb/firebase-server": "13.11.6",
|
|
30
|
+
"@dereekb/rxjs": "13.11.6",
|
|
31
|
+
"@dereekb/util": "13.11.6",
|
|
32
32
|
"@uirouter/angular": "21.0.0",
|
|
33
33
|
rxjs: "^7.8.2"
|
|
34
34
|
},
|
|
35
35
|
devDependencies: {
|
|
36
|
-
"@dereekb/model": "13.11.
|
|
36
|
+
"@dereekb/model": "13.11.6"
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -8239,9 +8239,11 @@ function readFieldEntries(fields) {
|
|
|
8239
8239
|
}
|
|
8240
8240
|
|
|
8241
8241
|
// packages/dbx-components-mcp/src/scan/extract-models/find-enums.ts
|
|
8242
|
-
import { Node as
|
|
8242
|
+
import { Node as Node9, SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
8243
8243
|
|
|
8244
8244
|
// packages/dbx-components-mcp/src/scan/extract-models/find-interfaces.ts
|
|
8245
|
+
import { Node as Node8 } from "ts-morph";
|
|
8246
|
+
var PASSTHROUGH_TYPE_WRAPPERS = /* @__PURE__ */ new Set(["Partial", "Required", "Readonly", "NonNullable", "MaybeMap", "Pick", "Omit"]);
|
|
8245
8247
|
function findInterfaces(sf) {
|
|
8246
8248
|
const out = [];
|
|
8247
8249
|
for (const decl of sf.getInterfaces()) {
|
|
@@ -8253,7 +8255,7 @@ function findInterfaces(sf) {
|
|
|
8253
8255
|
function buildInterface(decl) {
|
|
8254
8256
|
const tags = readInterfaceTags(decl.getJsDocs());
|
|
8255
8257
|
const description = readDescription(decl.getJsDocs());
|
|
8256
|
-
const extendsNames = decl.getExtends().map(
|
|
8258
|
+
const extendsNames = decl.getExtends().map(resolveExtendsName);
|
|
8257
8259
|
const props = [];
|
|
8258
8260
|
for (const prop of decl.getProperties()) {
|
|
8259
8261
|
const propJsDocs = prop.getJsDocs();
|
|
@@ -8277,6 +8279,39 @@ function buildInterface(decl) {
|
|
|
8277
8279
|
props
|
|
8278
8280
|
};
|
|
8279
8281
|
}
|
|
8282
|
+
function resolveExtendsName(expr) {
|
|
8283
|
+
const head = expr.getExpression().getText();
|
|
8284
|
+
let result = head;
|
|
8285
|
+
if (PASSTHROUGH_TYPE_WRAPPERS.has(head)) {
|
|
8286
|
+
const typeArgs = expr.getTypeArguments();
|
|
8287
|
+
if (typeArgs.length > 0) {
|
|
8288
|
+
const peeled = peelTypeNode(typeArgs[0]);
|
|
8289
|
+
if (peeled !== void 0) {
|
|
8290
|
+
result = peeled;
|
|
8291
|
+
}
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
return result;
|
|
8295
|
+
}
|
|
8296
|
+
function peelTypeNode(node) {
|
|
8297
|
+
let current = node;
|
|
8298
|
+
while (Node8.isParenthesizedTypeNode(current)) {
|
|
8299
|
+
current = current.getTypeNode();
|
|
8300
|
+
}
|
|
8301
|
+
let result;
|
|
8302
|
+
if (Node8.isTypeReference(current)) {
|
|
8303
|
+
const name = current.getTypeName().getText();
|
|
8304
|
+
if (PASSTHROUGH_TYPE_WRAPPERS.has(name)) {
|
|
8305
|
+
const inner = current.getTypeArguments();
|
|
8306
|
+
if (inner.length > 0) {
|
|
8307
|
+
result = peelTypeNode(inner[0]);
|
|
8308
|
+
}
|
|
8309
|
+
} else {
|
|
8310
|
+
result = name;
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
return result;
|
|
8314
|
+
}
|
|
8280
8315
|
function readInterfaceTags(jsDocs) {
|
|
8281
8316
|
let dbxModel = false;
|
|
8282
8317
|
for (const jsDoc of jsDocs) {
|
|
@@ -8354,14 +8389,14 @@ function buildEnum(decl) {
|
|
|
8354
8389
|
if (initializer === void 0) {
|
|
8355
8390
|
value = auto;
|
|
8356
8391
|
auto = value + 1;
|
|
8357
|
-
} else if (
|
|
8392
|
+
} else if (Node9.isStringLiteral(initializer) || Node9.isNoSubstitutionTemplateLiteral(initializer)) {
|
|
8358
8393
|
value = initializer.getLiteralText();
|
|
8359
|
-
} else if (
|
|
8394
|
+
} else if (Node9.isNumericLiteral(initializer)) {
|
|
8360
8395
|
value = Number(initializer.getLiteralText());
|
|
8361
8396
|
auto = value + 1;
|
|
8362
|
-
} else if (
|
|
8397
|
+
} else if (Node9.isPrefixUnaryExpression(initializer)) {
|
|
8363
8398
|
const inner = initializer.getOperand();
|
|
8364
|
-
if (
|
|
8399
|
+
if (Node9.isNumericLiteral(inner)) {
|
|
8365
8400
|
const raw = Number(inner.getLiteralText());
|
|
8366
8401
|
value = initializer.getOperatorToken() === SyntaxKind3.MinusToken ? -raw : raw;
|
|
8367
8402
|
auto = value + 1;
|
|
@@ -8381,7 +8416,7 @@ function buildEnum(decl) {
|
|
|
8381
8416
|
}
|
|
8382
8417
|
|
|
8383
8418
|
// packages/dbx-components-mcp/src/scan/extract-models/find-identities.ts
|
|
8384
|
-
import { Node as
|
|
8419
|
+
import { Node as Node10 } from "ts-morph";
|
|
8385
8420
|
var FUNCTION_NAME2 = "firestoreModelIdentity";
|
|
8386
8421
|
function findIdentities(sf) {
|
|
8387
8422
|
const out = [];
|
|
@@ -8389,7 +8424,7 @@ function findIdentities(sf) {
|
|
|
8389
8424
|
if (!statement.isExported()) continue;
|
|
8390
8425
|
for (const decl of statement.getDeclarations()) {
|
|
8391
8426
|
const initializer = decl.getInitializer();
|
|
8392
|
-
if (!initializer || !
|
|
8427
|
+
if (!initializer || !Node10.isCallExpression(initializer)) continue;
|
|
8393
8428
|
if (initializer.getExpression().getText() !== FUNCTION_NAME2) continue;
|
|
8394
8429
|
const parsed = parseIdentityCall(initializer.getArguments());
|
|
8395
8430
|
if (parsed) {
|
|
@@ -8426,14 +8461,14 @@ function parseIdentityCall(args) {
|
|
|
8426
8461
|
}
|
|
8427
8462
|
function stringLiteralValue(node) {
|
|
8428
8463
|
let result;
|
|
8429
|
-
if (
|
|
8464
|
+
if (Node10.isStringLiteral(node) || Node10.isNoSubstitutionTemplateLiteral(node)) {
|
|
8430
8465
|
result = node.getLiteralText();
|
|
8431
8466
|
}
|
|
8432
8467
|
return result;
|
|
8433
8468
|
}
|
|
8434
8469
|
function identifierName(node) {
|
|
8435
8470
|
let result;
|
|
8436
|
-
if (
|
|
8471
|
+
if (Node10.isIdentifier(node)) {
|
|
8437
8472
|
result = node.getText();
|
|
8438
8473
|
}
|
|
8439
8474
|
return result;
|
|
@@ -10809,6 +10844,11 @@ var ALIASES = {
|
|
|
10809
10844
|
dropdown: "value-selection",
|
|
10810
10845
|
select: "value-selection",
|
|
10811
10846
|
combobox: "value-selection",
|
|
10847
|
+
"dbx-list": "list-selection",
|
|
10848
|
+
dbxlist: "list-selection",
|
|
10849
|
+
"list-select": "list-selection",
|
|
10850
|
+
"list-selection-field": "list-selection",
|
|
10851
|
+
"dbx-list-selection": "list-selection",
|
|
10812
10852
|
// text variants (specialized)
|
|
10813
10853
|
email: "email",
|
|
10814
10854
|
"email-field": "email",
|
|
@@ -11291,6 +11331,16 @@ function scoreFieldAgainstToken(field, token) {
|
|
|
11291
11331
|
if (tier === token) {
|
|
11292
11332
|
score += 5;
|
|
11293
11333
|
}
|
|
11334
|
+
if (field.tier === "field-factory") {
|
|
11335
|
+
const ngFormType = field.ngFormType.toLowerCase();
|
|
11336
|
+
if (ngFormType === token) {
|
|
11337
|
+
score += 15;
|
|
11338
|
+
} else if (ngFormType.startsWith(token)) {
|
|
11339
|
+
score += 10;
|
|
11340
|
+
} else if (ngFormType.includes(token)) {
|
|
11341
|
+
score += 6;
|
|
11342
|
+
}
|
|
11343
|
+
}
|
|
11294
11344
|
for (const key of Object.keys(field.config)) {
|
|
11295
11345
|
const keyLower = key.toLowerCase();
|
|
11296
11346
|
if (keyLower === token) {
|
|
@@ -14229,7 +14279,7 @@ function createListAppTool(config) {
|
|
|
14229
14279
|
}
|
|
14230
14280
|
|
|
14231
14281
|
// packages/dbx-components-mcp/src/tools/model-validate/extract.ts
|
|
14232
|
-
import { Node as
|
|
14282
|
+
import { Node as Node11, Project as Project4, SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
14233
14283
|
function extractFile(source) {
|
|
14234
14284
|
const project = new Project4({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
14235
14285
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -14368,7 +14418,7 @@ function extractIdentityRefs(alias) {
|
|
|
14368
14418
|
if (!typeNode) {
|
|
14369
14419
|
return refs;
|
|
14370
14420
|
}
|
|
14371
|
-
if (
|
|
14421
|
+
if (Node11.isTypeQuery(typeNode)) {
|
|
14372
14422
|
refs.push(typeNode.getExprName().getText());
|
|
14373
14423
|
}
|
|
14374
14424
|
const typeofNodes = typeNode.getDescendantsOfKind(SyntaxKind4.TypeQuery);
|
|
@@ -14382,7 +14432,7 @@ function findIdentities2(sourceFile) {
|
|
|
14382
14432
|
for (const statement of sourceFile.getVariableStatements()) {
|
|
14383
14433
|
for (const decl of statement.getDeclarations()) {
|
|
14384
14434
|
const initializer = decl.getInitializer();
|
|
14385
|
-
if (!initializer || !
|
|
14435
|
+
if (!initializer || !Node11.isCallExpression(initializer)) {
|
|
14386
14436
|
continue;
|
|
14387
14437
|
}
|
|
14388
14438
|
if (initializer.getExpression().getText() !== "firestoreModelIdentity") {
|
|
@@ -14418,7 +14468,7 @@ function parseIdentityArgs(args) {
|
|
|
14418
14468
|
}
|
|
14419
14469
|
if (args.length === 3) {
|
|
14420
14470
|
const [parentNode, nameNode, prefixNode] = args;
|
|
14421
|
-
const parentRef =
|
|
14471
|
+
const parentRef = Node11.isIdentifier(parentNode) ? parentNode.getText() : void 0;
|
|
14422
14472
|
const result2 = {
|
|
14423
14473
|
parentIdentityRef: parentRef,
|
|
14424
14474
|
collectionName: stringLiteralValue2(nameNode),
|
|
@@ -14433,7 +14483,7 @@ function stringLiteralValue2(node) {
|
|
|
14433
14483
|
if (!node) {
|
|
14434
14484
|
return void 0;
|
|
14435
14485
|
}
|
|
14436
|
-
if (
|
|
14486
|
+
if (Node11.isStringLiteral(node) || Node11.isNoSubstitutionTemplateLiteral(node)) {
|
|
14437
14487
|
return node.getLiteralText();
|
|
14438
14488
|
}
|
|
14439
14489
|
return void 0;
|
|
@@ -14494,7 +14544,7 @@ function detectFactoryCallKind(sourceFile, factoryFnName) {
|
|
|
14494
14544
|
const calls = fn.getDescendantsOfKind(SyntaxKind4.CallExpression);
|
|
14495
14545
|
for (const call of calls) {
|
|
14496
14546
|
const expr = call.getExpression();
|
|
14497
|
-
if (!
|
|
14547
|
+
if (!Node11.isPropertyAccessExpression(expr)) {
|
|
14498
14548
|
continue;
|
|
14499
14549
|
}
|
|
14500
14550
|
const name = expr.getName();
|
|
@@ -15085,6 +15135,16 @@ var RULE_CATALOG = [
|
|
|
15085
15135
|
whenItDoesNotApply: "When the rename was intentional (rare \u2014 usually a copy-paste).",
|
|
15086
15136
|
canonicalFix: "Update the getter body to return the matching identity constant."
|
|
15087
15137
|
},
|
|
15138
|
+
{
|
|
15139
|
+
code: "MODEL_FIELD_LONG_NAME_EQUALS_NAME",
|
|
15140
|
+
source: "dbx_model_validate",
|
|
15141
|
+
severity: "warning",
|
|
15142
|
+
title: "A persisted field's `@dbxModelVariable <longName>` tag value matches the field's short name verbatim, defeating the tag's purpose (the long name should be the field's unabbreviated camelCase variable name)",
|
|
15143
|
+
whatItFlags: "A persisted field's `@dbxModelVariable <longName>` tag value matches the field's short name verbatim, defeating the tag's purpose (the long name should be the field's unabbreviated camelCase variable name).",
|
|
15144
|
+
whenItApplies: "Every field on a `@dbxModel` interface where `@dbxModelVariable` is present and its value equals the field's name (e.g. field `h` tagged `@dbxModelVariable h`, field `ub` tagged `@dbxModelVariable ub`). The tag must always carry the unabbreviated form so the catalog and decoder surface a meaningful long name.",
|
|
15145
|
+
whenItDoesNotApply: "Fields whose name is already the unabbreviated camelCase form (e.g. `name`, `email`, `id`, `at`) \u2014 add those to `dbx-mcp.config.json` `modelValidate.ignoredFieldNames` to silence the warning workspace-wide.",
|
|
15146
|
+
canonicalFix: "Replace the tag value with the field's unabbreviated camelCase variable name (e.g. `@dbxModelVariable h` \u2192 `@dbxModelVariable hours`, `@dbxModelVariable ub` \u2192 `@dbxModelVariable usedBudget`). To exempt fields whose long name legitimately equals the short name, add them to `modelValidate.ignoredFieldNames`."
|
|
15147
|
+
},
|
|
15088
15148
|
{
|
|
15089
15149
|
code: "MODEL_FIELD_MISSING_JSDOC",
|
|
15090
15150
|
source: "dbx_model_validate",
|
|
@@ -16959,9 +17019,10 @@ function checkFieldNameLengths(file, violations, options) {
|
|
|
16959
17019
|
});
|
|
16960
17020
|
}
|
|
16961
17021
|
}
|
|
16962
|
-
checkFieldJsDocs(file, violations);
|
|
17022
|
+
checkFieldJsDocs(file, violations, options);
|
|
16963
17023
|
}
|
|
16964
|
-
function checkFieldJsDocs(file, violations) {
|
|
17024
|
+
function checkFieldJsDocs(file, violations, options) {
|
|
17025
|
+
const ignored = options?.ignoredFieldNames;
|
|
16965
17026
|
for (const iface of file.dataInterfaces) {
|
|
16966
17027
|
for (const field of iface.fields) {
|
|
16967
17028
|
if (!field.jsDocFirstLine) {
|
|
@@ -16984,6 +17045,16 @@ function checkFieldJsDocs(file, violations) {
|
|
|
16984
17045
|
model: iface.name
|
|
16985
17046
|
});
|
|
16986
17047
|
}
|
|
17048
|
+
if (iface.dbxModelTag && field.dbxModelVariableTag !== void 0 && field.dbxModelVariableTag === field.name && !ignored?.has(field.name)) {
|
|
17049
|
+
pushViolation(violations, {
|
|
17050
|
+
code: "MODEL_FIELD_LONG_NAME_EQUALS_NAME",
|
|
17051
|
+
severity: "warning",
|
|
17052
|
+
message: `Field \`${field.name}\` in interface \`${iface.name}\` has \`@dbxModelVariable ${field.dbxModelVariableTag}\` matching its short name. The long name should be the field's unabbreviated camelCase variable name (e.g. \`h\` \u2192 \`hours\`, \`ub\` \u2192 \`usedBudget\`). If the short name is already the unabbreviated form, add \`${field.name}\` to \`modelValidate.ignoredFieldNames\` in \`dbx-mcp.config.json\`.`,
|
|
17053
|
+
file: file.name,
|
|
17054
|
+
line: field.line,
|
|
17055
|
+
model: iface.name
|
|
17056
|
+
});
|
|
17057
|
+
}
|
|
16987
17058
|
}
|
|
16988
17059
|
}
|
|
16989
17060
|
}
|
|
@@ -17764,7 +17835,7 @@ var modelValidateTool = /* @__PURE__ */ createModelValidateTool();
|
|
|
17764
17835
|
var runModelValidate = modelValidateTool.run;
|
|
17765
17836
|
|
|
17766
17837
|
// packages/dbx-components-mcp/src/tools/model-validate-api/extract.ts
|
|
17767
|
-
import { Node as
|
|
17838
|
+
import { Node as Node12, Project as Project5, SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
17768
17839
|
function extractFile2(source) {
|
|
17769
17840
|
const project = new Project5({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
17770
17841
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -17930,7 +18001,7 @@ function findCrudConfigType(sourceFile) {
|
|
|
17930
18001
|
continue;
|
|
17931
18002
|
}
|
|
17932
18003
|
const typeNode = alias.getTypeNode();
|
|
17933
|
-
const summary = typeNode &&
|
|
18004
|
+
const summary = typeNode && Node12.isTypeLiteral(typeNode) ? summarizeCrudConfigType(typeNode) : { keys: [], nonNullKeys: [], bareLeafParamsNames: [] };
|
|
17934
18005
|
const result = {
|
|
17935
18006
|
name: alias.getName(),
|
|
17936
18007
|
exported: alias.isExported(),
|
|
@@ -17944,14 +18015,14 @@ function findCrudConfigType(sourceFile) {
|
|
|
17944
18015
|
return void 0;
|
|
17945
18016
|
}
|
|
17946
18017
|
function summarizeCrudConfigType(typeLiteral) {
|
|
17947
|
-
if (!
|
|
18018
|
+
if (!Node12.isTypeLiteral(typeLiteral)) {
|
|
17948
18019
|
return { keys: [], nonNullKeys: [], bareLeafParamsNames: [] };
|
|
17949
18020
|
}
|
|
17950
18021
|
const keys = [];
|
|
17951
18022
|
const nonNullKeys = [];
|
|
17952
18023
|
const bareLeafParamsNames = [];
|
|
17953
18024
|
for (const member of typeLiteral.getMembers()) {
|
|
17954
|
-
if (!
|
|
18025
|
+
if (!Node12.isPropertySignature(member)) {
|
|
17955
18026
|
continue;
|
|
17956
18027
|
}
|
|
17957
18028
|
const name = member.getName();
|
|
@@ -17969,18 +18040,18 @@ function summarizeCrudConfigType(typeLiteral) {
|
|
|
17969
18040
|
return { keys, nonNullKeys, bareLeafParamsNames };
|
|
17970
18041
|
}
|
|
17971
18042
|
function isNullLiteralType(node) {
|
|
17972
|
-
if (
|
|
18043
|
+
if (Node12.isLiteralTypeNode(node)) {
|
|
17973
18044
|
const literal = node.getLiteral();
|
|
17974
|
-
if (
|
|
18045
|
+
if (Node12.isNullLiteral(literal)) {
|
|
17975
18046
|
return true;
|
|
17976
18047
|
}
|
|
17977
18048
|
}
|
|
17978
18049
|
return false;
|
|
17979
18050
|
}
|
|
17980
18051
|
function collectBareParamsLeaves(node, out) {
|
|
17981
|
-
if (
|
|
18052
|
+
if (Node12.isTypeLiteral(node)) {
|
|
17982
18053
|
for (const member of node.getMembers()) {
|
|
17983
|
-
if (!
|
|
18054
|
+
if (!Node12.isPropertySignature(member)) {
|
|
17984
18055
|
continue;
|
|
17985
18056
|
}
|
|
17986
18057
|
const valueNode = member.getTypeNode();
|
|
@@ -17990,10 +18061,10 @@ function collectBareParamsLeaves(node, out) {
|
|
|
17990
18061
|
}
|
|
17991
18062
|
return;
|
|
17992
18063
|
}
|
|
17993
|
-
if (
|
|
18064
|
+
if (Node12.isTupleTypeNode(node)) {
|
|
17994
18065
|
return;
|
|
17995
18066
|
}
|
|
17996
|
-
if (
|
|
18067
|
+
if (Node12.isTypeReference(node)) {
|
|
17997
18068
|
const name = node.getTypeName().getText();
|
|
17998
18069
|
if (name.endsWith("Params")) {
|
|
17999
18070
|
out.push(name);
|
|
@@ -18010,12 +18081,12 @@ function findCrudConfigConst(sourceFile) {
|
|
|
18010
18081
|
const typeNode = decl.getTypeNode();
|
|
18011
18082
|
const initializer = decl.getInitializer();
|
|
18012
18083
|
const runtimeKeys = [];
|
|
18013
|
-
if (initializer &&
|
|
18084
|
+
if (initializer && Node12.isAsExpression(initializer)) {
|
|
18014
18085
|
const inner = initializer.getExpression();
|
|
18015
|
-
if (
|
|
18086
|
+
if (Node12.isObjectLiteralExpression(inner)) {
|
|
18016
18087
|
runtimeKeys.push(...collectObjectLiteralKeys(inner));
|
|
18017
18088
|
}
|
|
18018
|
-
} else if (initializer &&
|
|
18089
|
+
} else if (initializer && Node12.isObjectLiteralExpression(initializer)) {
|
|
18019
18090
|
runtimeKeys.push(...collectObjectLiteralKeys(initializer));
|
|
18020
18091
|
}
|
|
18021
18092
|
const result = {
|
|
@@ -18033,7 +18104,7 @@ function findCrudConfigConst(sourceFile) {
|
|
|
18033
18104
|
function collectObjectLiteralKeys(obj) {
|
|
18034
18105
|
const out = [];
|
|
18035
18106
|
for (const prop of obj.getProperties()) {
|
|
18036
|
-
if (
|
|
18107
|
+
if (Node12.isPropertyAssignment(prop) || Node12.isShorthandPropertyAssignment(prop)) {
|
|
18037
18108
|
out.push(prop.getName());
|
|
18038
18109
|
}
|
|
18039
18110
|
}
|
|
@@ -18049,7 +18120,7 @@ function findFunctionMap(sourceFile) {
|
|
|
18049
18120
|
const initializer = decl.getInitializer();
|
|
18050
18121
|
let callsFactory = false;
|
|
18051
18122
|
const factoryArgs = [];
|
|
18052
|
-
if (initializer &&
|
|
18123
|
+
if (initializer && Node12.isCallExpression(initializer)) {
|
|
18053
18124
|
const exprText = initializer.getExpression().getText();
|
|
18054
18125
|
if (exprText === "callModelFirebaseFunctionMapFactory") {
|
|
18055
18126
|
callsFactory = true;
|
|
@@ -18187,18 +18258,18 @@ function extractCastTargetName(node) {
|
|
|
18187
18258
|
return void 0;
|
|
18188
18259
|
}
|
|
18189
18260
|
let current = node;
|
|
18190
|
-
while (current &&
|
|
18261
|
+
while (current && Node12.isAsExpression(current)) {
|
|
18191
18262
|
const typeNode = current.getTypeNode();
|
|
18192
18263
|
if (!typeNode) {
|
|
18193
18264
|
break;
|
|
18194
18265
|
}
|
|
18195
|
-
if (
|
|
18266
|
+
if (Node12.isTypeReference(typeNode)) {
|
|
18196
18267
|
const refName = typeNode.getTypeName().getText();
|
|
18197
18268
|
if (refName === "Type") {
|
|
18198
18269
|
const args = typeNode.getTypeArguments();
|
|
18199
18270
|
if (args.length === 1) {
|
|
18200
18271
|
const arg = args[0];
|
|
18201
|
-
if (
|
|
18272
|
+
if (Node12.isTypeReference(arg)) {
|
|
18202
18273
|
return arg.getTypeName().getText();
|
|
18203
18274
|
}
|
|
18204
18275
|
return arg.getText();
|
|
@@ -18217,7 +18288,7 @@ function extractValidatorProperties(initializer) {
|
|
|
18217
18288
|
}
|
|
18218
18289
|
const out = [];
|
|
18219
18290
|
for (const prop of obj.getProperties()) {
|
|
18220
|
-
if (!
|
|
18291
|
+
if (!Node12.isPropertyAssignment(prop)) {
|
|
18221
18292
|
continue;
|
|
18222
18293
|
}
|
|
18223
18294
|
const propAssignment = prop;
|
|
@@ -18227,7 +18298,7 @@ function extractValidatorProperties(initializer) {
|
|
|
18227
18298
|
const clean = optional ? stripped.slice(0, -1) : stripped;
|
|
18228
18299
|
const valueNode = propAssignment.getInitializer();
|
|
18229
18300
|
let hasClearable = false;
|
|
18230
|
-
if (valueNode &&
|
|
18301
|
+
if (valueNode && Node12.isCallExpression(valueNode)) {
|
|
18231
18302
|
const exprText = valueNode.getExpression().getText();
|
|
18232
18303
|
if (exprText === "clearable") {
|
|
18233
18304
|
hasClearable = true;
|
|
@@ -18239,25 +18310,25 @@ function extractValidatorProperties(initializer) {
|
|
|
18239
18310
|
}
|
|
18240
18311
|
function findArktypeObjectLiteral(initializer) {
|
|
18241
18312
|
let current = initializer;
|
|
18242
|
-
while (current &&
|
|
18313
|
+
while (current && Node12.isAsExpression(current)) {
|
|
18243
18314
|
current = current.getExpression();
|
|
18244
18315
|
}
|
|
18245
|
-
if (!current || !
|
|
18316
|
+
if (!current || !Node12.isCallExpression(current)) {
|
|
18246
18317
|
return void 0;
|
|
18247
18318
|
}
|
|
18248
18319
|
const expr = current.getExpression();
|
|
18249
|
-
if (
|
|
18320
|
+
if (Node12.isIdentifier(expr) && expr.getText() === "type") {
|
|
18250
18321
|
const args = current.getArguments();
|
|
18251
18322
|
const arg = args[0];
|
|
18252
|
-
if (arg &&
|
|
18323
|
+
if (arg && Node12.isObjectLiteralExpression(arg)) {
|
|
18253
18324
|
return arg;
|
|
18254
18325
|
}
|
|
18255
18326
|
return void 0;
|
|
18256
18327
|
}
|
|
18257
|
-
if (
|
|
18328
|
+
if (Node12.isPropertyAccessExpression(expr) && expr.getName() === "merge") {
|
|
18258
18329
|
const args = current.getArguments();
|
|
18259
18330
|
const arg = args[0];
|
|
18260
|
-
if (arg &&
|
|
18331
|
+
if (arg && Node12.isObjectLiteralExpression(arg)) {
|
|
18261
18332
|
return arg;
|
|
18262
18333
|
}
|
|
18263
18334
|
}
|
|
@@ -18942,7 +19013,7 @@ import { readdir as readdir2, readFile as readFile4, stat as stat4 } from "node:
|
|
|
18942
19013
|
import { join as join4, relative as relative4, sep as sep5 } from "node:path";
|
|
18943
19014
|
|
|
18944
19015
|
// packages/dbx-cli/manifest-extract/src/lib/extract-crud.ts
|
|
18945
|
-
import { Node as
|
|
19016
|
+
import { Node as Node13, Project as Project6 } from "ts-morph";
|
|
18946
19017
|
var SUPPORTED_VERBS = /* @__PURE__ */ new Set(["create", "read", "update", "delete", "query"]);
|
|
18947
19018
|
function extractCrudEntries(source) {
|
|
18948
19019
|
const project = new Project6({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
@@ -18968,9 +19039,9 @@ function extractCrudEntries(source) {
|
|
|
18968
19039
|
};
|
|
18969
19040
|
if (crudConfigType) {
|
|
18970
19041
|
const literal = crudConfigType.getTypeNode();
|
|
18971
|
-
if (literal &&
|
|
19042
|
+
if (literal && Node13.isTypeLiteral(literal)) {
|
|
18972
19043
|
for (const member of literal.getMembers()) {
|
|
18973
|
-
if (!
|
|
19044
|
+
if (!Node13.isPropertySignature(member)) {
|
|
18974
19045
|
continue;
|
|
18975
19046
|
}
|
|
18976
19047
|
const modelName = member.getName();
|
|
@@ -18982,9 +19053,9 @@ function extractCrudEntries(source) {
|
|
|
18982
19053
|
if (isNullLiteralType2(valueNode)) {
|
|
18983
19054
|
continue;
|
|
18984
19055
|
}
|
|
18985
|
-
if (
|
|
19056
|
+
if (Node13.isTypeLiteral(valueNode)) {
|
|
18986
19057
|
for (const verbMember of valueNode.getMembers()) {
|
|
18987
|
-
if (!
|
|
19058
|
+
if (!Node13.isPropertySignature(verbMember)) {
|
|
18988
19059
|
continue;
|
|
18989
19060
|
}
|
|
18990
19061
|
const verbName = verbMember.getName();
|
|
@@ -19005,9 +19076,9 @@ function extractCrudEntries(source) {
|
|
|
19005
19076
|
const functionTypeMap = findTypeAliasByEnding(sourceFile, "FunctionTypeMap");
|
|
19006
19077
|
if (functionTypeMap) {
|
|
19007
19078
|
const literal = functionTypeMap.getTypeNode();
|
|
19008
|
-
if (literal &&
|
|
19079
|
+
if (literal && Node13.isTypeLiteral(literal)) {
|
|
19009
19080
|
for (const member of literal.getMembers()) {
|
|
19010
|
-
if (!
|
|
19081
|
+
if (!Node13.isPropertySignature(member)) {
|
|
19011
19082
|
continue;
|
|
19012
19083
|
}
|
|
19013
19084
|
const key = member.getName();
|
|
@@ -19075,9 +19146,9 @@ function inferGroupName2(sourceFile) {
|
|
|
19075
19146
|
return void 0;
|
|
19076
19147
|
}
|
|
19077
19148
|
function isNullLiteralType2(node) {
|
|
19078
|
-
if (
|
|
19149
|
+
if (Node13.isLiteralTypeNode(node)) {
|
|
19079
19150
|
const literal = node.getLiteral();
|
|
19080
|
-
if (
|
|
19151
|
+
if (Node13.isNullLiteral(literal)) {
|
|
19081
19152
|
return true;
|
|
19082
19153
|
}
|
|
19083
19154
|
}
|
|
@@ -19085,9 +19156,9 @@ function isNullLiteralType2(node) {
|
|
|
19085
19156
|
}
|
|
19086
19157
|
function collectVerbEntries(input) {
|
|
19087
19158
|
const { modelName, verb, valueNode, entries, fallbackDescription, resolveTypeDocs } = input;
|
|
19088
|
-
if (
|
|
19159
|
+
if (Node13.isTypeLiteral(valueNode)) {
|
|
19089
19160
|
for (const specMember of valueNode.getMembers()) {
|
|
19090
|
-
if (!
|
|
19161
|
+
if (!Node13.isPropertySignature(specMember)) {
|
|
19091
19162
|
continue;
|
|
19092
19163
|
}
|
|
19093
19164
|
const specifier = specMember.getName();
|
|
@@ -19129,7 +19200,7 @@ function collectVerbEntries(input) {
|
|
|
19129
19200
|
});
|
|
19130
19201
|
}
|
|
19131
19202
|
function readTupleParamsResult(node) {
|
|
19132
|
-
if (!
|
|
19203
|
+
if (!Node13.isTupleTypeNode(node)) {
|
|
19133
19204
|
return void 0;
|
|
19134
19205
|
}
|
|
19135
19206
|
const elements = node.getElements();
|
|
@@ -19148,7 +19219,7 @@ function readBareParams(node) {
|
|
|
19148
19219
|
return { params, result: void 0 };
|
|
19149
19220
|
}
|
|
19150
19221
|
function typeNodeName(node) {
|
|
19151
|
-
if (
|
|
19222
|
+
if (Node13.isTypeReference(node)) {
|
|
19152
19223
|
return node.getTypeName().getText();
|
|
19153
19224
|
}
|
|
19154
19225
|
const text = node.getText().trim();
|
|
@@ -19987,7 +20058,7 @@ async function collectApiFiles2(rootAbs) {
|
|
|
19987
20058
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-handlers.ts
|
|
19988
20059
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
19989
20060
|
import { join as join8 } from "node:path";
|
|
19990
|
-
import { Node as
|
|
20061
|
+
import { Node as Node14, Project as Project8 } from "ts-morph";
|
|
19991
20062
|
var HANDLER_MAP_REL = "src/app/function/model/crud.functions.ts";
|
|
19992
20063
|
var VERB_TOKENS = [
|
|
19993
20064
|
{ token: "Create", verb: "create" },
|
|
@@ -20015,7 +20086,7 @@ async function extractHandlerEntries(apiAbs, apiDir) {
|
|
|
20015
20086
|
const verb = matchVerbFromConstName(name);
|
|
20016
20087
|
if (!verb) continue;
|
|
20017
20088
|
const initializer = decl.getInitializer();
|
|
20018
|
-
if (!initializer || !
|
|
20089
|
+
if (!initializer || !Node14.isObjectLiteralExpression(initializer)) continue;
|
|
20019
20090
|
verbsFound.push(verb);
|
|
20020
20091
|
collectVerbMap({ verb, mapLiteral: initializer, sourceFileRel, entries });
|
|
20021
20092
|
}
|
|
@@ -20033,7 +20104,7 @@ function matchVerbFromConstName(name) {
|
|
|
20033
20104
|
function collectVerbMap(input) {
|
|
20034
20105
|
const { verb, mapLiteral, sourceFileRel, entries } = input;
|
|
20035
20106
|
for (const prop of mapLiteral.getProperties()) {
|
|
20036
|
-
if (!
|
|
20107
|
+
if (!Node14.isPropertyAssignment(prop)) continue;
|
|
20037
20108
|
const model = prop.getName();
|
|
20038
20109
|
const value = prop.getInitializer();
|
|
20039
20110
|
if (!value) continue;
|
|
@@ -20052,25 +20123,25 @@ function collectVerbMap(input) {
|
|
|
20052
20123
|
}
|
|
20053
20124
|
}
|
|
20054
20125
|
function readSpecifierHandler(node) {
|
|
20055
|
-
if (!
|
|
20126
|
+
if (!Node14.isCallExpression(node)) return void 0;
|
|
20056
20127
|
const expr = node.getExpression();
|
|
20057
20128
|
if (!expr.getText().endsWith("onCallSpecifierHandler")) return void 0;
|
|
20058
20129
|
const args = node.getArguments();
|
|
20059
20130
|
if (args.length === 0) return void 0;
|
|
20060
20131
|
const firstArg = args[0];
|
|
20061
|
-
if (!
|
|
20132
|
+
if (!Node14.isObjectLiteralExpression(firstArg)) return void 0;
|
|
20062
20133
|
const out = /* @__PURE__ */ new Map();
|
|
20063
20134
|
for (const prop of firstArg.getProperties()) {
|
|
20064
|
-
if (!
|
|
20135
|
+
if (!Node14.isPropertyAssignment(prop) && !Node14.isShorthandPropertyAssignment(prop)) continue;
|
|
20065
20136
|
const specifier = prop.getName();
|
|
20066
|
-
const handlerName = readBareHandlerName(
|
|
20137
|
+
const handlerName = readBareHandlerName(Node14.isPropertyAssignment(prop) ? prop.getInitializerOrThrow() : prop) ?? "(unresolved)";
|
|
20067
20138
|
out.set(specifier, handlerName);
|
|
20068
20139
|
}
|
|
20069
20140
|
return out;
|
|
20070
20141
|
}
|
|
20071
20142
|
function readBareHandlerName(node) {
|
|
20072
|
-
if (
|
|
20073
|
-
if (
|
|
20143
|
+
if (Node14.isIdentifier(node)) return node.getText();
|
|
20144
|
+
if (Node14.isShorthandPropertyAssignment(node)) return node.getName();
|
|
20074
20145
|
const text = node.getText().split(/\s|\(/)[0];
|
|
20075
20146
|
if (/^[A-Za-z_]\w*$/.test(text)) return text;
|
|
20076
20147
|
return void 0;
|
|
@@ -21272,7 +21343,7 @@ function paramsHasFixtureDependencies(params) {
|
|
|
21272
21343
|
}
|
|
21273
21344
|
|
|
21274
21345
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/extract.ts
|
|
21275
|
-
import { Node as
|
|
21346
|
+
import { Node as Node15, Project as Project9, SyntaxKind as SyntaxKind7 } from "ts-morph";
|
|
21276
21347
|
|
|
21277
21348
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/framework-fixtures.ts
|
|
21278
21349
|
var KNOWN_NON_MODEL_FIXTURE_FAMILIES = [
|
|
@@ -21384,7 +21455,7 @@ function extendsByName(cls, baseName) {
|
|
|
21384
21455
|
const extendsClause = cls.getExtends();
|
|
21385
21456
|
if (!extendsClause) return false;
|
|
21386
21457
|
const expr = extendsClause.getExpression();
|
|
21387
|
-
if (
|
|
21458
|
+
if (Node15.isIdentifier(expr)) {
|
|
21388
21459
|
return expr.getText() === baseName;
|
|
21389
21460
|
}
|
|
21390
21461
|
return extendsClause.getText().startsWith(baseName);
|
|
@@ -21512,14 +21583,14 @@ function readContextFactory(decl) {
|
|
|
21512
21583
|
const initializer = decl.getInitializer();
|
|
21513
21584
|
if (!initializer) return void 0;
|
|
21514
21585
|
let bodyExpr;
|
|
21515
|
-
if (
|
|
21586
|
+
if (Node15.isArrowFunction(initializer) || Node15.isFunctionExpression(initializer)) {
|
|
21516
21587
|
bodyExpr = readSingleReturnExpression(initializer);
|
|
21517
21588
|
} else {
|
|
21518
21589
|
bodyExpr = initializer;
|
|
21519
21590
|
}
|
|
21520
|
-
if (!bodyExpr || !
|
|
21591
|
+
if (!bodyExpr || !Node15.isCallExpression(bodyExpr)) return void 0;
|
|
21521
21592
|
const callee = bodyExpr.getExpression();
|
|
21522
|
-
if (!
|
|
21593
|
+
if (!Node15.isIdentifier(callee)) return void 0;
|
|
21523
21594
|
const calleeName = callee.getText();
|
|
21524
21595
|
let family;
|
|
21525
21596
|
if (calleeName !== MODEL_FACTORY_NAME) {
|
|
@@ -21534,9 +21605,9 @@ function readContextFactory(decl) {
|
|
|
21534
21605
|
let parentFixtureFieldFromGetCollection;
|
|
21535
21606
|
if (args.length > 0) {
|
|
21536
21607
|
const first = args[0];
|
|
21537
|
-
if (
|
|
21608
|
+
if (Node15.isObjectLiteralExpression(first)) {
|
|
21538
21609
|
const getCollection = first.getProperty("getCollection");
|
|
21539
|
-
if (getCollection &&
|
|
21610
|
+
if (getCollection && Node15.isPropertyAssignment(getCollection)) {
|
|
21540
21611
|
const fnInit = getCollection.getInitializer();
|
|
21541
21612
|
const arity = readArrowParameterCount(fnInit);
|
|
21542
21613
|
if (arity >= 2) {
|
|
@@ -21587,7 +21658,7 @@ function familyFromExtends(cls) {
|
|
|
21587
21658
|
if (!ext) return void 0;
|
|
21588
21659
|
const expr = ext.getExpression();
|
|
21589
21660
|
let baseName;
|
|
21590
|
-
if (
|
|
21661
|
+
if (Node15.isIdentifier(expr)) {
|
|
21591
21662
|
baseName = expr.getText();
|
|
21592
21663
|
} else {
|
|
21593
21664
|
const text = ext.getText();
|
|
@@ -21600,9 +21671,9 @@ function familyFromExtends(cls) {
|
|
|
21600
21671
|
function readSingleReturnExpression(fn) {
|
|
21601
21672
|
const body = fn.getBody();
|
|
21602
21673
|
if (!body) return void 0;
|
|
21603
|
-
if (
|
|
21674
|
+
if (Node15.isBlock(body)) {
|
|
21604
21675
|
for (const stmt of body.getStatements()) {
|
|
21605
|
-
if (
|
|
21676
|
+
if (Node15.isReturnStatement(stmt)) {
|
|
21606
21677
|
return stmt.getExpression();
|
|
21607
21678
|
}
|
|
21608
21679
|
}
|
|
@@ -21612,19 +21683,19 @@ function readSingleReturnExpression(fn) {
|
|
|
21612
21683
|
}
|
|
21613
21684
|
function readArrowParameterCount(fn) {
|
|
21614
21685
|
if (!fn) return 0;
|
|
21615
|
-
if (
|
|
21686
|
+
if (Node15.isArrowFunction(fn) || Node15.isFunctionExpression(fn) || Node15.isFunctionDeclaration(fn) || Node15.isMethodDeclaration(fn)) {
|
|
21616
21687
|
return fn.getParameters().length;
|
|
21617
21688
|
}
|
|
21618
21689
|
return 0;
|
|
21619
21690
|
}
|
|
21620
21691
|
function readParamsAccessFieldName(fn) {
|
|
21621
21692
|
if (!fn) return void 0;
|
|
21622
|
-
if (!
|
|
21693
|
+
if (!Node15.isArrowFunction(fn) && !Node15.isFunctionExpression(fn)) return void 0;
|
|
21623
21694
|
const body = fn.getBody();
|
|
21624
21695
|
if (!body) return void 0;
|
|
21625
21696
|
for (const access2 of body.getDescendantsOfKind(SyntaxKind7.PropertyAccessExpression)) {
|
|
21626
21697
|
const expr = access2.getExpression();
|
|
21627
|
-
if (
|
|
21698
|
+
if (Node15.isIdentifier(expr) && expr.getText() === "params") {
|
|
21628
21699
|
return access2.getName();
|
|
21629
21700
|
}
|
|
21630
21701
|
}
|
|
@@ -21665,9 +21736,9 @@ function collectSingletonsByFactory(sourceFile) {
|
|
|
21665
21736
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
21666
21737
|
for (const decl of stmt.getDeclarations()) {
|
|
21667
21738
|
const init = decl.getInitializer();
|
|
21668
|
-
if (!init || !
|
|
21739
|
+
if (!init || !Node15.isCallExpression(init)) continue;
|
|
21669
21740
|
const callee = init.getExpression();
|
|
21670
|
-
if (!
|
|
21741
|
+
if (!Node15.isIdentifier(callee)) continue;
|
|
21671
21742
|
out.set(callee.getText(), decl.getName());
|
|
21672
21743
|
}
|
|
21673
21744
|
}
|
|
@@ -22915,7 +22986,7 @@ import { resolve as resolve32 } from "node:path";
|
|
|
22915
22986
|
import { type as type47 } from "arktype";
|
|
22916
22987
|
|
|
22917
22988
|
// packages/dbx-components-mcp/src/tools/model-test-shared/extract.ts
|
|
22918
|
-
import { Node as
|
|
22989
|
+
import { Node as Node16, Project as Project11, SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
22919
22990
|
var SPEC_FILE_VIRTUAL_PATH = "__spec__/spec.ts";
|
|
22920
22991
|
var FIXTURE_CONTEXT_SUFFIX = "Context";
|
|
22921
22992
|
var FIXTURE_FACTORY_SUFFIX = "ContextFactory";
|
|
@@ -22936,9 +23007,9 @@ function extractSpecTreeFromText(input) {
|
|
|
22936
23007
|
const counts = { describe: 0, it: 0, fixture: 0 };
|
|
22937
23008
|
const rootChildren = [];
|
|
22938
23009
|
for (const stmt of sourceFile.getStatements()) {
|
|
22939
|
-
if (!
|
|
23010
|
+
if (!Node16.isExpressionStatement(stmt)) continue;
|
|
22940
23011
|
const expr = stmt.getExpression();
|
|
22941
|
-
if (!
|
|
23012
|
+
if (!Node16.isCallExpression(expr)) continue;
|
|
22942
23013
|
const node = walkCall(expr, { prefix, knownFixtureNames, helperNames, counts });
|
|
22943
23014
|
if (node !== void 0) {
|
|
22944
23015
|
rootChildren.push(node);
|
|
@@ -23104,7 +23175,7 @@ function fixtureNode(input) {
|
|
|
23104
23175
|
const { call, calleeName, ctx, line, endLine } = input;
|
|
23105
23176
|
const args = call.getArguments();
|
|
23106
23177
|
const argsObject = args[0];
|
|
23107
|
-
const parentVars =
|
|
23178
|
+
const parentVars = Node16.isObjectLiteralExpression(argsObject) ? readParentVars(argsObject) : [];
|
|
23108
23179
|
const callback = findCallback(call);
|
|
23109
23180
|
const varName = callback === void 0 ? void 0 : readCallbackVarName(callback);
|
|
23110
23181
|
const model = stripFixturePrefix(calleeName, ctx.prefix);
|
|
@@ -23142,11 +23213,11 @@ function stripFixturePrefix(name, prefix) {
|
|
|
23142
23213
|
}
|
|
23143
23214
|
function readTitle(arg) {
|
|
23144
23215
|
if (arg === void 0) return { title: void 0, titleIsTemplate: false };
|
|
23145
|
-
if (
|
|
23216
|
+
if (Node16.isStringLiteral(arg) || Node16.isNoSubstitutionTemplateLiteral(arg)) {
|
|
23146
23217
|
const result2 = { title: arg.getLiteralText(), titleIsTemplate: false };
|
|
23147
23218
|
return result2;
|
|
23148
23219
|
}
|
|
23149
|
-
if (
|
|
23220
|
+
if (Node16.isTemplateExpression(arg)) {
|
|
23150
23221
|
const result2 = { title: arg.getText(), titleIsTemplate: true };
|
|
23151
23222
|
return result2;
|
|
23152
23223
|
}
|
|
@@ -23157,7 +23228,7 @@ function findCallback(call) {
|
|
|
23157
23228
|
const args = call.getArguments();
|
|
23158
23229
|
for (let i = args.length - 1; i >= 0; i--) {
|
|
23159
23230
|
const a = args[i];
|
|
23160
|
-
if (
|
|
23231
|
+
if (Node16.isArrowFunction(a) || Node16.isFunctionExpression(a)) {
|
|
23161
23232
|
return a;
|
|
23162
23233
|
}
|
|
23163
23234
|
}
|
|
@@ -23168,7 +23239,7 @@ function readCallbackVarName(callback) {
|
|
|
23168
23239
|
if (params.length === 0) return void 0;
|
|
23169
23240
|
const first = params[0];
|
|
23170
23241
|
const nameNode = first.getNameNode();
|
|
23171
|
-
if (
|
|
23242
|
+
if (Node16.isIdentifier(nameNode)) {
|
|
23172
23243
|
return nameNode.getText();
|
|
23173
23244
|
}
|
|
23174
23245
|
return void 0;
|
|
@@ -23176,13 +23247,13 @@ function readCallbackVarName(callback) {
|
|
|
23176
23247
|
function readParentVars(obj) {
|
|
23177
23248
|
const out = [];
|
|
23178
23249
|
for (const prop of obj.getProperties()) {
|
|
23179
|
-
if (
|
|
23250
|
+
if (Node16.isShorthandPropertyAssignment(prop)) {
|
|
23180
23251
|
out.push(prop.getName());
|
|
23181
23252
|
continue;
|
|
23182
23253
|
}
|
|
23183
|
-
if (
|
|
23254
|
+
if (Node16.isPropertyAssignment(prop)) {
|
|
23184
23255
|
const init = prop.getInitializer();
|
|
23185
|
-
if (init !== void 0 &&
|
|
23256
|
+
if (init !== void 0 && Node16.isIdentifier(init)) {
|
|
23186
23257
|
out.push(init.getText());
|
|
23187
23258
|
}
|
|
23188
23259
|
}
|
|
@@ -23191,10 +23262,10 @@ function readParentVars(obj) {
|
|
|
23191
23262
|
}
|
|
23192
23263
|
function walkCallbackBody(callback, ctx) {
|
|
23193
23264
|
const body = callback.getBody();
|
|
23194
|
-
if (
|
|
23265
|
+
if (Node16.isBlock(body)) {
|
|
23195
23266
|
return walkBlock(body, ctx);
|
|
23196
23267
|
}
|
|
23197
|
-
if (
|
|
23268
|
+
if (Node16.isCallExpression(body)) {
|
|
23198
23269
|
const child = walkCall(body, ctx);
|
|
23199
23270
|
return child === void 0 ? [] : [child];
|
|
23200
23271
|
}
|
|
@@ -23203,9 +23274,9 @@ function walkCallbackBody(callback, ctx) {
|
|
|
23203
23274
|
function walkBlock(block, ctx) {
|
|
23204
23275
|
const children = [];
|
|
23205
23276
|
for (const stmt of block.getStatements()) {
|
|
23206
|
-
if (!
|
|
23277
|
+
if (!Node16.isExpressionStatement(stmt)) continue;
|
|
23207
23278
|
const expr = stmt.getExpression();
|
|
23208
|
-
if (!
|
|
23279
|
+
if (!Node16.isCallExpression(expr)) continue;
|
|
23209
23280
|
const child = walkCall(expr, ctx);
|
|
23210
23281
|
if (child !== void 0) {
|
|
23211
23282
|
children.push(child);
|
|
@@ -23215,7 +23286,7 @@ function walkBlock(block, ctx) {
|
|
|
23215
23286
|
}
|
|
23216
23287
|
function getCalleeName(call) {
|
|
23217
23288
|
const expr = call.getExpression();
|
|
23218
|
-
if (
|
|
23289
|
+
if (Node16.isIdentifier(expr)) return expr.getText();
|
|
23219
23290
|
return void 0;
|
|
23220
23291
|
}
|
|
23221
23292
|
function collectHelpers(sourceFile) {
|
|
@@ -23231,7 +23302,7 @@ function collectHelpers(sourceFile) {
|
|
|
23231
23302
|
for (const decl of v.getDeclarations()) {
|
|
23232
23303
|
const init = decl.getInitializer();
|
|
23233
23304
|
if (init === void 0) continue;
|
|
23234
|
-
if (!
|
|
23305
|
+
if (!Node16.isArrowFunction(init) && !Node16.isFunctionExpression(init)) continue;
|
|
23235
23306
|
const usage = scanForDescribeOrIt(init);
|
|
23236
23307
|
if (!usage.emitsDescribe && !usage.emitsIt) continue;
|
|
23237
23308
|
out.push({ name: decl.getName(), line: decl.getStartLineNumber(), endLine: decl.getEndLineNumber(), emitsDescribe: usage.emitsDescribe, emitsIt: usage.emitsIt });
|
|
@@ -23245,7 +23316,7 @@ function scanForDescribeOrIt(node) {
|
|
|
23245
23316
|
if (descendant.getKind() !== SyntaxKind8.CallExpression) return;
|
|
23246
23317
|
const call = descendant;
|
|
23247
23318
|
const expr = call.getExpression();
|
|
23248
|
-
if (!
|
|
23319
|
+
if (!Node16.isIdentifier(expr)) return;
|
|
23249
23320
|
const name = expr.getText();
|
|
23250
23321
|
if (DESCRIBE_NAMES.has(name)) usage.emitsDescribe = true;
|
|
23251
23322
|
if (isItName(name)) usage.emitsIt = true;
|
|
@@ -24018,10 +24089,10 @@ var modelHierarchyTool = {
|
|
|
24018
24089
|
};
|
|
24019
24090
|
|
|
24020
24091
|
// packages/dbx-components-mcp/src/tools/storagefile-m-validate-app/extract.ts
|
|
24021
|
-
import { Node as
|
|
24092
|
+
import { Node as Node18, SyntaxKind as SyntaxKind10 } from "ts-morph";
|
|
24022
24093
|
|
|
24023
24094
|
// packages/dbx-components-mcp/src/tools/_validate/ast.ts
|
|
24024
|
-
import { Node as
|
|
24095
|
+
import { Node as Node17, Project as Project12, SyntaxKind as SyntaxKind9 } from "ts-morph";
|
|
24025
24096
|
var COMPONENT_VIRTUAL_PREFIX = "__component__/";
|
|
24026
24097
|
var API_VIRTUAL_PREFIX = "__api__/";
|
|
24027
24098
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -24046,28 +24117,28 @@ function componentRelPath(sourceFile) {
|
|
|
24046
24117
|
}
|
|
24047
24118
|
function unwrapAsExpressions(node) {
|
|
24048
24119
|
let current = node;
|
|
24049
|
-
while (current &&
|
|
24120
|
+
while (current && Node17.isAsExpression(current)) {
|
|
24050
24121
|
current = current.getExpression();
|
|
24051
24122
|
}
|
|
24052
24123
|
return current;
|
|
24053
24124
|
}
|
|
24054
24125
|
function asObjectLiteral(node) {
|
|
24055
24126
|
const inner = unwrapAsExpressions(node);
|
|
24056
|
-
if (inner &&
|
|
24127
|
+
if (inner && Node17.isObjectLiteralExpression(inner)) {
|
|
24057
24128
|
return inner;
|
|
24058
24129
|
}
|
|
24059
24130
|
return void 0;
|
|
24060
24131
|
}
|
|
24061
24132
|
function asArrayLiteral(node) {
|
|
24062
24133
|
const inner = unwrapAsExpressions(node);
|
|
24063
|
-
if (inner &&
|
|
24134
|
+
if (inner && Node17.isArrayLiteralExpression(inner)) {
|
|
24064
24135
|
return inner;
|
|
24065
24136
|
}
|
|
24066
24137
|
return void 0;
|
|
24067
24138
|
}
|
|
24068
24139
|
function readStringLiteralInitializer(decl) {
|
|
24069
24140
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
24070
|
-
if (initializer &&
|
|
24141
|
+
if (initializer && Node17.isStringLiteral(initializer)) {
|
|
24071
24142
|
return initializer.getLiteralText();
|
|
24072
24143
|
}
|
|
24073
24144
|
return void 0;
|
|
@@ -24079,37 +24150,37 @@ function typeAnnotationText(node) {
|
|
|
24079
24150
|
function getPropertyInitializer(obj, name) {
|
|
24080
24151
|
const prop = obj.getProperty(name);
|
|
24081
24152
|
if (!prop) return void 0;
|
|
24082
|
-
if (
|
|
24153
|
+
if (Node17.isPropertyAssignment(prop)) {
|
|
24083
24154
|
return prop.getInitializer();
|
|
24084
24155
|
}
|
|
24085
|
-
if (
|
|
24156
|
+
if (Node17.isShorthandPropertyAssignment(prop)) {
|
|
24086
24157
|
return prop.getNameNode();
|
|
24087
24158
|
}
|
|
24088
24159
|
return void 0;
|
|
24089
24160
|
}
|
|
24090
24161
|
function readStringProperty2(obj, name) {
|
|
24091
24162
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24092
|
-
if (init &&
|
|
24163
|
+
if (init && Node17.isStringLiteral(init)) {
|
|
24093
24164
|
return init.getLiteralText();
|
|
24094
24165
|
}
|
|
24095
24166
|
return void 0;
|
|
24096
24167
|
}
|
|
24097
24168
|
function readIdentifierProperty(obj, name) {
|
|
24098
24169
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24099
|
-
if (init &&
|
|
24170
|
+
if (init && Node17.isIdentifier(init)) {
|
|
24100
24171
|
return init.getText();
|
|
24101
24172
|
}
|
|
24102
24173
|
return void 0;
|
|
24103
24174
|
}
|
|
24104
24175
|
function findReturnExpression(fn) {
|
|
24105
|
-
if (!
|
|
24176
|
+
if (!Node17.isArrowFunction(fn) && !Node17.isFunctionDeclaration(fn) && !Node17.isFunctionExpression(fn)) {
|
|
24106
24177
|
return void 0;
|
|
24107
24178
|
}
|
|
24108
24179
|
const body = fn.getBody();
|
|
24109
24180
|
if (!body) return void 0;
|
|
24110
|
-
if (
|
|
24181
|
+
if (Node17.isBlock(body)) {
|
|
24111
24182
|
for (const stmt of body.getStatements()) {
|
|
24112
|
-
if (
|
|
24183
|
+
if (Node17.isReturnStatement(stmt)) {
|
|
24113
24184
|
return stmt.getExpression();
|
|
24114
24185
|
}
|
|
24115
24186
|
}
|
|
@@ -24129,7 +24200,7 @@ function findLocalVariable(sf, name) {
|
|
|
24129
24200
|
return void 0;
|
|
24130
24201
|
}
|
|
24131
24202
|
function collectTypeofReferences(node, out) {
|
|
24132
|
-
if (
|
|
24203
|
+
if (Node17.isTypeQuery(node)) {
|
|
24133
24204
|
out.push(node.getExprName().getText());
|
|
24134
24205
|
return;
|
|
24135
24206
|
}
|
|
@@ -24331,7 +24402,7 @@ function buildApiFunctionIndex(sources) {
|
|
|
24331
24402
|
for (const decl of stmt.getDeclarations()) {
|
|
24332
24403
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
24333
24404
|
if (!initializer) continue;
|
|
24334
|
-
if (
|
|
24405
|
+
if (Node18.isArrowFunction(initializer) || Node18.isFunctionExpression(initializer)) {
|
|
24335
24406
|
map.set(decl.getName(), { node: initializer, sourceFile: sf });
|
|
24336
24407
|
}
|
|
24337
24408
|
}
|
|
@@ -24344,34 +24415,34 @@ function collectInitializerBindingsFromValue(options) {
|
|
|
24344
24415
|
const { node, sf, index, resolved, unresolved, visited } = options;
|
|
24345
24416
|
const inner = unwrapAsExpressions(node);
|
|
24346
24417
|
if (!inner) return false;
|
|
24347
|
-
if (
|
|
24418
|
+
if (Node18.isArrayLiteralExpression(inner)) {
|
|
24348
24419
|
for (const el of inner.getElements()) {
|
|
24349
|
-
if (
|
|
24420
|
+
if (Node18.isSpreadElement(el)) {
|
|
24350
24421
|
const spreadInner = el.getExpression();
|
|
24351
|
-
if (
|
|
24422
|
+
if (Node18.isIdentifier(spreadInner)) {
|
|
24352
24423
|
collectInitializerBindingsFromIdentifier({ name: spreadInner.getText(), sf, index, resolved, unresolved, visited });
|
|
24353
|
-
} else if (
|
|
24424
|
+
} else if (Node18.isCallExpression(spreadInner)) {
|
|
24354
24425
|
const callee = spreadInner.getExpression();
|
|
24355
|
-
if (
|
|
24426
|
+
if (Node18.isIdentifier(callee)) {
|
|
24356
24427
|
collectInitializerBindingsFromIdentifier({ name: callee.getText(), sf, index, resolved, unresolved, visited });
|
|
24357
24428
|
}
|
|
24358
24429
|
}
|
|
24359
24430
|
continue;
|
|
24360
24431
|
}
|
|
24361
24432
|
const elementInner = unwrapAsExpressions(el);
|
|
24362
|
-
if (elementInner &&
|
|
24433
|
+
if (elementInner && Node18.isIdentifier(elementInner)) {
|
|
24363
24434
|
resolved.push(elementInner.getText());
|
|
24364
24435
|
}
|
|
24365
24436
|
}
|
|
24366
24437
|
return true;
|
|
24367
24438
|
}
|
|
24368
|
-
if (
|
|
24439
|
+
if (Node18.isCallExpression(inner)) {
|
|
24369
24440
|
const callee = inner.getExpression();
|
|
24370
|
-
if (
|
|
24441
|
+
if (Node18.isIdentifier(callee)) {
|
|
24371
24442
|
return collectInitializerBindingsFromIdentifier({ name: callee.getText(), sf, index, resolved, unresolved, visited });
|
|
24372
24443
|
}
|
|
24373
24444
|
}
|
|
24374
|
-
if (
|
|
24445
|
+
if (Node18.isIdentifier(inner)) {
|
|
24375
24446
|
return collectInitializerBindingsFromIdentifier({ name: inner.getText(), sf, index, resolved, unresolved, visited });
|
|
24376
24447
|
}
|
|
24377
24448
|
return false;
|
|
@@ -24410,15 +24481,15 @@ function collectUploadInitializerArray(options) {
|
|
|
24410
24481
|
const { initializerArr, sf, index, direct, spreads, resolved, unresolved } = options;
|
|
24411
24482
|
const visited = /* @__PURE__ */ new Set();
|
|
24412
24483
|
for (const el of initializerArr.getElements()) {
|
|
24413
|
-
if (
|
|
24484
|
+
if (Node18.isSpreadElement(el)) {
|
|
24414
24485
|
const inner2 = el.getExpression();
|
|
24415
|
-
if (
|
|
24486
|
+
if (Node18.isIdentifier(inner2)) {
|
|
24416
24487
|
const name = inner2.getText();
|
|
24417
24488
|
spreads.push(name);
|
|
24418
24489
|
collectInitializerBindingsFromIdentifier({ name, sf, index, resolved, unresolved, visited });
|
|
24419
|
-
} else if (
|
|
24490
|
+
} else if (Node18.isCallExpression(inner2)) {
|
|
24420
24491
|
const callee = inner2.getExpression();
|
|
24421
|
-
if (
|
|
24492
|
+
if (Node18.isIdentifier(callee)) {
|
|
24422
24493
|
const name = callee.getText();
|
|
24423
24494
|
spreads.push(name);
|
|
24424
24495
|
collectInitializerBindingsFromIdentifier({ name, sf, index, resolved, unresolved, visited });
|
|
@@ -24427,7 +24498,7 @@ function collectUploadInitializerArray(options) {
|
|
|
24427
24498
|
continue;
|
|
24428
24499
|
}
|
|
24429
24500
|
const inner = unwrapAsExpressions(el);
|
|
24430
|
-
if (inner &&
|
|
24501
|
+
if (inner && Node18.isIdentifier(inner)) {
|
|
24431
24502
|
const name = inner.getText();
|
|
24432
24503
|
direct.push(name);
|
|
24433
24504
|
resolved.push(name);
|
|
@@ -24440,7 +24511,7 @@ function extractUploadServiceCalls(sources, index) {
|
|
|
24440
24511
|
const rel = apiRelPath(sf);
|
|
24441
24512
|
for (const call of sf.getDescendantsOfKind(SyntaxKind10.CallExpression)) {
|
|
24442
24513
|
const expr = call.getExpression();
|
|
24443
|
-
if (!
|
|
24514
|
+
if (!Node18.isIdentifier(expr) || expr.getText() !== UPLOAD_SERVICE_FACTORY) continue;
|
|
24444
24515
|
const args = call.getArguments();
|
|
24445
24516
|
const first = args[0] ? resolveObjectArg(args[0], sf) : void 0;
|
|
24446
24517
|
if (!first) continue;
|
|
@@ -24468,12 +24539,12 @@ function extractUploadServiceCalls(sources, index) {
|
|
|
24468
24539
|
function resolveObjectArg(node, sf) {
|
|
24469
24540
|
const inner = unwrapAsExpressions(node);
|
|
24470
24541
|
if (!inner) return void 0;
|
|
24471
|
-
if (
|
|
24472
|
-
if (
|
|
24542
|
+
if (Node18.isObjectLiteralExpression(inner)) return inner;
|
|
24543
|
+
if (Node18.isIdentifier(inner)) {
|
|
24473
24544
|
const declNode = findLocalVariable(sf, inner.getText());
|
|
24474
24545
|
if (declNode) {
|
|
24475
24546
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
24476
|
-
if (declInit &&
|
|
24547
|
+
if (declInit && Node18.isObjectLiteralExpression(declInit)) {
|
|
24477
24548
|
return declInit;
|
|
24478
24549
|
}
|
|
24479
24550
|
}
|
|
@@ -24483,12 +24554,12 @@ function resolveObjectArg(node, sf) {
|
|
|
24483
24554
|
function resolveArrayFromProperty(obj, name, sf) {
|
|
24484
24555
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24485
24556
|
if (!init) return void 0;
|
|
24486
|
-
if (
|
|
24487
|
-
if (
|
|
24557
|
+
if (Node18.isArrayLiteralExpression(init)) return init;
|
|
24558
|
+
if (Node18.isIdentifier(init)) {
|
|
24488
24559
|
const declNode = findLocalVariable(sf, init.getText());
|
|
24489
24560
|
if (declNode) {
|
|
24490
24561
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
24491
|
-
if (declInit &&
|
|
24562
|
+
if (declInit && Node18.isArrayLiteralExpression(declInit)) {
|
|
24492
24563
|
return declInit;
|
|
24493
24564
|
}
|
|
24494
24565
|
}
|
|
@@ -24499,11 +24570,11 @@ function enclosingFactoryName(node) {
|
|
|
24499
24570
|
let current = node.getParent();
|
|
24500
24571
|
let result;
|
|
24501
24572
|
while (current) {
|
|
24502
|
-
if (
|
|
24573
|
+
if (Node18.isFunctionDeclaration(current)) {
|
|
24503
24574
|
result = current.getName() ?? void 0;
|
|
24504
24575
|
break;
|
|
24505
24576
|
}
|
|
24506
|
-
if (
|
|
24577
|
+
if (Node18.isVariableDeclaration(current)) {
|
|
24507
24578
|
result = current.getName();
|
|
24508
24579
|
break;
|
|
24509
24580
|
}
|
|
@@ -24557,10 +24628,10 @@ function extractProcessingConfigFromDecl(decl, rel) {
|
|
|
24557
24628
|
function readFlowSubtasks(obj) {
|
|
24558
24629
|
const flowInit = unwrapAsExpressions(getPropertyInitializer(obj, "flow"));
|
|
24559
24630
|
const subtasks = [];
|
|
24560
|
-
if (flowInit &&
|
|
24631
|
+
if (flowInit && Node18.isArrayLiteralExpression(flowInit)) {
|
|
24561
24632
|
for (const el of flowInit.getElements()) {
|
|
24562
24633
|
const inner = unwrapAsExpressions(el);
|
|
24563
|
-
if (inner &&
|
|
24634
|
+
if (inner && Node18.isObjectLiteralExpression(inner)) {
|
|
24564
24635
|
const subtask = readIdentifierProperty(inner, "subtask");
|
|
24565
24636
|
if (subtask) subtasks.push(subtask);
|
|
24566
24637
|
}
|
|
@@ -24574,7 +24645,7 @@ function extractProcessingHandlerCalls(sources) {
|
|
|
24574
24645
|
const rel = apiRelPath(sf);
|
|
24575
24646
|
for (const call of sf.getDescendantsOfKind(SyntaxKind10.CallExpression)) {
|
|
24576
24647
|
const expr = call.getExpression();
|
|
24577
|
-
if (!
|
|
24648
|
+
if (!Node18.isIdentifier(expr) || expr.getText() !== PROCESSING_HANDLER_FACTORY) continue;
|
|
24578
24649
|
const args = call.getArguments();
|
|
24579
24650
|
const first = args[0] ? resolveObjectArg(args[0], sf) : void 0;
|
|
24580
24651
|
if (!first) continue;
|
|
@@ -24595,7 +24666,7 @@ function extractProcessingHandlerCalls(sources) {
|
|
|
24595
24666
|
}
|
|
24596
24667
|
function collectProcessorArrayElements(processorsArr, direct, spreads) {
|
|
24597
24668
|
for (const el of processorsArr.getElements()) {
|
|
24598
|
-
if (
|
|
24669
|
+
if (Node18.isSpreadElement(el)) {
|
|
24599
24670
|
addProcessorIdentifierName(el.getExpression(), spreads);
|
|
24600
24671
|
continue;
|
|
24601
24672
|
}
|
|
@@ -24607,13 +24678,13 @@ function collectProcessorArrayElements(processorsArr, direct, spreads) {
|
|
|
24607
24678
|
}
|
|
24608
24679
|
function addProcessorIdentifierName(node, bucket) {
|
|
24609
24680
|
if (!node) return;
|
|
24610
|
-
if (
|
|
24681
|
+
if (Node18.isIdentifier(node)) {
|
|
24611
24682
|
bucket.push(node.getText());
|
|
24612
24683
|
return;
|
|
24613
24684
|
}
|
|
24614
|
-
if (
|
|
24685
|
+
if (Node18.isCallExpression(node)) {
|
|
24615
24686
|
const callee = node.getExpression();
|
|
24616
|
-
if (
|
|
24687
|
+
if (Node18.isIdentifier(callee)) {
|
|
24617
24688
|
bucket.push(callee.getText());
|
|
24618
24689
|
}
|
|
24619
24690
|
}
|
|
@@ -25605,7 +25676,7 @@ var storageFileMValidateFolderTool = createTwoSideValidateTool({
|
|
|
25605
25676
|
});
|
|
25606
25677
|
|
|
25607
25678
|
// packages/dbx-components-mcp/src/tools/notification-m-validate-app/extract.ts
|
|
25608
|
-
import { Node as
|
|
25679
|
+
import { Node as Node19, SyntaxKind as SyntaxKind11 } from "ts-morph";
|
|
25609
25680
|
var NOTIF_TEMPLATE_TYPE = "NotificationTemplateType";
|
|
25610
25681
|
var NOTIF_TEMPLATE_TYPE_INFO = "NotificationTemplateTypeInfo";
|
|
25611
25682
|
var NOTIF_TEMPLATE_TYPE_INFO_ARRAY = "NotificationTemplateTypeInfo[]";
|
|
@@ -25726,7 +25797,7 @@ function extractTemplateInfoAggregates(sources) {
|
|
|
25726
25797
|
const ids = [];
|
|
25727
25798
|
for (const el of arr.getElements()) {
|
|
25728
25799
|
const inner = unwrapAsExpressions(el);
|
|
25729
|
-
if (inner &&
|
|
25800
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25730
25801
|
ids.push(inner.getText());
|
|
25731
25802
|
}
|
|
25732
25803
|
}
|
|
@@ -25772,7 +25843,7 @@ function extractTaskAllTypesAggregates(sources) {
|
|
|
25772
25843
|
const ids = [];
|
|
25773
25844
|
for (const el of arr.getElements()) {
|
|
25774
25845
|
const inner = unwrapAsExpressions(el);
|
|
25775
|
-
if (inner &&
|
|
25846
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25776
25847
|
ids.push(inner.getText());
|
|
25777
25848
|
}
|
|
25778
25849
|
}
|
|
@@ -25800,14 +25871,14 @@ function extractTaskCheckpointAliases(sources) {
|
|
|
25800
25871
|
return out;
|
|
25801
25872
|
}
|
|
25802
25873
|
function collectStringLiterals(node, out) {
|
|
25803
|
-
if (
|
|
25874
|
+
if (Node19.isLiteralTypeNode(node)) {
|
|
25804
25875
|
const lit = node.getLiteral();
|
|
25805
|
-
if (
|
|
25876
|
+
if (Node19.isStringLiteral(lit)) {
|
|
25806
25877
|
out.push(lit.getLiteralText());
|
|
25807
25878
|
}
|
|
25808
25879
|
return;
|
|
25809
25880
|
}
|
|
25810
|
-
if (
|
|
25881
|
+
if (Node19.isUnionTypeNode(node)) {
|
|
25811
25882
|
for (const child of node.getTypeNodes()) {
|
|
25812
25883
|
collectStringLiterals(child, out);
|
|
25813
25884
|
}
|
|
@@ -25861,7 +25932,7 @@ function extractTemplateInfoRecord(sources, index) {
|
|
|
25861
25932
|
}
|
|
25862
25933
|
function tryReadTemplateInfoRecord(decl, rel, index) {
|
|
25863
25934
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
25864
|
-
if (!initializer || !
|
|
25935
|
+
if (!initializer || !Node19.isCallExpression(initializer)) return void 0;
|
|
25865
25936
|
if (initializer.getExpression().getText() !== TEMPLATE_INFO_RECORD_FACTORY) return void 0;
|
|
25866
25937
|
const args = initializer.getArguments();
|
|
25867
25938
|
const arr = args[0] ? asArrayLiteral(args[0]) : void 0;
|
|
@@ -25882,15 +25953,15 @@ function tryReadTemplateInfoRecord(decl, rel, index) {
|
|
|
25882
25953
|
}
|
|
25883
25954
|
function classifyInfoRecordArrayElements(arr, direct, spreads) {
|
|
25884
25955
|
for (const el of arr.getElements()) {
|
|
25885
|
-
if (
|
|
25956
|
+
if (Node19.isSpreadElement(el)) {
|
|
25886
25957
|
const inner2 = el.getExpression();
|
|
25887
|
-
if (
|
|
25958
|
+
if (Node19.isIdentifier(inner2)) {
|
|
25888
25959
|
spreads.push(inner2.getText());
|
|
25889
25960
|
}
|
|
25890
25961
|
continue;
|
|
25891
25962
|
}
|
|
25892
25963
|
const inner = unwrapAsExpressions(el);
|
|
25893
|
-
if (inner &&
|
|
25964
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25894
25965
|
direct.push(inner.getText());
|
|
25895
25966
|
}
|
|
25896
25967
|
}
|
|
@@ -25917,7 +25988,7 @@ function extractTemplateInfoRecordWiring(sources) {
|
|
|
25917
25988
|
const first = args[0];
|
|
25918
25989
|
if (!first) continue;
|
|
25919
25990
|
const inner = unwrapAsExpressions(first);
|
|
25920
|
-
if (!inner || !
|
|
25991
|
+
if (!inner || !Node19.isIdentifier(inner)) continue;
|
|
25921
25992
|
const result = {
|
|
25922
25993
|
recordIdentifier: inner.getText(),
|
|
25923
25994
|
sourceFile: rel
|
|
@@ -25955,7 +26026,7 @@ function buildApiFunctionIndex2(sources) {
|
|
|
25955
26026
|
for (const decl of stmt.getDeclarations()) {
|
|
25956
26027
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
25957
26028
|
if (!initializer) continue;
|
|
25958
|
-
if (
|
|
26029
|
+
if (Node19.isArrowFunction(initializer) || Node19.isFunctionExpression(initializer)) {
|
|
25959
26030
|
map.set(decl.getName(), { node: initializer, sourceFile: sf, relPath: rel });
|
|
25960
26031
|
}
|
|
25961
26032
|
}
|
|
@@ -25991,11 +26062,11 @@ function extractTemplateConfigsArrayFactory(sources, index) {
|
|
|
25991
26062
|
const arr = returnExpr ? asArrayLiteral(returnExpr) : void 0;
|
|
25992
26063
|
if (arr) {
|
|
25993
26064
|
for (const el of arr.getElements()) {
|
|
25994
|
-
if (
|
|
26065
|
+
if (Node19.isSpreadElement(el)) {
|
|
25995
26066
|
const inner2 = el.getExpression();
|
|
25996
|
-
if (
|
|
26067
|
+
if (Node19.isCallExpression(inner2)) {
|
|
25997
26068
|
const callee = inner2.getExpression();
|
|
25998
|
-
if (
|
|
26069
|
+
if (Node19.isIdentifier(callee)) {
|
|
25999
26070
|
const callName = callee.getText();
|
|
26000
26071
|
spreadCalls.push(callName);
|
|
26001
26072
|
if (!index.functionsByName.has(callName)) {
|
|
@@ -26006,9 +26077,9 @@ function extractTemplateConfigsArrayFactory(sources, index) {
|
|
|
26006
26077
|
continue;
|
|
26007
26078
|
}
|
|
26008
26079
|
const inner = unwrapAsExpressions(el);
|
|
26009
|
-
if (inner &&
|
|
26080
|
+
if (inner && Node19.isCallExpression(inner)) {
|
|
26010
26081
|
const callee = inner.getExpression();
|
|
26011
|
-
if (
|
|
26082
|
+
if (Node19.isIdentifier(callee)) {
|
|
26012
26083
|
directCalls.push(callee.getText());
|
|
26013
26084
|
}
|
|
26014
26085
|
}
|
|
@@ -26057,11 +26128,11 @@ function collectFromArrayEntryFactory(name, out, index) {
|
|
|
26057
26128
|
const arr = asArrayLiteral(returnExpr);
|
|
26058
26129
|
if (!arr) return;
|
|
26059
26130
|
for (const el of arr.getElements()) {
|
|
26060
|
-
if (
|
|
26131
|
+
if (Node19.isSpreadElement(el)) {
|
|
26061
26132
|
const inner2 = el.getExpression();
|
|
26062
|
-
if (
|
|
26133
|
+
if (Node19.isCallExpression(inner2)) {
|
|
26063
26134
|
const callee = inner2.getExpression();
|
|
26064
|
-
if (
|
|
26135
|
+
if (Node19.isIdentifier(callee)) {
|
|
26065
26136
|
collectFromArrayEntryFactory(callee.getText(), out, index);
|
|
26066
26137
|
}
|
|
26067
26138
|
}
|
|
@@ -26069,9 +26140,9 @@ function collectFromArrayEntryFactory(name, out, index) {
|
|
|
26069
26140
|
}
|
|
26070
26141
|
const inner = unwrapAsExpressions(el);
|
|
26071
26142
|
if (!inner) continue;
|
|
26072
|
-
if (
|
|
26143
|
+
if (Node19.isCallExpression(inner)) {
|
|
26073
26144
|
const callee = inner.getExpression();
|
|
26074
|
-
if (
|
|
26145
|
+
if (Node19.isIdentifier(callee)) {
|
|
26075
26146
|
collectFromSingleEntryFactory(callee.getText(), out, index);
|
|
26076
26147
|
}
|
|
26077
26148
|
continue;
|
|
@@ -26091,7 +26162,7 @@ function extractTaskServiceCalls(sources, index, trustedExternal) {
|
|
|
26091
26162
|
const rel = apiRelPath(sf);
|
|
26092
26163
|
for (const call of sf.getDescendantsOfKind(SyntaxKind11.CallExpression)) {
|
|
26093
26164
|
const expr = call.getExpression();
|
|
26094
|
-
if (!
|
|
26165
|
+
if (!Node19.isIdentifier(expr) || expr.getText() !== TASK_SERVICE_FACTORY) continue;
|
|
26095
26166
|
const args = call.getArguments();
|
|
26096
26167
|
const first = args[0] ? asObjectLiteral(args[0]) : void 0;
|
|
26097
26168
|
if (!first) continue;
|
|
@@ -26117,13 +26188,13 @@ function collectValidateArrayElements(validateArr) {
|
|
|
26117
26188
|
const spreads = [];
|
|
26118
26189
|
if (!validateArr) return { ids, spreads };
|
|
26119
26190
|
for (const el of validateArr.getElements()) {
|
|
26120
|
-
if (
|
|
26191
|
+
if (Node19.isSpreadElement(el)) {
|
|
26121
26192
|
const inner2 = el.getExpression();
|
|
26122
|
-
if (
|
|
26193
|
+
if (Node19.isIdentifier(inner2)) spreads.push(inner2.getText());
|
|
26123
26194
|
continue;
|
|
26124
26195
|
}
|
|
26125
26196
|
const inner = unwrapAsExpressions(el);
|
|
26126
|
-
if (inner &&
|
|
26197
|
+
if (inner && Node19.isIdentifier(inner)) ids.push(inner.getText());
|
|
26127
26198
|
}
|
|
26128
26199
|
return { ids, spreads };
|
|
26129
26200
|
}
|
|
@@ -26136,17 +26207,17 @@ function collectHandlersArrayElements(options) {
|
|
|
26136
26207
|
if (!handlersArr) return { handlerTypes, unresolvedSpreads, resolvedBindings, unresolvedBindings };
|
|
26137
26208
|
const visited = /* @__PURE__ */ new Set();
|
|
26138
26209
|
for (const el of handlersArr.getElements()) {
|
|
26139
|
-
if (
|
|
26210
|
+
if (Node19.isSpreadElement(el)) {
|
|
26140
26211
|
consumeHandlersSpreadElement({ inner: el.getExpression(), sf, index, trustedExternal, unresolvedSpreads, resolvedBindings, unresolvedBindings, visited });
|
|
26141
26212
|
continue;
|
|
26142
26213
|
}
|
|
26143
26214
|
const inner = unwrapAsExpressions(el);
|
|
26144
26215
|
if (!inner) continue;
|
|
26145
|
-
if (
|
|
26216
|
+
if (Node19.isIdentifier(inner)) {
|
|
26146
26217
|
collectHandlerBindingsFromIdentifier({ name: inner.getText(), sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26147
|
-
} else if (
|
|
26218
|
+
} else if (Node19.isCallExpression(inner)) {
|
|
26148
26219
|
const callee = inner.getExpression();
|
|
26149
|
-
if (
|
|
26220
|
+
if (Node19.isIdentifier(callee)) {
|
|
26150
26221
|
collectHandlerBindingsFromIdentifier({ name: callee.getText(), sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26151
26222
|
}
|
|
26152
26223
|
}
|
|
@@ -26155,16 +26226,16 @@ function collectHandlersArrayElements(options) {
|
|
|
26155
26226
|
}
|
|
26156
26227
|
function consumeHandlersSpreadElement(options) {
|
|
26157
26228
|
const { inner, sf, index, trustedExternal, unresolvedSpreads, resolvedBindings, unresolvedBindings, visited } = options;
|
|
26158
|
-
if (
|
|
26229
|
+
if (Node19.isCallExpression(inner)) {
|
|
26159
26230
|
const callee = inner.getExpression();
|
|
26160
|
-
if (
|
|
26231
|
+
if (Node19.isIdentifier(callee)) {
|
|
26161
26232
|
const name = callee.getText();
|
|
26162
26233
|
unresolvedSpreads.push(name);
|
|
26163
26234
|
collectHandlerBindingsFromIdentifier({ name, sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26164
26235
|
}
|
|
26165
26236
|
return;
|
|
26166
26237
|
}
|
|
26167
|
-
if (
|
|
26238
|
+
if (Node19.isIdentifier(inner)) {
|
|
26168
26239
|
const name = inner.getText();
|
|
26169
26240
|
unresolvedSpreads.push(name);
|
|
26170
26241
|
collectHandlerBindingsFromIdentifier({ name, sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
@@ -26174,13 +26245,13 @@ function collectHandlerBindingsFromValue(options) {
|
|
|
26174
26245
|
const { node, sf, index, trustedExternal, resolved, unresolved, visited } = options;
|
|
26175
26246
|
const inner = unwrapAsExpressions(node);
|
|
26176
26247
|
if (!inner) return false;
|
|
26177
|
-
if (
|
|
26248
|
+
if (Node19.isCallExpression(inner)) {
|
|
26178
26249
|
const callee = inner.getExpression();
|
|
26179
|
-
if (
|
|
26250
|
+
if (Node19.isIdentifier(callee)) {
|
|
26180
26251
|
return collectHandlerBindingsFromIdentifier({ name: callee.getText(), sf, index, trustedExternal, resolved, unresolved, visited });
|
|
26181
26252
|
}
|
|
26182
26253
|
}
|
|
26183
|
-
if (
|
|
26254
|
+
if (Node19.isIdentifier(inner)) {
|
|
26184
26255
|
return collectHandlerBindingsFromIdentifier({ name: inner.getText(), sf, index, trustedExternal, resolved, unresolved, visited });
|
|
26185
26256
|
}
|
|
26186
26257
|
return false;
|
|
@@ -26197,7 +26268,7 @@ function collectHandlerBindingsFromIdentifier(options) {
|
|
|
26197
26268
|
const typeText = typeNode ? typeNode.getText() : void 0;
|
|
26198
26269
|
const isHandlerConfigTyped = typeText !== void 0 && (typeText === NOTIF_TASK_SERVICE_HANDLER_CONFIG || typeText.startsWith(`${NOTIF_TASK_SERVICE_HANDLER_CONFIG}<`));
|
|
26199
26270
|
const declInit = unwrapAsExpressions(localDecl.getInitializer());
|
|
26200
|
-
const isObjectLit = declInit !== void 0 &&
|
|
26271
|
+
const isObjectLit = declInit !== void 0 && Node19.isObjectLiteralExpression(declInit);
|
|
26201
26272
|
if (isHandlerConfigTyped && isObjectLit) {
|
|
26202
26273
|
resolved.push(localDecl.getName());
|
|
26203
26274
|
resolvedAny = true;
|
|
@@ -26228,12 +26299,12 @@ function collectHandlerBindingsFromIdentifier(options) {
|
|
|
26228
26299
|
function resolveArrayFromProperty2(obj, name, sf) {
|
|
26229
26300
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
26230
26301
|
if (!init) return void 0;
|
|
26231
|
-
if (
|
|
26232
|
-
if (
|
|
26302
|
+
if (Node19.isArrayLiteralExpression(init)) return init;
|
|
26303
|
+
if (Node19.isIdentifier(init)) {
|
|
26233
26304
|
const declNode = findLocalVariable(sf, init.getText());
|
|
26234
26305
|
if (declNode) {
|
|
26235
26306
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
26236
|
-
if (declInit &&
|
|
26307
|
+
if (declInit && Node19.isArrayLiteralExpression(declInit)) {
|
|
26237
26308
|
return declInit;
|
|
26238
26309
|
}
|
|
26239
26310
|
}
|
|
@@ -26254,12 +26325,12 @@ function extractTaskHandlerEntries(sources) {
|
|
|
26254
26325
|
if (!typeIdent) return;
|
|
26255
26326
|
const flowInit = unwrapAsExpressions(getPropertyInitializer(obj, "flow"));
|
|
26256
26327
|
let flowCount;
|
|
26257
|
-
if (flowInit &&
|
|
26328
|
+
if (flowInit && Node19.isArrayLiteralExpression(flowInit)) {
|
|
26258
26329
|
flowCount = flowInit.getElements().length;
|
|
26259
26330
|
}
|
|
26260
26331
|
let dataArg;
|
|
26261
26332
|
let checkpointArg;
|
|
26262
|
-
if (
|
|
26333
|
+
if (Node19.isTypeReference(typeNode)) {
|
|
26263
26334
|
const tArgs = typeNode.getTypeArguments();
|
|
26264
26335
|
if (tArgs.length >= 1) dataArg = tArgs[0].getText();
|
|
26265
26336
|
if (tArgs.length >= 2) checkpointArg = tArgs[1].getText();
|
|
@@ -27152,7 +27223,7 @@ async function inspectFolder2(path) {
|
|
|
27152
27223
|
}
|
|
27153
27224
|
|
|
27154
27225
|
// packages/dbx-components-mcp/src/tools/system-m-validate-folder/extract.ts
|
|
27155
|
-
import { Node as
|
|
27226
|
+
import { Node as Node20, Project as Project13 } from "ts-morph";
|
|
27156
27227
|
var TYPE_CONSTANT_SUFFIX = "_SYSTEM_STATE_TYPE";
|
|
27157
27228
|
var DATA_INTERFACE_SUFFIX = "SystemData";
|
|
27158
27229
|
var CONVERTER_CONFIG_TYPE = "SystemStateStoredDataFieldConverterConfig";
|
|
@@ -27216,7 +27287,7 @@ function findDataInterfaces2(sourceFile) {
|
|
|
27216
27287
|
return out;
|
|
27217
27288
|
}
|
|
27218
27289
|
function extendsSystemStateStoredData(iface) {
|
|
27219
|
-
if (!
|
|
27290
|
+
if (!Node20.isInterfaceDeclaration(iface)) return false;
|
|
27220
27291
|
for (const clause of iface.getExtends()) {
|
|
27221
27292
|
const text = clause.getText();
|
|
27222
27293
|
if (text === SYSTEM_STATE_STORED_DATA || text.startsWith(`${SYSTEM_STATE_STORED_DATA}<`) || text === `${SYSTEM_STATE_STORED_DATA}, ${SYSTEM_STATE_STORED_DATA}`) {
|
|
@@ -27236,14 +27307,14 @@ function findConverters2(sourceFile) {
|
|
|
27236
27307
|
for (const decl of stmt.getDeclarations()) {
|
|
27237
27308
|
const typeNode = decl.getTypeNode();
|
|
27238
27309
|
if (!typeNode) continue;
|
|
27239
|
-
if (!
|
|
27310
|
+
if (!Node20.isTypeReference(typeNode)) continue;
|
|
27240
27311
|
const typeName = typeNode.getTypeName().getText();
|
|
27241
27312
|
if (typeName !== CONVERTER_CONFIG_TYPE) continue;
|
|
27242
27313
|
const typeArgs = typeNode.getTypeArguments();
|
|
27243
27314
|
let dataTypeArgument;
|
|
27244
27315
|
if (typeArgs.length >= 1) {
|
|
27245
27316
|
const arg = typeArgs[0];
|
|
27246
|
-
if (
|
|
27317
|
+
if (Node20.isTypeReference(arg)) {
|
|
27247
27318
|
dataTypeArgument = arg.getTypeName().getText();
|
|
27248
27319
|
} else {
|
|
27249
27320
|
dataTypeArgument = arg.getText();
|
|
@@ -27290,19 +27361,19 @@ function collectConverterMapKeys(decl) {
|
|
|
27290
27361
|
if (!obj) return [];
|
|
27291
27362
|
const out = [];
|
|
27292
27363
|
for (const prop of obj.getProperties()) {
|
|
27293
|
-
if (!
|
|
27364
|
+
if (!Node20.isPropertyAssignment(prop)) continue;
|
|
27294
27365
|
const nameNode = prop.getNameNode();
|
|
27295
27366
|
const line = prop.getStartLineNumber();
|
|
27296
|
-
if (
|
|
27367
|
+
if (Node20.isComputedPropertyName(nameNode)) {
|
|
27297
27368
|
const inner = nameNode.getExpression();
|
|
27298
27369
|
out.push({ raw: inner.getText(), kind: "identifier", line });
|
|
27299
27370
|
continue;
|
|
27300
27371
|
}
|
|
27301
|
-
if (
|
|
27372
|
+
if (Node20.isStringLiteral(nameNode)) {
|
|
27302
27373
|
out.push({ raw: nameNode.getLiteralText(), kind: "string", line });
|
|
27303
27374
|
continue;
|
|
27304
27375
|
}
|
|
27305
|
-
if (
|
|
27376
|
+
if (Node20.isIdentifier(nameNode)) {
|
|
27306
27377
|
out.push({ raw: nameNode.getText(), kind: "string", line });
|
|
27307
27378
|
continue;
|
|
27308
27379
|
}
|
|
@@ -27312,10 +27383,10 @@ function collectConverterMapKeys(decl) {
|
|
|
27312
27383
|
}
|
|
27313
27384
|
function unwrapObjectLiteral(node) {
|
|
27314
27385
|
let current = node;
|
|
27315
|
-
while (current &&
|
|
27386
|
+
while (current && Node20.isAsExpression(current)) {
|
|
27316
27387
|
current = current.getExpression();
|
|
27317
27388
|
}
|
|
27318
|
-
if (current &&
|
|
27389
|
+
if (current && Node20.isObjectLiteralExpression(current)) {
|
|
27319
27390
|
return current;
|
|
27320
27391
|
}
|
|
27321
27392
|
return void 0;
|
|
@@ -27349,10 +27420,10 @@ function findLastTopLevelExportLine(sourceFile) {
|
|
|
27349
27420
|
return last;
|
|
27350
27421
|
}
|
|
27351
27422
|
function isExportedTopLevel(stmt) {
|
|
27352
|
-
if (
|
|
27423
|
+
if (Node20.isVariableStatement(stmt) || Node20.isFunctionDeclaration(stmt) || Node20.isClassDeclaration(stmt) || Node20.isInterfaceDeclaration(stmt) || Node20.isTypeAliasDeclaration(stmt) || Node20.isEnumDeclaration(stmt)) {
|
|
27353
27424
|
return stmt.isExported();
|
|
27354
27425
|
}
|
|
27355
|
-
if (
|
|
27426
|
+
if (Node20.isExportDeclaration(stmt) || Node20.isExportAssignment(stmt)) {
|
|
27356
27427
|
return true;
|
|
27357
27428
|
}
|
|
27358
27429
|
return false;
|
|
@@ -27663,7 +27734,7 @@ var systemMValidateFolderTool = createFolderValidateTool({
|
|
|
27663
27734
|
});
|
|
27664
27735
|
|
|
27665
27736
|
// packages/dbx-components-mcp/src/tools/dbx-asset-validate-app/extract.ts
|
|
27666
|
-
import { Node as
|
|
27737
|
+
import { Node as Node21, Project as Project14 } from "ts-morph";
|
|
27667
27738
|
var ASSETS_RELPATH = "src/lib/assets.ts";
|
|
27668
27739
|
var BARREL_RELPATH = "src/lib/index.ts";
|
|
27669
27740
|
var LOCAL_ASSET_BUILDER = "localAsset";
|
|
@@ -27722,11 +27793,11 @@ function extractFromAssetsSource(ctx, sf) {
|
|
|
27722
27793
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
27723
27794
|
if (!initializer) continue;
|
|
27724
27795
|
const site = { isExported, symbolName: decl.getName(), line: decl.getStartLineNumber(), rel };
|
|
27725
|
-
if (
|
|
27796
|
+
if (Node21.isCallExpression(initializer)) {
|
|
27726
27797
|
handleCallInitializer(ctx, site, initializer);
|
|
27727
27798
|
continue;
|
|
27728
27799
|
}
|
|
27729
|
-
if (isExported &&
|
|
27800
|
+
if (isExported && Node21.isArrayLiteralExpression(initializer) && typeAnnotationText(decl) === ASSET_PATH_REF_ARRAY_TYPE) {
|
|
27730
27801
|
ctx.aggregatorExports.push({ symbolName: site.symbolName, memberNames: collectArrayIdentifiers(initializer.getElements()), sourceFile: rel, line: site.line });
|
|
27731
27802
|
}
|
|
27732
27803
|
}
|
|
@@ -27736,7 +27807,7 @@ function collectArrayIdentifiers(elements) {
|
|
|
27736
27807
|
const out = [];
|
|
27737
27808
|
for (const el of elements) {
|
|
27738
27809
|
const inner = unwrapAsExpressions(el);
|
|
27739
|
-
if (inner &&
|
|
27810
|
+
if (inner && Node21.isIdentifier(inner)) {
|
|
27740
27811
|
out.push(inner.getText());
|
|
27741
27812
|
}
|
|
27742
27813
|
}
|
|
@@ -27744,11 +27815,11 @@ function collectArrayIdentifiers(elements) {
|
|
|
27744
27815
|
}
|
|
27745
27816
|
function handleCallInitializer(ctx, site, callExpr) {
|
|
27746
27817
|
const callee = callExpr.getExpression();
|
|
27747
|
-
if (
|
|
27818
|
+
if (Node21.isIdentifier(callee)) {
|
|
27748
27819
|
handleIdentifierCallee({ ctx, site, callExpr, calleeName: callee.getText() });
|
|
27749
27820
|
return;
|
|
27750
27821
|
}
|
|
27751
|
-
if (
|
|
27822
|
+
if (Node21.isPropertyAccessExpression(callee)) {
|
|
27752
27823
|
handleFluentMemberCall(ctx, site, callExpr);
|
|
27753
27824
|
}
|
|
27754
27825
|
}
|
|
@@ -27806,9 +27877,9 @@ function handleRemoteBaseBuilder(ctx, site, arg) {
|
|
|
27806
27877
|
}
|
|
27807
27878
|
function handleFluentMemberCall(ctx, site, callExpr) {
|
|
27808
27879
|
const callee = callExpr.getExpression();
|
|
27809
|
-
if (!
|
|
27880
|
+
if (!Node21.isPropertyAccessExpression(callee)) return;
|
|
27810
27881
|
const identNode = callee.getExpression();
|
|
27811
|
-
if (!
|
|
27882
|
+
if (!Node21.isIdentifier(identNode)) return;
|
|
27812
27883
|
const memberName = callee.getName();
|
|
27813
27884
|
if (memberName !== "asset" && memberName !== "assets") return;
|
|
27814
27885
|
const builderName = identNode.getText();
|
|
@@ -27833,7 +27904,7 @@ function handleFluentMemberCall(ctx, site, callExpr) {
|
|
|
27833
27904
|
return;
|
|
27834
27905
|
}
|
|
27835
27906
|
const arrayInner = unwrapAsExpressions(args[0]);
|
|
27836
|
-
if (!arrayInner || !
|
|
27907
|
+
if (!arrayInner || !Node21.isArrayLiteralExpression(arrayInner)) return;
|
|
27837
27908
|
const resolvedPaths = collectFluentArrayPaths({ elements: arrayInner.getElements(), sourceType, folder, remoteBase });
|
|
27838
27909
|
if (site.isExported) {
|
|
27839
27910
|
ctx.assetConstants.push({ symbolName: site.symbolName, sourceType, helper, resolved: void 0, resolvedPaths, sourceFile: site.rel, line: site.line });
|
|
@@ -27843,7 +27914,7 @@ function collectFluentArrayPaths(input) {
|
|
|
27843
27914
|
const out = [];
|
|
27844
27915
|
for (const el of input.elements) {
|
|
27845
27916
|
const inner = unwrapAsExpressions(el);
|
|
27846
|
-
if (inner &&
|
|
27917
|
+
if (inner && Node21.isStringLiteral(inner)) {
|
|
27847
27918
|
const joined = joinFluent({ sourceType: input.sourceType, folder: input.folder, remoteBase: input.remoteBase, child: inner.getLiteralText() });
|
|
27848
27919
|
if (joined !== void 0) out.push(joined);
|
|
27849
27920
|
}
|
|
@@ -27876,7 +27947,7 @@ function readStringArg(call) {
|
|
|
27876
27947
|
}
|
|
27877
27948
|
function readStringArgFromNode(node) {
|
|
27878
27949
|
const inner = unwrapAsExpressions(node);
|
|
27879
|
-
if (inner &&
|
|
27950
|
+
if (inner && Node21.isStringLiteral(inner)) {
|
|
27880
27951
|
return inner.getLiteralText();
|
|
27881
27952
|
}
|
|
27882
27953
|
return void 0;
|
|
@@ -29245,6 +29316,83 @@ export class EditProfilePageComponent {
|
|
|
29245
29316
|
notes: "`dbxActionForm` lives in `@dereekb/dbx-form` \u2014 it is the value provider in this composition. The form's `dbxFormSource` seeds the initial value and the form's modification status feeds `isModified` on the action store."
|
|
29246
29317
|
};
|
|
29247
29318
|
|
|
29319
|
+
// packages/dbx-components-mcp/src/tools/data/patterns/actions/action.form-with-secondary.pattern.ts
|
|
29320
|
+
var ACTION_PATTERN_FORM_WITH_SECONDARY = {
|
|
29321
|
+
slug: "form-with-secondary",
|
|
29322
|
+
name: "Form submit with secondary action button",
|
|
29323
|
+
summary: "Outer `dbxAction` + `dbxActionForm` drives a primary (Approve) button; a nested `<ng-container dbxAction>` with `dbxActionValue` provides an independent secondary (Deny / Cancel) button that fires a void handler.",
|
|
29324
|
+
usesActionSlugs: ["action", "handler", "value", "button", "error-handler"],
|
|
29325
|
+
snippets: {
|
|
29326
|
+
minimal: `<div dbxAction [dbxActionHandler]="handleApprove">
|
|
29327
|
+
<my-form dbxActionForm></my-form>
|
|
29328
|
+
<dbx-button text="Approve" dbxActionButton></dbx-button>
|
|
29329
|
+
<ng-container dbxAction dbxActionValue [dbxActionHandler]="handleDeny">
|
|
29330
|
+
<dbx-button text="Deny" dbxActionButton></dbx-button>
|
|
29331
|
+
</ng-container>
|
|
29332
|
+
</div>`,
|
|
29333
|
+
brief: `<div dbxAction dbxActionSnackbarError [dbxActionHandler]="handleApprove">
|
|
29334
|
+
<my-form dbxActionForm [dbxFormSource]="data$"></my-form>
|
|
29335
|
+
<dbx-button [raised]="true" text="Approve" color="primary" dbxActionButton></dbx-button>
|
|
29336
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
29337
|
+
<ng-container dbxAction dbxActionSnackbarError dbxActionValue [dbxActionHandler]="handleDeny">
|
|
29338
|
+
<dbx-button [flat]="true" text="Deny" color="warn" dbxActionButton></dbx-button>
|
|
29339
|
+
</ng-container>
|
|
29340
|
+
</div>`,
|
|
29341
|
+
full: `import { Component, signal } from '@angular/core';
|
|
29342
|
+
import { type WorkUsingContext } from '@dereekb/rxjs';
|
|
29343
|
+
|
|
29344
|
+
type ConsentDecision = { readonly outcome: 'approved'; readonly value: ConsentFormValue } | { readonly outcome: 'denied' };
|
|
29345
|
+
|
|
29346
|
+
@Component({
|
|
29347
|
+
selector: 'app-consent-page',
|
|
29348
|
+
template: \`
|
|
29349
|
+
<!-- Outer context: form-driven Approve -->
|
|
29350
|
+
<div dbxAction dbxActionSnackbarError [dbxActionHandler]="handleApprove">
|
|
29351
|
+
<my-consent-form dbxActionForm [dbxFormSource]="defaults$"></my-consent-form>
|
|
29352
|
+
|
|
29353
|
+
<div class="dbx-pt3">
|
|
29354
|
+
<dbx-button [raised]="true" text="Approve" color="primary" dbxActionButton></dbx-button>
|
|
29355
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
29356
|
+
|
|
29357
|
+
<!-- Nested context: void Deny. dbxActionValue with no input -->
|
|
29358
|
+
<!-- supplies the empty payload that lets the button fire. -->
|
|
29359
|
+
<ng-container dbxAction dbxActionSnackbarError dbxActionValue [dbxActionHandler]="handleDeny">
|
|
29360
|
+
<dbx-button [flat]="true" text="Deny" color="warn" dbxActionButton></dbx-button>
|
|
29361
|
+
</ng-container>
|
|
29362
|
+
</div>
|
|
29363
|
+
</div>
|
|
29364
|
+
|
|
29365
|
+
@let decision = lastDecisionSignal();
|
|
29366
|
+
@if (decision) {
|
|
29367
|
+
<div class="dbx-pt3">
|
|
29368
|
+
@if (decision.outcome === 'approved') {
|
|
29369
|
+
<span>Approved with: <strong>{{ decision.value | json }}</strong></span>
|
|
29370
|
+
} @else {
|
|
29371
|
+
<span>Denied.</span>
|
|
29372
|
+
}
|
|
29373
|
+
</div>
|
|
29374
|
+
}
|
|
29375
|
+
\`,
|
|
29376
|
+
standalone: true
|
|
29377
|
+
})
|
|
29378
|
+
export class ConsentPageComponent {
|
|
29379
|
+
readonly defaults$ = this.store.defaults$;
|
|
29380
|
+
readonly lastDecisionSignal = signal<ConsentDecision | undefined>(undefined);
|
|
29381
|
+
|
|
29382
|
+
readonly handleApprove: WorkUsingContext<ConsentFormValue, ConsentResult> = (value, context) => {
|
|
29383
|
+
this.lastDecisionSignal.set({ outcome: 'approved', value });
|
|
29384
|
+
context.startWorkingWithLoadingStateObservable(this.store.approve(value));
|
|
29385
|
+
};
|
|
29386
|
+
|
|
29387
|
+
readonly handleDeny: WorkUsingContext<void, ConsentResult> = (_, context) => {
|
|
29388
|
+
this.lastDecisionSignal.set({ outcome: 'denied' });
|
|
29389
|
+
context.startWorkingWithLoadingStateObservable(this.store.deny());
|
|
29390
|
+
};
|
|
29391
|
+
}`
|
|
29392
|
+
},
|
|
29393
|
+
notes: 'Two non-obvious mechanics: (1) Each `dbxAction` creates its own `ActionContextStore`. `dbxActionButton` and other child directives inject the **nearest ancestor** store via Angular DI, so the inner button picks up the inner context \u2014 not the outer. (2) `dbxActionValue` with no input emits the empty-string sentinel, which `filterMaybe()` lets through, so `readyValue("")` fires immediately when the secondary button triggers; that satisfies `dbxActionButton` without needing a form on the secondary path. Each context can carry its own `dbxActionSnackbarError` so success/error feedback stays scoped per button. This is the canonical OIDC consent shape used in `@dereekb/dbx-firebase` (`oauth.consent.view.component.ts`).'
|
|
29394
|
+
};
|
|
29395
|
+
|
|
29248
29396
|
// packages/dbx-components-mcp/src/tools/data/patterns/actions/action.provide-context-up.pattern.ts
|
|
29249
29397
|
var ACTION_PATTERN_PROVIDE_CONTEXT_UP = {
|
|
29250
29398
|
slug: "provide-context-up",
|
|
@@ -29354,7 +29502,7 @@ export class TagEditorComponent {
|
|
|
29354
29502
|
};
|
|
29355
29503
|
|
|
29356
29504
|
// packages/dbx-components-mcp/src/tools/data/patterns/action-patterns.ts
|
|
29357
|
-
var ACTION_EXAMPLE_PATTERNS = [ACTION_PATTERN_BUTTON_CONFIRM_DELETE, ACTION_PATTERN_FORM_SUBMIT, ACTION_PATTERN_AUTO_TRIGGER_ON_MODIFY, ACTION_PATTERN_DISABLED_BY_KEY, ACTION_PATTERN_VALUE_GETTER_ON_TRIGGER, ACTION_PATTERN_PROVIDE_CONTEXT_UP];
|
|
29505
|
+
var ACTION_EXAMPLE_PATTERNS = [ACTION_PATTERN_BUTTON_CONFIRM_DELETE, ACTION_PATTERN_FORM_SUBMIT, ACTION_PATTERN_FORM_WITH_SECONDARY, ACTION_PATTERN_AUTO_TRIGGER_ON_MODIFY, ACTION_PATTERN_DISABLED_BY_KEY, ACTION_PATTERN_VALUE_GETTER_ON_TRIGGER, ACTION_PATTERN_PROVIDE_CONTEXT_UP];
|
|
29358
29506
|
function getActionExamplePattern(slug) {
|
|
29359
29507
|
const lowered = slug.trim().toLowerCase();
|
|
29360
29508
|
return ACTION_EXAMPLE_PATTERNS.find((p) => p.slug === lowered);
|
|
@@ -29714,7 +29862,7 @@ import { glob as fsGlob5, readFile as readFile18, stat as stat14 } from "node:fs
|
|
|
29714
29862
|
import { dirname as dirname13, isAbsolute as isAbsolute13, resolve as resolve34, sep as sep12 } from "node:path";
|
|
29715
29863
|
|
|
29716
29864
|
// packages/dbx-components-mcp/src/tools/route/extract.ts
|
|
29717
|
-
import { Node as
|
|
29865
|
+
import { Node as Node22, Project as Project15, SyntaxKind as SyntaxKind12 } from "ts-morph";
|
|
29718
29866
|
function extractFile3(source) {
|
|
29719
29867
|
const project = new Project15({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
29720
29868
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -29729,9 +29877,9 @@ function extractFile3(source) {
|
|
|
29729
29877
|
}
|
|
29730
29878
|
for (const arrayLit of findStateArrayLiterals(sourceFile)) {
|
|
29731
29879
|
for (const element of arrayLit.getElements()) {
|
|
29732
|
-
if (
|
|
29880
|
+
if (Node22.isObjectLiteralExpression(element)) {
|
|
29733
29881
|
addNode({ file: source.name, literal: element, fallbackConstName: void 0, into: collected, issues });
|
|
29734
|
-
} else if (
|
|
29882
|
+
} else if (Node22.isIdentifier(element)) {
|
|
29735
29883
|
const ref = objectLiteralsByName.get(element.getText());
|
|
29736
29884
|
if (ref) {
|
|
29737
29885
|
addNode({ file: source.name, literal: ref.literal, fallbackConstName: element.getText(), into: collected, issues });
|
|
@@ -29752,7 +29900,7 @@ function collectStateConsts(sourceFile) {
|
|
|
29752
29900
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
29753
29901
|
for (const decl of stmt.getDeclarations()) {
|
|
29754
29902
|
const initializer = decl.getInitializer();
|
|
29755
|
-
if (!initializer || !
|
|
29903
|
+
if (!initializer || !Node22.isObjectLiteralExpression(initializer)) {
|
|
29756
29904
|
continue;
|
|
29757
29905
|
}
|
|
29758
29906
|
const typeNode = decl.getTypeNode();
|
|
@@ -29767,7 +29915,7 @@ function findStateArrayLiterals(sourceFile) {
|
|
|
29767
29915
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
29768
29916
|
for (const decl of stmt.getDeclarations()) {
|
|
29769
29917
|
const initializer = decl.getInitializer();
|
|
29770
|
-
if (initializer &&
|
|
29918
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer) && declarationIsStateArray(stmt, decl.getName(), initializer)) {
|
|
29771
29919
|
arrays.push(initializer);
|
|
29772
29920
|
}
|
|
29773
29921
|
}
|
|
@@ -29781,17 +29929,17 @@ function findStateArrayLiterals(sourceFile) {
|
|
|
29781
29929
|
continue;
|
|
29782
29930
|
}
|
|
29783
29931
|
for (const arg of call.getArguments()) {
|
|
29784
|
-
if (!
|
|
29932
|
+
if (!Node22.isObjectLiteralExpression(arg)) {
|
|
29785
29933
|
continue;
|
|
29786
29934
|
}
|
|
29787
29935
|
const statesProp = arg.getProperty("states");
|
|
29788
|
-
if (!statesProp || !
|
|
29936
|
+
if (!statesProp || !Node22.isPropertyAssignment(statesProp)) {
|
|
29789
29937
|
continue;
|
|
29790
29938
|
}
|
|
29791
29939
|
const initializer = statesProp.getInitializer();
|
|
29792
|
-
if (initializer &&
|
|
29940
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer)) {
|
|
29793
29941
|
arrays.push(initializer);
|
|
29794
|
-
} else if (initializer &&
|
|
29942
|
+
} else if (initializer && Node22.isIdentifier(initializer)) {
|
|
29795
29943
|
const referenced = findArrayLiteralForIdentifier(sourceFile, initializer);
|
|
29796
29944
|
if (referenced) {
|
|
29797
29945
|
arrays.push(referenced);
|
|
@@ -29808,10 +29956,10 @@ function declarationIsStateArray(stmt, name, literal) {
|
|
|
29808
29956
|
return true;
|
|
29809
29957
|
}
|
|
29810
29958
|
for (const element of literal.getElements()) {
|
|
29811
|
-
if (
|
|
29959
|
+
if (Node22.isObjectLiteralExpression(element) && hasStringNameProperty(element)) {
|
|
29812
29960
|
return true;
|
|
29813
29961
|
}
|
|
29814
|
-
if (
|
|
29962
|
+
if (Node22.isIdentifier(element)) {
|
|
29815
29963
|
return true;
|
|
29816
29964
|
}
|
|
29817
29965
|
}
|
|
@@ -29819,11 +29967,11 @@ function declarationIsStateArray(stmt, name, literal) {
|
|
|
29819
29967
|
}
|
|
29820
29968
|
function hasStringNameProperty(literal) {
|
|
29821
29969
|
const nameProp = literal.getProperty("name");
|
|
29822
|
-
if (!nameProp || !
|
|
29970
|
+
if (!nameProp || !Node22.isPropertyAssignment(nameProp)) {
|
|
29823
29971
|
return false;
|
|
29824
29972
|
}
|
|
29825
29973
|
const initializer = nameProp.getInitializer();
|
|
29826
|
-
return initializer !== void 0 && (
|
|
29974
|
+
return initializer !== void 0 && (Node22.isStringLiteral(initializer) || Node22.isNoSubstitutionTemplateLiteral(initializer));
|
|
29827
29975
|
}
|
|
29828
29976
|
function findArrayLiteralForIdentifier(sourceFile, identifier) {
|
|
29829
29977
|
const name = identifier.getText();
|
|
@@ -29833,7 +29981,7 @@ function findArrayLiteralForIdentifier(sourceFile, identifier) {
|
|
|
29833
29981
|
continue;
|
|
29834
29982
|
}
|
|
29835
29983
|
const initializer = decl.getInitializer();
|
|
29836
|
-
if (initializer &&
|
|
29984
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer)) {
|
|
29837
29985
|
return initializer;
|
|
29838
29986
|
}
|
|
29839
29987
|
}
|
|
@@ -29883,21 +30031,21 @@ function addNode(options) {
|
|
|
29883
30031
|
}
|
|
29884
30032
|
function stringPropertyValue(literal, key) {
|
|
29885
30033
|
const prop = literal.getProperty(key);
|
|
29886
|
-
if (!prop || !
|
|
30034
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29887
30035
|
return void 0;
|
|
29888
30036
|
}
|
|
29889
30037
|
const initializer = prop.getInitializer();
|
|
29890
30038
|
if (!initializer) {
|
|
29891
30039
|
return void 0;
|
|
29892
30040
|
}
|
|
29893
|
-
if (
|
|
30041
|
+
if (Node22.isStringLiteral(initializer) || Node22.isNoSubstitutionTemplateLiteral(initializer)) {
|
|
29894
30042
|
return initializer.getLiteralText();
|
|
29895
30043
|
}
|
|
29896
30044
|
return void 0;
|
|
29897
30045
|
}
|
|
29898
30046
|
function booleanPropertyValue(literal, key) {
|
|
29899
30047
|
const prop = literal.getProperty(key);
|
|
29900
|
-
if (!prop || !
|
|
30048
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29901
30049
|
return void 0;
|
|
29902
30050
|
}
|
|
29903
30051
|
const initializer = prop.getInitializer();
|
|
@@ -29914,33 +30062,33 @@ function booleanPropertyValue(literal, key) {
|
|
|
29914
30062
|
}
|
|
29915
30063
|
function identifierPropertyValue(literal, key) {
|
|
29916
30064
|
const prop = literal.getProperty(key);
|
|
29917
|
-
if (!prop || !
|
|
30065
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29918
30066
|
return void 0;
|
|
29919
30067
|
}
|
|
29920
30068
|
const initializer = prop.getInitializer();
|
|
29921
30069
|
if (!initializer) {
|
|
29922
30070
|
return void 0;
|
|
29923
30071
|
}
|
|
29924
|
-
if (
|
|
30072
|
+
if (Node22.isIdentifier(initializer)) {
|
|
29925
30073
|
return initializer.getText();
|
|
29926
30074
|
}
|
|
29927
|
-
if (
|
|
30075
|
+
if (Node22.isPropertyAccessExpression(initializer)) {
|
|
29928
30076
|
return initializer.getText();
|
|
29929
30077
|
}
|
|
29930
30078
|
return void 0;
|
|
29931
30079
|
}
|
|
29932
30080
|
function objectPropertyKeys(literal, key) {
|
|
29933
30081
|
const prop = literal.getProperty(key);
|
|
29934
|
-
if (!prop || !
|
|
30082
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29935
30083
|
return [];
|
|
29936
30084
|
}
|
|
29937
30085
|
const initializer = prop.getInitializer();
|
|
29938
|
-
if (!initializer || !
|
|
30086
|
+
if (!initializer || !Node22.isObjectLiteralExpression(initializer)) {
|
|
29939
30087
|
return [];
|
|
29940
30088
|
}
|
|
29941
30089
|
const out = [];
|
|
29942
30090
|
for (const member of initializer.getProperties()) {
|
|
29943
|
-
if (
|
|
30091
|
+
if (Node22.isPropertyAssignment(member) || Node22.isShorthandPropertyAssignment(member) || Node22.isMethodDeclaration(member)) {
|
|
29944
30092
|
const nameNode = member.getNameNode();
|
|
29945
30093
|
if (nameNode) {
|
|
29946
30094
|
out.push(nameNode.getText());
|
|
@@ -29951,7 +30099,7 @@ function objectPropertyKeys(literal, key) {
|
|
|
29951
30099
|
}
|
|
29952
30100
|
function collectResolveKeys(literal) {
|
|
29953
30101
|
const prop = literal.getProperty("resolve");
|
|
29954
|
-
if (!prop || !
|
|
30102
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29955
30103
|
return [];
|
|
29956
30104
|
}
|
|
29957
30105
|
const initializer = prop.getInitializer();
|
|
@@ -29959,22 +30107,22 @@ function collectResolveKeys(literal) {
|
|
|
29959
30107
|
return [];
|
|
29960
30108
|
}
|
|
29961
30109
|
const keys = [];
|
|
29962
|
-
if (
|
|
30110
|
+
if (Node22.isObjectLiteralExpression(initializer)) {
|
|
29963
30111
|
for (const member of initializer.getProperties()) {
|
|
29964
|
-
if (
|
|
30112
|
+
if (Node22.isPropertyAssignment(member) || Node22.isShorthandPropertyAssignment(member) || Node22.isMethodDeclaration(member)) {
|
|
29965
30113
|
const nameNode = member.getNameNode();
|
|
29966
30114
|
if (nameNode) {
|
|
29967
30115
|
keys.push(nameNode.getText());
|
|
29968
30116
|
}
|
|
29969
30117
|
}
|
|
29970
30118
|
}
|
|
29971
|
-
} else if (
|
|
30119
|
+
} else if (Node22.isArrayLiteralExpression(initializer)) {
|
|
29972
30120
|
for (const element of initializer.getElements()) {
|
|
29973
|
-
if (
|
|
30121
|
+
if (Node22.isObjectLiteralExpression(element)) {
|
|
29974
30122
|
const tokenProp = element.getProperty("token");
|
|
29975
|
-
if (tokenProp &&
|
|
30123
|
+
if (tokenProp && Node22.isPropertyAssignment(tokenProp)) {
|
|
29976
30124
|
const tokenInit = tokenProp.getInitializer();
|
|
29977
|
-
if (tokenInit && (
|
|
30125
|
+
if (tokenInit && (Node22.isStringLiteral(tokenInit) || Node22.isIdentifier(tokenInit))) {
|
|
29978
30126
|
keys.push(tokenInit.getText().replaceAll(/^['"]|['"]$/g, ""));
|
|
29979
30127
|
}
|
|
29980
30128
|
}
|
|
@@ -32043,7 +32191,7 @@ function createSearchModelSnapshotFieldTool(config) {
|
|
|
32043
32191
|
import { glob, readFile as readFile19 } from "node:fs/promises";
|
|
32044
32192
|
import { resolve as resolve35 } from "node:path";
|
|
32045
32193
|
import { type as type59 } from "arktype";
|
|
32046
|
-
import { Node as
|
|
32194
|
+
import { Node as Node23, Project as Project16 } from "ts-morph";
|
|
32047
32195
|
var ListAppArgsType2 = type59({
|
|
32048
32196
|
componentDir: "string",
|
|
32049
32197
|
"apiDir?": "string",
|
|
@@ -32173,7 +32321,7 @@ async function buildListAppReport(input) {
|
|
|
32173
32321
|
function findSnapshotConverterCalls(sourceFile) {
|
|
32174
32322
|
const out = [];
|
|
32175
32323
|
sourceFile.forEachDescendant((node) => {
|
|
32176
|
-
if (
|
|
32324
|
+
if (Node23.isCallExpression(node)) {
|
|
32177
32325
|
const expr = node.getExpression();
|
|
32178
32326
|
const exprText = expr.getText();
|
|
32179
32327
|
const head = exprText.replace(/<[^>]*>$/, "");
|
|
@@ -32188,17 +32336,17 @@ function readFieldsObject(call) {
|
|
|
32188
32336
|
const args = call.getArguments();
|
|
32189
32337
|
if (args.length === 0) return void 0;
|
|
32190
32338
|
const first = args[0];
|
|
32191
|
-
if (!
|
|
32339
|
+
if (!Node23.isObjectLiteralExpression(first)) return void 0;
|
|
32192
32340
|
const fieldsProp = first.getProperty("fields");
|
|
32193
|
-
if (fieldsProp === void 0 || !
|
|
32341
|
+
if (fieldsProp === void 0 || !Node23.isPropertyAssignment(fieldsProp)) return void 0;
|
|
32194
32342
|
const initializer = fieldsProp.getInitializer();
|
|
32195
|
-
if (initializer === void 0 || !
|
|
32343
|
+
if (initializer === void 0 || !Node23.isObjectLiteralExpression(initializer)) return void 0;
|
|
32196
32344
|
return initializer;
|
|
32197
32345
|
}
|
|
32198
32346
|
function resolveModelName(call) {
|
|
32199
32347
|
let current = call.getParent();
|
|
32200
32348
|
while (current !== void 0) {
|
|
32201
|
-
if (
|
|
32349
|
+
if (Node23.isVariableDeclaration(current)) {
|
|
32202
32350
|
return current.getName();
|
|
32203
32351
|
}
|
|
32204
32352
|
current = current.getParent();
|
|
@@ -32208,10 +32356,10 @@ function resolveModelName(call) {
|
|
|
32208
32356
|
function extractFieldUsages(fieldsObj, registry) {
|
|
32209
32357
|
const out = [];
|
|
32210
32358
|
for (const property of fieldsObj.getProperties()) {
|
|
32211
|
-
if (!
|
|
32359
|
+
if (!Node23.isPropertyAssignment(property) && !Node23.isShorthandPropertyAssignment(property)) continue;
|
|
32212
32360
|
const fieldName = property.getName();
|
|
32213
32361
|
let converterText;
|
|
32214
|
-
if (
|
|
32362
|
+
if (Node23.isShorthandPropertyAssignment(property)) {
|
|
32215
32363
|
converterText = property.getName();
|
|
32216
32364
|
} else {
|
|
32217
32365
|
const initializer = property.getInitializer();
|
|
@@ -33734,7 +33882,7 @@ import { type as type64 } from "arktype";
|
|
|
33734
33882
|
// packages/dbx-components-mcp/src/tools/model-list-component/extract.ts
|
|
33735
33883
|
import { readdir as readdir12, readFile as readFile20, stat as stat16 } from "node:fs/promises";
|
|
33736
33884
|
import { basename as basename6, join as join19, relative as relative11, sep as sep14 } from "node:path";
|
|
33737
|
-
import { Node as
|
|
33885
|
+
import { Node as Node24, Project as Project17 } from "ts-morph";
|
|
33738
33886
|
var MODEL_SUBPATH3 = "src/lib/model";
|
|
33739
33887
|
var MODEL_SUBPATH_PREFIX = `${MODEL_SUBPATH3}/`;
|
|
33740
33888
|
var RESERVED_NAMES = RESERVED_MODEL_FOLDERS.map((r) => r.name);
|
|
@@ -33875,7 +34023,7 @@ function findIdentityIn(sourceFile) {
|
|
|
33875
34023
|
for (const statement of sourceFile.getVariableStatements()) {
|
|
33876
34024
|
for (const decl of statement.getDeclarations()) {
|
|
33877
34025
|
const initializer = decl.getInitializer();
|
|
33878
|
-
if (!initializer || !
|
|
34026
|
+
if (!initializer || !Node24.isCallExpression(initializer)) continue;
|
|
33879
34027
|
if (initializer.getExpression().getText() !== "firestoreModelIdentity") continue;
|
|
33880
34028
|
const args = initializer.getArguments();
|
|
33881
34029
|
const parsed = parseIdentityArgs2(args);
|
|
@@ -33895,13 +34043,13 @@ function parseIdentityArgs2(args) {
|
|
|
33895
34043
|
return { parentIdentityRef: void 0, collectionName: stringLiteralValue3(args[0]), collectionPrefix: stringLiteralValue3(args[1]) };
|
|
33896
34044
|
}
|
|
33897
34045
|
if (args.length === 3) {
|
|
33898
|
-
const parent =
|
|
34046
|
+
const parent = Node24.isIdentifier(args[0]) ? args[0].getText() : void 0;
|
|
33899
34047
|
return { parentIdentityRef: parent, collectionName: stringLiteralValue3(args[1]), collectionPrefix: stringLiteralValue3(args[2]) };
|
|
33900
34048
|
}
|
|
33901
34049
|
return { parentIdentityRef: void 0, collectionName: void 0, collectionPrefix: void 0 };
|
|
33902
34050
|
}
|
|
33903
34051
|
function stringLiteralValue3(node) {
|
|
33904
|
-
if (
|
|
34052
|
+
if (Node24.isStringLiteral(node) || Node24.isNoSubstitutionTemplateLiteral(node)) {
|
|
33905
34053
|
return node.getLiteralText();
|
|
33906
34054
|
}
|
|
33907
34055
|
return void 0;
|
|
@@ -34063,7 +34211,7 @@ import { type as type65 } from "arktype";
|
|
|
34063
34211
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app/extract.ts
|
|
34064
34212
|
import { readdir as readdir13, readFile as readFile21, stat as stat17 } from "node:fs/promises";
|
|
34065
34213
|
import { dirname as dirname14, join as join20, relative as relative12, sep as sep15 } from "node:path";
|
|
34066
|
-
import { Node as
|
|
34214
|
+
import { Node as Node25, Project as Project18 } from "ts-morph";
|
|
34067
34215
|
var ACTION_SERVER_SUFFIX2 = ".action.server.ts";
|
|
34068
34216
|
var COMMON_MODEL_SUBPATH2 = "src/app/common/model";
|
|
34069
34217
|
var COMMON_BARREL_REL = "src/app/common/index.ts";
|
|
@@ -34200,7 +34348,7 @@ function inspectModuleText(input) {
|
|
|
34200
34348
|
for (const decorator of cls.getDecorators()) {
|
|
34201
34349
|
if (decorator.getName() !== "Module") continue;
|
|
34202
34350
|
const args = decorator.getArguments();
|
|
34203
|
-
if (args.length === 0 || !
|
|
34351
|
+
if (args.length === 0 || !Node25.isObjectLiteralExpression(args[0])) continue;
|
|
34204
34352
|
const obj = args[0];
|
|
34205
34353
|
providedByModule ||= moduleArrayContains(obj, "providers", input.className);
|
|
34206
34354
|
exportedByModule ||= moduleArrayContains(obj, "exports", input.className);
|
|
@@ -34210,16 +34358,16 @@ function inspectModuleText(input) {
|
|
|
34210
34358
|
}
|
|
34211
34359
|
function moduleArrayContains(decoratorArg, propertyName, className) {
|
|
34212
34360
|
const property = decoratorArg.getProperty(propertyName);
|
|
34213
|
-
if (!property || !
|
|
34361
|
+
if (!property || !Node25.isPropertyAssignment(property)) return false;
|
|
34214
34362
|
const initializer = property.getInitializer();
|
|
34215
|
-
if (!initializer || !
|
|
34363
|
+
if (!initializer || !Node25.isArrayLiteralExpression(initializer)) return false;
|
|
34216
34364
|
for (const element of initializer.getElements()) {
|
|
34217
|
-
if (
|
|
34218
|
-
if (
|
|
34365
|
+
if (Node25.isIdentifier(element) && element.getText() === className) return true;
|
|
34366
|
+
if (Node25.isObjectLiteralExpression(element)) {
|
|
34219
34367
|
const provideProp = element.getProperty("provide");
|
|
34220
|
-
if (provideProp &&
|
|
34368
|
+
if (provideProp && Node25.isPropertyAssignment(provideProp)) {
|
|
34221
34369
|
const provideInit = provideProp.getInitializer();
|
|
34222
|
-
if (provideInit &&
|
|
34370
|
+
if (provideInit && Node25.isIdentifier(provideInit) && provideInit.getText() === className) return true;
|
|
34223
34371
|
}
|
|
34224
34372
|
}
|
|
34225
34373
|
}
|
|
@@ -34273,11 +34421,11 @@ function collectInterfaceGetters(sourceFile) {
|
|
|
34273
34421
|
const out = /* @__PURE__ */ new Map();
|
|
34274
34422
|
for (const iface of sourceFile.getInterfaces()) {
|
|
34275
34423
|
for (const member of iface.getMembers()) {
|
|
34276
|
-
if (
|
|
34424
|
+
if (Node25.isGetAccessorDeclaration(member)) {
|
|
34277
34425
|
out.set(member.getName(), iface.getName());
|
|
34278
34426
|
continue;
|
|
34279
34427
|
}
|
|
34280
|
-
if (
|
|
34428
|
+
if (Node25.isPropertySignature(member)) {
|
|
34281
34429
|
out.set(member.getName(), iface.getName());
|
|
34282
34430
|
}
|
|
34283
34431
|
}
|
|
@@ -34289,7 +34437,7 @@ function collectClassGetters(sourceFile) {
|
|
|
34289
34437
|
for (const cls of sourceFile.getClasses()) {
|
|
34290
34438
|
const set = /* @__PURE__ */ new Set();
|
|
34291
34439
|
for (const member of cls.getMembers()) {
|
|
34292
|
-
if (
|
|
34440
|
+
if (Node25.isGetAccessorDeclaration(member)) set.add(member.getName());
|
|
34293
34441
|
}
|
|
34294
34442
|
if (set.size > 0) out.set(cls.getName() ?? "<anon>", set);
|
|
34295
34443
|
}
|
|
@@ -34801,7 +34949,7 @@ import { resolve as resolve43 } from "node:path";
|
|
|
34801
34949
|
import { type as type67 } from "arktype";
|
|
34802
34950
|
|
|
34803
34951
|
// packages/dbx-components-mcp/src/scan/actions-extract.ts
|
|
34804
|
-
import { Node as
|
|
34952
|
+
import { Node as Node26, SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
34805
34953
|
var ACTION_MARKER = "dbxAction";
|
|
34806
34954
|
var ACTION_SLUG_TAG = "dbxActionSlug";
|
|
34807
34955
|
var ACTION_ROLE_TAG = "dbxActionRole";
|
|
@@ -35009,7 +35157,7 @@ function filterStates(values) {
|
|
|
35009
35157
|
}
|
|
35010
35158
|
function readEnumMemberLiteral(member) {
|
|
35011
35159
|
const initializer = member.getInitializer();
|
|
35012
|
-
if (initializer !== void 0 && (
|
|
35160
|
+
if (initializer !== void 0 && (Node26.isStringLiteral(initializer) || Node26.isNoSubstitutionTemplateLiteral(initializer))) {
|
|
35013
35161
|
return initializer.getLiteralText();
|
|
35014
35162
|
}
|
|
35015
35163
|
return member.getName();
|
|
@@ -35629,7 +35777,7 @@ import { resolve as resolve45 } from "node:path";
|
|
|
35629
35777
|
import { type as type71 } from "arktype";
|
|
35630
35778
|
|
|
35631
35779
|
// packages/dbx-components-mcp/src/scan/pipes-extract.ts
|
|
35632
|
-
import { Node as
|
|
35780
|
+
import { Node as Node27 } from "ts-morph";
|
|
35633
35781
|
var PIPE_MARKER = "dbxPipe";
|
|
35634
35782
|
var PIPE_SLUG_TAG = "dbxPipeSlug";
|
|
35635
35783
|
var PIPE_CATEGORY_TAG = "dbxPipeCategory";
|
|
@@ -35822,7 +35970,7 @@ function readPipeDecoratorConfig(decorator) {
|
|
|
35822
35970
|
return void 0;
|
|
35823
35971
|
}
|
|
35824
35972
|
const firstArg = args[0];
|
|
35825
|
-
if (!
|
|
35973
|
+
if (!Node27.isObjectLiteralExpression(firstArg)) {
|
|
35826
35974
|
return void 0;
|
|
35827
35975
|
}
|
|
35828
35976
|
const name = readStringProperty(firstArg, "name");
|
|
@@ -35835,7 +35983,7 @@ function readPipeDecoratorConfig(decorator) {
|
|
|
35835
35983
|
}
|
|
35836
35984
|
function readBooleanProperty(obj, propName) {
|
|
35837
35985
|
const prop = obj.getProperty(propName);
|
|
35838
|
-
if (prop === void 0 || !
|
|
35986
|
+
if (prop === void 0 || !Node27.isPropertyAssignment(prop)) {
|
|
35839
35987
|
return void 0;
|
|
35840
35988
|
}
|
|
35841
35989
|
const initializer = prop.getInitializer();
|