@lunora/advisor 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +1 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/index.d.mts +291 -3
- package/dist/index.d.ts +291 -3
- package/dist/index.mjs +14 -2
- package/dist/packem_shared/externalSourceOnGlobal-Bg-NfCX9.mjs +30 -0
- package/dist/packem_shared/externalSourceUnscoped-5vT-Bup3.mjs +44 -0
- package/dist/packem_shared/{fromServerSchema-DinF1nph.mjs → fromServerSchema-WVRvXPy8.mjs} +6 -0
- package/dist/packem_shared/mutatorFullRowReplace-BJnNDaIV.mjs +26 -0
- package/dist/packem_shared/r2sqlOutsideAction-CtqxvMuV.mjs +30 -0
- package/dist/packem_shared/shapeTargetsGlobalTable-DHrf4Koi.mjs +34 -0
- package/dist/packem_shared/shapeUnknownTable-C8aDWFoe.mjs +34 -0
- package/dist/packem_shared/workflowDuplicateStepName-ioBxPBCy.mjs +48 -0
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { e as emit } from './finding-Dm_zvzS1.mjs';
|
|
2
|
+
|
|
3
|
+
const shapeUnknownTable = {
|
|
4
|
+
categories: ["SCHEMA"],
|
|
5
|
+
description: "A `defineShape` is bound to a `table` name that does not exist in the schema. The shape can never resolve a rowset — its subscription seeds empty and errors at the first flush.",
|
|
6
|
+
facing: "INTERNAL",
|
|
7
|
+
level: "ERROR",
|
|
8
|
+
name: "shape_unknown_table",
|
|
9
|
+
remediation: "Fix the shape's `table` to a real table name (check for a typo or a table that was renamed/removed).",
|
|
10
|
+
run: (context) => {
|
|
11
|
+
if (context.shapes === void 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const knownTables = new Set(context.schema.tables.map((table) => table.name));
|
|
15
|
+
const findings = [];
|
|
16
|
+
for (const shape of context.shapes) {
|
|
17
|
+
if (shape.table === void 0 || knownTables.has(shape.table)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
findings.push(
|
|
21
|
+
emit(shapeUnknownTable, {
|
|
22
|
+
cacheKey: `shape_unknown_table:${shape.exportName}`,
|
|
23
|
+
detail: `Shape \`${shape.exportName}\` (${shape.file}) replicates from table \`${shape.table}\`, which is not declared in the schema. The shape can never resolve a rowset.`,
|
|
24
|
+
metadata: { exportName: shape.exportName, file: shape.file, table: shape.table }
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return findings;
|
|
29
|
+
},
|
|
30
|
+
source: "static",
|
|
31
|
+
title: "Shape bound to an unknown table"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { shapeUnknownTable as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { e as emit } from './finding-Dm_zvzS1.mjs';
|
|
2
|
+
|
|
3
|
+
const workflowDuplicateStepName = {
|
|
4
|
+
categories: ["SCHEMA"],
|
|
5
|
+
description: "Two durable steps in this workflow share a name. Cloudflare memoizes a step by its name, so on replay the second call returns the first step's cached result instead of running its body — silently skipping the work without an error.",
|
|
6
|
+
facing: "INTERNAL",
|
|
7
|
+
level: "ERROR",
|
|
8
|
+
// eslint-disable-next-line no-secrets/no-secrets -- the lint's rule id, not a credential
|
|
9
|
+
name: "workflow_duplicate_step_name",
|
|
10
|
+
remediation: "Give every `step.do` / `step.sleep` / `step.sleepUntil` / `step.waitForEvent` call in the workflow a unique name. If a step legitimately repeats (e.g. a loop), make the name distinct per iteration by interpolating the item id into the step name.",
|
|
11
|
+
run: (context) => {
|
|
12
|
+
if (context.workflows === void 0) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const findings = [];
|
|
16
|
+
for (const workflow of context.workflows) {
|
|
17
|
+
const { steps } = workflow;
|
|
18
|
+
if (steps === void 0 || steps.length === 0) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const firstLineByName = /* @__PURE__ */ new Map();
|
|
22
|
+
const reported = /* @__PURE__ */ new Set();
|
|
23
|
+
for (const step of steps) {
|
|
24
|
+
const firstLine = firstLineByName.get(step.name);
|
|
25
|
+
if (firstLine === void 0) {
|
|
26
|
+
firstLineByName.set(step.name, step.line);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (reported.has(step.name)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
reported.add(step.name);
|
|
33
|
+
findings.push(
|
|
34
|
+
emit(workflowDuplicateStepName, {
|
|
35
|
+
cacheKey: `workflow_duplicate_step_name:${workflow.exportName}:${step.name}`,
|
|
36
|
+
detail: `Workflow "${workflow.exportName}" reuses the durable step name "${step.name}" (first at line ${String(firstLine)}, again at line ${String(step.line)}). The second call returns the first's cached result instead of running.`,
|
|
37
|
+
metadata: { firstLine, line: step.line, stepName: step.name, workflow: workflow.exportName }
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return findings;
|
|
43
|
+
},
|
|
44
|
+
source: "static",
|
|
45
|
+
title: "Duplicate durable step name in workflow"
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { workflowDuplicateStepName as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/advisor",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"description": "Schema & query lints (splinter-style advisors) for Lunora, feeding the Studio Advisors view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"advisor",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"directory": "packages/advisor"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"dist",
|
|
28
|
+
"./dist",
|
|
29
29
|
"README.md",
|
|
30
30
|
"LICENSE.md",
|
|
31
31
|
"__assets__"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/server": "1.0.0-alpha.
|
|
49
|
+
"@lunora/server": "1.0.0-alpha.8"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": "^22.15.0 || >=24.11.0"
|