@dereekb/dbx-cli 14.1.0 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/index.esm.js +0 -195
- package/eslint/package.json +4 -3
- package/firebase-api-manifest/main.js +124 -13
- package/firebase-api-manifest/package.json +4 -3
- package/firestore-indexes/src/model-firebase-index-schema.d.ts +4 -4
- package/firestore-query-manifest/main.js +4 -3
- package/firestore-query-manifest/package.json +4 -3
- package/generate-firestore-indexes/main.js +3 -2
- package/generate-firestore-indexes/package.json +3 -2
- package/generate-mcp-manifest/package.json +4 -3
- package/generate-route-manifest/package.json +3 -2
- package/index.esm.js +4228 -1344
- package/lint-cache/package.json +3 -2
- package/manifest-extract/index.esm.js +113 -7
- package/manifest-extract/package.json +8 -8
- package/manifest-extract/src/lib/types.d.ts +10 -0
- package/model-test/package.json +2 -2
- package/package.json +6 -6
- package/route/package.json +7 -7
- package/src/lib/auth/index.d.ts +1 -0
- package/src/lib/auth/oidc.loopback.d.ts +127 -0
- package/src/lib/cache/cache.command.factory.d.ts +44 -0
- package/src/lib/cache/data-cache.codec.d.ts +36 -0
- package/src/lib/cache/data-cache.d.ts +272 -0
- package/src/lib/cache/data-cache.fingerprint.d.ts +109 -0
- package/src/lib/cache/data-cache.options.d.ts +98 -0
- package/src/lib/cache/index.d.ts +5 -0
- package/src/lib/config/env.d.ts +43 -7
- package/src/lib/config/env.resolve.d.ts +4 -3
- package/src/lib/config/paths.d.ts +11 -1
- package/src/lib/firestore/firestore-query.command.d.ts +25 -1
- package/src/lib/index.d.ts +1 -0
- package/src/lib/runner/run.d.ts +11 -0
- package/src/lib/util/browser.d.ts +23 -0
- package/src/lib/util/index.d.ts +1 -0
- package/src/lib/util/interactive.d.ts +10 -1
- package/test/package.json +10 -9
- package/validate/package.json +3 -3
package/eslint/index.esm.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'typescript';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Returns the JSDoc Block comment immediately preceding `anchor`, or `null` when
|
|
5
3
|
* the anchor has no JSDoc leader. Used by the `@dbx<Family>` companion-tag rules
|
|
@@ -36,199 +34,6 @@ import 'typescript';
|
|
|
36
34
|
return result;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
/**
|
|
40
|
-
* Default maximum positional parameters before the warn-level rule suggests a config object.
|
|
41
|
-
* Triggers a warning when a function has more than 2 positional parameters (i.e. 3+ args).
|
|
42
|
-
*/ var DEFAULT_MAX_PARAMS_WARN = 2;
|
|
43
|
-
/**
|
|
44
|
-
* Default maximum positional parameters before the hard-error rule rejects the signature.
|
|
45
|
-
* Triggers an error when a function has more than 4 positional parameters (i.e. 5+ args).
|
|
46
|
-
*/ var DEFAULT_MAX_PARAMS_HARD = 4;
|
|
47
|
-
/**
|
|
48
|
-
* Default JSDoc tag that opts a function out of this rule.
|
|
49
|
-
*/ var DEFAULT_ALLOW_JSDOC_TAG = '@dbxAllowMultiParams';
|
|
50
|
-
/**
|
|
51
|
-
* Returns a human-readable display name for the function-like node, or `<anonymous>`.
|
|
52
|
-
*
|
|
53
|
-
* @param node - The function-like AST node.
|
|
54
|
-
* @returns The identifier string used in diagnostic messages.
|
|
55
|
-
*/ function getFunctionDisplayName(node) {
|
|
56
|
-
var _node_id;
|
|
57
|
-
var name = '<anonymous>';
|
|
58
|
-
if (((_node_id = node.id) === null || _node_id === void 0 ? void 0 : _node_id.type) === 'Identifier') {
|
|
59
|
-
name = node.id.name;
|
|
60
|
-
} else if (node.parent) {
|
|
61
|
-
var _parent_id, _parent_key, _parent_key1, _parent_left;
|
|
62
|
-
var parent = node.parent;
|
|
63
|
-
if (parent.type === 'VariableDeclarator' && ((_parent_id = parent.id) === null || _parent_id === void 0 ? void 0 : _parent_id.type) === 'Identifier') {
|
|
64
|
-
name = parent.id.name;
|
|
65
|
-
} else if (parent.type === 'Property' && ((_parent_key = parent.key) === null || _parent_key === void 0 ? void 0 : _parent_key.type) === 'Identifier') {
|
|
66
|
-
name = parent.key.name;
|
|
67
|
-
} else if (parent.type === 'MethodDefinition' && ((_parent_key1 = parent.key) === null || _parent_key1 === void 0 ? void 0 : _parent_key1.type) === 'Identifier') {
|
|
68
|
-
name = parent.key.name;
|
|
69
|
-
} else if (parent.type === 'AssignmentExpression' && ((_parent_left = parent.left) === null || _parent_left === void 0 ? void 0 : _parent_left.type) === 'Identifier') {
|
|
70
|
-
name = parent.left.name;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return name;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Returns true if a parameter has any decorators (NestJS handler/Inject pattern).
|
|
77
|
-
*
|
|
78
|
-
* @param param - The parameter AST node.
|
|
79
|
-
* @returns True when the parameter carries at least one decorator.
|
|
80
|
-
*/ function paramHasDecorator(param) {
|
|
81
|
-
var _param_decorators;
|
|
82
|
-
var decorators = (_param_decorators = param.decorators) !== null && _param_decorators !== void 0 ? _param_decorators : [];
|
|
83
|
-
return Array.isArray(decorators) && decorators.length > 0;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Returns true when the function is the constructor of a class.
|
|
87
|
-
*
|
|
88
|
-
* @param node - The function-like AST node.
|
|
89
|
-
* @returns True if `node` is the `constructor` body of a class.
|
|
90
|
-
*/ function isConstructor(node) {
|
|
91
|
-
var _node_parent;
|
|
92
|
-
return ((_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.type) === 'MethodDefinition' && node.parent.kind === 'constructor';
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Returns true if any leading JSDoc block above `anchor` contains the allow tag.
|
|
96
|
-
*
|
|
97
|
-
* @param sourceCode - The ESLint `SourceCode` instance.
|
|
98
|
-
* @param anchor - The AST node whose leading comments are scanned.
|
|
99
|
-
* @param allowTag - The JSDoc tag string that opts the function out.
|
|
100
|
-
* @returns True when a JSDoc with the allow tag is present.
|
|
101
|
-
*/ function hasAllowJsdoc(sourceCode, anchor, allowTag) {
|
|
102
|
-
var comments = sourceCode.getCommentsBefore(anchor) || [];
|
|
103
|
-
var allow = false;
|
|
104
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
105
|
-
try {
|
|
106
|
-
for(var _iterator = comments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
107
|
-
var comment = _step.value;
|
|
108
|
-
if (comment.type === 'Block' && comment.value.startsWith('*') && comment.value.includes(allowTag)) {
|
|
109
|
-
allow = true;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
} catch (err) {
|
|
113
|
-
_didIteratorError = true;
|
|
114
|
-
_iteratorError = err;
|
|
115
|
-
} finally{
|
|
116
|
-
try {
|
|
117
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
118
|
-
_iterator.return();
|
|
119
|
-
}
|
|
120
|
-
} finally{
|
|
121
|
-
if (_didIteratorError) {
|
|
122
|
-
throw _iteratorError;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return allow;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Builds a prefer-config-object-style rule with a configurable default `maxParams` threshold.
|
|
130
|
-
* Class constructors and decorated parameters (e.g. NestJS `@Inject`) are exempted. Functions can
|
|
131
|
-
* opt out via a leading JSDoc block carrying the configured allow tag (default `@dbxAllowMultiParams`).
|
|
132
|
-
*
|
|
133
|
-
* @param config - Default threshold and rule description.
|
|
134
|
-
* @returns A complete ESLint rule definition that emits `tooManyParams` reports.
|
|
135
|
-
*/ function createPreferConfigObjectRule(config) {
|
|
136
|
-
return {
|
|
137
|
-
meta: {
|
|
138
|
-
type: 'suggestion',
|
|
139
|
-
docs: {
|
|
140
|
-
description: config.description,
|
|
141
|
-
recommended: true
|
|
142
|
-
},
|
|
143
|
-
messages: {
|
|
144
|
-
tooManyParams: "Function '{{name}}' takes {{count}} positional parameters; use a single config object instead (see dbx__note__typescript-programming → Prefer Single Config Object)."
|
|
145
|
-
},
|
|
146
|
-
schema: [
|
|
147
|
-
{
|
|
148
|
-
type: 'object',
|
|
149
|
-
properties: {
|
|
150
|
-
maxParams: {
|
|
151
|
-
type: 'number',
|
|
152
|
-
minimum: 0,
|
|
153
|
-
description: 'Maximum number of positional parameters before the rule fires.'
|
|
154
|
-
},
|
|
155
|
-
allowJsdocTag: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
description: 'JSDoc tag that opts a function out of this rule.'
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
additionalProperties: false
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
},
|
|
164
|
-
create: function create(context) {
|
|
165
|
-
var _context_options_, _options_maxParams, _options_allowJsdocTag;
|
|
166
|
-
var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
|
|
167
|
-
var maxParams = (_options_maxParams = options.maxParams) !== null && _options_maxParams !== void 0 ? _options_maxParams : config.defaultMaxParams;
|
|
168
|
-
var allowTag = (_options_allowJsdocTag = options.allowJsdocTag) !== null && _options_allowJsdocTag !== void 0 ? _options_allowJsdocTag : DEFAULT_ALLOW_JSDOC_TAG;
|
|
169
|
-
var sourceCode = context.sourceCode;
|
|
170
|
-
function checkFunction(node) {
|
|
171
|
-
if (!isConstructor(node)) {
|
|
172
|
-
var _node_params;
|
|
173
|
-
var params = (_node_params = node.params) !== null && _node_params !== void 0 ? _node_params : [];
|
|
174
|
-
// Decorated parameters indicate framework-driven signatures (NestJS handlers, Angular DI inside
|
|
175
|
-
// constructors which we already skip — but standalone decorated functions exist too).
|
|
176
|
-
if (!params.some(paramHasDecorator) && params.length > maxParams) {
|
|
177
|
-
var _node_parent, _node_parent_parent;
|
|
178
|
-
// Anchor for JSDoc lookup: prefer the enclosing export statement, then a VariableDeclaration
|
|
179
|
-
// (for `const fn = () => ...`), otherwise the function node itself.
|
|
180
|
-
var anchor = node;
|
|
181
|
-
if (((_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.type) === 'VariableDeclarator' && ((_node_parent_parent = node.parent.parent) === null || _node_parent_parent === void 0 ? void 0 : _node_parent_parent.type) === 'VariableDeclaration') {
|
|
182
|
-
anchor = node.parent.parent;
|
|
183
|
-
}
|
|
184
|
-
if (anchor.parent && (anchor.parent.type === 'ExportNamedDeclaration' || anchor.parent.type === 'ExportDefaultDeclaration')) {
|
|
185
|
-
anchor = anchor.parent;
|
|
186
|
-
}
|
|
187
|
-
if (!hasAllowJsdoc(sourceCode, anchor, allowTag)) {
|
|
188
|
-
var _node_id;
|
|
189
|
-
var name = getFunctionDisplayName(node);
|
|
190
|
-
context.report({
|
|
191
|
-
node: (_node_id = node.id) !== null && _node_id !== void 0 ? _node_id : node,
|
|
192
|
-
messageId: 'tooManyParams',
|
|
193
|
-
data: {
|
|
194
|
-
name: name,
|
|
195
|
-
count: String(params.length)
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
FunctionDeclaration: checkFunction,
|
|
204
|
-
FunctionExpression: checkFunction,
|
|
205
|
-
ArrowFunctionExpression: checkFunction
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* ESLint rule recommending a single config object when a function takes more than two positional
|
|
212
|
-
* parameters (default `maxParams: 2`, i.e. fires at 3+ args). Intended to be configured at the
|
|
213
|
-
* `warn` severity. Pair with `prefer-config-object-hard` for a stricter cap.
|
|
214
|
-
*
|
|
215
|
-
* @see `dbx__note__typescript-programming` → Prefer Single Config Object
|
|
216
|
-
*/ createPreferConfigObjectRule({
|
|
217
|
-
defaultMaxParams: DEFAULT_MAX_PARAMS_WARN,
|
|
218
|
-
description: 'Prefer a single config object when a function takes more than two positional parameters.'
|
|
219
|
-
});
|
|
220
|
-
/**
|
|
221
|
-
* Hard-stop variant of `prefer-config-object`. Fires when a function takes more than four positional
|
|
222
|
-
* parameters (default `maxParams: 4`, i.e. fires at 5+ args). Intended to be configured at the
|
|
223
|
-
* `error` severity so genuinely unwieldy signatures break the build even when the softer warn-level
|
|
224
|
-
* rule is disabled or downgraded.
|
|
225
|
-
*
|
|
226
|
-
* @see `dbx__note__typescript-programming` → Prefer Single Config Object
|
|
227
|
-
*/ createPreferConfigObjectRule({
|
|
228
|
-
defaultMaxParams: DEFAULT_MAX_PARAMS_HARD,
|
|
229
|
-
description: 'Reject function signatures with more than four positional parameters; require a single config object.'
|
|
230
|
-
});
|
|
231
|
-
|
|
232
37
|
function _array_like_to_array$1(arr, len) {
|
|
233
38
|
if (len == null || len > arr.length) len = arr.length;
|
|
234
39
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
package/eslint/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/eslint",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"type": "module",
|
|
5
6
|
"peerDependencies": {
|
|
6
|
-
"@dereekb/dbx-cli": "14.
|
|
7
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
8
|
+
"@dereekb/util": "14.3.0",
|
|
8
9
|
"@typescript-eslint/utils": "8.69.0",
|
|
9
10
|
"typescript": "6.0.3"
|
|
10
11
|
},
|
|
@@ -729,6 +729,9 @@ var MCP_TOOL_NAME_SEGMENT_TAG = "dbxModelMcpToolNameSegment";
|
|
|
729
729
|
var MODEL_TYPE_VALUE_PATTERN = /^[a-z][A-Za-z0-9_$]*$/;
|
|
730
730
|
var TOOL_NAME_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_$]*$/;
|
|
731
731
|
var IDENTITY_FN = "firestoreModelIdentity";
|
|
732
|
+
var IDENTITY_TYPE = "FirestoreModelIdentity";
|
|
733
|
+
var ROOT_IDENTITY_TYPE = "RootFirestoreModelIdentity";
|
|
734
|
+
var IDENTITY_WITH_PARENT_TYPE = "FirestoreModelIdentityWithParent";
|
|
732
735
|
var SINGLE_ITEM_COLLECTION_FN = "singleItemFirestoreCollection";
|
|
733
736
|
var ROOT_SINGLE_ITEM_COLLECTION_FN = "rootSingleItemFirestoreCollection";
|
|
734
737
|
var SINGLE_ITEM_COLLECTION_FN_NAMES = [SINGLE_ITEM_COLLECTION_FN, ROOT_SINGLE_ITEM_COLLECTION_FN];
|
|
@@ -760,16 +763,73 @@ function readIdentities(sourceFile) {
|
|
|
760
763
|
if (!statement.isExported()) continue;
|
|
761
764
|
for (const decl of statement.getDeclarations()) {
|
|
762
765
|
const initializer = decl.getInitializer();
|
|
763
|
-
if (
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
766
|
+
if (initializer && Node4.isCallExpression(initializer)) {
|
|
767
|
+
if (initializer.getExpression().getText() !== IDENTITY_FN) continue;
|
|
768
|
+
const parsed = parseFirestoreModelIdentityArgs(initializer.getArguments());
|
|
769
|
+
if (parsed) {
|
|
770
|
+
out.push({ identityConst: decl.getName(), ...parsed, parentModelType: void 0 });
|
|
771
|
+
}
|
|
772
|
+
} else {
|
|
773
|
+
const parsed = parseDeclaredIdentityType(decl.getTypeNode());
|
|
774
|
+
if (parsed) {
|
|
775
|
+
out.push({ identityConst: decl.getName(), ...parsed });
|
|
776
|
+
}
|
|
768
777
|
}
|
|
769
778
|
}
|
|
770
779
|
}
|
|
771
780
|
return out;
|
|
772
781
|
}
|
|
782
|
+
function parseDeclaredIdentityType(typeNode) {
|
|
783
|
+
let result;
|
|
784
|
+
const named = readNamedTypeNode(typeNode);
|
|
785
|
+
if (named) {
|
|
786
|
+
const { typeName, args } = named;
|
|
787
|
+
if (typeName === IDENTITY_WITH_PARENT_TYPE && args.length >= 3) {
|
|
788
|
+
const parent = parseDeclaredIdentityType(args[0]);
|
|
789
|
+
result = {
|
|
790
|
+
modelType: readLiteralTypeText(args[1]) ?? "",
|
|
791
|
+
collectionPrefix: readLiteralTypeText(args[2]),
|
|
792
|
+
parentIdentityConst: void 0,
|
|
793
|
+
parentModelType: parent?.modelType
|
|
794
|
+
};
|
|
795
|
+
} else if ((typeName === ROOT_IDENTITY_TYPE || typeName === IDENTITY_TYPE) && args.length >= 2) {
|
|
796
|
+
result = {
|
|
797
|
+
modelType: readLiteralTypeText(args[0]) ?? "",
|
|
798
|
+
collectionPrefix: readLiteralTypeText(args[1]),
|
|
799
|
+
parentIdentityConst: void 0,
|
|
800
|
+
parentModelType: void 0
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
if (result && !result.modelType) {
|
|
804
|
+
result = void 0;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
}
|
|
809
|
+
function readNamedTypeNode(typeNode) {
|
|
810
|
+
let result;
|
|
811
|
+
if (typeNode) {
|
|
812
|
+
if (Node4.isImportTypeNode(typeNode)) {
|
|
813
|
+
const qualifier = typeNode.getQualifier();
|
|
814
|
+
if (qualifier) {
|
|
815
|
+
result = { typeName: qualifier.getText().split(".").pop() ?? "", args: typeNode.getTypeArguments() };
|
|
816
|
+
}
|
|
817
|
+
} else if (Node4.isTypeReference(typeNode)) {
|
|
818
|
+
result = { typeName: typeNode.getTypeName().getText().split(".").pop() ?? "", args: typeNode.getTypeArguments() };
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return result;
|
|
822
|
+
}
|
|
823
|
+
function readLiteralTypeText(node) {
|
|
824
|
+
let result;
|
|
825
|
+
if (node && Node4.isLiteralTypeNode(node)) {
|
|
826
|
+
const literal = node.getLiteral();
|
|
827
|
+
if (Node4.isStringLiteral(literal)) {
|
|
828
|
+
result = literal.getLiteralText();
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return result;
|
|
832
|
+
}
|
|
773
833
|
function readInterfaces(sourceFile) {
|
|
774
834
|
const out = [];
|
|
775
835
|
for (const decl of sourceFile.getInterfaces()) {
|
|
@@ -1223,18 +1283,27 @@ function findModelFiles(packageRoot) {
|
|
|
1223
1283
|
const libRoot = join5(packageRoot, "src", "lib");
|
|
1224
1284
|
const out = [];
|
|
1225
1285
|
if (safeIsDirectory2(libRoot)) {
|
|
1286
|
+
const seenStems = /* @__PURE__ */ new Set();
|
|
1226
1287
|
for (const filePath of walkSourceFiles(libRoot)) {
|
|
1288
|
+
const stem = sourceFileStem(filePath);
|
|
1289
|
+
if (seenStems.has(stem)) continue;
|
|
1227
1290
|
const text = readFileSync6(filePath, "utf8");
|
|
1228
1291
|
if (!textHasModelMarker(text)) continue;
|
|
1229
1292
|
const extraction = extractModelsFromSource({ name: filePath, text });
|
|
1230
1293
|
if (!hasExtractedArtifact(extraction)) continue;
|
|
1294
|
+
seenStems.add(stem);
|
|
1231
1295
|
out.push({ filePath, extraction });
|
|
1232
1296
|
}
|
|
1233
1297
|
}
|
|
1234
1298
|
return out;
|
|
1235
1299
|
}
|
|
1300
|
+
function sourceFileStem(filePath) {
|
|
1301
|
+
return filePath.replace(/\.d\.ts$/, "").replace(/\.ts$/, "");
|
|
1302
|
+
}
|
|
1236
1303
|
function textHasModelMarker(text) {
|
|
1237
|
-
return text.includes("firestoreModelIdentity(") ||
|
|
1304
|
+
return text.includes("firestoreModelIdentity(") || // the declared-type form the call leaves behind in a .d.ts. One substring covers all three identity
|
|
1305
|
+
// types, since `RootFirestoreModelIdentity` and `FirestoreModelIdentityWithParent` both contain it.
|
|
1306
|
+
text.includes("FirestoreModelIdentity") || text.includes("@dbxModelGroup") || text.includes("snapshotConverterFunctions") || text.includes("firestoreSubObject") || text.includes("firestoreObjectArray") || text.includes("@dbxModelServiceFactory") || text.includes("singleItemFirestoreCollection") || text.includes("rootSingleItemFirestoreCollection") || text.includes("export enum ") || text.includes("export declare enum ");
|
|
1238
1307
|
}
|
|
1239
1308
|
function hasExtractedArtifact(extraction) {
|
|
1240
1309
|
return extraction.identities.length > 0 || extraction.modelGroups.length > 0 || extraction.converters.length > 0 || extraction.serviceFactories.length > 0 || extraction.singleItemCollections.length > 0 || extraction.enums.length > 0;
|
|
@@ -1252,7 +1321,7 @@ function* walkSourceFiles(dir) {
|
|
|
1252
1321
|
}
|
|
1253
1322
|
}
|
|
1254
1323
|
function isCandidateSourceFile(name) {
|
|
1255
|
-
return name.endsWith(".ts") && !name.endsWith(".api.ts") && !name.endsWith(".
|
|
1324
|
+
return name.endsWith(".ts") && !name.endsWith(".api.ts") && !name.endsWith(".api.d.ts") && !name.endsWith(".spec.ts") && !name.endsWith(".test.ts");
|
|
1256
1325
|
}
|
|
1257
1326
|
function safeIsDirectory2(p) {
|
|
1258
1327
|
let result;
|
|
@@ -1349,8 +1418,23 @@ function buildGlobalRegistries(extractions) {
|
|
|
1349
1418
|
}
|
|
1350
1419
|
}
|
|
1351
1420
|
}
|
|
1421
|
+
linkDeclaredParents(identityByConst);
|
|
1352
1422
|
return { converterRegistry, interfaceRegistry, groupByModelName, serviceFactoryByModelType, enumNames, singleItemByIdentityConst, identityByConst, stringConstants };
|
|
1353
1423
|
}
|
|
1424
|
+
function linkDeclaredParents(identityByConst) {
|
|
1425
|
+
const constByModelType = /* @__PURE__ */ new Map();
|
|
1426
|
+
for (const identity of identityByConst.values()) {
|
|
1427
|
+
if (!constByModelType.has(identity.modelType)) constByModelType.set(identity.modelType, identity.identityConst);
|
|
1428
|
+
}
|
|
1429
|
+
for (const [key, identity] of identityByConst) {
|
|
1430
|
+
if (identity.parentIdentityConst === void 0 && identity.parentModelType !== void 0) {
|
|
1431
|
+
const parentIdentityConst = constByModelType.get(identity.parentModelType);
|
|
1432
|
+
if (parentIdentityConst !== void 0) {
|
|
1433
|
+
identityByConst.set(key, { ...identity, parentIdentityConst });
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1354
1438
|
function registerConverters(converters, registry) {
|
|
1355
1439
|
for (const converter of converters) {
|
|
1356
1440
|
if (converter.converterConst && !registry.has(converter.converterConst)) {
|
|
@@ -1371,8 +1455,9 @@ function registerModelGroups(modelGroups, registry) {
|
|
|
1371
1455
|
}
|
|
1372
1456
|
}
|
|
1373
1457
|
function appendEntriesFromSource(source, registries, accumulator) {
|
|
1374
|
-
for (const
|
|
1375
|
-
if (accumulator.seen.has(
|
|
1458
|
+
for (const rawIdentity of source.extraction.identities) {
|
|
1459
|
+
if (accumulator.seen.has(rawIdentity.identityConst)) continue;
|
|
1460
|
+
const identity = registries.identityByConst.get(rawIdentity.identityConst) ?? rawIdentity;
|
|
1376
1461
|
const entry = buildEntryForIdentity({ identity, source, registries });
|
|
1377
1462
|
if (entry) {
|
|
1378
1463
|
accumulator.seen.add(identity.identityConst);
|
|
@@ -1388,8 +1473,9 @@ function buildEntryForIdentity(input) {
|
|
|
1388
1473
|
const iface = registries.interfaceRegistry.get(modelName);
|
|
1389
1474
|
if (iface?.hasDbxModelTag) {
|
|
1390
1475
|
const converter = findConverterForInterface(source.extraction, modelName) ?? findConverterFromRegistry(registries.converterRegistry, modelName);
|
|
1476
|
+
let fields;
|
|
1391
1477
|
if (converter) {
|
|
1392
|
-
|
|
1478
|
+
fields = buildFields({
|
|
1393
1479
|
converter,
|
|
1394
1480
|
iface,
|
|
1395
1481
|
interfaceRegistry: registries.interfaceRegistry,
|
|
@@ -1398,12 +1484,36 @@ function buildEntryForIdentity(input) {
|
|
|
1398
1484
|
depth: 0,
|
|
1399
1485
|
visitedConverters: /* @__PURE__ */ new Set()
|
|
1400
1486
|
});
|
|
1487
|
+
} else if (isDeclarationSource(source.sourceFile)) {
|
|
1488
|
+
fields = buildFieldsFromInterface(iface, registries.interfaceRegistry);
|
|
1489
|
+
}
|
|
1490
|
+
if (fields) {
|
|
1401
1491
|
result = buildManifestEntry({ identity, modelName, collectionPrefix: identity.collectionPrefix, iface, fields, source, registries });
|
|
1402
1492
|
}
|
|
1403
1493
|
}
|
|
1404
1494
|
}
|
|
1405
1495
|
return result;
|
|
1406
1496
|
}
|
|
1497
|
+
function isDeclarationSource(sourceFile) {
|
|
1498
|
+
return sourceFile.endsWith(".d.ts");
|
|
1499
|
+
}
|
|
1500
|
+
function buildFieldsFromInterface(iface, interfaceRegistry) {
|
|
1501
|
+
const propByName = /* @__PURE__ */ new Map();
|
|
1502
|
+
for (const prop of iface.props) propByName.set(prop.name, prop);
|
|
1503
|
+
for (const ancestor of collectAncestors(iface, interfaceRegistry)) {
|
|
1504
|
+
for (const prop of ancestor.props) {
|
|
1505
|
+
if (!propByName.has(prop.name)) propByName.set(prop.name, prop);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return Array.from(propByName.values(), (prop) => ({
|
|
1509
|
+
name: prop.name,
|
|
1510
|
+
longName: resolveLongName(prop.name, prop.longName),
|
|
1511
|
+
...prop.tsType ? { tsType: prop.tsType } : {},
|
|
1512
|
+
optional: prop.optional,
|
|
1513
|
+
...prop.description ? { description: prop.description } : {},
|
|
1514
|
+
...prop.syncFlag ? { syncFlag: prop.syncFlag } : {}
|
|
1515
|
+
}));
|
|
1516
|
+
}
|
|
1407
1517
|
function buildManifestEntry(input) {
|
|
1408
1518
|
const { identity, modelName, collectionPrefix, iface, fields, source, registries } = input;
|
|
1409
1519
|
const modelGroup = registries.groupByModelName.get(modelName);
|
|
@@ -1750,15 +1860,16 @@ function renderModelField(field, emitConverters) {
|
|
|
1750
1860
|
// packages/dbx-cli/firebase-api-manifest/package.json
|
|
1751
1861
|
var package_default = {
|
|
1752
1862
|
name: "@dereekb/dbx-cli-firebase-api-manifest",
|
|
1753
|
-
version: "14.
|
|
1863
|
+
version: "14.3.0",
|
|
1864
|
+
sideEffects: false,
|
|
1754
1865
|
private: true,
|
|
1755
1866
|
type: "module",
|
|
1756
1867
|
devDependencies: {
|
|
1757
1868
|
"ts-morph": "^28.0.0"
|
|
1758
1869
|
},
|
|
1759
1870
|
peerDependencies: {
|
|
1760
|
-
"@dereekb/dbx-cli": "14.
|
|
1761
|
-
"@dereekb/util": "14.
|
|
1871
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
1872
|
+
"@dereekb/util": "14.3.0",
|
|
1762
1873
|
oxfmt: "^0.66.0"
|
|
1763
1874
|
}
|
|
1764
1875
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-firebase-api-manifest",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"private": true,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"devDependencies": {
|
|
7
8
|
"ts-morph": "^28.0.0"
|
|
8
9
|
},
|
|
9
10
|
"peerDependencies": {
|
|
10
|
-
"@dereekb/dbx-cli": "14.
|
|
11
|
-
"@dereekb/util": "14.
|
|
11
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
12
|
+
"@dereekb/util": "14.3.0",
|
|
12
13
|
"oxfmt": "^0.66.0"
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -100,7 +100,7 @@ export type FirestoreWhereOperator = (typeof FIRESTORE_WHERE_OPERATORS)[number];
|
|
|
100
100
|
export declare const ConstraintSequenceEntry: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
101
101
|
kind: "where" | "orderBy";
|
|
102
102
|
fieldPath: string;
|
|
103
|
-
operator?: "
|
|
103
|
+
operator?: "<" | ">" | ">=" | "<=" | "==" | "in" | "!=" | "not-in" | "array-contains" | "array-contains-any" | undefined;
|
|
104
104
|
direction?: "asc" | "desc" | undefined;
|
|
105
105
|
fromHelper?: string | undefined;
|
|
106
106
|
}, {}>;
|
|
@@ -118,7 +118,7 @@ export declare const ConstraintSequence: import("arktype/internal/variants/objec
|
|
|
118
118
|
entries: {
|
|
119
119
|
kind: "where" | "orderBy";
|
|
120
120
|
fieldPath: string;
|
|
121
|
-
operator?: "
|
|
121
|
+
operator?: "<" | ">" | ">=" | "<=" | "==" | "in" | "!=" | "not-in" | "array-contains" | "array-contains-any" | undefined;
|
|
122
122
|
direction?: "asc" | "desc" | undefined;
|
|
123
123
|
fromHelper?: string | undefined;
|
|
124
124
|
}[];
|
|
@@ -248,7 +248,7 @@ export declare const ModelFirebaseIndexEntry: import("arktype/internal/variants/
|
|
|
248
248
|
entries: {
|
|
249
249
|
kind: "where" | "orderBy";
|
|
250
250
|
fieldPath: string;
|
|
251
|
-
operator?: "
|
|
251
|
+
operator?: "<" | ">" | ">=" | "<=" | "==" | "in" | "!=" | "not-in" | "array-contains" | "array-contains-any" | undefined;
|
|
252
252
|
direction?: "asc" | "desc" | undefined;
|
|
253
253
|
fromHelper?: string | undefined;
|
|
254
254
|
}[];
|
|
@@ -326,7 +326,7 @@ export declare const ModelFirebaseIndexManifest: import("arktype/internal/varian
|
|
|
326
326
|
entries: {
|
|
327
327
|
kind: "where" | "orderBy";
|
|
328
328
|
fieldPath: string;
|
|
329
|
-
operator?: "
|
|
329
|
+
operator?: "<" | ">" | ">=" | "<=" | "==" | "in" | "!=" | "not-in" | "array-contains" | "array-contains-any" | undefined;
|
|
330
330
|
direction?: "asc" | "desc" | undefined;
|
|
331
331
|
fromHelper?: string | undefined;
|
|
332
332
|
}[];
|
|
@@ -9,15 +9,16 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve3 }
|
|
|
9
9
|
// packages/dbx-cli/firestore-query-manifest/package.json
|
|
10
10
|
var package_default = {
|
|
11
11
|
name: "@dereekb/dbx-cli-firestore-query-manifest",
|
|
12
|
-
version: "14.
|
|
12
|
+
version: "14.3.0",
|
|
13
|
+
sideEffects: false,
|
|
13
14
|
private: true,
|
|
14
15
|
type: "module",
|
|
15
16
|
devDependencies: {
|
|
16
17
|
eslint: "10.9.1"
|
|
17
18
|
},
|
|
18
19
|
peerDependencies: {
|
|
19
|
-
"@dereekb/dbx-cli": "14.
|
|
20
|
-
"@dereekb/util": "14.
|
|
20
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
21
|
+
"@dereekb/util": "14.3.0"
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-firestore-query-manifest",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"private": true,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"devDependencies": {
|
|
7
8
|
"eslint": "10.9.1"
|
|
8
9
|
},
|
|
9
10
|
"peerDependencies": {
|
|
10
|
-
"@dereekb/dbx-cli": "14.
|
|
11
|
-
"@dereekb/util": "14.
|
|
11
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
12
|
+
"@dereekb/util": "14.3.0"
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -5,14 +5,15 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
// packages/dbx-cli/generate-firestore-indexes/package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@dereekb/dbx-cli-generate-firestore-indexes",
|
|
8
|
-
version: "14.
|
|
8
|
+
version: "14.3.0",
|
|
9
|
+
sideEffects: false,
|
|
9
10
|
private: true,
|
|
10
11
|
type: "module",
|
|
11
12
|
devDependencies: {
|
|
12
13
|
eslint: "10.9.1"
|
|
13
14
|
},
|
|
14
15
|
peerDependencies: {
|
|
15
|
-
"@dereekb/dbx-cli": "14.
|
|
16
|
+
"@dereekb/dbx-cli": "14.3.0"
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-generate-firestore-indexes",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"private": true,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"devDependencies": {
|
|
7
8
|
"eslint": "10.9.1"
|
|
8
9
|
},
|
|
9
10
|
"peerDependencies": {
|
|
10
|
-
"@dereekb/dbx-cli": "14.
|
|
11
|
+
"@dereekb/dbx-cli": "14.3.0"
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-generate-mcp-manifest",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"private": true,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/dbx-cli": "14.
|
|
8
|
-
"@dereekb/model": "14.
|
|
8
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
9
|
+
"@dereekb/model": "14.3.0",
|
|
9
10
|
"arktype": "^2.2.0",
|
|
10
11
|
"jiti": "2.7.0"
|
|
11
12
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-generate-route-manifest",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"private": true,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/dbx-cli": "14.
|
|
8
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
8
9
|
"ts-morph": "^28.0.0"
|
|
9
10
|
}
|
|
10
11
|
}
|