@telorun/kernel 0.2.9 → 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.
Files changed (127) hide show
  1. package/README.md +7 -7
  2. package/dist/controllers/module/import-controller.d.ts.map +1 -1
  3. package/dist/controllers/module/import-controller.js +22 -23
  4. package/dist/controllers/module/import-controller.js.map +1 -1
  5. package/dist/controllers/resource-definition/resource-definition-controller.d.ts +1 -1
  6. package/dist/controllers/resource-definition/resource-definition-controller.d.ts.map +1 -1
  7. package/dist/evaluation-context.d.ts +21 -4
  8. package/dist/evaluation-context.d.ts.map +1 -1
  9. package/dist/evaluation-context.js +85 -13
  10. package/dist/evaluation-context.js.map +1 -1
  11. package/dist/kernel.d.ts +11 -8
  12. package/dist/kernel.d.ts.map +1 -1
  13. package/dist/kernel.js +38 -16
  14. package/dist/kernel.js.map +1 -1
  15. package/dist/manifest-schemas.d.ts +44 -1
  16. package/dist/manifest-schemas.d.ts.map +1 -1
  17. package/dist/manifest-schemas.js +59 -15
  18. package/dist/manifest-schemas.js.map +1 -1
  19. package/dist/module-context.d.ts +1 -1
  20. package/dist/module-context.js +1 -1
  21. package/dist/resource-context.d.ts +6 -2
  22. package/dist/resource-context.d.ts.map +1 -1
  23. package/dist/resource-context.js +24 -4
  24. package/dist/resource-context.js.map +1 -1
  25. package/package.json +3 -3
  26. package/src/controllers/module/import-controller.ts +28 -28
  27. package/src/controllers/resource-definition/resource-definition-controller.ts +1 -1
  28. package/src/evaluation-context.ts +107 -18
  29. package/src/kernel.ts +52 -18
  30. package/src/manifest-schemas.ts +61 -15
  31. package/src/module-context.ts +1 -1
  32. package/src/resource-context.ts +38 -3
  33. package/dist/base-definition.d.ts +0 -14
  34. package/dist/base-definition.d.ts.map +0 -1
  35. package/dist/base-definition.js +0 -17
  36. package/dist/base-definition.js.map +0 -1
  37. package/dist/capabilities/capabilities/component.yaml +0 -4
  38. package/dist/capabilities/capabilities/executable.yaml +0 -8
  39. package/dist/capabilities/capabilities/handler.yaml +0 -4
  40. package/dist/capabilities/capabilities/listener.yaml +0 -4
  41. package/dist/capabilities/capabilities/provider.yaml +0 -4
  42. package/dist/capabilities/capabilities/template.yaml +0 -4
  43. package/dist/capabilities/capabilities/type.yaml +0 -4
  44. package/dist/capabilities/component.d.ts +0 -3
  45. package/dist/capabilities/component.d.ts.map +0 -1
  46. package/dist/capabilities/component.js +0 -4
  47. package/dist/capabilities/component.js.map +0 -1
  48. package/dist/capabilities/component.yaml +0 -3
  49. package/dist/capabilities/executable.d.ts +0 -3
  50. package/dist/capabilities/executable.d.ts.map +0 -1
  51. package/dist/capabilities/executable.js +0 -5
  52. package/dist/capabilities/executable.js.map +0 -1
  53. package/dist/capabilities/executable.yaml +0 -7
  54. package/dist/capabilities/handler.d.ts +0 -3
  55. package/dist/capabilities/handler.d.ts.map +0 -1
  56. package/dist/capabilities/handler.js +0 -4
  57. package/dist/capabilities/handler.js.map +0 -1
  58. package/dist/capabilities/handler.yaml +0 -3
  59. package/dist/capabilities/invokable.d.ts +0 -3
  60. package/dist/capabilities/invokable.d.ts.map +0 -1
  61. package/dist/capabilities/invokable.js +0 -5
  62. package/dist/capabilities/invokable.js.map +0 -1
  63. package/dist/capabilities/listener.d.ts +0 -3
  64. package/dist/capabilities/listener.d.ts.map +0 -1
  65. package/dist/capabilities/listener.js +0 -5
  66. package/dist/capabilities/listener.js.map +0 -1
  67. package/dist/capabilities/listener.yaml +0 -3
  68. package/dist/capabilities/mount.d.ts +0 -3
  69. package/dist/capabilities/mount.d.ts.map +0 -1
  70. package/dist/capabilities/mount.js +0 -5
  71. package/dist/capabilities/mount.js.map +0 -1
  72. package/dist/capabilities/provider.d.ts +0 -3
  73. package/dist/capabilities/provider.d.ts.map +0 -1
  74. package/dist/capabilities/provider.js +0 -8
  75. package/dist/capabilities/provider.js.map +0 -1
  76. package/dist/capabilities/provider.yaml +0 -3
  77. package/dist/capabilities/runnable.d.ts +0 -3
  78. package/dist/capabilities/runnable.d.ts.map +0 -1
  79. package/dist/capabilities/runnable.js +0 -5
  80. package/dist/capabilities/runnable.js.map +0 -1
  81. package/dist/capabilities/service.d.ts +0 -3
  82. package/dist/capabilities/service.d.ts.map +0 -1
  83. package/dist/capabilities/service.js +0 -5
  84. package/dist/capabilities/service.js.map +0 -1
  85. package/dist/capabilities/template.d.ts +0 -3
  86. package/dist/capabilities/template.d.ts.map +0 -1
  87. package/dist/capabilities/template.js +0 -5
  88. package/dist/capabilities/template.js.map +0 -1
  89. package/dist/capabilities/template.yaml +0 -3
  90. package/dist/capabilities/type.d.ts +0 -3
  91. package/dist/capabilities/type.d.ts.map +0 -1
  92. package/dist/capabilities/type.js +0 -5
  93. package/dist/capabilities/type.js.map +0 -1
  94. package/dist/capabilities/type.yaml +0 -3
  95. package/dist/controllers/capability/capability-controller.d.ts +0 -32
  96. package/dist/controllers/capability/capability-controller.d.ts.map +0 -1
  97. package/dist/controllers/capability/capability-controller.js +0 -26
  98. package/dist/controllers/capability/capability-controller.js.map +0 -1
  99. package/dist/controllers/module/module.json +0 -48
  100. package/dist/loader.d.ts +0 -18
  101. package/dist/loader.d.ts.map +0 -1
  102. package/dist/loader.js +0 -127
  103. package/dist/loader.js.map +0 -1
  104. package/dist/manifest-adapters/http-adapter.d.ts +0 -8
  105. package/dist/manifest-adapters/http-adapter.d.ts.map +0 -1
  106. package/dist/manifest-adapters/http-adapter.js +0 -31
  107. package/dist/manifest-adapters/http-adapter.js.map +0 -1
  108. package/dist/manifest-adapters/registry-adapter.d.ts +0 -9
  109. package/dist/manifest-adapters/registry-adapter.d.ts.map +0 -1
  110. package/dist/manifest-adapters/registry-adapter.js +0 -48
  111. package/dist/manifest-adapters/registry-adapter.js.map +0 -1
  112. package/dist/module-context-registry.d.ts +0 -48
  113. package/dist/module-context-registry.d.ts.map +0 -1
  114. package/dist/module-context-registry.js +0 -91
  115. package/dist/module-context-registry.js.map +0 -1
  116. package/dist/schema-valiator.d.ts +0 -15
  117. package/dist/schema-valiator.d.ts.map +0 -1
  118. package/dist/schema-valiator.js +0 -127
  119. package/dist/schema-valiator.js.map +0 -1
  120. package/dist/snapshot-serializer.d.ts +0 -62
  121. package/dist/snapshot-serializer.d.ts.map +0 -1
  122. package/dist/snapshot-serializer.js +0 -164
  123. package/dist/snapshot-serializer.js.map +0 -1
  124. package/dist/types.d.ts +0 -65
  125. package/dist/types.d.ts.map +0 -1
  126. package/dist/types.js +0 -8
  127. package/dist/types.js.map +0 -1
