@telorun/assert 0.2.0 → 0.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/README.md CHANGED
@@ -1,7 +1,3 @@
1
- ---
2
- description: "Telo: YAML-driven execution engine for declarative backends with micro-kernel architecture and language-agnostic design"
3
- ---
4
-
5
1
  # ⚡ Telo
6
2
 
7
3
  Runtime for declarative backends.
package/dist/manifest.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_MANIFEST_FILENAME, Loader, StaticAnalyzer } from "@telorun/analyzer";
2
2
  import * as fs from "fs/promises";
3
3
  import * as path from "path";
4
- class LocalFileAdapter {
4
+ class LocalFileSource {
5
5
  supports(p) {
6
6
  return (p.startsWith("file://") ||
7
7
  p.startsWith("/") ||
@@ -52,7 +52,7 @@ export async function create(manifest, ctx) {
52
52
  const green = (t) => c("32", t);
53
53
  const dim = (t) => c("2", t);
54
54
  const name = manifest.metadata.name;
55
- const loader = new Loader([new LocalFileAdapter()]);
55
+ const loader = new Loader([new LocalFileSource()]);
56
56
  const analyzer = new StaticAnalyzer();
57
57
  const resolvedUrl = new URL(manifest.source, ctx.moduleContext.source).toString();
58
58
  let manifests;
@@ -44,14 +44,13 @@ export async function create(manifest, ctx) {
44
44
  return {
45
45
  run: async () => {
46
46
  const { bold, red, green, yellow, dim } = createColors(ctx.stderr);
47
- const declaringModule = manifest.metadata.module ?? "default";
48
47
  const resourcesToCheck = manifest.resources ?? {};
49
48
  const failures = [];
50
49
  const passed = [];
51
50
  const { resources } = ctx.moduleContext;
52
51
  for (const [alias, expected] of Object.entries(resourcesToCheck)) {
53
- if (!ctx.resolveModuleAlias(declaringModule, alias)) {
54
- failures.push(`Import alias '${alias}' not found in module '${declaringModule}'`);
52
+ if (!ctx.moduleContext.hasImport(alias)) {
53
+ failures.push(`Import alias '${alias}' not found in declaring module`);
55
54
  continue;
56
55
  }
57
56
  const snap = resources[alias] ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/assert",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Telo Assert module - Assertion resource kinds for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -31,8 +31,8 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@sinclair/typebox": "^0.34.48",
34
- "@telorun/analyzer": "0.4.0",
35
- "@telorun/sdk": "0.5.0"
34
+ "@telorun/analyzer": "0.5.0",
35
+ "@telorun/sdk": "0.6.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^20.0.0",
package/src/manifest.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_MANIFEST_FILENAME, Loader, StaticAnalyzer, type AnalysisDiagnostic, type ManifestAdapter } from "@telorun/analyzer";
1
+ import { DEFAULT_MANIFEST_FILENAME, Loader, StaticAnalyzer, type AnalysisDiagnostic, type ManifestSource } from "@telorun/analyzer";
2
2
  import type { ResourceContext, Runnable } from "@telorun/sdk";
3
3
  import * as fs from "fs/promises";
4
4
  import * as path from "path";
@@ -18,7 +18,7 @@ interface ManifestAssertManifest {
18
18
  };
19
19
  }
20
20
 
21
- class LocalFileAdapter implements ManifestAdapter {
21
+ class LocalFileSource implements ManifestSource {
22
22
  supports(p: string): boolean {
23
23
  return (
24
24
  p.startsWith("file://") ||
@@ -78,7 +78,7 @@ export async function create(
78
78
  const dim = (t: string) => c("2", t);
79
79
 
80
80
  const name = manifest.metadata.name;
81
- const loader = new Loader([new LocalFileAdapter()]);
81
+ const loader = new Loader([new LocalFileSource()]);
82
82
  const analyzer = new StaticAnalyzer();
83
83
 
84
84
  const resolvedUrl = new URL(manifest.source, ctx.moduleContext.source).toString();
@@ -50,14 +50,13 @@ export async function create(
50
50
  return {
51
51
  run: async () => {
52
52
  const { bold, red, green, yellow, dim } = createColors(ctx.stderr);
53
- const declaringModule = manifest.metadata.module ?? "default";
54
53
  const resourcesToCheck = manifest.resources ?? {};
55
54
  const failures: string[] = [];
56
55
  const passed: string[] = [];
57
56
  const { resources } = ctx.moduleContext;
58
57
  for (const [alias, expected] of Object.entries(resourcesToCheck)) {
59
- if (!(ctx as any).resolveModuleAlias(declaringModule, alias)) {
60
- failures.push(`Import alias '${alias}' not found in module '${declaringModule}'`);
58
+ if (!ctx.moduleContext.hasImport(alias)) {
59
+ failures.push(`Import alias '${alias}' not found in declaring module`);
61
60
  continue;
62
61
  }
63
62