@pogodisco/task-runner 0.2.0 → 0.2.1
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/dist/v2/command/main.d.ts +2 -1
- package/dist/v2/command/main.js +13 -2
- package/dist/v2/graph/index.d.ts +2 -2
- package/dist/v2/graph/index.js +2 -1
- package/dist/v2/graph/registry.d.ts +4 -4
- package/dist/v2/graph/registry.js +5 -2
- package/dist/v2/index.d.ts +2 -3
- package/dist/v2/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TResponse } from "@pogodisco/response";
|
|
2
2
|
export type CommandInputFor<R extends Record<string, any>, K extends keyof R> = R[K] extends (args: infer I) => any ? I : never;
|
|
3
3
|
export type CommandOutputFor<R extends Record<string, any>, K extends keyof R> = R[K] extends (args: any) => Promise<TResponse<infer O>> ? O : never;
|
|
4
|
-
export declare function createCommandRegistrar<R extends Record<string, (...args: any) => Promise<TResponse<any>>>>(registry: R): <
|
|
4
|
+
export declare function createCommandRegistrar<R extends Record<string, (...args: any) => Promise<TResponse<any>>>>(registry: R): CommandRegistrar<R>;
|
|
5
|
+
export type CommandRegistrar<R extends Record<string, (...args: any) => Promise<TResponse<any>>>> = <K extends keyof R & string>(name: K, params: CommandInputFor<R, K>) => Promise<TResponse<CommandOutputFor<R, K>>>;
|
package/dist/v2/command/main.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
// -----------------------------
|
|
2
2
|
// Registrar creator
|
|
3
3
|
// -----------------------------
|
|
4
|
+
// export function createCommandRegistrar<
|
|
5
|
+
// R extends Record<string, (...args: any) => Promise<TResponse<any>>>,
|
|
6
|
+
// >(registry: R): CommandRegistrar<R> {
|
|
7
|
+
// return async function appCommand<K extends keyof R & string>(
|
|
8
|
+
// name: K,
|
|
9
|
+
// params: CommandInputFor<R, K>,
|
|
10
|
+
// ): Promise<TResponse<CommandOutputFor<R, K>>> {
|
|
11
|
+
// const fn = registry[name];
|
|
12
|
+
// return await fn(params);
|
|
13
|
+
// };
|
|
14
|
+
// }
|
|
4
15
|
export function createCommandRegistrar(registry) {
|
|
5
|
-
return async
|
|
16
|
+
return async (name, params) => {
|
|
6
17
|
const fn = registry[name];
|
|
7
|
-
return
|
|
18
|
+
return fn(params);
|
|
8
19
|
};
|
|
9
20
|
}
|
package/dist/v2/graph/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./types/index.js";
|
|
2
2
|
export { createGraph, runGraph } from "./main.js";
|
|
3
|
-
export
|
|
3
|
+
export * from "./registry.js";
|
package/dist/v2/graph/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeCtx, SchemaGraph } from "./types/index.js";
|
|
2
|
-
type GraphInputFor<R extends Record<string, SchemaGraph<any, any>>, K extends keyof R> = R[K] extends SchemaGraph<any, infer I> ? I : never;
|
|
3
|
-
type GraphOutputFor<R extends Record<string, SchemaGraph<any, any>>, K extends keyof R> = R[K] extends SchemaGraph<infer N, infer I> ? RuntimeCtx<N, I> : never;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
2
|
+
export type GraphInputFor<R extends Record<string, SchemaGraph<any, any>>, K extends keyof R> = R[K] extends SchemaGraph<any, infer I> ? I : never;
|
|
3
|
+
export type GraphOutputFor<R extends Record<string, SchemaGraph<any, any>>, K extends keyof R> = R[K] extends SchemaGraph<infer N, infer I> ? RuntimeCtx<N, I> : never;
|
|
4
|
+
export type GraphRegistrar<R extends Record<string, SchemaGraph<any, any>>> = <K extends keyof R & string>(name: K, params: GraphInputFor<R, K>) => Promise<GraphOutputFor<R, K>>;
|
|
5
|
+
export declare function createGraphRegistrar<R extends Record<string, SchemaGraph<any, any>>>(registry: R): GraphRegistrar<R>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { runGraph } from "./main.js";
|
|
2
|
+
// -----------------------------
|
|
3
|
+
// Factory
|
|
4
|
+
// -----------------------------
|
|
2
5
|
export function createGraphRegistrar(registry) {
|
|
3
|
-
return async
|
|
6
|
+
return async (name, params) => {
|
|
4
7
|
const graph = registry[name];
|
|
5
|
-
return runGraph(graph, params);
|
|
8
|
+
return runGraph(graph, params);
|
|
6
9
|
};
|
|
7
10
|
}
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { runSchema, defineSchema } from "./main.js";
|
|
2
2
|
export { wrapSchema } from "./utils/index.js";
|
|
3
|
-
export { type TaskLogger, type LogEvent, type TasksFromFns, } from "./types/index.js";
|
|
4
3
|
export * from "./graph/index.js";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
export * from "./types/index.js";
|
|
5
|
+
export * from "./command/main.js";
|
package/dist/v2/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { runSchema, defineSchema } from "./main.js";
|
|
2
2
|
export { wrapSchema } from "./utils/index.js";
|
|
3
3
|
export * from "./graph/index.js";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export * from "./types/index.js";
|
|
5
|
+
export * from "./command/main.js";
|