@ontrails/warden 1.0.0-beta.12 → 1.0.0-beta.13
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/CHANGELOG.md +51 -31
- package/README.md +17 -17
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -10
- package/dist/cli.js.map +1 -1
- package/dist/drift.d.ts +6 -6
- package/dist/drift.d.ts.map +1 -1
- package/dist/drift.js +8 -8
- package/dist/drift.js.map +1 -1
- package/dist/formatters.js +2 -2
- package/dist/formatters.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/rules/ast.d.ts +15 -11
- package/dist/rules/ast.d.ts.map +1 -1
- package/dist/rules/ast.js +34 -30
- package/dist/rules/ast.js.map +1 -1
- package/dist/rules/context-no-trailhead-types.d.ts +12 -0
- package/dist/rules/context-no-trailhead-types.d.ts.map +1 -0
- package/dist/rules/context-no-trailhead-types.js +96 -0
- package/dist/rules/context-no-trailhead-types.js.map +1 -0
- package/dist/rules/cross-declarations.d.ts +13 -0
- package/dist/rules/cross-declarations.d.ts.map +1 -0
- package/dist/rules/cross-declarations.js +264 -0
- package/dist/rules/cross-declarations.js.map +1 -0
- package/dist/rules/follow-declarations.d.ts +1 -1
- package/dist/rules/follow-declarations.js +5 -5
- package/dist/rules/follow-declarations.js.map +1 -1
- package/dist/rules/implementation-returns-result.d.ts +2 -2
- package/dist/rules/implementation-returns-result.js +6 -6
- package/dist/rules/implementation-returns-result.js.map +1 -1
- package/dist/rules/index.d.ts +4 -4
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +12 -12
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/no-direct-impl-in-route.d.ts +4 -4
- package/dist/rules/no-direct-impl-in-route.js +14 -14
- package/dist/rules/no-direct-impl-in-route.js.map +1 -1
- package/dist/rules/no-direct-implementation-call.d.ts +3 -3
- package/dist/rules/no-direct-implementation-call.js +7 -7
- package/dist/rules/no-direct-implementation-call.js.map +1 -1
- package/dist/rules/no-sync-result-assumption.d.ts +1 -1
- package/dist/rules/no-sync-result-assumption.js +5 -5
- package/dist/rules/no-sync-result-assumption.js.map +1 -1
- package/dist/rules/no-throw-in-detour-target.js +2 -2
- package/dist/rules/no-throw-in-detour-target.js.map +1 -1
- package/dist/rules/no-throw-in-implementation.d.ts +1 -1
- package/dist/rules/no-throw-in-implementation.js +3 -3
- package/dist/rules/no-throw-in-implementation.js.map +1 -1
- package/dist/rules/provision-declarations.d.ts +14 -0
- package/dist/rules/provision-declarations.d.ts.map +1 -0
- package/dist/rules/provision-declarations.js +344 -0
- package/dist/rules/provision-declarations.js.map +1 -0
- package/dist/rules/provision-exists.d.ts +6 -0
- package/dist/rules/provision-exists.d.ts.map +1 -0
- package/dist/rules/provision-exists.js +89 -0
- package/dist/rules/provision-exists.js.map +1 -0
- package/dist/rules/service-declarations.d.ts +7 -5
- package/dist/rules/service-declarations.d.ts.map +1 -1
- package/dist/rules/service-declarations.js +106 -103
- package/dist/rules/service-declarations.js.map +1 -1
- package/dist/rules/service-exists.d.ts +3 -1
- package/dist/rules/service-exists.d.ts.map +1 -1
- package/dist/rules/service-exists.js +35 -33
- package/dist/rules/service-exists.js.map +1 -1
- package/dist/rules/specs.d.ts +1 -1
- package/dist/rules/specs.d.ts.map +1 -1
- package/dist/rules/specs.js +1 -1
- package/dist/rules/specs.js.map +1 -1
- package/dist/rules/types.d.ts +2 -2
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/trails/context-no-surface-types.trail.js +1 -1
- package/dist/trails/context-no-trailhead-types.trail.d.ts +13 -0
- package/dist/trails/context-no-trailhead-types.trail.d.ts.map +1 -0
- package/dist/trails/context-no-trailhead-types.trail.js +21 -0
- package/dist/trails/context-no-trailhead-types.trail.js.map +1 -0
- package/dist/trails/cross-declarations.trail.d.ts +13 -0
- package/dist/trails/cross-declarations.trail.d.ts.map +1 -0
- package/dist/trails/cross-declarations.trail.js +22 -0
- package/dist/trails/cross-declarations.trail.js.map +1 -0
- package/dist/trails/follow-declarations.trail.js +1 -1
- package/dist/trails/implementation-returns-result.trail.js +1 -1
- package/dist/trails/index.d.ts +4 -4
- package/dist/trails/index.d.ts.map +1 -1
- package/dist/trails/index.js +4 -4
- package/dist/trails/index.js.map +1 -1
- package/dist/trails/no-direct-impl-in-route.trail.js +4 -4
- package/dist/trails/no-direct-impl-in-route.trail.js.map +1 -1
- package/dist/trails/no-direct-implementation-call.trail.js +2 -2
- package/dist/trails/no-direct-implementation-call.trail.js.map +1 -1
- package/dist/trails/no-sync-result-assumption.trail.js +2 -2
- package/dist/trails/no-sync-result-assumption.trail.js.map +1 -1
- package/dist/trails/no-throw-in-detour-target.trail.d.ts +1 -1
- package/dist/trails/no-throw-in-detour-target.trail.js +1 -1
- package/dist/trails/no-throw-in-implementation.trail.js +1 -1
- package/dist/trails/prefer-schema-inference.trail.js +1 -1
- package/dist/trails/provision-declarations.trail.d.ts +13 -0
- package/dist/trails/provision-declarations.trail.d.ts.map +1 -0
- package/dist/trails/provision-declarations.trail.js +25 -0
- package/dist/trails/provision-declarations.trail.js.map +1 -0
- package/dist/trails/provision-exists.trail.d.ts +15 -0
- package/dist/trails/provision-exists.trail.d.ts.map +1 -0
- package/dist/trails/provision-exists.trail.js +27 -0
- package/dist/trails/provision-exists.trail.js.map +1 -0
- package/dist/trails/run.d.ts +2 -2
- package/dist/trails/run.d.ts.map +1 -1
- package/dist/trails/run.js +6 -6
- package/dist/trails/run.js.map +1 -1
- package/dist/trails/schema.d.ts +1 -1
- package/dist/trails/schema.js +2 -2
- package/dist/trails/schema.js.map +1 -1
- package/dist/trails/service-declarations.trail.d.ts +13 -0
- package/dist/trails/service-declarations.trail.d.ts.map +1 -1
- package/dist/trails/service-declarations.trail.js +9 -7
- package/dist/trails/service-declarations.trail.js.map +1 -1
- package/dist/trails/service-exists.trail.d.ts +17 -0
- package/dist/trails/service-exists.trail.d.ts.map +1 -1
- package/dist/trails/service-exists.trail.js +10 -8
- package/dist/trails/service-exists.trail.js.map +1 -1
- package/dist/trails/valid-describe-refs.trail.d.ts +1 -1
- package/dist/trails/valid-detour-refs.trail.d.ts +1 -1
- package/dist/trails/valid-detour-refs.trail.js +2 -2
- package/dist/trails/wrap-rule.js +14 -14
- package/dist/trails/wrap-rule.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/cli.test.ts +8 -8
- package/src/__tests__/{follow-declarations.test.ts → cross-declarations.test.ts} +78 -78
- package/src/__tests__/drift.test.ts +5 -5
- package/src/__tests__/formatters.test.ts +2 -2
- package/src/__tests__/implementation-returns-result.test.ts +11 -11
- package/src/__tests__/no-direct-implementation-call.test.ts +10 -10
- package/src/__tests__/no-sync-result-assumption.test.ts +6 -6
- package/src/__tests__/no-throw-in-detour-target.test.ts +6 -6
- package/src/__tests__/prefer-schema-inference.test.ts +4 -4
- package/src/__tests__/provision-declarations.test.ts +318 -0
- package/src/__tests__/provision-exists.test.ts +122 -0
- package/src/__tests__/rules.test.ts +38 -38
- package/src/__tests__/valid-describe-refs.test.ts +4 -4
- package/src/__tests__/wrap-rule.test.ts +4 -4
- package/src/cli.ts +17 -13
- package/src/drift.ts +12 -12
- package/src/formatters.ts +2 -2
- package/src/index.ts +8 -8
- package/src/rules/ast.ts +36 -31
- package/src/rules/{context-no-surface-types.ts → context-no-trailhead-types.ts} +8 -8
- package/src/rules/{follow-declarations.ts → cross-declarations.ts} +63 -56
- package/src/rules/implementation-returns-result.ts +6 -6
- package/src/rules/index.ts +12 -12
- package/src/rules/no-direct-impl-in-route.ts +17 -17
- package/src/rules/no-direct-implementation-call.ts +7 -7
- package/src/rules/no-sync-result-assumption.ts +5 -5
- package/src/rules/no-throw-in-detour-target.ts +2 -2
- package/src/rules/no-throw-in-implementation.ts +3 -3
- package/src/rules/{service-declarations.ts → provision-declarations.ts} +145 -129
- package/src/rules/{service-exists.ts → provision-exists.ts} +51 -46
- package/src/rules/specs.ts +4 -4
- package/src/rules/types.ts +2 -2
- package/src/trails/{context-no-surface-types.trail.ts → context-no-trailhead-types.trail.ts} +5 -5
- package/src/trails/cross-declarations.trail.ts +22 -0
- package/src/trails/implementation-returns-result.trail.ts +1 -1
- package/src/trails/index.ts +4 -4
- package/src/trails/no-direct-impl-in-route.trail.ts +4 -4
- package/src/trails/no-direct-implementation-call.trail.ts +2 -2
- package/src/trails/no-sync-result-assumption.trail.ts +2 -2
- package/src/trails/no-throw-in-detour-target.trail.ts +1 -1
- package/src/trails/no-throw-in-implementation.trail.ts +1 -1
- package/src/trails/prefer-schema-inference.trail.ts +1 -1
- package/src/trails/provision-declarations.trail.ts +25 -0
- package/src/trails/provision-exists.trail.ts +27 -0
- package/src/trails/run.ts +7 -7
- package/src/trails/schema.ts +2 -2
- package/src/trails/valid-detour-refs.trail.ts +2 -2
- package/src/trails/wrap-rule.ts +17 -17
- package/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/service-declarations.test.ts +0 -318
- package/src/__tests__/service-exists.test.ts +0 -122
- package/src/trails/follow-declarations.trail.ts +0 -22
- package/src/trails/service-declarations.trail.ts +0 -25
- package/src/trails/service-exists.trail.ts +0 -27
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { provisionExists } from '../rules/provision-exists.js';
|
|
2
|
+
import { wrapRule } from './wrap-rule.js';
|
|
3
|
+
export const provisionExistsTrail = wrapRule({
|
|
4
|
+
examples: [
|
|
5
|
+
{
|
|
6
|
+
expected: { diagnostics: [] },
|
|
7
|
+
input: {
|
|
8
|
+
filePath: 'clean.ts',
|
|
9
|
+
knownProvisionIds: ['db.main'],
|
|
10
|
+
knownTrailIds: ['entity.show'],
|
|
11
|
+
sourceCode: `const db = provision("db.main", {
|
|
12
|
+
create: () => Result.ok({ source: "factory" }),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
trail("entity.show", {
|
|
16
|
+
provisions: [db],
|
|
17
|
+
blaze: async (_input, ctx) => {
|
|
18
|
+
return Result.ok(db.from(ctx));
|
|
19
|
+
}
|
|
20
|
+
})`,
|
|
21
|
+
},
|
|
22
|
+
name: 'Declared provisions resolve to known project provisions',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
rule: provisionExists,
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=provision-exists.trail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-exists.trail.js","sourceRoot":"","sources":["../../src/trails/provision-exists.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC3C,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,iBAAiB,EAAE,CAAC,SAAS,CAAC;gBAC9B,aAAa,EAAE,CAAC,aAAa,CAAC;gBAC9B,UAAU,EAAE;;;;;;;;;GASjB;aACI;YACD,IAAI,EAAE,yDAAyD;SAChE;KACF;IACD,IAAI,EAAE,eAAe;CACtB,CAAC,CAAC"}
|
package/dist/trails/run.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { WardenDiagnostic } from '../rules/types.js';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Run all warden rule trails for a given file and collect diagnostics.
|
|
9
9
|
*
|
|
10
10
|
* Each rule trail runs independently. Errors from individual trails are
|
|
11
11
|
* silently skipped so that one broken rule does not block the rest.
|
|
12
12
|
*/
|
|
13
13
|
export declare const runWardenTrails: (filePath: string, sourceCode: string, options?: {
|
|
14
|
-
readonly
|
|
14
|
+
readonly knownProvisionIds?: readonly string[];
|
|
15
15
|
readonly knownTrailIds?: readonly string[];
|
|
16
16
|
}) => Promise<readonly WardenDiagnostic[]>;
|
|
17
17
|
//# sourceMappingURL=run.d.ts.map
|
package/dist/trails/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAChB,YAAY,MAAM,EAClB,UAAU;IACR,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAChB,YAAY,MAAM,EAClB,UAAU;IACR,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C,KACA,OAAO,CAAC,SAAS,gBAAgB,EAAE,CA2BrC,CAAC"}
|
package/dist/trails/run.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns a flat array of diagnostics from every rule.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { run } from '@ontrails/core';
|
|
7
7
|
import { wardenTopo } from './topo.js';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Run all warden rule trails for a given file and collect diagnostics.
|
|
10
10
|
*
|
|
11
11
|
* Each rule trail runs independently. Errors from individual trails are
|
|
12
12
|
* silently skipped so that one broken rule does not block the rest.
|
|
@@ -14,11 +14,11 @@ import { wardenTopo } from './topo.js';
|
|
|
14
14
|
export const runWardenTrails = async (filePath, sourceCode, options) => {
|
|
15
15
|
const allDiagnostics = [];
|
|
16
16
|
for (const id of wardenTopo.ids()) {
|
|
17
|
-
const input = options?.knownTrailIds || options?.
|
|
17
|
+
const input = options?.knownTrailIds || options?.knownProvisionIds
|
|
18
18
|
? {
|
|
19
19
|
filePath,
|
|
20
|
-
...(options?.
|
|
21
|
-
? {
|
|
20
|
+
...(options?.knownProvisionIds
|
|
21
|
+
? { knownProvisionIds: options.knownProvisionIds }
|
|
22
22
|
: {}),
|
|
23
23
|
...(options?.knownTrailIds
|
|
24
24
|
? { knownTrailIds: options.knownTrailIds }
|
|
@@ -26,7 +26,7 @@ export const runWardenTrails = async (filePath, sourceCode, options) => {
|
|
|
26
26
|
sourceCode,
|
|
27
27
|
}
|
|
28
28
|
: { filePath, sourceCode };
|
|
29
|
-
const result = await
|
|
29
|
+
const result = await run(wardenTopo, id, input);
|
|
30
30
|
if (result.isOk()) {
|
|
31
31
|
const { diagnostics } = result.value;
|
|
32
32
|
for (const d of diagnostics) {
|
package/dist/trails/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/trails/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,QAAgB,EAChB,UAAkB,EAClB,OAGC,EACqC,EAAE;IACxC,MAAM,cAAc,GAAuB,EAAE,CAAC;IAE9C,KAAK,MAAM,EAAE,IAAI,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;QAClC,MAAM,KAAK,GACT,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,iBAAiB;YAClD,CAAC,CAAC;gBACE,QAAQ;gBACR,GAAG,CAAC,OAAO,EAAE,iBAAiB;oBAC5B,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;oBAClD,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,OAAO,EAAE,aAAa;oBACxB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE;oBAC1C,CAAC,CAAC,EAAE,CAAC;gBACP,UAAU;aACX;YACH,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,KAAmB,CAAC;YACnD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;gBAC5B,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
package/dist/trails/schema.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const ruleInput: z.ZodObject<{
|
|
|
31
31
|
export declare const projectAwareRuleInput: z.ZodObject<{
|
|
32
32
|
filePath: z.ZodString;
|
|
33
33
|
sourceCode: z.ZodString;
|
|
34
|
-
|
|
34
|
+
knownProvisionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
35
|
knownTrailIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
37
|
/** Output returned by every warden rule trail. */
|
package/dist/trails/schema.js
CHANGED
|
@@ -26,10 +26,10 @@ export const ruleInput = z.object({
|
|
|
26
26
|
* files.
|
|
27
27
|
*/
|
|
28
28
|
export const projectAwareRuleInput = ruleInput.extend({
|
|
29
|
-
|
|
29
|
+
knownProvisionIds: z
|
|
30
30
|
.array(z.string())
|
|
31
31
|
.optional()
|
|
32
|
-
.describe('
|
|
32
|
+
.describe('Provision IDs known across the project'),
|
|
33
33
|
knownTrailIds: z
|
|
34
34
|
.array(z.string())
|
|
35
35
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/trails/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACjE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpE,CAAC,CAAC;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACvD,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,MAAM,CAAC;IACpD,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/trails/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACjE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpE,CAAC,CAAC;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACvD,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,MAAM,CAAC;IACpD,iBAAiB,EAAE,CAAC;SACjB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,wCAAwC,CAAC;IACrD,aAAa,EAAE,CAAC;SACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,oCAAoC,CAAC;CAClD,CAAC,CAAC;AAEH,kDAAkD;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CACrE,CAAC,CAAC"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
export declare const provisionDeclarationsTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
}, {
|
|
5
|
+
diagnostics: {
|
|
6
|
+
filePath: string;
|
|
7
|
+
line: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
severity: "error" | "warn";
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
/** Backward-compatible alias while the migration is in flight. */
|
|
1
14
|
export declare const serviceDeclarationsTrail: import("@ontrails/core").Trail<{
|
|
2
15
|
filePath: string;
|
|
3
16
|
sourceCode: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-declarations.trail.d.ts","sourceRoot":"","sources":["../../src/trails/service-declarations.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"service-declarations.trail.d.ts","sourceRoot":"","sources":["../../src/trails/service-declarations.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B;;;;;;;;;;;EAqBrC,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAA6B,CAAC"}
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provisionDeclarations } from '../rules/service-declarations.js';
|
|
2
2
|
import { wrapRule } from './wrap-rule.js';
|
|
3
|
-
export const
|
|
3
|
+
export const provisionDeclarationsTrail = wrapRule({
|
|
4
4
|
examples: [
|
|
5
5
|
{
|
|
6
6
|
expected: { diagnostics: [] },
|
|
7
7
|
input: {
|
|
8
8
|
filePath: 'clean.ts',
|
|
9
|
-
sourceCode: `const db =
|
|
9
|
+
sourceCode: `const db = provision("db.main", {
|
|
10
10
|
create: () => Result.ok({ source: "factory" }),
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
trail("entity.show", {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
provisions: [db],
|
|
15
|
+
blaze: async (_input, ctx) => {
|
|
16
16
|
return Result.ok(db.from(ctx));
|
|
17
17
|
}
|
|
18
18
|
})`,
|
|
19
19
|
},
|
|
20
|
-
name: 'Matched
|
|
20
|
+
name: 'Matched provision declarations and usage',
|
|
21
21
|
},
|
|
22
22
|
],
|
|
23
|
-
rule:
|
|
23
|
+
rule: provisionDeclarations,
|
|
24
24
|
});
|
|
25
|
+
/** Backward-compatible alias while the migration is in flight. */
|
|
26
|
+
export const serviceDeclarationsTrail = provisionDeclarationsTrail;
|
|
25
27
|
//# sourceMappingURL=service-declarations.trail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-declarations.trail.js","sourceRoot":"","sources":["../../src/trails/service-declarations.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"service-declarations.trail.js","sourceRoot":"","sources":["../../src/trails/service-declarations.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IACjD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE;;;;;;;;;GASjB;aACI;YACD,IAAI,EAAE,0CAA0C;SACjD;KACF;IACD,IAAI,EAAE,qBAAqB;CAC5B,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
export declare const provisionExistsTrail: import("@ontrails/core").Trail<{
|
|
2
|
+
filePath: string;
|
|
3
|
+
sourceCode: string;
|
|
4
|
+
knownProvisionIds?: string[] | undefined;
|
|
5
|
+
knownServiceIds?: string[] | undefined;
|
|
6
|
+
knownTrailIds?: string[] | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
diagnostics: {
|
|
9
|
+
filePath: string;
|
|
10
|
+
line: number;
|
|
11
|
+
message: string;
|
|
12
|
+
rule: string;
|
|
13
|
+
severity: "error" | "warn";
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
16
|
+
/** Backward-compatible alias while the migration is in flight. */
|
|
1
17
|
export declare const serviceExistsTrail: import("@ontrails/core").Trail<{
|
|
2
18
|
filePath: string;
|
|
3
19
|
sourceCode: string;
|
|
20
|
+
knownProvisionIds?: string[] | undefined;
|
|
4
21
|
knownServiceIds?: string[] | undefined;
|
|
5
22
|
knownTrailIds?: string[] | undefined;
|
|
6
23
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-exists.trail.d.ts","sourceRoot":"","sources":["../../src/trails/service-exists.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"service-exists.trail.d.ts","sourceRoot":"","sources":["../../src/trails/service-exists.trail.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;EAuB/B,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;EAAuB,CAAC"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { provisionExists } from '../rules/service-exists.js';
|
|
2
2
|
import { wrapRule } from './wrap-rule.js';
|
|
3
|
-
export const
|
|
3
|
+
export const provisionExistsTrail = wrapRule({
|
|
4
4
|
examples: [
|
|
5
5
|
{
|
|
6
6
|
expected: { diagnostics: [] },
|
|
7
7
|
input: {
|
|
8
8
|
filePath: 'clean.ts',
|
|
9
|
-
|
|
9
|
+
knownProvisionIds: ['db.main'],
|
|
10
10
|
knownTrailIds: ['entity.show'],
|
|
11
|
-
sourceCode: `const db =
|
|
11
|
+
sourceCode: `const db = provision("db.main", {
|
|
12
12
|
create: () => Result.ok({ source: "factory" }),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
trail("entity.show", {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
provisions: [db],
|
|
17
|
+
blaze: async (_input, ctx) => {
|
|
18
18
|
return Result.ok(db.from(ctx));
|
|
19
19
|
}
|
|
20
20
|
})`,
|
|
21
21
|
},
|
|
22
|
-
name: 'Declared
|
|
22
|
+
name: 'Declared provisions resolve to known project provisions',
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
-
rule:
|
|
25
|
+
rule: provisionExists,
|
|
26
26
|
});
|
|
27
|
+
/** Backward-compatible alias while the migration is in flight. */
|
|
28
|
+
export const serviceExistsTrail = provisionExistsTrail;
|
|
27
29
|
//# sourceMappingURL=service-exists.trail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-exists.trail.js","sourceRoot":"","sources":["../../src/trails/service-exists.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"service-exists.trail.js","sourceRoot":"","sources":["../../src/trails/service-exists.trail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC3C,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;YAC7B,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,iBAAiB,EAAE,CAAC,SAAS,CAAC;gBAC9B,aAAa,EAAE,CAAC,aAAa,CAAC;gBAC9B,UAAU,EAAE;;;;;;;;;GASjB;aACI;YACD,IAAI,EAAE,yDAAyD;SAChE;KACF;IACD,IAAI,EAAE,eAAe;CACtB,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const validDescribeRefsTrail: import("@ontrails/core").Trail<{
|
|
2
2
|
filePath: string;
|
|
3
3
|
sourceCode: string;
|
|
4
|
-
|
|
4
|
+
knownProvisionIds?: string[] | undefined;
|
|
5
5
|
knownTrailIds?: string[] | undefined;
|
|
6
6
|
}, {
|
|
7
7
|
diagnostics: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const validDetourRefsTrail: import("@ontrails/core").Trail<{
|
|
2
2
|
filePath: string;
|
|
3
3
|
sourceCode: string;
|
|
4
|
-
|
|
4
|
+
knownProvisionIds?: string[] | undefined;
|
|
5
5
|
knownTrailIds?: string[] | undefined;
|
|
6
6
|
}, {
|
|
7
7
|
diagnostics: {
|
|
@@ -8,12 +8,12 @@ export const validDetourRefsTrail = wrapRule({
|
|
|
8
8
|
filePath: 'clean.ts',
|
|
9
9
|
knownTrailIds: ['entity.fallback', 'entity.show'],
|
|
10
10
|
sourceCode: `trail("entity.fallback", {
|
|
11
|
-
|
|
11
|
+
blaze: async (input, ctx) => Result.ok(data)
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
trail("entity.show", {
|
|
15
15
|
detours: [{ target: "entity.fallback" }],
|
|
16
|
-
|
|
16
|
+
blaze: async (input, ctx) => Result.ok(data)
|
|
17
17
|
})`,
|
|
18
18
|
},
|
|
19
19
|
name: 'Valid detour target reference',
|
package/dist/trails/wrap-rule.js
CHANGED
|
@@ -11,16 +11,10 @@ export function wrapRule(options) {
|
|
|
11
11
|
if (isProjectAware) {
|
|
12
12
|
const projectAwareRule = rule;
|
|
13
13
|
return trail(`warden.rule.${rule.name}`, {
|
|
14
|
-
|
|
15
|
-
examples: examples,
|
|
16
|
-
input: projectAwareRuleInput,
|
|
17
|
-
intent: 'read',
|
|
18
|
-
metadata: { category: 'governance', severity: rule.severity },
|
|
19
|
-
output: ruleOutput,
|
|
20
|
-
run: (input) => {
|
|
14
|
+
blaze: (input) => {
|
|
21
15
|
const context = {
|
|
22
|
-
|
|
23
|
-
? new Set(input.
|
|
16
|
+
knownProvisionIds: input.knownProvisionIds
|
|
17
|
+
? new Set(input.knownProvisionIds)
|
|
24
18
|
: undefined,
|
|
25
19
|
knownTrailIds: input.knownTrailIds
|
|
26
20
|
? new Set(input.knownTrailIds)
|
|
@@ -29,19 +23,25 @@ export function wrapRule(options) {
|
|
|
29
23
|
const diagnostics = projectAwareRule.checkWithContext(input.sourceCode, input.filePath, context);
|
|
30
24
|
return Result.ok({ diagnostics: [...diagnostics] });
|
|
31
25
|
},
|
|
26
|
+
description: rule.description,
|
|
27
|
+
examples: examples,
|
|
28
|
+
input: projectAwareRuleInput,
|
|
29
|
+
intent: 'read',
|
|
30
|
+
meta: { category: 'governance', severity: rule.severity },
|
|
31
|
+
output: ruleOutput,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return trail(`warden.rule.${rule.name}`, {
|
|
35
|
+
blaze: (input) => {
|
|
36
|
+
const diagnostics = rule.check(input.sourceCode, input.filePath);
|
|
37
|
+
return Result.ok({ diagnostics: [...diagnostics] });
|
|
38
|
+
},
|
|
35
39
|
description: rule.description,
|
|
36
40
|
examples: examples,
|
|
37
41
|
input: ruleInput,
|
|
38
42
|
intent: 'read',
|
|
39
|
-
|
|
43
|
+
meta: { category: 'governance', severity: rule.severity },
|
|
40
44
|
output: ruleOutput,
|
|
41
|
-
run: (input) => {
|
|
42
|
-
const diagnostics = rule.check(input.sourceCode, input.filePath);
|
|
43
|
-
return Result.ok({ diagnostics: [...diagnostics] });
|
|
44
|
-
},
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
//# sourceMappingURL=wrap-rule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-rule.js","sourceRoot":"","sources":["../../src/trails/wrap-rule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA4B3E,MAAM,UAAU,QAAQ,CACtB,OAAsD;IAEtD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,cAAc,GAAG,kBAAkB,IAAI,IAAI,CAAC;IAElD,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,gBAAgB,GAAG,IAA8B,CAAC;QACxD,OAAO,KAAK,CAAC,eAAe,IAAI,CAAC,IAAI,EAAE,EAAE;YACvC,
|
|
1
|
+
{"version":3,"file":"wrap-rule.js","sourceRoot":"","sources":["../../src/trails/wrap-rule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA4B3E,MAAM,UAAU,QAAQ,CACtB,OAAsD;IAEtD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,cAAc,GAAG,kBAAkB,IAAI,IAAI,CAAC;IAElD,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,gBAAgB,GAAG,IAA8B,CAAC;QACxD,OAAO,KAAK,CAAC,eAAe,IAAI,CAAC,IAAI,EAAE,EAAE;YACvC,KAAK,EAAE,CAAC,KAA4B,EAAE,EAAE;gBACtC,MAAM,OAAO,GAAG;oBACd,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;wBACxC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC;wBAClC,CAAC,CAAC,SAAS;oBACb,aAAa,EAAE,KAAK,CAAC,aAAa;wBAChC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;wBAC9B,CAAC,CAAC,IAAI,GAAG,EAAU;iBACJ,CAAC;gBACpB,MAAM,WAAW,GAAG,gBAAgB,CAAC,gBAAgB,CACnD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,QAAQ,EACd,OAAO,CACR,CAAC;gBACF,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;YACtD,CAAC;YACD,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,QAGG;YACb,KAAK,EAAE,qBAAqB;YAC5B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;YACzD,MAAM,EAAE,UAAU;SACnB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,eAAe,IAAI,CAAC,IAAI,EAAE,EAAE;QACvC,KAAK,EAAE,CAAC,KAAgB,EAAE,EAAE;YAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,QAAoD;QAC9D,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;QACzD,MAAM,EAAE,UAAU;KACnB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ describe('runWarden', () => {
|
|
|
21
21
|
writeFileSync(
|
|
22
22
|
join(dir, 'bad.ts'),
|
|
23
23
|
`trail("entity.show", {
|
|
24
|
-
|
|
24
|
+
blaze: async (input, ctx) => {
|
|
25
25
|
throw new Error("boom");
|
|
26
26
|
}
|
|
27
27
|
})`
|
|
@@ -41,7 +41,7 @@ describe('runWarden', () => {
|
|
|
41
41
|
writeFileSync(
|
|
42
42
|
join(dir, 'good.ts'),
|
|
43
43
|
`trail("entity.show", {
|
|
44
|
-
|
|
44
|
+
blaze: async (input, ctx) => {
|
|
45
45
|
return Result.ok(data);
|
|
46
46
|
}
|
|
47
47
|
})`
|
|
@@ -72,7 +72,7 @@ describe('runWarden', () => {
|
|
|
72
72
|
// Even with bad code, driftOnly should produce 0 diagnostics
|
|
73
73
|
writeFileSync(
|
|
74
74
|
join(dir, 'bad.ts'),
|
|
75
|
-
`trail("x", {
|
|
75
|
+
`trail("x", { blaze: async () => { throw new Error("x"); } })`
|
|
76
76
|
);
|
|
77
77
|
const report = await runWarden({ driftOnly: true, rootDir: dir });
|
|
78
78
|
expect(report.diagnostics.length).toBe(0);
|
|
@@ -89,7 +89,7 @@ describe('runWarden', () => {
|
|
|
89
89
|
join(dir, 'show.ts'),
|
|
90
90
|
`trail("entity.show", {
|
|
91
91
|
detours: { NotFoundError: ["entity.search"] },
|
|
92
|
-
|
|
92
|
+
blaze: async (input, ctx) => {
|
|
93
93
|
return Result.ok(data);
|
|
94
94
|
}
|
|
95
95
|
})`
|
|
@@ -97,7 +97,7 @@ describe('runWarden', () => {
|
|
|
97
97
|
writeFileSync(
|
|
98
98
|
join(dir, 'search.ts'),
|
|
99
99
|
`trail("entity.search", {
|
|
100
|
-
|
|
100
|
+
blaze: async (input, ctx) => {
|
|
101
101
|
return Result.ok(data);
|
|
102
102
|
}
|
|
103
103
|
})`
|
|
@@ -121,7 +121,7 @@ describe('runWarden', () => {
|
|
|
121
121
|
join(dir, 'show.ts'),
|
|
122
122
|
`trail("entity.show", {
|
|
123
123
|
detours: { NotFoundError: ["entity.search"] },
|
|
124
|
-
|
|
124
|
+
blaze: async (input, ctx) => {
|
|
125
125
|
return Result.ok(data);
|
|
126
126
|
}
|
|
127
127
|
})`
|
|
@@ -129,7 +129,7 @@ describe('runWarden', () => {
|
|
|
129
129
|
writeFileSync(
|
|
130
130
|
join(dir, 'search.ts'),
|
|
131
131
|
`trail("entity.search", {
|
|
132
|
-
|
|
132
|
+
blaze: async (input, ctx) => {
|
|
133
133
|
throw new Error("boom");
|
|
134
134
|
}
|
|
135
135
|
})`
|
|
@@ -192,7 +192,7 @@ describe('formatWardenReport', () => {
|
|
|
192
192
|
passed: false,
|
|
193
193
|
warnCount: 0,
|
|
194
194
|
});
|
|
195
|
-
expect(output).toContain('
|
|
195
|
+
expect(output).toContain('trailhead.lock is stale');
|
|
196
196
|
expect(output).toContain('Result: FAIL');
|
|
197
197
|
});
|
|
198
198
|
});
|