@pbuilder/sdk 0.19.0 → 0.20.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 +46 -3
- package/dist/acl/irwire/stdio-engine-client.d.ts +1 -0
- package/dist/acl/irwire/stdio-engine-client.js +9 -0
- package/dist/bin/pbuilder-codegen.js +90 -18
- package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.d.ts +15 -0
- package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.js +17 -0
- package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.d.ts +16 -3
- package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.js +45 -11
- package/dist/bounded-contexts/authoring/domain/aggregates/session/session.d.ts +3 -1
- package/dist/bounded-contexts/authoring/domain/aggregates/session/session.js +10 -1
- package/dist/bounded-contexts/authoring/domain/ports/engine-client.d.ts +1 -0
- package/dist/bounded-contexts/authoring/domain/services/define-dialect.d.ts +28 -1
- package/dist/bounded-contexts/authoring/domain/services/define-dialect.js +27 -3
- package/dist/bounded-contexts/authoring/domain/services/evaluation.d.ts +29 -0
- package/dist/bounded-contexts/authoring/domain/services/evaluation.js +43 -0
- package/dist/bounded-contexts/authoring/domain/services/glob-match.d.ts +4 -0
- package/dist/bounded-contexts/authoring/domain/services/glob-match.js +81 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.d.ts +1 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.js +4 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.d.ts +2 -1
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.js +6 -2
- package/dist/bounded-contexts/authoring/domain/valueobjects/findings.d.ts +12 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/findings.js +57 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.d.ts +2 -0
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.d.ts +7 -2
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.js +28 -7
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.d.ts +6 -2
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.js +23 -13
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.d.ts +1 -0
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.js +5 -2
- package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.d.ts +2 -1
- package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.js +1 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.js +15 -0
- package/dist/bounded-contexts/authoring/testing/contract-fake.d.ts +1 -0
- package/dist/bounded-contexts/authoring/testing/contract-fake.js +8 -0
- package/dist/bounded-contexts/authoring/testing/glob-pattern.d.ts +5 -0
- package/dist/bounded-contexts/authoring/testing/glob-pattern.js +20 -0
- package/dist/bounded-contexts/authoring/testing/harness/index.d.ts +8 -0
- package/dist/bounded-contexts/authoring/testing/harness/index.js +12 -1
- package/dist/bounded-contexts/authoring/testing/run-vehicle.d.ts +1 -0
- package/dist/bounded-contexts/authoring/testing/run-vehicle.js +4 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.d.ts +3 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.js +4 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/runner.js +15 -3
- package/dist/runner-manifest.json +33 -9
- package/dist/shared-kernel/wire-protocol.d.ts +1 -1
- package/dist/shared-kernel/wire-protocol.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
1
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
2
|
import { type CsharpDocument } from "../csharp/ast.ts";
|
|
3
3
|
import { type CsharpOps } from "../csharp/pack.ts";
|
|
4
4
|
import { type Lifetime, type ServiceOptions } from "./ops.ts";
|
|
@@ -49,3 +49,16 @@ type AspnetOps = CsharpOps & ServiceOps;
|
|
|
49
49
|
* // -> var app = builder.Build();
|
|
50
50
|
*/
|
|
51
51
|
export declare function find(path: string): Handle<"found", CsharpDocument, AspnetOps>;
|
|
52
|
+
/**
|
|
53
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
54
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
55
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* import * as aspnet from "@pbuilder/sdk/aspnet";
|
|
59
|
+
*
|
|
60
|
+
* export const run = async () => {
|
|
61
|
+
* for (const file of await aspnet.glob("src/**\/*.cs")) await file.read();
|
|
62
|
+
* };
|
|
63
|
+
*/
|
|
64
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", CsharpDocument, AspnetOps>[]>;
|
|
@@ -47,3 +47,18 @@ const aspnetDialect = withOps(defineDialect({ extensions: [".cs"], ast: { parse,
|
|
|
47
47
|
export function find(path) {
|
|
48
48
|
return aspnetDialect.find(path);
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
52
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
53
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* import * as aspnet from "@pbuilder/sdk/aspnet";
|
|
57
|
+
*
|
|
58
|
+
* export const run = async () => {
|
|
59
|
+
* for (const file of await aspnet.glob("src/**\/*.cs")) await file.read();
|
|
60
|
+
* };
|
|
61
|
+
*/
|
|
62
|
+
export function glob(pattern, options) {
|
|
63
|
+
return aspnetDialect.glob(pattern, options);
|
|
64
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
1
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
2
|
import { type CsharpDocument } from "./ast.ts";
|
|
3
3
|
import type { FromOptions, UsingOptions } from "./ops.ts";
|
|
4
4
|
import { type CsharpOps } from "./pack.ts";
|
|
@@ -42,3 +42,16 @@ export type { CsharpDocument, FromOptions, UsingOptions };
|
|
|
42
42
|
* // -> }
|
|
43
43
|
*/
|
|
44
44
|
export declare function find(path: string): Handle<"found", CsharpDocument, CsharpOps>;
|
|
45
|
+
/**
|
|
46
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
47
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
48
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* import * as csharp from "@pbuilder/sdk/csharp";
|
|
52
|
+
*
|
|
53
|
+
* export const run = async () => {
|
|
54
|
+
* for (const file of await csharp.glob("src/**\/*.cs")) await file.read();
|
|
55
|
+
* };
|
|
56
|
+
*/
|
|
57
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", CsharpDocument, CsharpOps>[]>;
|
|
@@ -43,3 +43,18 @@ const csharpDialect = withOps(defineDialect({ extensions: [".cs"], ast: { parse,
|
|
|
43
43
|
export function find(path) {
|
|
44
44
|
return csharpDialect.find(path);
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
48
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
49
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* import * as csharp from "@pbuilder/sdk/csharp";
|
|
53
|
+
*
|
|
54
|
+
* export const run = async () => {
|
|
55
|
+
* for (const file of await csharp.glob("src/**\/*.cs")) await file.read();
|
|
56
|
+
* };
|
|
57
|
+
*/
|
|
58
|
+
export function glob(pattern, options) {
|
|
59
|
+
return csharpDialect.glob(pattern, options);
|
|
60
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Root } from "postcss";
|
|
2
|
-
import { type Handle, type Query } from "../../../../domain/services/define-dialect.ts";
|
|
2
|
+
import { type GlobOptions, type Handle, type Query } from "../../../../domain/services/define-dialect.ts";
|
|
3
3
|
import { getDeclaration, type CssTarget, type DeclarationOptions } from "./ops.ts";
|
|
4
4
|
export * as astLibrary from "postcss";
|
|
5
5
|
export { getDeclaration };
|
|
@@ -38,3 +38,16 @@ type CssOps = {
|
|
|
38
38
|
* // -> }
|
|
39
39
|
*/
|
|
40
40
|
export declare function find(path: string): Handle<"found", Root, CssOps>;
|
|
41
|
+
/**
|
|
42
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
43
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
44
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* import * as css from "@pbuilder/sdk/css";
|
|
48
|
+
*
|
|
49
|
+
* export const run = async () => {
|
|
50
|
+
* for (const file of await css.glob("src/**\/*.css")) await file.read();
|
|
51
|
+
* };
|
|
52
|
+
*/
|
|
53
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", Root, CssOps>[]>;
|
|
@@ -36,3 +36,18 @@ const cssDialect = withOps(defineDialect({ extensions: [".css"], ast: { parse, p
|
|
|
36
36
|
export function find(path) {
|
|
37
37
|
return cssDialect.find(path);
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
41
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
42
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* import * as css from "@pbuilder/sdk/css";
|
|
46
|
+
*
|
|
47
|
+
* export const run = async () => {
|
|
48
|
+
* for (const file of await css.glob("src/**\/*.css")) await file.read();
|
|
49
|
+
* };
|
|
50
|
+
*/
|
|
51
|
+
export function glob(pattern, options) {
|
|
52
|
+
return cssDialect.glob(pattern, options);
|
|
53
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
1
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
2
|
import type { JsonPath, JsonValue } from "../../../../domain/valueobjects/json-value.ts";
|
|
3
3
|
import { type JsonDocument } from "./ast.ts";
|
|
4
4
|
import { type AppendOptions, type KeyPosition, type SortOptions } from "./ops.ts";
|
|
@@ -53,3 +53,16 @@ type JsonOps = {
|
|
|
53
53
|
* // -> }
|
|
54
54
|
*/
|
|
55
55
|
export declare function find(path: string): Handle<"found", JsonDocument, JsonOps>;
|
|
56
|
+
/**
|
|
57
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
58
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
59
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* import * as json from "@pbuilder/sdk/json";
|
|
63
|
+
*
|
|
64
|
+
* export const run = async () => {
|
|
65
|
+
* for (const file of await json.glob("**\/package.json")) await file.read();
|
|
66
|
+
* };
|
|
67
|
+
*/
|
|
68
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", JsonDocument, JsonOps>[]>;
|
|
@@ -52,3 +52,18 @@ const jsonDialect = withOps(defineDialect({ extensions: [".json", ".jsonc"], ast
|
|
|
52
52
|
export function find(path) {
|
|
53
53
|
return jsonDialect.find(path);
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
57
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
58
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* import * as json from "@pbuilder/sdk/json";
|
|
62
|
+
*
|
|
63
|
+
* export const run = async () => {
|
|
64
|
+
* for (const file of await json.glob("**\/package.json")) await file.read();
|
|
65
|
+
* };
|
|
66
|
+
*/
|
|
67
|
+
export function glob(pattern, options) {
|
|
68
|
+
return jsonDialect.glob(pattern, options);
|
|
69
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
1
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
2
|
import { type MsbuildDocument } from "./ast.ts";
|
|
3
3
|
import { type ProjectOptions } from "./ops.ts";
|
|
4
4
|
export * as astLibrary from "saxes";
|
|
@@ -53,3 +53,16 @@ type MsbuildOps = {
|
|
|
53
53
|
* // -> </Solution>
|
|
54
54
|
*/
|
|
55
55
|
export declare function find(path: string): Handle<"found", MsbuildDocument, MsbuildOps>;
|
|
56
|
+
/**
|
|
57
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
58
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
59
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* import * as msbuild from "@pbuilder/sdk/msbuild";
|
|
63
|
+
*
|
|
64
|
+
* export const run = async () => {
|
|
65
|
+
* for (const file of await msbuild.glob("**\/*.csproj")) await file.read();
|
|
66
|
+
* };
|
|
67
|
+
*/
|
|
68
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", MsbuildDocument, MsbuildOps>[]>;
|
|
@@ -52,3 +52,18 @@ const msbuildDialect = withOps(defineDialect({ extensions: [".csproj", ".props",
|
|
|
52
52
|
export function find(path) {
|
|
53
53
|
return msbuildDialect.find(path);
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
57
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
58
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* import * as msbuild from "@pbuilder/sdk/msbuild";
|
|
62
|
+
*
|
|
63
|
+
* export const run = async () => {
|
|
64
|
+
* for (const file of await msbuild.glob("**\/*.csproj")) await file.read();
|
|
65
|
+
* };
|
|
66
|
+
*/
|
|
67
|
+
export function glob(pattern, options) {
|
|
68
|
+
return msbuildDialect.glob(pattern, options);
|
|
69
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SourceFile } from "ts-morph";
|
|
2
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
3
3
|
import { typescriptOps } from "../typescript/pack.ts";
|
|
4
4
|
export * as astLibrary from "ts-morph";
|
|
5
5
|
type ModuleOps = {
|
|
@@ -41,3 +41,16 @@ type NestOps = typeof typescriptOps & ModuleOps;
|
|
|
41
41
|
* // -> export class AppModule {}
|
|
42
42
|
*/
|
|
43
43
|
export declare function find(path: string): Handle<"found", SourceFile, NestOps>;
|
|
44
|
+
/**
|
|
45
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
46
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
47
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* import * as nestjs from "@pbuilder/sdk/nestjs";
|
|
51
|
+
*
|
|
52
|
+
* export const run = async () => {
|
|
53
|
+
* for (const file of await nestjs.glob("src/**\/*.module.ts")) await file.read();
|
|
54
|
+
* };
|
|
55
|
+
*/
|
|
56
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, NestOps>[]>;
|
|
@@ -44,3 +44,18 @@ const nestjsDialect = withOps(baseDialect, typescriptOps, moduleOps);
|
|
|
44
44
|
export function find(path) {
|
|
45
45
|
return nestjsDialect.find(path);
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
49
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
50
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* import * as nestjs from "@pbuilder/sdk/nestjs";
|
|
54
|
+
*
|
|
55
|
+
* export const run = async () => {
|
|
56
|
+
* for (const file of await nestjs.glob("src/**\/*.module.ts")) await file.read();
|
|
57
|
+
* };
|
|
58
|
+
*/
|
|
59
|
+
export function glob(pattern, options) {
|
|
60
|
+
return nestjsDialect.glob(pattern, options);
|
|
61
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SourceFile } from "ts-morph";
|
|
2
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
3
3
|
import { typescriptOps } from "../typescript/pack.ts";
|
|
4
4
|
import { type JsxTarget } from "./ops.ts";
|
|
5
5
|
export * as astLibrary from "ts-morph";
|
|
@@ -50,3 +50,16 @@ type ReactOps = typeof typescriptOps & JsxOps;
|
|
|
50
50
|
* // -> const el = <Button onClick={handleClick} />;
|
|
51
51
|
*/
|
|
52
52
|
export declare function find(path: string): Handle<"found", SourceFile, ReactOps>;
|
|
53
|
+
/**
|
|
54
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
55
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
56
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* import * as react from "@pbuilder/sdk/react";
|
|
60
|
+
*
|
|
61
|
+
* export const run = async () => {
|
|
62
|
+
* for (const file of await react.glob("src/**\/*.tsx")) await file.read();
|
|
63
|
+
* };
|
|
64
|
+
*/
|
|
65
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, ReactOps>[]>;
|
|
@@ -71,3 +71,18 @@ export function find(path) {
|
|
|
71
71
|
}
|
|
72
72
|
throw dialectError("find(path) — .tsx and .jsx are the only extensions the React dialect supports.");
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
76
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
77
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* import * as react from "@pbuilder/sdk/react";
|
|
81
|
+
*
|
|
82
|
+
* export const run = async () => {
|
|
83
|
+
* for (const file of await react.glob("src/**\/*.tsx")) await file.read();
|
|
84
|
+
* };
|
|
85
|
+
*/
|
|
86
|
+
export function glob(pattern, options) {
|
|
87
|
+
return reactDialect.glob(pattern, options);
|
|
88
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SourceFile } from "ts-morph";
|
|
2
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
3
3
|
import type { ArrayElement, ArrayLocator } from "./array-element.ts";
|
|
4
4
|
import type { ClassPropertyOptions } from "./class-property.ts";
|
|
5
5
|
export * as astLibrary from "ts-morph";
|
|
@@ -51,3 +51,16 @@ type TypeScriptOps = {
|
|
|
51
51
|
* };
|
|
52
52
|
*/
|
|
53
53
|
export declare function find(path: string): Handle<"found", SourceFile, TypeScriptOps>;
|
|
54
|
+
/**
|
|
55
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
56
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
57
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* import * as ts from "@pbuilder/sdk/typescript";
|
|
61
|
+
*
|
|
62
|
+
* export const run = async () => {
|
|
63
|
+
* for (const file of await ts.glob("src/**\/*.ts")) await file.read();
|
|
64
|
+
* };
|
|
65
|
+
*/
|
|
66
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, TypeScriptOps>[]>;
|
|
@@ -35,3 +35,18 @@ const typescriptDialect = withOps(baseDialect, opsPack);
|
|
|
35
35
|
export function find(path) {
|
|
36
36
|
return typescriptDialect.find(path);
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
40
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
41
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* import * as ts from "@pbuilder/sdk/typescript";
|
|
45
|
+
*
|
|
46
|
+
* export const run = async () => {
|
|
47
|
+
* for (const file of await ts.glob("src/**\/*.ts")) await file.read();
|
|
48
|
+
* };
|
|
49
|
+
*/
|
|
50
|
+
export function glob(pattern, options) {
|
|
51
|
+
return typescriptDialect.glob(pattern, options);
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
1
|
+
import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
|
|
2
2
|
import { type YamlStream } from "./ast.ts";
|
|
3
3
|
import type { DocumentOption, YamlPath, YamlValue } from "./paths.ts";
|
|
4
4
|
import { type CollectionStyle, type CommentOptions, type ScalarStyle } from "./presentation.ts";
|
|
@@ -67,3 +67,16 @@ type YamlOps = {
|
|
|
67
67
|
* // -> - 3000:3000
|
|
68
68
|
*/
|
|
69
69
|
export declare function find(path: string): Handle<"found", YamlStream, YamlOps>;
|
|
70
|
+
/**
|
|
71
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
72
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
73
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* import * as yaml from "@pbuilder/sdk/yaml";
|
|
77
|
+
*
|
|
78
|
+
* export const run = async () => {
|
|
79
|
+
* for (const file of await yaml.glob("**\/*.{yml,yaml}")) await file.read();
|
|
80
|
+
* };
|
|
81
|
+
*/
|
|
82
|
+
export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", YamlStream, YamlOps>[]>;
|
|
@@ -68,3 +68,18 @@ const yamlDialect = withOps(baseDialect, opsPack);
|
|
|
68
68
|
export function find(path) {
|
|
69
69
|
return yamlDialect.find(path);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
73
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
74
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* import * as yaml from "@pbuilder/sdk/yaml";
|
|
78
|
+
*
|
|
79
|
+
* export const run = async () => {
|
|
80
|
+
* for (const file of await yaml.glob("**\/*.{yml,yaml}")) await file.read();
|
|
81
|
+
* };
|
|
82
|
+
*/
|
|
83
|
+
export function glob(pattern, options) {
|
|
84
|
+
return yamlDialect.glob(pattern, options);
|
|
85
|
+
}
|
|
@@ -14,4 +14,5 @@ export declare class ContractFake implements EngineClient {
|
|
|
14
14
|
committedTree(): ReadonlyMap<string, string>;
|
|
15
15
|
stagingTree(): ReadonlyMap<string, string>;
|
|
16
16
|
read(filePath: string): Promise<string | undefined>;
|
|
17
|
+
list(pattern: string, ignore?: readonly string[]): Promise<readonly string[]>;
|
|
17
18
|
}
|
|
@@ -8,6 +8,7 @@ import { posix as path } from "node:path";
|
|
|
8
8
|
import { exceedsEmitBatchBudget } from "../domain/valueobjects/wire.js";
|
|
9
9
|
import { EMIT_BATCH_BUDGET_BYTES, EMIT_FRAME_ENVELOPE_ALLOWANCE_BYTES } from "../../../shared-kernel/batch-cap.js";
|
|
10
10
|
import { EmitRejection } from "../domain/ports/emit-rejection.js";
|
|
11
|
+
import { listMatching } from "./glob-pattern.js";
|
|
11
12
|
import { deepEqual } from "../../../platform/deep-equal.js";
|
|
12
13
|
import { CONTRACT_FAKE_PREFIX, ALREADY_EXISTS, USE_FORCE_TO_OVERWRITE, NOT_FOUND, EXCEEDS_SIZE_CAP, ROUND_TRIP_FIDELITY_CHECK, JSON_SERIALIZATION, } from "./rejection-messages.js";
|
|
13
14
|
export class ContractFake {
|
|
@@ -98,6 +99,13 @@ export class ContractFake {
|
|
|
98
99
|
}
|
|
99
100
|
return undefined;
|
|
100
101
|
}
|
|
102
|
+
// Sees staging as read() does: staged and seeded paths, minus the deleted ones.
|
|
103
|
+
async list(pattern, ignore) {
|
|
104
|
+
const present = new Set([...Object.keys(this.#seed), ...this.#tree.keys()]);
|
|
105
|
+
for (const p of this.#deleted)
|
|
106
|
+
present.delete(p);
|
|
107
|
+
return listMatching(present, pattern, ignore);
|
|
108
|
+
}
|
|
101
109
|
#exists(p) {
|
|
102
110
|
if (this.#deleted.has(p))
|
|
103
111
|
return false;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paths among `files` that `pattern` matches and no `ignore` pattern does, sorted bytewise.
|
|
3
|
+
* Every alternative of `pattern` must stay inside the workspace, as the engine's gate requires.
|
|
4
|
+
*/
|
|
5
|
+
export declare function listMatching(files: Iterable<string>, pattern: string, ignore?: readonly string[]): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The listing the in-memory engines answer `list` with, matching as the engine's `tree.list` does.
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import { alternatives, globMatcher } from "../domain/services/glob-match.js";
|
|
4
|
+
/**
|
|
5
|
+
* The paths among `files` that `pattern` matches and no `ignore` pattern does, sorted bytewise.
|
|
6
|
+
* Every alternative of `pattern` must stay inside the workspace, as the engine's gate requires.
|
|
7
|
+
*/
|
|
8
|
+
export function listMatching(files, pattern, ignore = []) {
|
|
9
|
+
for (const alternative of alternatives(pattern)) {
|
|
10
|
+
const normalized = posix.normalize(alternative);
|
|
11
|
+
if (posix.isAbsolute(alternative) || normalized === ".." || normalized.startsWith("../")) {
|
|
12
|
+
throw new Error("path escapes workspace");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const matches = globMatcher(pattern);
|
|
16
|
+
const ignored = ignore.map(globMatcher);
|
|
17
|
+
return [...files]
|
|
18
|
+
.filter((path) => matches(path) && !ignored.some((ignores) => ignores(path)))
|
|
19
|
+
.sort((a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b)));
|
|
20
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Batch, Directive } from "../../domain/valueobjects/wire.ts";
|
|
2
2
|
import type { AuthoringError } from "../../domain/valueobjects/authoring-error.ts";
|
|
3
|
+
import type { Role } from "../../domain/valueobjects/findings.ts";
|
|
3
4
|
/**
|
|
4
5
|
* The outcome of running a factory via `runFactoryForTest`.
|
|
5
6
|
*
|
|
@@ -65,6 +66,11 @@ export type { Batch, Directive };
|
|
|
65
66
|
* `packageDir` at all.
|
|
66
67
|
* @param options.declaredDialects - the names of the author-defined dialects the schematic's
|
|
67
68
|
* library declares in its Manifest; a handle of any other named dialect fails the run (A-16).
|
|
69
|
+
* @param options.role - the role the schematic declares in its Collection definition entry. With
|
|
70
|
+
* `evaluation`, `fn` returns its Findings and `result.result` holds them as they leave the
|
|
71
|
+
* schematic: each with its `source`, and only those inside the scope `include` and `exclude` name.
|
|
72
|
+
* @param options.name - the qualified name `collection:schematic` of the schematic, which an
|
|
73
|
+
* evaluation's findings carry as their `source`; required with the role `evaluation`.
|
|
68
74
|
*
|
|
69
75
|
* @example
|
|
70
76
|
* import { runFactoryForTest } from "@pbuilder/sdk/testing";
|
|
@@ -95,4 +101,6 @@ export declare function runFactoryForTest<O, R = void>(fn: (input: O) => R | Pro
|
|
|
95
101
|
seed?: Record<string, string>;
|
|
96
102
|
packageDir?: string | URL;
|
|
97
103
|
declaredDialects?: readonly string[];
|
|
104
|
+
role?: Role;
|
|
105
|
+
name?: string;
|
|
98
106
|
}): Promise<RunResult<R>>;
|
|
@@ -29,6 +29,11 @@ import { nodePackageFiles } from "../../infrastructure/out/fs/package-files.js";
|
|
|
29
29
|
* `packageDir` at all.
|
|
30
30
|
* @param options.declaredDialects - the names of the author-defined dialects the schematic's
|
|
31
31
|
* library declares in its Manifest; a handle of any other named dialect fails the run (A-16).
|
|
32
|
+
* @param options.role - the role the schematic declares in its Collection definition entry. With
|
|
33
|
+
* `evaluation`, `fn` returns its Findings and `result.result` holds them as they leave the
|
|
34
|
+
* schematic: each with its `source`, and only those inside the scope `include` and `exclude` name.
|
|
35
|
+
* @param options.name - the qualified name `collection:schematic` of the schematic, which an
|
|
36
|
+
* evaluation's findings carry as their `source`; required with the role `evaluation`.
|
|
32
37
|
*
|
|
33
38
|
* @example
|
|
34
39
|
* import { runFactoryForTest } from "@pbuilder/sdk/testing";
|
|
@@ -56,6 +61,9 @@ import { nodePackageFiles } from "../../infrastructure/out/fs/package-files.js";
|
|
|
56
61
|
* });
|
|
57
62
|
*/
|
|
58
63
|
export async function runFactoryForTest(fn, input, options) {
|
|
64
|
+
if (options?.role === "evaluation" && options.name === undefined) {
|
|
65
|
+
throw new Error("runFactoryForTest: an evaluation factory needs options.name, the qualified name collection:schematic");
|
|
66
|
+
}
|
|
59
67
|
const fake = new ContractFake({ seed: options?.seed ?? {} });
|
|
60
68
|
const emitted = [];
|
|
61
69
|
const reads = new Map();
|
|
@@ -69,6 +77,9 @@ export async function runFactoryForTest(fn, input, options) {
|
|
|
69
77
|
reads.set(path, (reads.get(path) ?? 0) + 1);
|
|
70
78
|
return fake.read(path);
|
|
71
79
|
},
|
|
80
|
+
list(pattern, ignore) {
|
|
81
|
+
return fake.list(pattern, ignore);
|
|
82
|
+
},
|
|
72
83
|
commit(result) {
|
|
73
84
|
committed = result;
|
|
74
85
|
return fake.commit();
|
|
@@ -82,7 +93,7 @@ export async function runFactoryForTest(fn, input, options) {
|
|
|
82
93
|
: { declaredDialects: options?.declaredDialects });
|
|
83
94
|
let error;
|
|
84
95
|
try {
|
|
85
|
-
await run(input, { client });
|
|
96
|
+
await run(input, { client, role: options?.role, name: options?.name });
|
|
86
97
|
}
|
|
87
98
|
catch (caught) {
|
|
88
99
|
error = caught;
|
|
@@ -3,6 +3,7 @@ import type { Batch } from "../domain/valueobjects/wire.ts";
|
|
|
3
3
|
interface RunVehicleClient {
|
|
4
4
|
emit(batch: Batch): Promise<void>;
|
|
5
5
|
read(path: string): Promise<string | undefined>;
|
|
6
|
+
list(pattern: string, ignore?: readonly string[]): Promise<readonly string[]>;
|
|
6
7
|
commit(): Promise<void>;
|
|
7
8
|
discard(): Promise<void>;
|
|
8
9
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// its allow-list is exactly one path, and this is not it). The port shape is satisfied via a
|
|
17
17
|
// LOCAL structural type instead — the same sanctioned pattern `src/testing/index.ts`'s facade
|
|
18
18
|
// uses for its own spy-wrapping.
|
|
19
|
+
import { listMatching } from "./glob-pattern.js";
|
|
19
20
|
function applyDirective(tree, directive) {
|
|
20
21
|
if (directive.op === "create") {
|
|
21
22
|
tree.set(directive.create.pathTemplate, directive.create.template);
|
|
@@ -91,6 +92,9 @@ export function createRunVehicle(seed) {
|
|
|
91
92
|
async read(path) {
|
|
92
93
|
return tree.get(path);
|
|
93
94
|
},
|
|
95
|
+
async list(pattern, ignore) {
|
|
96
|
+
return listMatching(tree.keys(), pattern, ignore);
|
|
97
|
+
},
|
|
94
98
|
async commit() {
|
|
95
99
|
// Nothing to promote — this vehicle applies eagerly on emit (no staging/committed
|
|
96
100
|
// distinction; each exercise is a fresh, single-purpose, single-run instance whose
|
|
@@ -15,6 +15,9 @@ export interface BridgeParams {
|
|
|
15
15
|
input: BridgeInput;
|
|
16
16
|
/** The Frame's declared dialects (A-16, CA-5); absent means none. */
|
|
17
17
|
dialects?: readonly DeclaredDialect[];
|
|
18
|
+
/** The root's role and qualified name (CA-19); absent when the engine has none to pass. */
|
|
19
|
+
role?: string;
|
|
20
|
+
name?: string;
|
|
18
21
|
}
|
|
19
22
|
export interface BridgeIo {
|
|
20
23
|
input: RunnerIo["input"];
|
|
@@ -46,6 +46,10 @@ function toArgv(params) {
|
|
|
46
46
|
argv.push("--input-file", params.input.path);
|
|
47
47
|
if (params.dialects !== undefined)
|
|
48
48
|
argv.push("--dialects", JSON.stringify(params.dialects));
|
|
49
|
+
if (params.role !== undefined)
|
|
50
|
+
argv.push("--role", params.role);
|
|
51
|
+
if (params.name !== undefined)
|
|
52
|
+
argv.push("--name", params.name);
|
|
49
53
|
return argv;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
@@ -91,13 +91,16 @@ function parseDialects(value) {
|
|
|
91
91
|
return dialects;
|
|
92
92
|
}
|
|
93
93
|
// REQ-RUN-01: `--factory <url>#<export>` required; exactly one of `--input <json>` XOR
|
|
94
|
-
// `--input-file <path>`; `--dialects <json>` optional, absent meaning none declared;
|
|
95
|
-
//
|
|
94
|
+
// `--input-file <path>`; `--dialects <json>` optional, absent meaning none declared; `--role`
|
|
95
|
+
// and `--name` optional, the root's role and qualified name the engine passes unread (CA-19);
|
|
96
|
+
// any unrecognized flag fails closed.
|
|
96
97
|
function parseArgv(argv) {
|
|
97
98
|
let factory;
|
|
98
99
|
let inputJson;
|
|
99
100
|
let inputFile;
|
|
100
101
|
let dialects = [];
|
|
102
|
+
let role;
|
|
103
|
+
let name;
|
|
101
104
|
for (let i = 0; i < argv.length; i += 2) {
|
|
102
105
|
const flag = argv[i];
|
|
103
106
|
const value = argv[i + 1];
|
|
@@ -116,6 +119,10 @@ function parseArgv(argv) {
|
|
|
116
119
|
return { error: DIALECTS_SHAPE };
|
|
117
120
|
dialects = declared;
|
|
118
121
|
}
|
|
122
|
+
else if (flag === "--role")
|
|
123
|
+
role = value;
|
|
124
|
+
else if (flag === "--name")
|
|
125
|
+
name = value;
|
|
119
126
|
else
|
|
120
127
|
return { error: composeWithToken("pbuilder-runner: unrecognized flag ", flag) };
|
|
121
128
|
}
|
|
@@ -127,9 +134,14 @@ function parseArgv(argv) {
|
|
|
127
134
|
if (inputJson === undefined && inputFile === undefined) {
|
|
128
135
|
return { error: "pbuilder-runner: exactly one of --input or --input-file is required" };
|
|
129
136
|
}
|
|
137
|
+
if (role === "evaluation" && name === undefined) {
|
|
138
|
+
return { error: "pbuilder-runner: --role evaluation needs --name, the qualified name collection:schematic" };
|
|
139
|
+
}
|
|
130
140
|
return {
|
|
131
141
|
factory,
|
|
132
142
|
dialects,
|
|
143
|
+
role,
|
|
144
|
+
name,
|
|
133
145
|
input: inputJson !== undefined ? { kind: "inline", json: inputJson } : { kind: "file", path: inputFile },
|
|
134
146
|
};
|
|
135
147
|
}
|
|
@@ -385,7 +397,7 @@ async function runRunnerBody(argv, io, opened) {
|
|
|
385
397
|
};
|
|
386
398
|
const client = new StdioEngineClient(channel);
|
|
387
399
|
try {
|
|
388
|
-
await run(resolvedInput.value, { client });
|
|
400
|
+
await run(resolvedInput.value, { client, role: parsed.role, name: parsed.name });
|
|
389
401
|
return 0;
|
|
390
402
|
}
|
|
391
403
|
catch (err) {
|