@dereekb/dbx-components-mcp 13.11.5 → 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 +412 -279
- 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;
|
|
@@ -14244,7 +14279,7 @@ function createListAppTool(config) {
|
|
|
14244
14279
|
}
|
|
14245
14280
|
|
|
14246
14281
|
// packages/dbx-components-mcp/src/tools/model-validate/extract.ts
|
|
14247
|
-
import { Node as
|
|
14282
|
+
import { Node as Node11, Project as Project4, SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
14248
14283
|
function extractFile(source) {
|
|
14249
14284
|
const project = new Project4({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
14250
14285
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -14383,7 +14418,7 @@ function extractIdentityRefs(alias) {
|
|
|
14383
14418
|
if (!typeNode) {
|
|
14384
14419
|
return refs;
|
|
14385
14420
|
}
|
|
14386
|
-
if (
|
|
14421
|
+
if (Node11.isTypeQuery(typeNode)) {
|
|
14387
14422
|
refs.push(typeNode.getExprName().getText());
|
|
14388
14423
|
}
|
|
14389
14424
|
const typeofNodes = typeNode.getDescendantsOfKind(SyntaxKind4.TypeQuery);
|
|
@@ -14397,7 +14432,7 @@ function findIdentities2(sourceFile) {
|
|
|
14397
14432
|
for (const statement of sourceFile.getVariableStatements()) {
|
|
14398
14433
|
for (const decl of statement.getDeclarations()) {
|
|
14399
14434
|
const initializer = decl.getInitializer();
|
|
14400
|
-
if (!initializer || !
|
|
14435
|
+
if (!initializer || !Node11.isCallExpression(initializer)) {
|
|
14401
14436
|
continue;
|
|
14402
14437
|
}
|
|
14403
14438
|
if (initializer.getExpression().getText() !== "firestoreModelIdentity") {
|
|
@@ -14433,7 +14468,7 @@ function parseIdentityArgs(args) {
|
|
|
14433
14468
|
}
|
|
14434
14469
|
if (args.length === 3) {
|
|
14435
14470
|
const [parentNode, nameNode, prefixNode] = args;
|
|
14436
|
-
const parentRef =
|
|
14471
|
+
const parentRef = Node11.isIdentifier(parentNode) ? parentNode.getText() : void 0;
|
|
14437
14472
|
const result2 = {
|
|
14438
14473
|
parentIdentityRef: parentRef,
|
|
14439
14474
|
collectionName: stringLiteralValue2(nameNode),
|
|
@@ -14448,7 +14483,7 @@ function stringLiteralValue2(node) {
|
|
|
14448
14483
|
if (!node) {
|
|
14449
14484
|
return void 0;
|
|
14450
14485
|
}
|
|
14451
|
-
if (
|
|
14486
|
+
if (Node11.isStringLiteral(node) || Node11.isNoSubstitutionTemplateLiteral(node)) {
|
|
14452
14487
|
return node.getLiteralText();
|
|
14453
14488
|
}
|
|
14454
14489
|
return void 0;
|
|
@@ -14509,7 +14544,7 @@ function detectFactoryCallKind(sourceFile, factoryFnName) {
|
|
|
14509
14544
|
const calls = fn.getDescendantsOfKind(SyntaxKind4.CallExpression);
|
|
14510
14545
|
for (const call of calls) {
|
|
14511
14546
|
const expr = call.getExpression();
|
|
14512
|
-
if (!
|
|
14547
|
+
if (!Node11.isPropertyAccessExpression(expr)) {
|
|
14513
14548
|
continue;
|
|
14514
14549
|
}
|
|
14515
14550
|
const name = expr.getName();
|
|
@@ -15100,6 +15135,16 @@ var RULE_CATALOG = [
|
|
|
15100
15135
|
whenItDoesNotApply: "When the rename was intentional (rare \u2014 usually a copy-paste).",
|
|
15101
15136
|
canonicalFix: "Update the getter body to return the matching identity constant."
|
|
15102
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
|
+
},
|
|
15103
15148
|
{
|
|
15104
15149
|
code: "MODEL_FIELD_MISSING_JSDOC",
|
|
15105
15150
|
source: "dbx_model_validate",
|
|
@@ -16974,9 +17019,10 @@ function checkFieldNameLengths(file, violations, options) {
|
|
|
16974
17019
|
});
|
|
16975
17020
|
}
|
|
16976
17021
|
}
|
|
16977
|
-
checkFieldJsDocs(file, violations);
|
|
17022
|
+
checkFieldJsDocs(file, violations, options);
|
|
16978
17023
|
}
|
|
16979
|
-
function checkFieldJsDocs(file, violations) {
|
|
17024
|
+
function checkFieldJsDocs(file, violations, options) {
|
|
17025
|
+
const ignored = options?.ignoredFieldNames;
|
|
16980
17026
|
for (const iface of file.dataInterfaces) {
|
|
16981
17027
|
for (const field of iface.fields) {
|
|
16982
17028
|
if (!field.jsDocFirstLine) {
|
|
@@ -16999,6 +17045,16 @@ function checkFieldJsDocs(file, violations) {
|
|
|
16999
17045
|
model: iface.name
|
|
17000
17046
|
});
|
|
17001
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
|
+
}
|
|
17002
17058
|
}
|
|
17003
17059
|
}
|
|
17004
17060
|
}
|
|
@@ -17779,7 +17835,7 @@ var modelValidateTool = /* @__PURE__ */ createModelValidateTool();
|
|
|
17779
17835
|
var runModelValidate = modelValidateTool.run;
|
|
17780
17836
|
|
|
17781
17837
|
// packages/dbx-components-mcp/src/tools/model-validate-api/extract.ts
|
|
17782
|
-
import { Node as
|
|
17838
|
+
import { Node as Node12, Project as Project5, SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
17783
17839
|
function extractFile2(source) {
|
|
17784
17840
|
const project = new Project5({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
17785
17841
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -17945,7 +18001,7 @@ function findCrudConfigType(sourceFile) {
|
|
|
17945
18001
|
continue;
|
|
17946
18002
|
}
|
|
17947
18003
|
const typeNode = alias.getTypeNode();
|
|
17948
|
-
const summary = typeNode &&
|
|
18004
|
+
const summary = typeNode && Node12.isTypeLiteral(typeNode) ? summarizeCrudConfigType(typeNode) : { keys: [], nonNullKeys: [], bareLeafParamsNames: [] };
|
|
17949
18005
|
const result = {
|
|
17950
18006
|
name: alias.getName(),
|
|
17951
18007
|
exported: alias.isExported(),
|
|
@@ -17959,14 +18015,14 @@ function findCrudConfigType(sourceFile) {
|
|
|
17959
18015
|
return void 0;
|
|
17960
18016
|
}
|
|
17961
18017
|
function summarizeCrudConfigType(typeLiteral) {
|
|
17962
|
-
if (!
|
|
18018
|
+
if (!Node12.isTypeLiteral(typeLiteral)) {
|
|
17963
18019
|
return { keys: [], nonNullKeys: [], bareLeafParamsNames: [] };
|
|
17964
18020
|
}
|
|
17965
18021
|
const keys = [];
|
|
17966
18022
|
const nonNullKeys = [];
|
|
17967
18023
|
const bareLeafParamsNames = [];
|
|
17968
18024
|
for (const member of typeLiteral.getMembers()) {
|
|
17969
|
-
if (!
|
|
18025
|
+
if (!Node12.isPropertySignature(member)) {
|
|
17970
18026
|
continue;
|
|
17971
18027
|
}
|
|
17972
18028
|
const name = member.getName();
|
|
@@ -17984,18 +18040,18 @@ function summarizeCrudConfigType(typeLiteral) {
|
|
|
17984
18040
|
return { keys, nonNullKeys, bareLeafParamsNames };
|
|
17985
18041
|
}
|
|
17986
18042
|
function isNullLiteralType(node) {
|
|
17987
|
-
if (
|
|
18043
|
+
if (Node12.isLiteralTypeNode(node)) {
|
|
17988
18044
|
const literal = node.getLiteral();
|
|
17989
|
-
if (
|
|
18045
|
+
if (Node12.isNullLiteral(literal)) {
|
|
17990
18046
|
return true;
|
|
17991
18047
|
}
|
|
17992
18048
|
}
|
|
17993
18049
|
return false;
|
|
17994
18050
|
}
|
|
17995
18051
|
function collectBareParamsLeaves(node, out) {
|
|
17996
|
-
if (
|
|
18052
|
+
if (Node12.isTypeLiteral(node)) {
|
|
17997
18053
|
for (const member of node.getMembers()) {
|
|
17998
|
-
if (!
|
|
18054
|
+
if (!Node12.isPropertySignature(member)) {
|
|
17999
18055
|
continue;
|
|
18000
18056
|
}
|
|
18001
18057
|
const valueNode = member.getTypeNode();
|
|
@@ -18005,10 +18061,10 @@ function collectBareParamsLeaves(node, out) {
|
|
|
18005
18061
|
}
|
|
18006
18062
|
return;
|
|
18007
18063
|
}
|
|
18008
|
-
if (
|
|
18064
|
+
if (Node12.isTupleTypeNode(node)) {
|
|
18009
18065
|
return;
|
|
18010
18066
|
}
|
|
18011
|
-
if (
|
|
18067
|
+
if (Node12.isTypeReference(node)) {
|
|
18012
18068
|
const name = node.getTypeName().getText();
|
|
18013
18069
|
if (name.endsWith("Params")) {
|
|
18014
18070
|
out.push(name);
|
|
@@ -18025,12 +18081,12 @@ function findCrudConfigConst(sourceFile) {
|
|
|
18025
18081
|
const typeNode = decl.getTypeNode();
|
|
18026
18082
|
const initializer = decl.getInitializer();
|
|
18027
18083
|
const runtimeKeys = [];
|
|
18028
|
-
if (initializer &&
|
|
18084
|
+
if (initializer && Node12.isAsExpression(initializer)) {
|
|
18029
18085
|
const inner = initializer.getExpression();
|
|
18030
|
-
if (
|
|
18086
|
+
if (Node12.isObjectLiteralExpression(inner)) {
|
|
18031
18087
|
runtimeKeys.push(...collectObjectLiteralKeys(inner));
|
|
18032
18088
|
}
|
|
18033
|
-
} else if (initializer &&
|
|
18089
|
+
} else if (initializer && Node12.isObjectLiteralExpression(initializer)) {
|
|
18034
18090
|
runtimeKeys.push(...collectObjectLiteralKeys(initializer));
|
|
18035
18091
|
}
|
|
18036
18092
|
const result = {
|
|
@@ -18048,7 +18104,7 @@ function findCrudConfigConst(sourceFile) {
|
|
|
18048
18104
|
function collectObjectLiteralKeys(obj) {
|
|
18049
18105
|
const out = [];
|
|
18050
18106
|
for (const prop of obj.getProperties()) {
|
|
18051
|
-
if (
|
|
18107
|
+
if (Node12.isPropertyAssignment(prop) || Node12.isShorthandPropertyAssignment(prop)) {
|
|
18052
18108
|
out.push(prop.getName());
|
|
18053
18109
|
}
|
|
18054
18110
|
}
|
|
@@ -18064,7 +18120,7 @@ function findFunctionMap(sourceFile) {
|
|
|
18064
18120
|
const initializer = decl.getInitializer();
|
|
18065
18121
|
let callsFactory = false;
|
|
18066
18122
|
const factoryArgs = [];
|
|
18067
|
-
if (initializer &&
|
|
18123
|
+
if (initializer && Node12.isCallExpression(initializer)) {
|
|
18068
18124
|
const exprText = initializer.getExpression().getText();
|
|
18069
18125
|
if (exprText === "callModelFirebaseFunctionMapFactory") {
|
|
18070
18126
|
callsFactory = true;
|
|
@@ -18202,18 +18258,18 @@ function extractCastTargetName(node) {
|
|
|
18202
18258
|
return void 0;
|
|
18203
18259
|
}
|
|
18204
18260
|
let current = node;
|
|
18205
|
-
while (current &&
|
|
18261
|
+
while (current && Node12.isAsExpression(current)) {
|
|
18206
18262
|
const typeNode = current.getTypeNode();
|
|
18207
18263
|
if (!typeNode) {
|
|
18208
18264
|
break;
|
|
18209
18265
|
}
|
|
18210
|
-
if (
|
|
18266
|
+
if (Node12.isTypeReference(typeNode)) {
|
|
18211
18267
|
const refName = typeNode.getTypeName().getText();
|
|
18212
18268
|
if (refName === "Type") {
|
|
18213
18269
|
const args = typeNode.getTypeArguments();
|
|
18214
18270
|
if (args.length === 1) {
|
|
18215
18271
|
const arg = args[0];
|
|
18216
|
-
if (
|
|
18272
|
+
if (Node12.isTypeReference(arg)) {
|
|
18217
18273
|
return arg.getTypeName().getText();
|
|
18218
18274
|
}
|
|
18219
18275
|
return arg.getText();
|
|
@@ -18232,7 +18288,7 @@ function extractValidatorProperties(initializer) {
|
|
|
18232
18288
|
}
|
|
18233
18289
|
const out = [];
|
|
18234
18290
|
for (const prop of obj.getProperties()) {
|
|
18235
|
-
if (!
|
|
18291
|
+
if (!Node12.isPropertyAssignment(prop)) {
|
|
18236
18292
|
continue;
|
|
18237
18293
|
}
|
|
18238
18294
|
const propAssignment = prop;
|
|
@@ -18242,7 +18298,7 @@ function extractValidatorProperties(initializer) {
|
|
|
18242
18298
|
const clean = optional ? stripped.slice(0, -1) : stripped;
|
|
18243
18299
|
const valueNode = propAssignment.getInitializer();
|
|
18244
18300
|
let hasClearable = false;
|
|
18245
|
-
if (valueNode &&
|
|
18301
|
+
if (valueNode && Node12.isCallExpression(valueNode)) {
|
|
18246
18302
|
const exprText = valueNode.getExpression().getText();
|
|
18247
18303
|
if (exprText === "clearable") {
|
|
18248
18304
|
hasClearable = true;
|
|
@@ -18254,25 +18310,25 @@ function extractValidatorProperties(initializer) {
|
|
|
18254
18310
|
}
|
|
18255
18311
|
function findArktypeObjectLiteral(initializer) {
|
|
18256
18312
|
let current = initializer;
|
|
18257
|
-
while (current &&
|
|
18313
|
+
while (current && Node12.isAsExpression(current)) {
|
|
18258
18314
|
current = current.getExpression();
|
|
18259
18315
|
}
|
|
18260
|
-
if (!current || !
|
|
18316
|
+
if (!current || !Node12.isCallExpression(current)) {
|
|
18261
18317
|
return void 0;
|
|
18262
18318
|
}
|
|
18263
18319
|
const expr = current.getExpression();
|
|
18264
|
-
if (
|
|
18320
|
+
if (Node12.isIdentifier(expr) && expr.getText() === "type") {
|
|
18265
18321
|
const args = current.getArguments();
|
|
18266
18322
|
const arg = args[0];
|
|
18267
|
-
if (arg &&
|
|
18323
|
+
if (arg && Node12.isObjectLiteralExpression(arg)) {
|
|
18268
18324
|
return arg;
|
|
18269
18325
|
}
|
|
18270
18326
|
return void 0;
|
|
18271
18327
|
}
|
|
18272
|
-
if (
|
|
18328
|
+
if (Node12.isPropertyAccessExpression(expr) && expr.getName() === "merge") {
|
|
18273
18329
|
const args = current.getArguments();
|
|
18274
18330
|
const arg = args[0];
|
|
18275
|
-
if (arg &&
|
|
18331
|
+
if (arg && Node12.isObjectLiteralExpression(arg)) {
|
|
18276
18332
|
return arg;
|
|
18277
18333
|
}
|
|
18278
18334
|
}
|
|
@@ -18957,7 +19013,7 @@ import { readdir as readdir2, readFile as readFile4, stat as stat4 } from "node:
|
|
|
18957
19013
|
import { join as join4, relative as relative4, sep as sep5 } from "node:path";
|
|
18958
19014
|
|
|
18959
19015
|
// packages/dbx-cli/manifest-extract/src/lib/extract-crud.ts
|
|
18960
|
-
import { Node as
|
|
19016
|
+
import { Node as Node13, Project as Project6 } from "ts-morph";
|
|
18961
19017
|
var SUPPORTED_VERBS = /* @__PURE__ */ new Set(["create", "read", "update", "delete", "query"]);
|
|
18962
19018
|
function extractCrudEntries(source) {
|
|
18963
19019
|
const project = new Project6({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
@@ -18983,9 +19039,9 @@ function extractCrudEntries(source) {
|
|
|
18983
19039
|
};
|
|
18984
19040
|
if (crudConfigType) {
|
|
18985
19041
|
const literal = crudConfigType.getTypeNode();
|
|
18986
|
-
if (literal &&
|
|
19042
|
+
if (literal && Node13.isTypeLiteral(literal)) {
|
|
18987
19043
|
for (const member of literal.getMembers()) {
|
|
18988
|
-
if (!
|
|
19044
|
+
if (!Node13.isPropertySignature(member)) {
|
|
18989
19045
|
continue;
|
|
18990
19046
|
}
|
|
18991
19047
|
const modelName = member.getName();
|
|
@@ -18997,9 +19053,9 @@ function extractCrudEntries(source) {
|
|
|
18997
19053
|
if (isNullLiteralType2(valueNode)) {
|
|
18998
19054
|
continue;
|
|
18999
19055
|
}
|
|
19000
|
-
if (
|
|
19056
|
+
if (Node13.isTypeLiteral(valueNode)) {
|
|
19001
19057
|
for (const verbMember of valueNode.getMembers()) {
|
|
19002
|
-
if (!
|
|
19058
|
+
if (!Node13.isPropertySignature(verbMember)) {
|
|
19003
19059
|
continue;
|
|
19004
19060
|
}
|
|
19005
19061
|
const verbName = verbMember.getName();
|
|
@@ -19020,9 +19076,9 @@ function extractCrudEntries(source) {
|
|
|
19020
19076
|
const functionTypeMap = findTypeAliasByEnding(sourceFile, "FunctionTypeMap");
|
|
19021
19077
|
if (functionTypeMap) {
|
|
19022
19078
|
const literal = functionTypeMap.getTypeNode();
|
|
19023
|
-
if (literal &&
|
|
19079
|
+
if (literal && Node13.isTypeLiteral(literal)) {
|
|
19024
19080
|
for (const member of literal.getMembers()) {
|
|
19025
|
-
if (!
|
|
19081
|
+
if (!Node13.isPropertySignature(member)) {
|
|
19026
19082
|
continue;
|
|
19027
19083
|
}
|
|
19028
19084
|
const key = member.getName();
|
|
@@ -19090,9 +19146,9 @@ function inferGroupName2(sourceFile) {
|
|
|
19090
19146
|
return void 0;
|
|
19091
19147
|
}
|
|
19092
19148
|
function isNullLiteralType2(node) {
|
|
19093
|
-
if (
|
|
19149
|
+
if (Node13.isLiteralTypeNode(node)) {
|
|
19094
19150
|
const literal = node.getLiteral();
|
|
19095
|
-
if (
|
|
19151
|
+
if (Node13.isNullLiteral(literal)) {
|
|
19096
19152
|
return true;
|
|
19097
19153
|
}
|
|
19098
19154
|
}
|
|
@@ -19100,9 +19156,9 @@ function isNullLiteralType2(node) {
|
|
|
19100
19156
|
}
|
|
19101
19157
|
function collectVerbEntries(input) {
|
|
19102
19158
|
const { modelName, verb, valueNode, entries, fallbackDescription, resolveTypeDocs } = input;
|
|
19103
|
-
if (
|
|
19159
|
+
if (Node13.isTypeLiteral(valueNode)) {
|
|
19104
19160
|
for (const specMember of valueNode.getMembers()) {
|
|
19105
|
-
if (!
|
|
19161
|
+
if (!Node13.isPropertySignature(specMember)) {
|
|
19106
19162
|
continue;
|
|
19107
19163
|
}
|
|
19108
19164
|
const specifier = specMember.getName();
|
|
@@ -19144,7 +19200,7 @@ function collectVerbEntries(input) {
|
|
|
19144
19200
|
});
|
|
19145
19201
|
}
|
|
19146
19202
|
function readTupleParamsResult(node) {
|
|
19147
|
-
if (!
|
|
19203
|
+
if (!Node13.isTupleTypeNode(node)) {
|
|
19148
19204
|
return void 0;
|
|
19149
19205
|
}
|
|
19150
19206
|
const elements = node.getElements();
|
|
@@ -19163,7 +19219,7 @@ function readBareParams(node) {
|
|
|
19163
19219
|
return { params, result: void 0 };
|
|
19164
19220
|
}
|
|
19165
19221
|
function typeNodeName(node) {
|
|
19166
|
-
if (
|
|
19222
|
+
if (Node13.isTypeReference(node)) {
|
|
19167
19223
|
return node.getTypeName().getText();
|
|
19168
19224
|
}
|
|
19169
19225
|
const text = node.getText().trim();
|
|
@@ -20002,7 +20058,7 @@ async function collectApiFiles2(rootAbs) {
|
|
|
20002
20058
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-handlers.ts
|
|
20003
20059
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
20004
20060
|
import { join as join8 } from "node:path";
|
|
20005
|
-
import { Node as
|
|
20061
|
+
import { Node as Node14, Project as Project8 } from "ts-morph";
|
|
20006
20062
|
var HANDLER_MAP_REL = "src/app/function/model/crud.functions.ts";
|
|
20007
20063
|
var VERB_TOKENS = [
|
|
20008
20064
|
{ token: "Create", verb: "create" },
|
|
@@ -20030,7 +20086,7 @@ async function extractHandlerEntries(apiAbs, apiDir) {
|
|
|
20030
20086
|
const verb = matchVerbFromConstName(name);
|
|
20031
20087
|
if (!verb) continue;
|
|
20032
20088
|
const initializer = decl.getInitializer();
|
|
20033
|
-
if (!initializer || !
|
|
20089
|
+
if (!initializer || !Node14.isObjectLiteralExpression(initializer)) continue;
|
|
20034
20090
|
verbsFound.push(verb);
|
|
20035
20091
|
collectVerbMap({ verb, mapLiteral: initializer, sourceFileRel, entries });
|
|
20036
20092
|
}
|
|
@@ -20048,7 +20104,7 @@ function matchVerbFromConstName(name) {
|
|
|
20048
20104
|
function collectVerbMap(input) {
|
|
20049
20105
|
const { verb, mapLiteral, sourceFileRel, entries } = input;
|
|
20050
20106
|
for (const prop of mapLiteral.getProperties()) {
|
|
20051
|
-
if (!
|
|
20107
|
+
if (!Node14.isPropertyAssignment(prop)) continue;
|
|
20052
20108
|
const model = prop.getName();
|
|
20053
20109
|
const value = prop.getInitializer();
|
|
20054
20110
|
if (!value) continue;
|
|
@@ -20067,25 +20123,25 @@ function collectVerbMap(input) {
|
|
|
20067
20123
|
}
|
|
20068
20124
|
}
|
|
20069
20125
|
function readSpecifierHandler(node) {
|
|
20070
|
-
if (!
|
|
20126
|
+
if (!Node14.isCallExpression(node)) return void 0;
|
|
20071
20127
|
const expr = node.getExpression();
|
|
20072
20128
|
if (!expr.getText().endsWith("onCallSpecifierHandler")) return void 0;
|
|
20073
20129
|
const args = node.getArguments();
|
|
20074
20130
|
if (args.length === 0) return void 0;
|
|
20075
20131
|
const firstArg = args[0];
|
|
20076
|
-
if (!
|
|
20132
|
+
if (!Node14.isObjectLiteralExpression(firstArg)) return void 0;
|
|
20077
20133
|
const out = /* @__PURE__ */ new Map();
|
|
20078
20134
|
for (const prop of firstArg.getProperties()) {
|
|
20079
|
-
if (!
|
|
20135
|
+
if (!Node14.isPropertyAssignment(prop) && !Node14.isShorthandPropertyAssignment(prop)) continue;
|
|
20080
20136
|
const specifier = prop.getName();
|
|
20081
|
-
const handlerName = readBareHandlerName(
|
|
20137
|
+
const handlerName = readBareHandlerName(Node14.isPropertyAssignment(prop) ? prop.getInitializerOrThrow() : prop) ?? "(unresolved)";
|
|
20082
20138
|
out.set(specifier, handlerName);
|
|
20083
20139
|
}
|
|
20084
20140
|
return out;
|
|
20085
20141
|
}
|
|
20086
20142
|
function readBareHandlerName(node) {
|
|
20087
|
-
if (
|
|
20088
|
-
if (
|
|
20143
|
+
if (Node14.isIdentifier(node)) return node.getText();
|
|
20144
|
+
if (Node14.isShorthandPropertyAssignment(node)) return node.getName();
|
|
20089
20145
|
const text = node.getText().split(/\s|\(/)[0];
|
|
20090
20146
|
if (/^[A-Za-z_]\w*$/.test(text)) return text;
|
|
20091
20147
|
return void 0;
|
|
@@ -21287,7 +21343,7 @@ function paramsHasFixtureDependencies(params) {
|
|
|
21287
21343
|
}
|
|
21288
21344
|
|
|
21289
21345
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/extract.ts
|
|
21290
|
-
import { Node as
|
|
21346
|
+
import { Node as Node15, Project as Project9, SyntaxKind as SyntaxKind7 } from "ts-morph";
|
|
21291
21347
|
|
|
21292
21348
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/framework-fixtures.ts
|
|
21293
21349
|
var KNOWN_NON_MODEL_FIXTURE_FAMILIES = [
|
|
@@ -21399,7 +21455,7 @@ function extendsByName(cls, baseName) {
|
|
|
21399
21455
|
const extendsClause = cls.getExtends();
|
|
21400
21456
|
if (!extendsClause) return false;
|
|
21401
21457
|
const expr = extendsClause.getExpression();
|
|
21402
|
-
if (
|
|
21458
|
+
if (Node15.isIdentifier(expr)) {
|
|
21403
21459
|
return expr.getText() === baseName;
|
|
21404
21460
|
}
|
|
21405
21461
|
return extendsClause.getText().startsWith(baseName);
|
|
@@ -21527,14 +21583,14 @@ function readContextFactory(decl) {
|
|
|
21527
21583
|
const initializer = decl.getInitializer();
|
|
21528
21584
|
if (!initializer) return void 0;
|
|
21529
21585
|
let bodyExpr;
|
|
21530
|
-
if (
|
|
21586
|
+
if (Node15.isArrowFunction(initializer) || Node15.isFunctionExpression(initializer)) {
|
|
21531
21587
|
bodyExpr = readSingleReturnExpression(initializer);
|
|
21532
21588
|
} else {
|
|
21533
21589
|
bodyExpr = initializer;
|
|
21534
21590
|
}
|
|
21535
|
-
if (!bodyExpr || !
|
|
21591
|
+
if (!bodyExpr || !Node15.isCallExpression(bodyExpr)) return void 0;
|
|
21536
21592
|
const callee = bodyExpr.getExpression();
|
|
21537
|
-
if (!
|
|
21593
|
+
if (!Node15.isIdentifier(callee)) return void 0;
|
|
21538
21594
|
const calleeName = callee.getText();
|
|
21539
21595
|
let family;
|
|
21540
21596
|
if (calleeName !== MODEL_FACTORY_NAME) {
|
|
@@ -21549,9 +21605,9 @@ function readContextFactory(decl) {
|
|
|
21549
21605
|
let parentFixtureFieldFromGetCollection;
|
|
21550
21606
|
if (args.length > 0) {
|
|
21551
21607
|
const first = args[0];
|
|
21552
|
-
if (
|
|
21608
|
+
if (Node15.isObjectLiteralExpression(first)) {
|
|
21553
21609
|
const getCollection = first.getProperty("getCollection");
|
|
21554
|
-
if (getCollection &&
|
|
21610
|
+
if (getCollection && Node15.isPropertyAssignment(getCollection)) {
|
|
21555
21611
|
const fnInit = getCollection.getInitializer();
|
|
21556
21612
|
const arity = readArrowParameterCount(fnInit);
|
|
21557
21613
|
if (arity >= 2) {
|
|
@@ -21602,7 +21658,7 @@ function familyFromExtends(cls) {
|
|
|
21602
21658
|
if (!ext) return void 0;
|
|
21603
21659
|
const expr = ext.getExpression();
|
|
21604
21660
|
let baseName;
|
|
21605
|
-
if (
|
|
21661
|
+
if (Node15.isIdentifier(expr)) {
|
|
21606
21662
|
baseName = expr.getText();
|
|
21607
21663
|
} else {
|
|
21608
21664
|
const text = ext.getText();
|
|
@@ -21615,9 +21671,9 @@ function familyFromExtends(cls) {
|
|
|
21615
21671
|
function readSingleReturnExpression(fn) {
|
|
21616
21672
|
const body = fn.getBody();
|
|
21617
21673
|
if (!body) return void 0;
|
|
21618
|
-
if (
|
|
21674
|
+
if (Node15.isBlock(body)) {
|
|
21619
21675
|
for (const stmt of body.getStatements()) {
|
|
21620
|
-
if (
|
|
21676
|
+
if (Node15.isReturnStatement(stmt)) {
|
|
21621
21677
|
return stmt.getExpression();
|
|
21622
21678
|
}
|
|
21623
21679
|
}
|
|
@@ -21627,19 +21683,19 @@ function readSingleReturnExpression(fn) {
|
|
|
21627
21683
|
}
|
|
21628
21684
|
function readArrowParameterCount(fn) {
|
|
21629
21685
|
if (!fn) return 0;
|
|
21630
|
-
if (
|
|
21686
|
+
if (Node15.isArrowFunction(fn) || Node15.isFunctionExpression(fn) || Node15.isFunctionDeclaration(fn) || Node15.isMethodDeclaration(fn)) {
|
|
21631
21687
|
return fn.getParameters().length;
|
|
21632
21688
|
}
|
|
21633
21689
|
return 0;
|
|
21634
21690
|
}
|
|
21635
21691
|
function readParamsAccessFieldName(fn) {
|
|
21636
21692
|
if (!fn) return void 0;
|
|
21637
|
-
if (!
|
|
21693
|
+
if (!Node15.isArrowFunction(fn) && !Node15.isFunctionExpression(fn)) return void 0;
|
|
21638
21694
|
const body = fn.getBody();
|
|
21639
21695
|
if (!body) return void 0;
|
|
21640
21696
|
for (const access2 of body.getDescendantsOfKind(SyntaxKind7.PropertyAccessExpression)) {
|
|
21641
21697
|
const expr = access2.getExpression();
|
|
21642
|
-
if (
|
|
21698
|
+
if (Node15.isIdentifier(expr) && expr.getText() === "params") {
|
|
21643
21699
|
return access2.getName();
|
|
21644
21700
|
}
|
|
21645
21701
|
}
|
|
@@ -21680,9 +21736,9 @@ function collectSingletonsByFactory(sourceFile) {
|
|
|
21680
21736
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
21681
21737
|
for (const decl of stmt.getDeclarations()) {
|
|
21682
21738
|
const init = decl.getInitializer();
|
|
21683
|
-
if (!init || !
|
|
21739
|
+
if (!init || !Node15.isCallExpression(init)) continue;
|
|
21684
21740
|
const callee = init.getExpression();
|
|
21685
|
-
if (!
|
|
21741
|
+
if (!Node15.isIdentifier(callee)) continue;
|
|
21686
21742
|
out.set(callee.getText(), decl.getName());
|
|
21687
21743
|
}
|
|
21688
21744
|
}
|
|
@@ -22930,7 +22986,7 @@ import { resolve as resolve32 } from "node:path";
|
|
|
22930
22986
|
import { type as type47 } from "arktype";
|
|
22931
22987
|
|
|
22932
22988
|
// packages/dbx-components-mcp/src/tools/model-test-shared/extract.ts
|
|
22933
|
-
import { Node as
|
|
22989
|
+
import { Node as Node16, Project as Project11, SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
22934
22990
|
var SPEC_FILE_VIRTUAL_PATH = "__spec__/spec.ts";
|
|
22935
22991
|
var FIXTURE_CONTEXT_SUFFIX = "Context";
|
|
22936
22992
|
var FIXTURE_FACTORY_SUFFIX = "ContextFactory";
|
|
@@ -22951,9 +23007,9 @@ function extractSpecTreeFromText(input) {
|
|
|
22951
23007
|
const counts = { describe: 0, it: 0, fixture: 0 };
|
|
22952
23008
|
const rootChildren = [];
|
|
22953
23009
|
for (const stmt of sourceFile.getStatements()) {
|
|
22954
|
-
if (!
|
|
23010
|
+
if (!Node16.isExpressionStatement(stmt)) continue;
|
|
22955
23011
|
const expr = stmt.getExpression();
|
|
22956
|
-
if (!
|
|
23012
|
+
if (!Node16.isCallExpression(expr)) continue;
|
|
22957
23013
|
const node = walkCall(expr, { prefix, knownFixtureNames, helperNames, counts });
|
|
22958
23014
|
if (node !== void 0) {
|
|
22959
23015
|
rootChildren.push(node);
|
|
@@ -23119,7 +23175,7 @@ function fixtureNode(input) {
|
|
|
23119
23175
|
const { call, calleeName, ctx, line, endLine } = input;
|
|
23120
23176
|
const args = call.getArguments();
|
|
23121
23177
|
const argsObject = args[0];
|
|
23122
|
-
const parentVars =
|
|
23178
|
+
const parentVars = Node16.isObjectLiteralExpression(argsObject) ? readParentVars(argsObject) : [];
|
|
23123
23179
|
const callback = findCallback(call);
|
|
23124
23180
|
const varName = callback === void 0 ? void 0 : readCallbackVarName(callback);
|
|
23125
23181
|
const model = stripFixturePrefix(calleeName, ctx.prefix);
|
|
@@ -23157,11 +23213,11 @@ function stripFixturePrefix(name, prefix) {
|
|
|
23157
23213
|
}
|
|
23158
23214
|
function readTitle(arg) {
|
|
23159
23215
|
if (arg === void 0) return { title: void 0, titleIsTemplate: false };
|
|
23160
|
-
if (
|
|
23216
|
+
if (Node16.isStringLiteral(arg) || Node16.isNoSubstitutionTemplateLiteral(arg)) {
|
|
23161
23217
|
const result2 = { title: arg.getLiteralText(), titleIsTemplate: false };
|
|
23162
23218
|
return result2;
|
|
23163
23219
|
}
|
|
23164
|
-
if (
|
|
23220
|
+
if (Node16.isTemplateExpression(arg)) {
|
|
23165
23221
|
const result2 = { title: arg.getText(), titleIsTemplate: true };
|
|
23166
23222
|
return result2;
|
|
23167
23223
|
}
|
|
@@ -23172,7 +23228,7 @@ function findCallback(call) {
|
|
|
23172
23228
|
const args = call.getArguments();
|
|
23173
23229
|
for (let i = args.length - 1; i >= 0; i--) {
|
|
23174
23230
|
const a = args[i];
|
|
23175
|
-
if (
|
|
23231
|
+
if (Node16.isArrowFunction(a) || Node16.isFunctionExpression(a)) {
|
|
23176
23232
|
return a;
|
|
23177
23233
|
}
|
|
23178
23234
|
}
|
|
@@ -23183,7 +23239,7 @@ function readCallbackVarName(callback) {
|
|
|
23183
23239
|
if (params.length === 0) return void 0;
|
|
23184
23240
|
const first = params[0];
|
|
23185
23241
|
const nameNode = first.getNameNode();
|
|
23186
|
-
if (
|
|
23242
|
+
if (Node16.isIdentifier(nameNode)) {
|
|
23187
23243
|
return nameNode.getText();
|
|
23188
23244
|
}
|
|
23189
23245
|
return void 0;
|
|
@@ -23191,13 +23247,13 @@ function readCallbackVarName(callback) {
|
|
|
23191
23247
|
function readParentVars(obj) {
|
|
23192
23248
|
const out = [];
|
|
23193
23249
|
for (const prop of obj.getProperties()) {
|
|
23194
|
-
if (
|
|
23250
|
+
if (Node16.isShorthandPropertyAssignment(prop)) {
|
|
23195
23251
|
out.push(prop.getName());
|
|
23196
23252
|
continue;
|
|
23197
23253
|
}
|
|
23198
|
-
if (
|
|
23254
|
+
if (Node16.isPropertyAssignment(prop)) {
|
|
23199
23255
|
const init = prop.getInitializer();
|
|
23200
|
-
if (init !== void 0 &&
|
|
23256
|
+
if (init !== void 0 && Node16.isIdentifier(init)) {
|
|
23201
23257
|
out.push(init.getText());
|
|
23202
23258
|
}
|
|
23203
23259
|
}
|
|
@@ -23206,10 +23262,10 @@ function readParentVars(obj) {
|
|
|
23206
23262
|
}
|
|
23207
23263
|
function walkCallbackBody(callback, ctx) {
|
|
23208
23264
|
const body = callback.getBody();
|
|
23209
|
-
if (
|
|
23265
|
+
if (Node16.isBlock(body)) {
|
|
23210
23266
|
return walkBlock(body, ctx);
|
|
23211
23267
|
}
|
|
23212
|
-
if (
|
|
23268
|
+
if (Node16.isCallExpression(body)) {
|
|
23213
23269
|
const child = walkCall(body, ctx);
|
|
23214
23270
|
return child === void 0 ? [] : [child];
|
|
23215
23271
|
}
|
|
@@ -23218,9 +23274,9 @@ function walkCallbackBody(callback, ctx) {
|
|
|
23218
23274
|
function walkBlock(block, ctx) {
|
|
23219
23275
|
const children = [];
|
|
23220
23276
|
for (const stmt of block.getStatements()) {
|
|
23221
|
-
if (!
|
|
23277
|
+
if (!Node16.isExpressionStatement(stmt)) continue;
|
|
23222
23278
|
const expr = stmt.getExpression();
|
|
23223
|
-
if (!
|
|
23279
|
+
if (!Node16.isCallExpression(expr)) continue;
|
|
23224
23280
|
const child = walkCall(expr, ctx);
|
|
23225
23281
|
if (child !== void 0) {
|
|
23226
23282
|
children.push(child);
|
|
@@ -23230,7 +23286,7 @@ function walkBlock(block, ctx) {
|
|
|
23230
23286
|
}
|
|
23231
23287
|
function getCalleeName(call) {
|
|
23232
23288
|
const expr = call.getExpression();
|
|
23233
|
-
if (
|
|
23289
|
+
if (Node16.isIdentifier(expr)) return expr.getText();
|
|
23234
23290
|
return void 0;
|
|
23235
23291
|
}
|
|
23236
23292
|
function collectHelpers(sourceFile) {
|
|
@@ -23246,7 +23302,7 @@ function collectHelpers(sourceFile) {
|
|
|
23246
23302
|
for (const decl of v.getDeclarations()) {
|
|
23247
23303
|
const init = decl.getInitializer();
|
|
23248
23304
|
if (init === void 0) continue;
|
|
23249
|
-
if (!
|
|
23305
|
+
if (!Node16.isArrowFunction(init) && !Node16.isFunctionExpression(init)) continue;
|
|
23250
23306
|
const usage = scanForDescribeOrIt(init);
|
|
23251
23307
|
if (!usage.emitsDescribe && !usage.emitsIt) continue;
|
|
23252
23308
|
out.push({ name: decl.getName(), line: decl.getStartLineNumber(), endLine: decl.getEndLineNumber(), emitsDescribe: usage.emitsDescribe, emitsIt: usage.emitsIt });
|
|
@@ -23260,7 +23316,7 @@ function scanForDescribeOrIt(node) {
|
|
|
23260
23316
|
if (descendant.getKind() !== SyntaxKind8.CallExpression) return;
|
|
23261
23317
|
const call = descendant;
|
|
23262
23318
|
const expr = call.getExpression();
|
|
23263
|
-
if (!
|
|
23319
|
+
if (!Node16.isIdentifier(expr)) return;
|
|
23264
23320
|
const name = expr.getText();
|
|
23265
23321
|
if (DESCRIBE_NAMES.has(name)) usage.emitsDescribe = true;
|
|
23266
23322
|
if (isItName(name)) usage.emitsIt = true;
|
|
@@ -24033,10 +24089,10 @@ var modelHierarchyTool = {
|
|
|
24033
24089
|
};
|
|
24034
24090
|
|
|
24035
24091
|
// packages/dbx-components-mcp/src/tools/storagefile-m-validate-app/extract.ts
|
|
24036
|
-
import { Node as
|
|
24092
|
+
import { Node as Node18, SyntaxKind as SyntaxKind10 } from "ts-morph";
|
|
24037
24093
|
|
|
24038
24094
|
// packages/dbx-components-mcp/src/tools/_validate/ast.ts
|
|
24039
|
-
import { Node as
|
|
24095
|
+
import { Node as Node17, Project as Project12, SyntaxKind as SyntaxKind9 } from "ts-morph";
|
|
24040
24096
|
var COMPONENT_VIRTUAL_PREFIX = "__component__/";
|
|
24041
24097
|
var API_VIRTUAL_PREFIX = "__api__/";
|
|
24042
24098
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -24061,28 +24117,28 @@ function componentRelPath(sourceFile) {
|
|
|
24061
24117
|
}
|
|
24062
24118
|
function unwrapAsExpressions(node) {
|
|
24063
24119
|
let current = node;
|
|
24064
|
-
while (current &&
|
|
24120
|
+
while (current && Node17.isAsExpression(current)) {
|
|
24065
24121
|
current = current.getExpression();
|
|
24066
24122
|
}
|
|
24067
24123
|
return current;
|
|
24068
24124
|
}
|
|
24069
24125
|
function asObjectLiteral(node) {
|
|
24070
24126
|
const inner = unwrapAsExpressions(node);
|
|
24071
|
-
if (inner &&
|
|
24127
|
+
if (inner && Node17.isObjectLiteralExpression(inner)) {
|
|
24072
24128
|
return inner;
|
|
24073
24129
|
}
|
|
24074
24130
|
return void 0;
|
|
24075
24131
|
}
|
|
24076
24132
|
function asArrayLiteral(node) {
|
|
24077
24133
|
const inner = unwrapAsExpressions(node);
|
|
24078
|
-
if (inner &&
|
|
24134
|
+
if (inner && Node17.isArrayLiteralExpression(inner)) {
|
|
24079
24135
|
return inner;
|
|
24080
24136
|
}
|
|
24081
24137
|
return void 0;
|
|
24082
24138
|
}
|
|
24083
24139
|
function readStringLiteralInitializer(decl) {
|
|
24084
24140
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
24085
|
-
if (initializer &&
|
|
24141
|
+
if (initializer && Node17.isStringLiteral(initializer)) {
|
|
24086
24142
|
return initializer.getLiteralText();
|
|
24087
24143
|
}
|
|
24088
24144
|
return void 0;
|
|
@@ -24094,37 +24150,37 @@ function typeAnnotationText(node) {
|
|
|
24094
24150
|
function getPropertyInitializer(obj, name) {
|
|
24095
24151
|
const prop = obj.getProperty(name);
|
|
24096
24152
|
if (!prop) return void 0;
|
|
24097
|
-
if (
|
|
24153
|
+
if (Node17.isPropertyAssignment(prop)) {
|
|
24098
24154
|
return prop.getInitializer();
|
|
24099
24155
|
}
|
|
24100
|
-
if (
|
|
24156
|
+
if (Node17.isShorthandPropertyAssignment(prop)) {
|
|
24101
24157
|
return prop.getNameNode();
|
|
24102
24158
|
}
|
|
24103
24159
|
return void 0;
|
|
24104
24160
|
}
|
|
24105
24161
|
function readStringProperty2(obj, name) {
|
|
24106
24162
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24107
|
-
if (init &&
|
|
24163
|
+
if (init && Node17.isStringLiteral(init)) {
|
|
24108
24164
|
return init.getLiteralText();
|
|
24109
24165
|
}
|
|
24110
24166
|
return void 0;
|
|
24111
24167
|
}
|
|
24112
24168
|
function readIdentifierProperty(obj, name) {
|
|
24113
24169
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24114
|
-
if (init &&
|
|
24170
|
+
if (init && Node17.isIdentifier(init)) {
|
|
24115
24171
|
return init.getText();
|
|
24116
24172
|
}
|
|
24117
24173
|
return void 0;
|
|
24118
24174
|
}
|
|
24119
24175
|
function findReturnExpression(fn) {
|
|
24120
|
-
if (!
|
|
24176
|
+
if (!Node17.isArrowFunction(fn) && !Node17.isFunctionDeclaration(fn) && !Node17.isFunctionExpression(fn)) {
|
|
24121
24177
|
return void 0;
|
|
24122
24178
|
}
|
|
24123
24179
|
const body = fn.getBody();
|
|
24124
24180
|
if (!body) return void 0;
|
|
24125
|
-
if (
|
|
24181
|
+
if (Node17.isBlock(body)) {
|
|
24126
24182
|
for (const stmt of body.getStatements()) {
|
|
24127
|
-
if (
|
|
24183
|
+
if (Node17.isReturnStatement(stmt)) {
|
|
24128
24184
|
return stmt.getExpression();
|
|
24129
24185
|
}
|
|
24130
24186
|
}
|
|
@@ -24144,7 +24200,7 @@ function findLocalVariable(sf, name) {
|
|
|
24144
24200
|
return void 0;
|
|
24145
24201
|
}
|
|
24146
24202
|
function collectTypeofReferences(node, out) {
|
|
24147
|
-
if (
|
|
24203
|
+
if (Node17.isTypeQuery(node)) {
|
|
24148
24204
|
out.push(node.getExprName().getText());
|
|
24149
24205
|
return;
|
|
24150
24206
|
}
|
|
@@ -24346,7 +24402,7 @@ function buildApiFunctionIndex(sources) {
|
|
|
24346
24402
|
for (const decl of stmt.getDeclarations()) {
|
|
24347
24403
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
24348
24404
|
if (!initializer) continue;
|
|
24349
|
-
if (
|
|
24405
|
+
if (Node18.isArrowFunction(initializer) || Node18.isFunctionExpression(initializer)) {
|
|
24350
24406
|
map.set(decl.getName(), { node: initializer, sourceFile: sf });
|
|
24351
24407
|
}
|
|
24352
24408
|
}
|
|
@@ -24359,34 +24415,34 @@ function collectInitializerBindingsFromValue(options) {
|
|
|
24359
24415
|
const { node, sf, index, resolved, unresolved, visited } = options;
|
|
24360
24416
|
const inner = unwrapAsExpressions(node);
|
|
24361
24417
|
if (!inner) return false;
|
|
24362
|
-
if (
|
|
24418
|
+
if (Node18.isArrayLiteralExpression(inner)) {
|
|
24363
24419
|
for (const el of inner.getElements()) {
|
|
24364
|
-
if (
|
|
24420
|
+
if (Node18.isSpreadElement(el)) {
|
|
24365
24421
|
const spreadInner = el.getExpression();
|
|
24366
|
-
if (
|
|
24422
|
+
if (Node18.isIdentifier(spreadInner)) {
|
|
24367
24423
|
collectInitializerBindingsFromIdentifier({ name: spreadInner.getText(), sf, index, resolved, unresolved, visited });
|
|
24368
|
-
} else if (
|
|
24424
|
+
} else if (Node18.isCallExpression(spreadInner)) {
|
|
24369
24425
|
const callee = spreadInner.getExpression();
|
|
24370
|
-
if (
|
|
24426
|
+
if (Node18.isIdentifier(callee)) {
|
|
24371
24427
|
collectInitializerBindingsFromIdentifier({ name: callee.getText(), sf, index, resolved, unresolved, visited });
|
|
24372
24428
|
}
|
|
24373
24429
|
}
|
|
24374
24430
|
continue;
|
|
24375
24431
|
}
|
|
24376
24432
|
const elementInner = unwrapAsExpressions(el);
|
|
24377
|
-
if (elementInner &&
|
|
24433
|
+
if (elementInner && Node18.isIdentifier(elementInner)) {
|
|
24378
24434
|
resolved.push(elementInner.getText());
|
|
24379
24435
|
}
|
|
24380
24436
|
}
|
|
24381
24437
|
return true;
|
|
24382
24438
|
}
|
|
24383
|
-
if (
|
|
24439
|
+
if (Node18.isCallExpression(inner)) {
|
|
24384
24440
|
const callee = inner.getExpression();
|
|
24385
|
-
if (
|
|
24441
|
+
if (Node18.isIdentifier(callee)) {
|
|
24386
24442
|
return collectInitializerBindingsFromIdentifier({ name: callee.getText(), sf, index, resolved, unresolved, visited });
|
|
24387
24443
|
}
|
|
24388
24444
|
}
|
|
24389
|
-
if (
|
|
24445
|
+
if (Node18.isIdentifier(inner)) {
|
|
24390
24446
|
return collectInitializerBindingsFromIdentifier({ name: inner.getText(), sf, index, resolved, unresolved, visited });
|
|
24391
24447
|
}
|
|
24392
24448
|
return false;
|
|
@@ -24425,15 +24481,15 @@ function collectUploadInitializerArray(options) {
|
|
|
24425
24481
|
const { initializerArr, sf, index, direct, spreads, resolved, unresolved } = options;
|
|
24426
24482
|
const visited = /* @__PURE__ */ new Set();
|
|
24427
24483
|
for (const el of initializerArr.getElements()) {
|
|
24428
|
-
if (
|
|
24484
|
+
if (Node18.isSpreadElement(el)) {
|
|
24429
24485
|
const inner2 = el.getExpression();
|
|
24430
|
-
if (
|
|
24486
|
+
if (Node18.isIdentifier(inner2)) {
|
|
24431
24487
|
const name = inner2.getText();
|
|
24432
24488
|
spreads.push(name);
|
|
24433
24489
|
collectInitializerBindingsFromIdentifier({ name, sf, index, resolved, unresolved, visited });
|
|
24434
|
-
} else if (
|
|
24490
|
+
} else if (Node18.isCallExpression(inner2)) {
|
|
24435
24491
|
const callee = inner2.getExpression();
|
|
24436
|
-
if (
|
|
24492
|
+
if (Node18.isIdentifier(callee)) {
|
|
24437
24493
|
const name = callee.getText();
|
|
24438
24494
|
spreads.push(name);
|
|
24439
24495
|
collectInitializerBindingsFromIdentifier({ name, sf, index, resolved, unresolved, visited });
|
|
@@ -24442,7 +24498,7 @@ function collectUploadInitializerArray(options) {
|
|
|
24442
24498
|
continue;
|
|
24443
24499
|
}
|
|
24444
24500
|
const inner = unwrapAsExpressions(el);
|
|
24445
|
-
if (inner &&
|
|
24501
|
+
if (inner && Node18.isIdentifier(inner)) {
|
|
24446
24502
|
const name = inner.getText();
|
|
24447
24503
|
direct.push(name);
|
|
24448
24504
|
resolved.push(name);
|
|
@@ -24455,7 +24511,7 @@ function extractUploadServiceCalls(sources, index) {
|
|
|
24455
24511
|
const rel = apiRelPath(sf);
|
|
24456
24512
|
for (const call of sf.getDescendantsOfKind(SyntaxKind10.CallExpression)) {
|
|
24457
24513
|
const expr = call.getExpression();
|
|
24458
|
-
if (!
|
|
24514
|
+
if (!Node18.isIdentifier(expr) || expr.getText() !== UPLOAD_SERVICE_FACTORY) continue;
|
|
24459
24515
|
const args = call.getArguments();
|
|
24460
24516
|
const first = args[0] ? resolveObjectArg(args[0], sf) : void 0;
|
|
24461
24517
|
if (!first) continue;
|
|
@@ -24483,12 +24539,12 @@ function extractUploadServiceCalls(sources, index) {
|
|
|
24483
24539
|
function resolveObjectArg(node, sf) {
|
|
24484
24540
|
const inner = unwrapAsExpressions(node);
|
|
24485
24541
|
if (!inner) return void 0;
|
|
24486
|
-
if (
|
|
24487
|
-
if (
|
|
24542
|
+
if (Node18.isObjectLiteralExpression(inner)) return inner;
|
|
24543
|
+
if (Node18.isIdentifier(inner)) {
|
|
24488
24544
|
const declNode = findLocalVariable(sf, inner.getText());
|
|
24489
24545
|
if (declNode) {
|
|
24490
24546
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
24491
|
-
if (declInit &&
|
|
24547
|
+
if (declInit && Node18.isObjectLiteralExpression(declInit)) {
|
|
24492
24548
|
return declInit;
|
|
24493
24549
|
}
|
|
24494
24550
|
}
|
|
@@ -24498,12 +24554,12 @@ function resolveObjectArg(node, sf) {
|
|
|
24498
24554
|
function resolveArrayFromProperty(obj, name, sf) {
|
|
24499
24555
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
24500
24556
|
if (!init) return void 0;
|
|
24501
|
-
if (
|
|
24502
|
-
if (
|
|
24557
|
+
if (Node18.isArrayLiteralExpression(init)) return init;
|
|
24558
|
+
if (Node18.isIdentifier(init)) {
|
|
24503
24559
|
const declNode = findLocalVariable(sf, init.getText());
|
|
24504
24560
|
if (declNode) {
|
|
24505
24561
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
24506
|
-
if (declInit &&
|
|
24562
|
+
if (declInit && Node18.isArrayLiteralExpression(declInit)) {
|
|
24507
24563
|
return declInit;
|
|
24508
24564
|
}
|
|
24509
24565
|
}
|
|
@@ -24514,11 +24570,11 @@ function enclosingFactoryName(node) {
|
|
|
24514
24570
|
let current = node.getParent();
|
|
24515
24571
|
let result;
|
|
24516
24572
|
while (current) {
|
|
24517
|
-
if (
|
|
24573
|
+
if (Node18.isFunctionDeclaration(current)) {
|
|
24518
24574
|
result = current.getName() ?? void 0;
|
|
24519
24575
|
break;
|
|
24520
24576
|
}
|
|
24521
|
-
if (
|
|
24577
|
+
if (Node18.isVariableDeclaration(current)) {
|
|
24522
24578
|
result = current.getName();
|
|
24523
24579
|
break;
|
|
24524
24580
|
}
|
|
@@ -24572,10 +24628,10 @@ function extractProcessingConfigFromDecl(decl, rel) {
|
|
|
24572
24628
|
function readFlowSubtasks(obj) {
|
|
24573
24629
|
const flowInit = unwrapAsExpressions(getPropertyInitializer(obj, "flow"));
|
|
24574
24630
|
const subtasks = [];
|
|
24575
|
-
if (flowInit &&
|
|
24631
|
+
if (flowInit && Node18.isArrayLiteralExpression(flowInit)) {
|
|
24576
24632
|
for (const el of flowInit.getElements()) {
|
|
24577
24633
|
const inner = unwrapAsExpressions(el);
|
|
24578
|
-
if (inner &&
|
|
24634
|
+
if (inner && Node18.isObjectLiteralExpression(inner)) {
|
|
24579
24635
|
const subtask = readIdentifierProperty(inner, "subtask");
|
|
24580
24636
|
if (subtask) subtasks.push(subtask);
|
|
24581
24637
|
}
|
|
@@ -24589,7 +24645,7 @@ function extractProcessingHandlerCalls(sources) {
|
|
|
24589
24645
|
const rel = apiRelPath(sf);
|
|
24590
24646
|
for (const call of sf.getDescendantsOfKind(SyntaxKind10.CallExpression)) {
|
|
24591
24647
|
const expr = call.getExpression();
|
|
24592
|
-
if (!
|
|
24648
|
+
if (!Node18.isIdentifier(expr) || expr.getText() !== PROCESSING_HANDLER_FACTORY) continue;
|
|
24593
24649
|
const args = call.getArguments();
|
|
24594
24650
|
const first = args[0] ? resolveObjectArg(args[0], sf) : void 0;
|
|
24595
24651
|
if (!first) continue;
|
|
@@ -24610,7 +24666,7 @@ function extractProcessingHandlerCalls(sources) {
|
|
|
24610
24666
|
}
|
|
24611
24667
|
function collectProcessorArrayElements(processorsArr, direct, spreads) {
|
|
24612
24668
|
for (const el of processorsArr.getElements()) {
|
|
24613
|
-
if (
|
|
24669
|
+
if (Node18.isSpreadElement(el)) {
|
|
24614
24670
|
addProcessorIdentifierName(el.getExpression(), spreads);
|
|
24615
24671
|
continue;
|
|
24616
24672
|
}
|
|
@@ -24622,13 +24678,13 @@ function collectProcessorArrayElements(processorsArr, direct, spreads) {
|
|
|
24622
24678
|
}
|
|
24623
24679
|
function addProcessorIdentifierName(node, bucket) {
|
|
24624
24680
|
if (!node) return;
|
|
24625
|
-
if (
|
|
24681
|
+
if (Node18.isIdentifier(node)) {
|
|
24626
24682
|
bucket.push(node.getText());
|
|
24627
24683
|
return;
|
|
24628
24684
|
}
|
|
24629
|
-
if (
|
|
24685
|
+
if (Node18.isCallExpression(node)) {
|
|
24630
24686
|
const callee = node.getExpression();
|
|
24631
|
-
if (
|
|
24687
|
+
if (Node18.isIdentifier(callee)) {
|
|
24632
24688
|
bucket.push(callee.getText());
|
|
24633
24689
|
}
|
|
24634
24690
|
}
|
|
@@ -25620,7 +25676,7 @@ var storageFileMValidateFolderTool = createTwoSideValidateTool({
|
|
|
25620
25676
|
});
|
|
25621
25677
|
|
|
25622
25678
|
// packages/dbx-components-mcp/src/tools/notification-m-validate-app/extract.ts
|
|
25623
|
-
import { Node as
|
|
25679
|
+
import { Node as Node19, SyntaxKind as SyntaxKind11 } from "ts-morph";
|
|
25624
25680
|
var NOTIF_TEMPLATE_TYPE = "NotificationTemplateType";
|
|
25625
25681
|
var NOTIF_TEMPLATE_TYPE_INFO = "NotificationTemplateTypeInfo";
|
|
25626
25682
|
var NOTIF_TEMPLATE_TYPE_INFO_ARRAY = "NotificationTemplateTypeInfo[]";
|
|
@@ -25741,7 +25797,7 @@ function extractTemplateInfoAggregates(sources) {
|
|
|
25741
25797
|
const ids = [];
|
|
25742
25798
|
for (const el of arr.getElements()) {
|
|
25743
25799
|
const inner = unwrapAsExpressions(el);
|
|
25744
|
-
if (inner &&
|
|
25800
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25745
25801
|
ids.push(inner.getText());
|
|
25746
25802
|
}
|
|
25747
25803
|
}
|
|
@@ -25787,7 +25843,7 @@ function extractTaskAllTypesAggregates(sources) {
|
|
|
25787
25843
|
const ids = [];
|
|
25788
25844
|
for (const el of arr.getElements()) {
|
|
25789
25845
|
const inner = unwrapAsExpressions(el);
|
|
25790
|
-
if (inner &&
|
|
25846
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25791
25847
|
ids.push(inner.getText());
|
|
25792
25848
|
}
|
|
25793
25849
|
}
|
|
@@ -25815,14 +25871,14 @@ function extractTaskCheckpointAliases(sources) {
|
|
|
25815
25871
|
return out;
|
|
25816
25872
|
}
|
|
25817
25873
|
function collectStringLiterals(node, out) {
|
|
25818
|
-
if (
|
|
25874
|
+
if (Node19.isLiteralTypeNode(node)) {
|
|
25819
25875
|
const lit = node.getLiteral();
|
|
25820
|
-
if (
|
|
25876
|
+
if (Node19.isStringLiteral(lit)) {
|
|
25821
25877
|
out.push(lit.getLiteralText());
|
|
25822
25878
|
}
|
|
25823
25879
|
return;
|
|
25824
25880
|
}
|
|
25825
|
-
if (
|
|
25881
|
+
if (Node19.isUnionTypeNode(node)) {
|
|
25826
25882
|
for (const child of node.getTypeNodes()) {
|
|
25827
25883
|
collectStringLiterals(child, out);
|
|
25828
25884
|
}
|
|
@@ -25876,7 +25932,7 @@ function extractTemplateInfoRecord(sources, index) {
|
|
|
25876
25932
|
}
|
|
25877
25933
|
function tryReadTemplateInfoRecord(decl, rel, index) {
|
|
25878
25934
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
25879
|
-
if (!initializer || !
|
|
25935
|
+
if (!initializer || !Node19.isCallExpression(initializer)) return void 0;
|
|
25880
25936
|
if (initializer.getExpression().getText() !== TEMPLATE_INFO_RECORD_FACTORY) return void 0;
|
|
25881
25937
|
const args = initializer.getArguments();
|
|
25882
25938
|
const arr = args[0] ? asArrayLiteral(args[0]) : void 0;
|
|
@@ -25897,15 +25953,15 @@ function tryReadTemplateInfoRecord(decl, rel, index) {
|
|
|
25897
25953
|
}
|
|
25898
25954
|
function classifyInfoRecordArrayElements(arr, direct, spreads) {
|
|
25899
25955
|
for (const el of arr.getElements()) {
|
|
25900
|
-
if (
|
|
25956
|
+
if (Node19.isSpreadElement(el)) {
|
|
25901
25957
|
const inner2 = el.getExpression();
|
|
25902
|
-
if (
|
|
25958
|
+
if (Node19.isIdentifier(inner2)) {
|
|
25903
25959
|
spreads.push(inner2.getText());
|
|
25904
25960
|
}
|
|
25905
25961
|
continue;
|
|
25906
25962
|
}
|
|
25907
25963
|
const inner = unwrapAsExpressions(el);
|
|
25908
|
-
if (inner &&
|
|
25964
|
+
if (inner && Node19.isIdentifier(inner)) {
|
|
25909
25965
|
direct.push(inner.getText());
|
|
25910
25966
|
}
|
|
25911
25967
|
}
|
|
@@ -25932,7 +25988,7 @@ function extractTemplateInfoRecordWiring(sources) {
|
|
|
25932
25988
|
const first = args[0];
|
|
25933
25989
|
if (!first) continue;
|
|
25934
25990
|
const inner = unwrapAsExpressions(first);
|
|
25935
|
-
if (!inner || !
|
|
25991
|
+
if (!inner || !Node19.isIdentifier(inner)) continue;
|
|
25936
25992
|
const result = {
|
|
25937
25993
|
recordIdentifier: inner.getText(),
|
|
25938
25994
|
sourceFile: rel
|
|
@@ -25970,7 +26026,7 @@ function buildApiFunctionIndex2(sources) {
|
|
|
25970
26026
|
for (const decl of stmt.getDeclarations()) {
|
|
25971
26027
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
25972
26028
|
if (!initializer) continue;
|
|
25973
|
-
if (
|
|
26029
|
+
if (Node19.isArrowFunction(initializer) || Node19.isFunctionExpression(initializer)) {
|
|
25974
26030
|
map.set(decl.getName(), { node: initializer, sourceFile: sf, relPath: rel });
|
|
25975
26031
|
}
|
|
25976
26032
|
}
|
|
@@ -26006,11 +26062,11 @@ function extractTemplateConfigsArrayFactory(sources, index) {
|
|
|
26006
26062
|
const arr = returnExpr ? asArrayLiteral(returnExpr) : void 0;
|
|
26007
26063
|
if (arr) {
|
|
26008
26064
|
for (const el of arr.getElements()) {
|
|
26009
|
-
if (
|
|
26065
|
+
if (Node19.isSpreadElement(el)) {
|
|
26010
26066
|
const inner2 = el.getExpression();
|
|
26011
|
-
if (
|
|
26067
|
+
if (Node19.isCallExpression(inner2)) {
|
|
26012
26068
|
const callee = inner2.getExpression();
|
|
26013
|
-
if (
|
|
26069
|
+
if (Node19.isIdentifier(callee)) {
|
|
26014
26070
|
const callName = callee.getText();
|
|
26015
26071
|
spreadCalls.push(callName);
|
|
26016
26072
|
if (!index.functionsByName.has(callName)) {
|
|
@@ -26021,9 +26077,9 @@ function extractTemplateConfigsArrayFactory(sources, index) {
|
|
|
26021
26077
|
continue;
|
|
26022
26078
|
}
|
|
26023
26079
|
const inner = unwrapAsExpressions(el);
|
|
26024
|
-
if (inner &&
|
|
26080
|
+
if (inner && Node19.isCallExpression(inner)) {
|
|
26025
26081
|
const callee = inner.getExpression();
|
|
26026
|
-
if (
|
|
26082
|
+
if (Node19.isIdentifier(callee)) {
|
|
26027
26083
|
directCalls.push(callee.getText());
|
|
26028
26084
|
}
|
|
26029
26085
|
}
|
|
@@ -26072,11 +26128,11 @@ function collectFromArrayEntryFactory(name, out, index) {
|
|
|
26072
26128
|
const arr = asArrayLiteral(returnExpr);
|
|
26073
26129
|
if (!arr) return;
|
|
26074
26130
|
for (const el of arr.getElements()) {
|
|
26075
|
-
if (
|
|
26131
|
+
if (Node19.isSpreadElement(el)) {
|
|
26076
26132
|
const inner2 = el.getExpression();
|
|
26077
|
-
if (
|
|
26133
|
+
if (Node19.isCallExpression(inner2)) {
|
|
26078
26134
|
const callee = inner2.getExpression();
|
|
26079
|
-
if (
|
|
26135
|
+
if (Node19.isIdentifier(callee)) {
|
|
26080
26136
|
collectFromArrayEntryFactory(callee.getText(), out, index);
|
|
26081
26137
|
}
|
|
26082
26138
|
}
|
|
@@ -26084,9 +26140,9 @@ function collectFromArrayEntryFactory(name, out, index) {
|
|
|
26084
26140
|
}
|
|
26085
26141
|
const inner = unwrapAsExpressions(el);
|
|
26086
26142
|
if (!inner) continue;
|
|
26087
|
-
if (
|
|
26143
|
+
if (Node19.isCallExpression(inner)) {
|
|
26088
26144
|
const callee = inner.getExpression();
|
|
26089
|
-
if (
|
|
26145
|
+
if (Node19.isIdentifier(callee)) {
|
|
26090
26146
|
collectFromSingleEntryFactory(callee.getText(), out, index);
|
|
26091
26147
|
}
|
|
26092
26148
|
continue;
|
|
@@ -26106,7 +26162,7 @@ function extractTaskServiceCalls(sources, index, trustedExternal) {
|
|
|
26106
26162
|
const rel = apiRelPath(sf);
|
|
26107
26163
|
for (const call of sf.getDescendantsOfKind(SyntaxKind11.CallExpression)) {
|
|
26108
26164
|
const expr = call.getExpression();
|
|
26109
|
-
if (!
|
|
26165
|
+
if (!Node19.isIdentifier(expr) || expr.getText() !== TASK_SERVICE_FACTORY) continue;
|
|
26110
26166
|
const args = call.getArguments();
|
|
26111
26167
|
const first = args[0] ? asObjectLiteral(args[0]) : void 0;
|
|
26112
26168
|
if (!first) continue;
|
|
@@ -26132,13 +26188,13 @@ function collectValidateArrayElements(validateArr) {
|
|
|
26132
26188
|
const spreads = [];
|
|
26133
26189
|
if (!validateArr) return { ids, spreads };
|
|
26134
26190
|
for (const el of validateArr.getElements()) {
|
|
26135
|
-
if (
|
|
26191
|
+
if (Node19.isSpreadElement(el)) {
|
|
26136
26192
|
const inner2 = el.getExpression();
|
|
26137
|
-
if (
|
|
26193
|
+
if (Node19.isIdentifier(inner2)) spreads.push(inner2.getText());
|
|
26138
26194
|
continue;
|
|
26139
26195
|
}
|
|
26140
26196
|
const inner = unwrapAsExpressions(el);
|
|
26141
|
-
if (inner &&
|
|
26197
|
+
if (inner && Node19.isIdentifier(inner)) ids.push(inner.getText());
|
|
26142
26198
|
}
|
|
26143
26199
|
return { ids, spreads };
|
|
26144
26200
|
}
|
|
@@ -26151,17 +26207,17 @@ function collectHandlersArrayElements(options) {
|
|
|
26151
26207
|
if (!handlersArr) return { handlerTypes, unresolvedSpreads, resolvedBindings, unresolvedBindings };
|
|
26152
26208
|
const visited = /* @__PURE__ */ new Set();
|
|
26153
26209
|
for (const el of handlersArr.getElements()) {
|
|
26154
|
-
if (
|
|
26210
|
+
if (Node19.isSpreadElement(el)) {
|
|
26155
26211
|
consumeHandlersSpreadElement({ inner: el.getExpression(), sf, index, trustedExternal, unresolvedSpreads, resolvedBindings, unresolvedBindings, visited });
|
|
26156
26212
|
continue;
|
|
26157
26213
|
}
|
|
26158
26214
|
const inner = unwrapAsExpressions(el);
|
|
26159
26215
|
if (!inner) continue;
|
|
26160
|
-
if (
|
|
26216
|
+
if (Node19.isIdentifier(inner)) {
|
|
26161
26217
|
collectHandlerBindingsFromIdentifier({ name: inner.getText(), sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26162
|
-
} else if (
|
|
26218
|
+
} else if (Node19.isCallExpression(inner)) {
|
|
26163
26219
|
const callee = inner.getExpression();
|
|
26164
|
-
if (
|
|
26220
|
+
if (Node19.isIdentifier(callee)) {
|
|
26165
26221
|
collectHandlerBindingsFromIdentifier({ name: callee.getText(), sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26166
26222
|
}
|
|
26167
26223
|
}
|
|
@@ -26170,16 +26226,16 @@ function collectHandlersArrayElements(options) {
|
|
|
26170
26226
|
}
|
|
26171
26227
|
function consumeHandlersSpreadElement(options) {
|
|
26172
26228
|
const { inner, sf, index, trustedExternal, unresolvedSpreads, resolvedBindings, unresolvedBindings, visited } = options;
|
|
26173
|
-
if (
|
|
26229
|
+
if (Node19.isCallExpression(inner)) {
|
|
26174
26230
|
const callee = inner.getExpression();
|
|
26175
|
-
if (
|
|
26231
|
+
if (Node19.isIdentifier(callee)) {
|
|
26176
26232
|
const name = callee.getText();
|
|
26177
26233
|
unresolvedSpreads.push(name);
|
|
26178
26234
|
collectHandlerBindingsFromIdentifier({ name, sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
26179
26235
|
}
|
|
26180
26236
|
return;
|
|
26181
26237
|
}
|
|
26182
|
-
if (
|
|
26238
|
+
if (Node19.isIdentifier(inner)) {
|
|
26183
26239
|
const name = inner.getText();
|
|
26184
26240
|
unresolvedSpreads.push(name);
|
|
26185
26241
|
collectHandlerBindingsFromIdentifier({ name, sf, index, trustedExternal, resolved: resolvedBindings, unresolved: unresolvedBindings, visited });
|
|
@@ -26189,13 +26245,13 @@ function collectHandlerBindingsFromValue(options) {
|
|
|
26189
26245
|
const { node, sf, index, trustedExternal, resolved, unresolved, visited } = options;
|
|
26190
26246
|
const inner = unwrapAsExpressions(node);
|
|
26191
26247
|
if (!inner) return false;
|
|
26192
|
-
if (
|
|
26248
|
+
if (Node19.isCallExpression(inner)) {
|
|
26193
26249
|
const callee = inner.getExpression();
|
|
26194
|
-
if (
|
|
26250
|
+
if (Node19.isIdentifier(callee)) {
|
|
26195
26251
|
return collectHandlerBindingsFromIdentifier({ name: callee.getText(), sf, index, trustedExternal, resolved, unresolved, visited });
|
|
26196
26252
|
}
|
|
26197
26253
|
}
|
|
26198
|
-
if (
|
|
26254
|
+
if (Node19.isIdentifier(inner)) {
|
|
26199
26255
|
return collectHandlerBindingsFromIdentifier({ name: inner.getText(), sf, index, trustedExternal, resolved, unresolved, visited });
|
|
26200
26256
|
}
|
|
26201
26257
|
return false;
|
|
@@ -26212,7 +26268,7 @@ function collectHandlerBindingsFromIdentifier(options) {
|
|
|
26212
26268
|
const typeText = typeNode ? typeNode.getText() : void 0;
|
|
26213
26269
|
const isHandlerConfigTyped = typeText !== void 0 && (typeText === NOTIF_TASK_SERVICE_HANDLER_CONFIG || typeText.startsWith(`${NOTIF_TASK_SERVICE_HANDLER_CONFIG}<`));
|
|
26214
26270
|
const declInit = unwrapAsExpressions(localDecl.getInitializer());
|
|
26215
|
-
const isObjectLit = declInit !== void 0 &&
|
|
26271
|
+
const isObjectLit = declInit !== void 0 && Node19.isObjectLiteralExpression(declInit);
|
|
26216
26272
|
if (isHandlerConfigTyped && isObjectLit) {
|
|
26217
26273
|
resolved.push(localDecl.getName());
|
|
26218
26274
|
resolvedAny = true;
|
|
@@ -26243,12 +26299,12 @@ function collectHandlerBindingsFromIdentifier(options) {
|
|
|
26243
26299
|
function resolveArrayFromProperty2(obj, name, sf) {
|
|
26244
26300
|
const init = unwrapAsExpressions(getPropertyInitializer(obj, name));
|
|
26245
26301
|
if (!init) return void 0;
|
|
26246
|
-
if (
|
|
26247
|
-
if (
|
|
26302
|
+
if (Node19.isArrayLiteralExpression(init)) return init;
|
|
26303
|
+
if (Node19.isIdentifier(init)) {
|
|
26248
26304
|
const declNode = findLocalVariable(sf, init.getText());
|
|
26249
26305
|
if (declNode) {
|
|
26250
26306
|
const declInit = unwrapAsExpressions(declNode.getInitializer());
|
|
26251
|
-
if (declInit &&
|
|
26307
|
+
if (declInit && Node19.isArrayLiteralExpression(declInit)) {
|
|
26252
26308
|
return declInit;
|
|
26253
26309
|
}
|
|
26254
26310
|
}
|
|
@@ -26269,12 +26325,12 @@ function extractTaskHandlerEntries(sources) {
|
|
|
26269
26325
|
if (!typeIdent) return;
|
|
26270
26326
|
const flowInit = unwrapAsExpressions(getPropertyInitializer(obj, "flow"));
|
|
26271
26327
|
let flowCount;
|
|
26272
|
-
if (flowInit &&
|
|
26328
|
+
if (flowInit && Node19.isArrayLiteralExpression(flowInit)) {
|
|
26273
26329
|
flowCount = flowInit.getElements().length;
|
|
26274
26330
|
}
|
|
26275
26331
|
let dataArg;
|
|
26276
26332
|
let checkpointArg;
|
|
26277
|
-
if (
|
|
26333
|
+
if (Node19.isTypeReference(typeNode)) {
|
|
26278
26334
|
const tArgs = typeNode.getTypeArguments();
|
|
26279
26335
|
if (tArgs.length >= 1) dataArg = tArgs[0].getText();
|
|
26280
26336
|
if (tArgs.length >= 2) checkpointArg = tArgs[1].getText();
|
|
@@ -27167,7 +27223,7 @@ async function inspectFolder2(path) {
|
|
|
27167
27223
|
}
|
|
27168
27224
|
|
|
27169
27225
|
// packages/dbx-components-mcp/src/tools/system-m-validate-folder/extract.ts
|
|
27170
|
-
import { Node as
|
|
27226
|
+
import { Node as Node20, Project as Project13 } from "ts-morph";
|
|
27171
27227
|
var TYPE_CONSTANT_SUFFIX = "_SYSTEM_STATE_TYPE";
|
|
27172
27228
|
var DATA_INTERFACE_SUFFIX = "SystemData";
|
|
27173
27229
|
var CONVERTER_CONFIG_TYPE = "SystemStateStoredDataFieldConverterConfig";
|
|
@@ -27231,7 +27287,7 @@ function findDataInterfaces2(sourceFile) {
|
|
|
27231
27287
|
return out;
|
|
27232
27288
|
}
|
|
27233
27289
|
function extendsSystemStateStoredData(iface) {
|
|
27234
|
-
if (!
|
|
27290
|
+
if (!Node20.isInterfaceDeclaration(iface)) return false;
|
|
27235
27291
|
for (const clause of iface.getExtends()) {
|
|
27236
27292
|
const text = clause.getText();
|
|
27237
27293
|
if (text === SYSTEM_STATE_STORED_DATA || text.startsWith(`${SYSTEM_STATE_STORED_DATA}<`) || text === `${SYSTEM_STATE_STORED_DATA}, ${SYSTEM_STATE_STORED_DATA}`) {
|
|
@@ -27251,14 +27307,14 @@ function findConverters2(sourceFile) {
|
|
|
27251
27307
|
for (const decl of stmt.getDeclarations()) {
|
|
27252
27308
|
const typeNode = decl.getTypeNode();
|
|
27253
27309
|
if (!typeNode) continue;
|
|
27254
|
-
if (!
|
|
27310
|
+
if (!Node20.isTypeReference(typeNode)) continue;
|
|
27255
27311
|
const typeName = typeNode.getTypeName().getText();
|
|
27256
27312
|
if (typeName !== CONVERTER_CONFIG_TYPE) continue;
|
|
27257
27313
|
const typeArgs = typeNode.getTypeArguments();
|
|
27258
27314
|
let dataTypeArgument;
|
|
27259
27315
|
if (typeArgs.length >= 1) {
|
|
27260
27316
|
const arg = typeArgs[0];
|
|
27261
|
-
if (
|
|
27317
|
+
if (Node20.isTypeReference(arg)) {
|
|
27262
27318
|
dataTypeArgument = arg.getTypeName().getText();
|
|
27263
27319
|
} else {
|
|
27264
27320
|
dataTypeArgument = arg.getText();
|
|
@@ -27305,19 +27361,19 @@ function collectConverterMapKeys(decl) {
|
|
|
27305
27361
|
if (!obj) return [];
|
|
27306
27362
|
const out = [];
|
|
27307
27363
|
for (const prop of obj.getProperties()) {
|
|
27308
|
-
if (!
|
|
27364
|
+
if (!Node20.isPropertyAssignment(prop)) continue;
|
|
27309
27365
|
const nameNode = prop.getNameNode();
|
|
27310
27366
|
const line = prop.getStartLineNumber();
|
|
27311
|
-
if (
|
|
27367
|
+
if (Node20.isComputedPropertyName(nameNode)) {
|
|
27312
27368
|
const inner = nameNode.getExpression();
|
|
27313
27369
|
out.push({ raw: inner.getText(), kind: "identifier", line });
|
|
27314
27370
|
continue;
|
|
27315
27371
|
}
|
|
27316
|
-
if (
|
|
27372
|
+
if (Node20.isStringLiteral(nameNode)) {
|
|
27317
27373
|
out.push({ raw: nameNode.getLiteralText(), kind: "string", line });
|
|
27318
27374
|
continue;
|
|
27319
27375
|
}
|
|
27320
|
-
if (
|
|
27376
|
+
if (Node20.isIdentifier(nameNode)) {
|
|
27321
27377
|
out.push({ raw: nameNode.getText(), kind: "string", line });
|
|
27322
27378
|
continue;
|
|
27323
27379
|
}
|
|
@@ -27327,10 +27383,10 @@ function collectConverterMapKeys(decl) {
|
|
|
27327
27383
|
}
|
|
27328
27384
|
function unwrapObjectLiteral(node) {
|
|
27329
27385
|
let current = node;
|
|
27330
|
-
while (current &&
|
|
27386
|
+
while (current && Node20.isAsExpression(current)) {
|
|
27331
27387
|
current = current.getExpression();
|
|
27332
27388
|
}
|
|
27333
|
-
if (current &&
|
|
27389
|
+
if (current && Node20.isObjectLiteralExpression(current)) {
|
|
27334
27390
|
return current;
|
|
27335
27391
|
}
|
|
27336
27392
|
return void 0;
|
|
@@ -27364,10 +27420,10 @@ function findLastTopLevelExportLine(sourceFile) {
|
|
|
27364
27420
|
return last;
|
|
27365
27421
|
}
|
|
27366
27422
|
function isExportedTopLevel(stmt) {
|
|
27367
|
-
if (
|
|
27423
|
+
if (Node20.isVariableStatement(stmt) || Node20.isFunctionDeclaration(stmt) || Node20.isClassDeclaration(stmt) || Node20.isInterfaceDeclaration(stmt) || Node20.isTypeAliasDeclaration(stmt) || Node20.isEnumDeclaration(stmt)) {
|
|
27368
27424
|
return stmt.isExported();
|
|
27369
27425
|
}
|
|
27370
|
-
if (
|
|
27426
|
+
if (Node20.isExportDeclaration(stmt) || Node20.isExportAssignment(stmt)) {
|
|
27371
27427
|
return true;
|
|
27372
27428
|
}
|
|
27373
27429
|
return false;
|
|
@@ -27678,7 +27734,7 @@ var systemMValidateFolderTool = createFolderValidateTool({
|
|
|
27678
27734
|
});
|
|
27679
27735
|
|
|
27680
27736
|
// packages/dbx-components-mcp/src/tools/dbx-asset-validate-app/extract.ts
|
|
27681
|
-
import { Node as
|
|
27737
|
+
import { Node as Node21, Project as Project14 } from "ts-morph";
|
|
27682
27738
|
var ASSETS_RELPATH = "src/lib/assets.ts";
|
|
27683
27739
|
var BARREL_RELPATH = "src/lib/index.ts";
|
|
27684
27740
|
var LOCAL_ASSET_BUILDER = "localAsset";
|
|
@@ -27737,11 +27793,11 @@ function extractFromAssetsSource(ctx, sf) {
|
|
|
27737
27793
|
const initializer = unwrapAsExpressions(decl.getInitializer());
|
|
27738
27794
|
if (!initializer) continue;
|
|
27739
27795
|
const site = { isExported, symbolName: decl.getName(), line: decl.getStartLineNumber(), rel };
|
|
27740
|
-
if (
|
|
27796
|
+
if (Node21.isCallExpression(initializer)) {
|
|
27741
27797
|
handleCallInitializer(ctx, site, initializer);
|
|
27742
27798
|
continue;
|
|
27743
27799
|
}
|
|
27744
|
-
if (isExported &&
|
|
27800
|
+
if (isExported && Node21.isArrayLiteralExpression(initializer) && typeAnnotationText(decl) === ASSET_PATH_REF_ARRAY_TYPE) {
|
|
27745
27801
|
ctx.aggregatorExports.push({ symbolName: site.symbolName, memberNames: collectArrayIdentifiers(initializer.getElements()), sourceFile: rel, line: site.line });
|
|
27746
27802
|
}
|
|
27747
27803
|
}
|
|
@@ -27751,7 +27807,7 @@ function collectArrayIdentifiers(elements) {
|
|
|
27751
27807
|
const out = [];
|
|
27752
27808
|
for (const el of elements) {
|
|
27753
27809
|
const inner = unwrapAsExpressions(el);
|
|
27754
|
-
if (inner &&
|
|
27810
|
+
if (inner && Node21.isIdentifier(inner)) {
|
|
27755
27811
|
out.push(inner.getText());
|
|
27756
27812
|
}
|
|
27757
27813
|
}
|
|
@@ -27759,11 +27815,11 @@ function collectArrayIdentifiers(elements) {
|
|
|
27759
27815
|
}
|
|
27760
27816
|
function handleCallInitializer(ctx, site, callExpr) {
|
|
27761
27817
|
const callee = callExpr.getExpression();
|
|
27762
|
-
if (
|
|
27818
|
+
if (Node21.isIdentifier(callee)) {
|
|
27763
27819
|
handleIdentifierCallee({ ctx, site, callExpr, calleeName: callee.getText() });
|
|
27764
27820
|
return;
|
|
27765
27821
|
}
|
|
27766
|
-
if (
|
|
27822
|
+
if (Node21.isPropertyAccessExpression(callee)) {
|
|
27767
27823
|
handleFluentMemberCall(ctx, site, callExpr);
|
|
27768
27824
|
}
|
|
27769
27825
|
}
|
|
@@ -27821,9 +27877,9 @@ function handleRemoteBaseBuilder(ctx, site, arg) {
|
|
|
27821
27877
|
}
|
|
27822
27878
|
function handleFluentMemberCall(ctx, site, callExpr) {
|
|
27823
27879
|
const callee = callExpr.getExpression();
|
|
27824
|
-
if (!
|
|
27880
|
+
if (!Node21.isPropertyAccessExpression(callee)) return;
|
|
27825
27881
|
const identNode = callee.getExpression();
|
|
27826
|
-
if (!
|
|
27882
|
+
if (!Node21.isIdentifier(identNode)) return;
|
|
27827
27883
|
const memberName = callee.getName();
|
|
27828
27884
|
if (memberName !== "asset" && memberName !== "assets") return;
|
|
27829
27885
|
const builderName = identNode.getText();
|
|
@@ -27848,7 +27904,7 @@ function handleFluentMemberCall(ctx, site, callExpr) {
|
|
|
27848
27904
|
return;
|
|
27849
27905
|
}
|
|
27850
27906
|
const arrayInner = unwrapAsExpressions(args[0]);
|
|
27851
|
-
if (!arrayInner || !
|
|
27907
|
+
if (!arrayInner || !Node21.isArrayLiteralExpression(arrayInner)) return;
|
|
27852
27908
|
const resolvedPaths = collectFluentArrayPaths({ elements: arrayInner.getElements(), sourceType, folder, remoteBase });
|
|
27853
27909
|
if (site.isExported) {
|
|
27854
27910
|
ctx.assetConstants.push({ symbolName: site.symbolName, sourceType, helper, resolved: void 0, resolvedPaths, sourceFile: site.rel, line: site.line });
|
|
@@ -27858,7 +27914,7 @@ function collectFluentArrayPaths(input) {
|
|
|
27858
27914
|
const out = [];
|
|
27859
27915
|
for (const el of input.elements) {
|
|
27860
27916
|
const inner = unwrapAsExpressions(el);
|
|
27861
|
-
if (inner &&
|
|
27917
|
+
if (inner && Node21.isStringLiteral(inner)) {
|
|
27862
27918
|
const joined = joinFluent({ sourceType: input.sourceType, folder: input.folder, remoteBase: input.remoteBase, child: inner.getLiteralText() });
|
|
27863
27919
|
if (joined !== void 0) out.push(joined);
|
|
27864
27920
|
}
|
|
@@ -27891,7 +27947,7 @@ function readStringArg(call) {
|
|
|
27891
27947
|
}
|
|
27892
27948
|
function readStringArgFromNode(node) {
|
|
27893
27949
|
const inner = unwrapAsExpressions(node);
|
|
27894
|
-
if (inner &&
|
|
27950
|
+
if (inner && Node21.isStringLiteral(inner)) {
|
|
27895
27951
|
return inner.getLiteralText();
|
|
27896
27952
|
}
|
|
27897
27953
|
return void 0;
|
|
@@ -29260,6 +29316,83 @@ export class EditProfilePageComponent {
|
|
|
29260
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."
|
|
29261
29317
|
};
|
|
29262
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
|
+
|
|
29263
29396
|
// packages/dbx-components-mcp/src/tools/data/patterns/actions/action.provide-context-up.pattern.ts
|
|
29264
29397
|
var ACTION_PATTERN_PROVIDE_CONTEXT_UP = {
|
|
29265
29398
|
slug: "provide-context-up",
|
|
@@ -29369,7 +29502,7 @@ export class TagEditorComponent {
|
|
|
29369
29502
|
};
|
|
29370
29503
|
|
|
29371
29504
|
// packages/dbx-components-mcp/src/tools/data/patterns/action-patterns.ts
|
|
29372
|
-
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];
|
|
29373
29506
|
function getActionExamplePattern(slug) {
|
|
29374
29507
|
const lowered = slug.trim().toLowerCase();
|
|
29375
29508
|
return ACTION_EXAMPLE_PATTERNS.find((p) => p.slug === lowered);
|
|
@@ -29729,7 +29862,7 @@ import { glob as fsGlob5, readFile as readFile18, stat as stat14 } from "node:fs
|
|
|
29729
29862
|
import { dirname as dirname13, isAbsolute as isAbsolute13, resolve as resolve34, sep as sep12 } from "node:path";
|
|
29730
29863
|
|
|
29731
29864
|
// packages/dbx-components-mcp/src/tools/route/extract.ts
|
|
29732
|
-
import { Node as
|
|
29865
|
+
import { Node as Node22, Project as Project15, SyntaxKind as SyntaxKind12 } from "ts-morph";
|
|
29733
29866
|
function extractFile3(source) {
|
|
29734
29867
|
const project = new Project15({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
29735
29868
|
const sourceFile = project.createSourceFile(source.name, source.text, { overwrite: true });
|
|
@@ -29744,9 +29877,9 @@ function extractFile3(source) {
|
|
|
29744
29877
|
}
|
|
29745
29878
|
for (const arrayLit of findStateArrayLiterals(sourceFile)) {
|
|
29746
29879
|
for (const element of arrayLit.getElements()) {
|
|
29747
|
-
if (
|
|
29880
|
+
if (Node22.isObjectLiteralExpression(element)) {
|
|
29748
29881
|
addNode({ file: source.name, literal: element, fallbackConstName: void 0, into: collected, issues });
|
|
29749
|
-
} else if (
|
|
29882
|
+
} else if (Node22.isIdentifier(element)) {
|
|
29750
29883
|
const ref = objectLiteralsByName.get(element.getText());
|
|
29751
29884
|
if (ref) {
|
|
29752
29885
|
addNode({ file: source.name, literal: ref.literal, fallbackConstName: element.getText(), into: collected, issues });
|
|
@@ -29767,7 +29900,7 @@ function collectStateConsts(sourceFile) {
|
|
|
29767
29900
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
29768
29901
|
for (const decl of stmt.getDeclarations()) {
|
|
29769
29902
|
const initializer = decl.getInitializer();
|
|
29770
|
-
if (!initializer || !
|
|
29903
|
+
if (!initializer || !Node22.isObjectLiteralExpression(initializer)) {
|
|
29771
29904
|
continue;
|
|
29772
29905
|
}
|
|
29773
29906
|
const typeNode = decl.getTypeNode();
|
|
@@ -29782,7 +29915,7 @@ function findStateArrayLiterals(sourceFile) {
|
|
|
29782
29915
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
29783
29916
|
for (const decl of stmt.getDeclarations()) {
|
|
29784
29917
|
const initializer = decl.getInitializer();
|
|
29785
|
-
if (initializer &&
|
|
29918
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer) && declarationIsStateArray(stmt, decl.getName(), initializer)) {
|
|
29786
29919
|
arrays.push(initializer);
|
|
29787
29920
|
}
|
|
29788
29921
|
}
|
|
@@ -29796,17 +29929,17 @@ function findStateArrayLiterals(sourceFile) {
|
|
|
29796
29929
|
continue;
|
|
29797
29930
|
}
|
|
29798
29931
|
for (const arg of call.getArguments()) {
|
|
29799
|
-
if (!
|
|
29932
|
+
if (!Node22.isObjectLiteralExpression(arg)) {
|
|
29800
29933
|
continue;
|
|
29801
29934
|
}
|
|
29802
29935
|
const statesProp = arg.getProperty("states");
|
|
29803
|
-
if (!statesProp || !
|
|
29936
|
+
if (!statesProp || !Node22.isPropertyAssignment(statesProp)) {
|
|
29804
29937
|
continue;
|
|
29805
29938
|
}
|
|
29806
29939
|
const initializer = statesProp.getInitializer();
|
|
29807
|
-
if (initializer &&
|
|
29940
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer)) {
|
|
29808
29941
|
arrays.push(initializer);
|
|
29809
|
-
} else if (initializer &&
|
|
29942
|
+
} else if (initializer && Node22.isIdentifier(initializer)) {
|
|
29810
29943
|
const referenced = findArrayLiteralForIdentifier(sourceFile, initializer);
|
|
29811
29944
|
if (referenced) {
|
|
29812
29945
|
arrays.push(referenced);
|
|
@@ -29823,10 +29956,10 @@ function declarationIsStateArray(stmt, name, literal) {
|
|
|
29823
29956
|
return true;
|
|
29824
29957
|
}
|
|
29825
29958
|
for (const element of literal.getElements()) {
|
|
29826
|
-
if (
|
|
29959
|
+
if (Node22.isObjectLiteralExpression(element) && hasStringNameProperty(element)) {
|
|
29827
29960
|
return true;
|
|
29828
29961
|
}
|
|
29829
|
-
if (
|
|
29962
|
+
if (Node22.isIdentifier(element)) {
|
|
29830
29963
|
return true;
|
|
29831
29964
|
}
|
|
29832
29965
|
}
|
|
@@ -29834,11 +29967,11 @@ function declarationIsStateArray(stmt, name, literal) {
|
|
|
29834
29967
|
}
|
|
29835
29968
|
function hasStringNameProperty(literal) {
|
|
29836
29969
|
const nameProp = literal.getProperty("name");
|
|
29837
|
-
if (!nameProp || !
|
|
29970
|
+
if (!nameProp || !Node22.isPropertyAssignment(nameProp)) {
|
|
29838
29971
|
return false;
|
|
29839
29972
|
}
|
|
29840
29973
|
const initializer = nameProp.getInitializer();
|
|
29841
|
-
return initializer !== void 0 && (
|
|
29974
|
+
return initializer !== void 0 && (Node22.isStringLiteral(initializer) || Node22.isNoSubstitutionTemplateLiteral(initializer));
|
|
29842
29975
|
}
|
|
29843
29976
|
function findArrayLiteralForIdentifier(sourceFile, identifier) {
|
|
29844
29977
|
const name = identifier.getText();
|
|
@@ -29848,7 +29981,7 @@ function findArrayLiteralForIdentifier(sourceFile, identifier) {
|
|
|
29848
29981
|
continue;
|
|
29849
29982
|
}
|
|
29850
29983
|
const initializer = decl.getInitializer();
|
|
29851
|
-
if (initializer &&
|
|
29984
|
+
if (initializer && Node22.isArrayLiteralExpression(initializer)) {
|
|
29852
29985
|
return initializer;
|
|
29853
29986
|
}
|
|
29854
29987
|
}
|
|
@@ -29898,21 +30031,21 @@ function addNode(options) {
|
|
|
29898
30031
|
}
|
|
29899
30032
|
function stringPropertyValue(literal, key) {
|
|
29900
30033
|
const prop = literal.getProperty(key);
|
|
29901
|
-
if (!prop || !
|
|
30034
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29902
30035
|
return void 0;
|
|
29903
30036
|
}
|
|
29904
30037
|
const initializer = prop.getInitializer();
|
|
29905
30038
|
if (!initializer) {
|
|
29906
30039
|
return void 0;
|
|
29907
30040
|
}
|
|
29908
|
-
if (
|
|
30041
|
+
if (Node22.isStringLiteral(initializer) || Node22.isNoSubstitutionTemplateLiteral(initializer)) {
|
|
29909
30042
|
return initializer.getLiteralText();
|
|
29910
30043
|
}
|
|
29911
30044
|
return void 0;
|
|
29912
30045
|
}
|
|
29913
30046
|
function booleanPropertyValue(literal, key) {
|
|
29914
30047
|
const prop = literal.getProperty(key);
|
|
29915
|
-
if (!prop || !
|
|
30048
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29916
30049
|
return void 0;
|
|
29917
30050
|
}
|
|
29918
30051
|
const initializer = prop.getInitializer();
|
|
@@ -29929,33 +30062,33 @@ function booleanPropertyValue(literal, key) {
|
|
|
29929
30062
|
}
|
|
29930
30063
|
function identifierPropertyValue(literal, key) {
|
|
29931
30064
|
const prop = literal.getProperty(key);
|
|
29932
|
-
if (!prop || !
|
|
30065
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29933
30066
|
return void 0;
|
|
29934
30067
|
}
|
|
29935
30068
|
const initializer = prop.getInitializer();
|
|
29936
30069
|
if (!initializer) {
|
|
29937
30070
|
return void 0;
|
|
29938
30071
|
}
|
|
29939
|
-
if (
|
|
30072
|
+
if (Node22.isIdentifier(initializer)) {
|
|
29940
30073
|
return initializer.getText();
|
|
29941
30074
|
}
|
|
29942
|
-
if (
|
|
30075
|
+
if (Node22.isPropertyAccessExpression(initializer)) {
|
|
29943
30076
|
return initializer.getText();
|
|
29944
30077
|
}
|
|
29945
30078
|
return void 0;
|
|
29946
30079
|
}
|
|
29947
30080
|
function objectPropertyKeys(literal, key) {
|
|
29948
30081
|
const prop = literal.getProperty(key);
|
|
29949
|
-
if (!prop || !
|
|
30082
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29950
30083
|
return [];
|
|
29951
30084
|
}
|
|
29952
30085
|
const initializer = prop.getInitializer();
|
|
29953
|
-
if (!initializer || !
|
|
30086
|
+
if (!initializer || !Node22.isObjectLiteralExpression(initializer)) {
|
|
29954
30087
|
return [];
|
|
29955
30088
|
}
|
|
29956
30089
|
const out = [];
|
|
29957
30090
|
for (const member of initializer.getProperties()) {
|
|
29958
|
-
if (
|
|
30091
|
+
if (Node22.isPropertyAssignment(member) || Node22.isShorthandPropertyAssignment(member) || Node22.isMethodDeclaration(member)) {
|
|
29959
30092
|
const nameNode = member.getNameNode();
|
|
29960
30093
|
if (nameNode) {
|
|
29961
30094
|
out.push(nameNode.getText());
|
|
@@ -29966,7 +30099,7 @@ function objectPropertyKeys(literal, key) {
|
|
|
29966
30099
|
}
|
|
29967
30100
|
function collectResolveKeys(literal) {
|
|
29968
30101
|
const prop = literal.getProperty("resolve");
|
|
29969
|
-
if (!prop || !
|
|
30102
|
+
if (!prop || !Node22.isPropertyAssignment(prop)) {
|
|
29970
30103
|
return [];
|
|
29971
30104
|
}
|
|
29972
30105
|
const initializer = prop.getInitializer();
|
|
@@ -29974,22 +30107,22 @@ function collectResolveKeys(literal) {
|
|
|
29974
30107
|
return [];
|
|
29975
30108
|
}
|
|
29976
30109
|
const keys = [];
|
|
29977
|
-
if (
|
|
30110
|
+
if (Node22.isObjectLiteralExpression(initializer)) {
|
|
29978
30111
|
for (const member of initializer.getProperties()) {
|
|
29979
|
-
if (
|
|
30112
|
+
if (Node22.isPropertyAssignment(member) || Node22.isShorthandPropertyAssignment(member) || Node22.isMethodDeclaration(member)) {
|
|
29980
30113
|
const nameNode = member.getNameNode();
|
|
29981
30114
|
if (nameNode) {
|
|
29982
30115
|
keys.push(nameNode.getText());
|
|
29983
30116
|
}
|
|
29984
30117
|
}
|
|
29985
30118
|
}
|
|
29986
|
-
} else if (
|
|
30119
|
+
} else if (Node22.isArrayLiteralExpression(initializer)) {
|
|
29987
30120
|
for (const element of initializer.getElements()) {
|
|
29988
|
-
if (
|
|
30121
|
+
if (Node22.isObjectLiteralExpression(element)) {
|
|
29989
30122
|
const tokenProp = element.getProperty("token");
|
|
29990
|
-
if (tokenProp &&
|
|
30123
|
+
if (tokenProp && Node22.isPropertyAssignment(tokenProp)) {
|
|
29991
30124
|
const tokenInit = tokenProp.getInitializer();
|
|
29992
|
-
if (tokenInit && (
|
|
30125
|
+
if (tokenInit && (Node22.isStringLiteral(tokenInit) || Node22.isIdentifier(tokenInit))) {
|
|
29993
30126
|
keys.push(tokenInit.getText().replaceAll(/^['"]|['"]$/g, ""));
|
|
29994
30127
|
}
|
|
29995
30128
|
}
|
|
@@ -32058,7 +32191,7 @@ function createSearchModelSnapshotFieldTool(config) {
|
|
|
32058
32191
|
import { glob, readFile as readFile19 } from "node:fs/promises";
|
|
32059
32192
|
import { resolve as resolve35 } from "node:path";
|
|
32060
32193
|
import { type as type59 } from "arktype";
|
|
32061
|
-
import { Node as
|
|
32194
|
+
import { Node as Node23, Project as Project16 } from "ts-morph";
|
|
32062
32195
|
var ListAppArgsType2 = type59({
|
|
32063
32196
|
componentDir: "string",
|
|
32064
32197
|
"apiDir?": "string",
|
|
@@ -32188,7 +32321,7 @@ async function buildListAppReport(input) {
|
|
|
32188
32321
|
function findSnapshotConverterCalls(sourceFile) {
|
|
32189
32322
|
const out = [];
|
|
32190
32323
|
sourceFile.forEachDescendant((node) => {
|
|
32191
|
-
if (
|
|
32324
|
+
if (Node23.isCallExpression(node)) {
|
|
32192
32325
|
const expr = node.getExpression();
|
|
32193
32326
|
const exprText = expr.getText();
|
|
32194
32327
|
const head = exprText.replace(/<[^>]*>$/, "");
|
|
@@ -32203,17 +32336,17 @@ function readFieldsObject(call) {
|
|
|
32203
32336
|
const args = call.getArguments();
|
|
32204
32337
|
if (args.length === 0) return void 0;
|
|
32205
32338
|
const first = args[0];
|
|
32206
|
-
if (!
|
|
32339
|
+
if (!Node23.isObjectLiteralExpression(first)) return void 0;
|
|
32207
32340
|
const fieldsProp = first.getProperty("fields");
|
|
32208
|
-
if (fieldsProp === void 0 || !
|
|
32341
|
+
if (fieldsProp === void 0 || !Node23.isPropertyAssignment(fieldsProp)) return void 0;
|
|
32209
32342
|
const initializer = fieldsProp.getInitializer();
|
|
32210
|
-
if (initializer === void 0 || !
|
|
32343
|
+
if (initializer === void 0 || !Node23.isObjectLiteralExpression(initializer)) return void 0;
|
|
32211
32344
|
return initializer;
|
|
32212
32345
|
}
|
|
32213
32346
|
function resolveModelName(call) {
|
|
32214
32347
|
let current = call.getParent();
|
|
32215
32348
|
while (current !== void 0) {
|
|
32216
|
-
if (
|
|
32349
|
+
if (Node23.isVariableDeclaration(current)) {
|
|
32217
32350
|
return current.getName();
|
|
32218
32351
|
}
|
|
32219
32352
|
current = current.getParent();
|
|
@@ -32223,10 +32356,10 @@ function resolveModelName(call) {
|
|
|
32223
32356
|
function extractFieldUsages(fieldsObj, registry) {
|
|
32224
32357
|
const out = [];
|
|
32225
32358
|
for (const property of fieldsObj.getProperties()) {
|
|
32226
|
-
if (!
|
|
32359
|
+
if (!Node23.isPropertyAssignment(property) && !Node23.isShorthandPropertyAssignment(property)) continue;
|
|
32227
32360
|
const fieldName = property.getName();
|
|
32228
32361
|
let converterText;
|
|
32229
|
-
if (
|
|
32362
|
+
if (Node23.isShorthandPropertyAssignment(property)) {
|
|
32230
32363
|
converterText = property.getName();
|
|
32231
32364
|
} else {
|
|
32232
32365
|
const initializer = property.getInitializer();
|
|
@@ -33749,7 +33882,7 @@ import { type as type64 } from "arktype";
|
|
|
33749
33882
|
// packages/dbx-components-mcp/src/tools/model-list-component/extract.ts
|
|
33750
33883
|
import { readdir as readdir12, readFile as readFile20, stat as stat16 } from "node:fs/promises";
|
|
33751
33884
|
import { basename as basename6, join as join19, relative as relative11, sep as sep14 } from "node:path";
|
|
33752
|
-
import { Node as
|
|
33885
|
+
import { Node as Node24, Project as Project17 } from "ts-morph";
|
|
33753
33886
|
var MODEL_SUBPATH3 = "src/lib/model";
|
|
33754
33887
|
var MODEL_SUBPATH_PREFIX = `${MODEL_SUBPATH3}/`;
|
|
33755
33888
|
var RESERVED_NAMES = RESERVED_MODEL_FOLDERS.map((r) => r.name);
|
|
@@ -33890,7 +34023,7 @@ function findIdentityIn(sourceFile) {
|
|
|
33890
34023
|
for (const statement of sourceFile.getVariableStatements()) {
|
|
33891
34024
|
for (const decl of statement.getDeclarations()) {
|
|
33892
34025
|
const initializer = decl.getInitializer();
|
|
33893
|
-
if (!initializer || !
|
|
34026
|
+
if (!initializer || !Node24.isCallExpression(initializer)) continue;
|
|
33894
34027
|
if (initializer.getExpression().getText() !== "firestoreModelIdentity") continue;
|
|
33895
34028
|
const args = initializer.getArguments();
|
|
33896
34029
|
const parsed = parseIdentityArgs2(args);
|
|
@@ -33910,13 +34043,13 @@ function parseIdentityArgs2(args) {
|
|
|
33910
34043
|
return { parentIdentityRef: void 0, collectionName: stringLiteralValue3(args[0]), collectionPrefix: stringLiteralValue3(args[1]) };
|
|
33911
34044
|
}
|
|
33912
34045
|
if (args.length === 3) {
|
|
33913
|
-
const parent =
|
|
34046
|
+
const parent = Node24.isIdentifier(args[0]) ? args[0].getText() : void 0;
|
|
33914
34047
|
return { parentIdentityRef: parent, collectionName: stringLiteralValue3(args[1]), collectionPrefix: stringLiteralValue3(args[2]) };
|
|
33915
34048
|
}
|
|
33916
34049
|
return { parentIdentityRef: void 0, collectionName: void 0, collectionPrefix: void 0 };
|
|
33917
34050
|
}
|
|
33918
34051
|
function stringLiteralValue3(node) {
|
|
33919
|
-
if (
|
|
34052
|
+
if (Node24.isStringLiteral(node) || Node24.isNoSubstitutionTemplateLiteral(node)) {
|
|
33920
34053
|
return node.getLiteralText();
|
|
33921
34054
|
}
|
|
33922
34055
|
return void 0;
|
|
@@ -34078,7 +34211,7 @@ import { type as type65 } from "arktype";
|
|
|
34078
34211
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app/extract.ts
|
|
34079
34212
|
import { readdir as readdir13, readFile as readFile21, stat as stat17 } from "node:fs/promises";
|
|
34080
34213
|
import { dirname as dirname14, join as join20, relative as relative12, sep as sep15 } from "node:path";
|
|
34081
|
-
import { Node as
|
|
34214
|
+
import { Node as Node25, Project as Project18 } from "ts-morph";
|
|
34082
34215
|
var ACTION_SERVER_SUFFIX2 = ".action.server.ts";
|
|
34083
34216
|
var COMMON_MODEL_SUBPATH2 = "src/app/common/model";
|
|
34084
34217
|
var COMMON_BARREL_REL = "src/app/common/index.ts";
|
|
@@ -34215,7 +34348,7 @@ function inspectModuleText(input) {
|
|
|
34215
34348
|
for (const decorator of cls.getDecorators()) {
|
|
34216
34349
|
if (decorator.getName() !== "Module") continue;
|
|
34217
34350
|
const args = decorator.getArguments();
|
|
34218
|
-
if (args.length === 0 || !
|
|
34351
|
+
if (args.length === 0 || !Node25.isObjectLiteralExpression(args[0])) continue;
|
|
34219
34352
|
const obj = args[0];
|
|
34220
34353
|
providedByModule ||= moduleArrayContains(obj, "providers", input.className);
|
|
34221
34354
|
exportedByModule ||= moduleArrayContains(obj, "exports", input.className);
|
|
@@ -34225,16 +34358,16 @@ function inspectModuleText(input) {
|
|
|
34225
34358
|
}
|
|
34226
34359
|
function moduleArrayContains(decoratorArg, propertyName, className) {
|
|
34227
34360
|
const property = decoratorArg.getProperty(propertyName);
|
|
34228
|
-
if (!property || !
|
|
34361
|
+
if (!property || !Node25.isPropertyAssignment(property)) return false;
|
|
34229
34362
|
const initializer = property.getInitializer();
|
|
34230
|
-
if (!initializer || !
|
|
34363
|
+
if (!initializer || !Node25.isArrayLiteralExpression(initializer)) return false;
|
|
34231
34364
|
for (const element of initializer.getElements()) {
|
|
34232
|
-
if (
|
|
34233
|
-
if (
|
|
34365
|
+
if (Node25.isIdentifier(element) && element.getText() === className) return true;
|
|
34366
|
+
if (Node25.isObjectLiteralExpression(element)) {
|
|
34234
34367
|
const provideProp = element.getProperty("provide");
|
|
34235
|
-
if (provideProp &&
|
|
34368
|
+
if (provideProp && Node25.isPropertyAssignment(provideProp)) {
|
|
34236
34369
|
const provideInit = provideProp.getInitializer();
|
|
34237
|
-
if (provideInit &&
|
|
34370
|
+
if (provideInit && Node25.isIdentifier(provideInit) && provideInit.getText() === className) return true;
|
|
34238
34371
|
}
|
|
34239
34372
|
}
|
|
34240
34373
|
}
|
|
@@ -34288,11 +34421,11 @@ function collectInterfaceGetters(sourceFile) {
|
|
|
34288
34421
|
const out = /* @__PURE__ */ new Map();
|
|
34289
34422
|
for (const iface of sourceFile.getInterfaces()) {
|
|
34290
34423
|
for (const member of iface.getMembers()) {
|
|
34291
|
-
if (
|
|
34424
|
+
if (Node25.isGetAccessorDeclaration(member)) {
|
|
34292
34425
|
out.set(member.getName(), iface.getName());
|
|
34293
34426
|
continue;
|
|
34294
34427
|
}
|
|
34295
|
-
if (
|
|
34428
|
+
if (Node25.isPropertySignature(member)) {
|
|
34296
34429
|
out.set(member.getName(), iface.getName());
|
|
34297
34430
|
}
|
|
34298
34431
|
}
|
|
@@ -34304,7 +34437,7 @@ function collectClassGetters(sourceFile) {
|
|
|
34304
34437
|
for (const cls of sourceFile.getClasses()) {
|
|
34305
34438
|
const set = /* @__PURE__ */ new Set();
|
|
34306
34439
|
for (const member of cls.getMembers()) {
|
|
34307
|
-
if (
|
|
34440
|
+
if (Node25.isGetAccessorDeclaration(member)) set.add(member.getName());
|
|
34308
34441
|
}
|
|
34309
34442
|
if (set.size > 0) out.set(cls.getName() ?? "<anon>", set);
|
|
34310
34443
|
}
|
|
@@ -34816,7 +34949,7 @@ import { resolve as resolve43 } from "node:path";
|
|
|
34816
34949
|
import { type as type67 } from "arktype";
|
|
34817
34950
|
|
|
34818
34951
|
// packages/dbx-components-mcp/src/scan/actions-extract.ts
|
|
34819
|
-
import { Node as
|
|
34952
|
+
import { Node as Node26, SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
34820
34953
|
var ACTION_MARKER = "dbxAction";
|
|
34821
34954
|
var ACTION_SLUG_TAG = "dbxActionSlug";
|
|
34822
34955
|
var ACTION_ROLE_TAG = "dbxActionRole";
|
|
@@ -35024,7 +35157,7 @@ function filterStates(values) {
|
|
|
35024
35157
|
}
|
|
35025
35158
|
function readEnumMemberLiteral(member) {
|
|
35026
35159
|
const initializer = member.getInitializer();
|
|
35027
|
-
if (initializer !== void 0 && (
|
|
35160
|
+
if (initializer !== void 0 && (Node26.isStringLiteral(initializer) || Node26.isNoSubstitutionTemplateLiteral(initializer))) {
|
|
35028
35161
|
return initializer.getLiteralText();
|
|
35029
35162
|
}
|
|
35030
35163
|
return member.getName();
|
|
@@ -35644,7 +35777,7 @@ import { resolve as resolve45 } from "node:path";
|
|
|
35644
35777
|
import { type as type71 } from "arktype";
|
|
35645
35778
|
|
|
35646
35779
|
// packages/dbx-components-mcp/src/scan/pipes-extract.ts
|
|
35647
|
-
import { Node as
|
|
35780
|
+
import { Node as Node27 } from "ts-morph";
|
|
35648
35781
|
var PIPE_MARKER = "dbxPipe";
|
|
35649
35782
|
var PIPE_SLUG_TAG = "dbxPipeSlug";
|
|
35650
35783
|
var PIPE_CATEGORY_TAG = "dbxPipeCategory";
|
|
@@ -35837,7 +35970,7 @@ function readPipeDecoratorConfig(decorator) {
|
|
|
35837
35970
|
return void 0;
|
|
35838
35971
|
}
|
|
35839
35972
|
const firstArg = args[0];
|
|
35840
|
-
if (!
|
|
35973
|
+
if (!Node27.isObjectLiteralExpression(firstArg)) {
|
|
35841
35974
|
return void 0;
|
|
35842
35975
|
}
|
|
35843
35976
|
const name = readStringProperty(firstArg, "name");
|
|
@@ -35850,7 +35983,7 @@ function readPipeDecoratorConfig(decorator) {
|
|
|
35850
35983
|
}
|
|
35851
35984
|
function readBooleanProperty(obj, propName) {
|
|
35852
35985
|
const prop = obj.getProperty(propName);
|
|
35853
|
-
if (prop === void 0 || !
|
|
35986
|
+
if (prop === void 0 || !Node27.isPropertyAssignment(prop)) {
|
|
35854
35987
|
return void 0;
|
|
35855
35988
|
}
|
|
35856
35989
|
const initializer = prop.getInitializer();
|