@@ -1,14 +0,0 @@
1
- import type { ModuleContext, ResourceContext, ResourceDefinition, ResourceInstance, ResourceManifest } from "@telorun/sdk";
2
- export interface BaseDefinition {
3
- name: string;
4
- expand?: {
5
- compile?: string[];
6
- runtime?: string[];
7
- };
8
- onDefinition?(definition: ResourceDefinition, ctx: ResourceContext): void | Promise<void>;
9
- onManifest?(manifest: ResourceManifest, ctx: ModuleContext): ResourceManifest | Promise<ResourceManifest>;
10
- onInit?(instance: ResourceInstance, ctx: ResourceContext): Promise<void>;
11
- onInvoke?(instance: ResourceInstance, inputs: any, ctx: ResourceContext): Promise<any>;
12
- }
13
- export declare function createBaseDefinition(def: BaseDefinition): BaseDefinition;
14
- //# sourceMappingURL=base-definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-definition.d.ts","sourceRoot":"","sources":["../src/base-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,YAAY,CAAC,CAAC,UAAU,EAAE,kBAAkB,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,UAAU,CAAC,CACT,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,EAAE,aAAa,GACjB,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAChD,MAAM,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,QAAQ,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACxF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAoBxE"}
@@ -1,17 +0,0 @@
1
- export function createBaseDefinition(def) {
2
- const compile = def.expand?.compile ?? [];
3
- const runtime = def.expand?.runtime ?? [];
4
- return {
5
- ...def,
6
- onManifest: compile.length
7
- ? (manifest, ctx) => ctx.expandPaths(manifest, compile, runtime)
8
- : def.onManifest,
9
- onInvoke: runtime.length
10
- ? async (instance, inputs, _ctx) => {
11
- const expanded = _ctx.moduleContext.expandPaths(inputs, runtime);
12
- return instance.invoke(expanded);
13
- }
14
- : def.onInvoke,
15
- };
16
- }
17
- //# sourceMappingURL=base-definition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-definition.js","sourceRoot":"","sources":["../src/base-definition.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,oBAAoB,CAAC,GAAmB;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IAE1C,OAAO;QACL,GAAG,GAAG;QACN,UAAU,EAAE,OAAO,CAAC,MAAM;YACxB,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAChB,GAAG,CAAC,WAAW,CAAC,QAAmC,EAAE,OAAO,EAAE,OAAO,CAAqB;YAC9F,CAAC,CAAC,GAAG,CAAC,UAAU;QAClB,QAAQ,EAAE,OAAO,CAAC,MAAM;YACtB,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;gBAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAC7C,MAAiC,EACjC,OAAO,CACR,CAAC;gBACF,OAAO,QAAQ,CAAC,MAAO,CAAC,QAAQ,CAAC,CAAC;YACpC,CAAC;YACH,CAAC,CAAC,GAAG,CAAC,QAAQ;KACjB,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: component
@@ -1,8 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: executable
5
- schema:
6
- type: object
7
- properties:
8
- foo: { type: string }
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: handler
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: listener
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: provider
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: template
@@ -1,4 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- module: Kernel
4
- name: type
@@ -1,3 +0,0 @@
1
- import type { BaseDefinition } from "../base-definition.js";
2
- export declare const component: BaseDefinition;
3
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/capabilities/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,eAAO,MAAM,SAAS,EAAE,cAEvB,CAAC"}
@@ -1,4 +0,0 @@
1
- export const component = {
2
- name: "component",
3
- };
4
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/capabilities/component.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,WAAW;CAClB,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: component
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const runnable: ResourceDefinition;
3
- //# sourceMappingURL=executable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../src/capabilities/executable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,QAAQ,EAAE,kBAGtB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const runnable = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Runnable", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=executable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executable.js","sourceRoot":"","sources":["../../src/capabilities/executable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;CACjD,CAAC"}
@@ -1,7 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: executable
4
- schema:
5
- type: object
6
- properties:
7
- foo: { type: string }
@@ -1,3 +0,0 @@
1
- import type { BaseDefinition } from "../base-definition.js";
2
- export declare const handler: BaseDefinition;
3
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/capabilities/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,eAAO,MAAM,OAAO,EAAE,cAErB,CAAC"}
@@ -1,4 +0,0 @@
1
- export const handler = {
2
- name: "handler",
3
- };
4
- //# sourceMappingURL=handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/capabilities/handler.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC,IAAI,EAAE,SAAS;CAChB,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: handler
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const invocable: ResourceDefinition;
3
- //# sourceMappingURL=invokable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invokable.d.ts","sourceRoot":"","sources":["../../src/capabilities/invokable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,SAAS,EAAE,kBAGvB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const invocable = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Invocable", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=invokable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invokable.js","sourceRoot":"","sources":["../../src/capabilities/invokable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAuB;IAC3C,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE;CAClD,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const service: ResourceDefinition;
3
- //# sourceMappingURL=listener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../src/capabilities/listener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,OAAO,EAAE,kBAGrB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const service = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Service", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=listener.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listener.js","sourceRoot":"","sources":["../../src/capabilities/listener.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAuB;IACzC,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE;CAChD,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: listener
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const mount: ResourceDefinition;
3
- //# sourceMappingURL=mount.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/capabilities/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,KAAK,EAAE,kBAGnB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const mount = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Mount", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=mount.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mount.js","sourceRoot":"","sources":["../../src/capabilities/mount.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAuB;IACvC,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;CAC9C,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const provider: ResourceDefinition;
3
- //# sourceMappingURL=provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/capabilities/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,QAAQ,EAAE,kBAMtB,CAAC"}
@@ -1,8 +0,0 @@
1
- export const provider = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Provider", module: "Kernel" },
4
- expand: {
5
- compile: ["**"],
6
- },
7
- };
8
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/capabilities/provider.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;IAChD,MAAM,EAAE;QACN,OAAO,EAAE,CAAC,IAAI,CAAC;KAChB;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: provider
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const runnable: ResourceDefinition;
3
- //# sourceMappingURL=runnable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runnable.d.ts","sourceRoot":"","sources":["../../src/capabilities/runnable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,QAAQ,EAAE,kBAGtB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const runnable = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Runnable", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=runnable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runnable.js","sourceRoot":"","sources":["../../src/capabilities/runnable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;CACjD,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const service: ResourceDefinition;
3
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/capabilities/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,OAAO,EAAE,kBAGrB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const service = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Service", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/capabilities/service.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAuB;IACzC,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE;CAChD,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const template: ResourceDefinition;
3
- //# sourceMappingURL=template.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/capabilities/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,QAAQ,EAAE,kBAGtB,CAAC"}
@@ -1,5 +0,0 @@
1
- export const template = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Template", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/capabilities/template.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;CACjD,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: template
@@ -1,3 +0,0 @@
1
- import type { ResourceDefinition } from "@telorun/sdk";
2
- export declare const typeCapability: ResourceDefinition;
3
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/capabilities/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,cAAc,EAAE,kBAG5B,CAAC"}
@@ -1,5 +0,0 @@
1
- export const typeCapability = {
2
- kind: "Kernel.Abstract",
3
- metadata: { name: "Type", module: "Kernel" },
4
- };
5
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/capabilities/type.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAuB;IAChD,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE;CAC7C,CAAC"}
@@ -1,3 +0,0 @@
1
- kind: Kernel.Capability
2
- metadata:
3
- name: type
@@ -1,32 +0,0 @@
1
- import type { ResourceContext, ResourceInstance } from "@telorun/sdk";
2
- type CapabilityResource = {
3
- kind: string;
4
- metadata: {
5
- name: string;
6
- [key: string]: any;
7
- };
8
- };
9
- declare class Capability implements ResourceInstance {
10
- private readonly resource;
11
- constructor(resource: CapabilityResource);
12
- init(ctx: ResourceContext): Promise<void>;
13
- }
14
- export declare function create(resource: any, _ctx: ResourceContext): Promise<Capability>;
15
- export declare const schema: {
16
- type: string;
17
- properties: {
18
- metadata: {
19
- type: string;
20
- properties: {
21
- name: {
22
- type: string;
23
- };
24
- };
25
- required: string[];
26
- };
27
- };
28
- required: string[];
29
- additionalProperties: boolean;
30
- };
31
- export {};
32
- //# sourceMappingURL=capability-controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capability-controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/capability/capability-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtE,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,cAAM,UAAW,YAAW,gBAAgB;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,kBAAkB;IAEnD,IAAI,CAAC,GAAG,EAAE,eAAe;CAGhC;AAED,wBAAsB,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAEtF;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CAalB,CAAC"}
@@ -1,26 +0,0 @@
1
- class Capability {
2
- constructor(resource) {
3
- this.resource = resource;
4
- }
5
- async init(ctx) {
6
- ctx.registerCapability(this.resource.metadata.name);
7
- }
8
- }
9
- export async function create(resource, _ctx) {
10
- return new Capability(resource);
11
- }
12
- export const schema = {
13
- type: "object",
14
- properties: {
15
- metadata: {
16
- type: "object",
17
- properties: {
18
- name: { type: "string" },
19
- },
20
- required: ["name"],
21
- },
22
- },
23
- required: ["metadata"],
24
- additionalProperties: true,
25
- };
26
- //# sourceMappingURL=capability-controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capability-controller.js","sourceRoot":"","sources":["../../../src/controllers/capability/capability-controller.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU;IACd,YAA6B,QAA4B;QAA5B,aAAQ,GAAR,QAAQ,CAAoB;IAAG,CAAC;IAE7D,KAAK,CAAC,IAAI,CAAC,GAAoB;QAC7B,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAa,EAAE,IAAqB;IAC/D,OAAO,IAAI,UAAU,CAAC,QAA8B,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aACzB;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,oBAAoB,EAAE,IAAI;CAC3B,CAAC"}
@@ -1,48 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "metadata": {
5
- "type": "object",
6
- "properties": {
7
- "name": {
8
- "type": "string"
9
- }
10
- },
11
- "required": ["name"]
12
- },
13
- "imports": {
14
- "type": "array",
15
- "items": {
16
- "type": "string"
17
- },
18
- "description": "Paths to other modules to import"
19
- },
20
- "definitions": {
21
- "type": "array",
22
- "items": {
23
- "type": "string"
24
- },
25
- "description": "Paths to ResourceDefinition files"
26
- },
27
- "resources": {
28
- "type": "array",
29
- "items": {
30
- "oneOf": [
31
- {
32
- "type": "string"
33
- },
34
- {
35
- "type": "object",
36
- "properties": {
37
- "path": {
38
- "type": "string"
39
- }
40
- }
41
- }
42
- ]
43
- },
44
- "description": "Paths to resource instance files to load"
45
- }
46
- },
47
- "required": ["metadata"]
48
- }
package/dist/loader.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Loader as BaseLoader } from "@telorun/analyzer";
2
- import { ResourceManifest } from "@telorun/sdk";
3
- export declare class Loader extends BaseLoader {
4
- private static projectRoot;
5
- private readonly localAdapter;
6
- constructor();
7
- private static ensureProjectRoot;
8
- resolvePath(base: string, relative: string): string;
9
- /**
10
- * Resolve a path-or-URL to its canonical file source URL.
11
- * If the path refers to a directory, returns the URL of module.yaml inside it.
12
- */
13
- resolveEntryPoint(pathOrUrl: string): Promise<string>;
14
- loadDirectory(pathOrUrl: string): Promise<ResourceManifest[]>;
15
- loadManifest(pathOrUrl: string, baseUrl: string, compileContext?: Record<string, unknown>): Promise<ResourceManifest[]>;
16
- private orderResourcesByKindDependencies;
17
- }
18
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAKjE,qBAAa,MAAO,SAAQ,UAAU;IACpC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAuB;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmB;;IAQhD,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAMhC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAInD;;;OAGG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKrD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAyB7D,YAAY,CAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAC3C,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAW9B,OAAO,CAAC,gCAAgC;CA0DzC"}
package/dist/loader.js DELETED
@@ -1,127 +0,0 @@
1
- import { Loader as BaseLoader } from "@telorun/analyzer";
2
- import * as path from "path";
3
- import { LocalFileAdapter } from "./manifest-adapters/local-file-adapter.js";
4
- import { formatAjvErrors, validateRuntimeResource } from "./manifest-schemas.js";
5
- export class Loader extends BaseLoader {
6
- constructor() {
7
- super();
8
- this.localAdapter = new LocalFileAdapter();
9
- this.register(this.localAdapter);
10
- }
11
- static ensureProjectRoot(baseDir) {
12
- if (!Loader.projectRoot) {
13
- Loader.projectRoot = path.resolve(baseDir);
14
- }
15
- }
16
- resolvePath(base, relative) {
17
- return this.localAdapter.resolveRelative(base, relative);
18
- }
19
- /**
20
- * Resolve a path-or-URL to its canonical file source URL.
21
- * If the path refers to a directory, returns the URL of module.yaml inside it.
22
- */
23
- async resolveEntryPoint(pathOrUrl) {
24
- const { source } = await this.localAdapter.read(pathOrUrl);
25
- return source;
26
- }
27
- async loadDirectory(pathOrUrl) {
28
- const sources = await this.localAdapter.readAll(pathOrUrl);
29
- const firstPath = sources[0] ? new URL(sources[0]).pathname : process.cwd();
30
- Loader.ensureProjectRoot(path.dirname(firstPath));
31
- const resources = [];
32
- for (const source of sources) {
33
- const manifests = await this.loadModule(source);
34
- for (const m of manifests) {
35
- if (!m.metadata?.name)
36
- continue;
37
- const resource = m;
38
- if (!validateRuntimeResource(resource)) {
39
- throw new Error(`Resource validation failed for ${m.kind}.${m.metadata.name}: ${formatAjvErrors(validateRuntimeResource.errors)}`);
40
- }
41
- const filePath = new URL(m.metadata.source).pathname;
42
- const uriBase = `file://localhost${filePath.replace(/\\/g, "/")}`;
43
- resource.metadata.uri = `${uriBase}#${m.kind}.${m.metadata.name}`;
44
- resource.metadata.generationDepth = 0;
45
- resources.push(resource);
46
- }
47
- }
48
- return this.orderResourcesByKindDependencies(resources);
49
- }
50
- async loadManifest(pathOrUrl, baseUrl, compileContext = {}) {
51
- if (!baseUrl) {
52
- throw new Error("Base URL is required to load target manifest");
53
- }
54
- const url = new URL(pathOrUrl, baseUrl).toString();
55
- if (!Loader.projectRoot) {
56
- Loader.ensureProjectRoot(path.dirname(new URL(url).pathname));
57
- }
58
- return this.loadModule(url, { compile: true });
59
- }
60
- orderResourcesByKindDependencies(resources) {
61
- if (resources.length <= 1)
62
- return resources;
63
- const indicesByName = new Map();
64
- for (let i = 0; i < resources.length; i++) {
65
- const name = resources[i]?.metadata?.name;
66
- if (!name)
67
- continue;
68
- const list = indicesByName.get(name);
69
- if (list)
70
- list.push(i);
71
- else
72
- indicesByName.set(name, [i]);
73
- }
74
- const edges = new Map();
75
- const indegree = new Map();
76
- for (let i = 0; i < resources.length; i++)
77
- indegree.set(i, 0);
78
- for (let i = 0; i < resources.length; i++) {
79
- const kind = resources[i]?.kind;
80
- if (!kind)
81
- continue;
82
- const definers = indicesByName.get(kind);
83
- if (!definers)
84
- continue;
85
- for (const definerIndex of definers) {
86
- if (definerIndex === i)
87
- continue;
88
- let set = edges.get(definerIndex);
89
- if (!set) {
90
- set = new Set();
91
- edges.set(definerIndex, set);
92
- }
93
- if (!set.has(i)) {
94
- set.add(i);
95
- indegree.set(i, (indegree.get(i) || 0) + 1);
96
- }
97
- }
98
- }
99
- const ready = [];
100
- for (let i = 0; i < resources.length; i++) {
101
- if ((indegree.get(i) || 0) === 0)
102
- ready.push(i);
103
- }
104
- ready.sort((a, b) => a - b);
105
- const ordered = [];
106
- while (ready.length > 0) {
107
- const index = ready.shift();
108
- ordered.push(resources[index]);
109
- const next = edges.get(index);
110
- if (!next)
111
- continue;
112
- for (const dependent of next) {
113
- const count = (indegree.get(dependent) || 0) - 1;
114
- indegree.set(dependent, count);
115
- if (count === 0)
116
- ready.push(dependent);
117
- }
118
- if (ready.length > 1)
119
- ready.sort((a, b) => a - b);
120
- }
121
- if (ordered.length !== resources.length)
122
- throw new Error("Resource dependency cycle detected");
123
- return ordered;
124
- }
125
- }
126
- Loader.projectRoot = null;
127
- //# sourceMappingURL=loader.js.map