@pbuilder/sdk 0.17.0 → 0.19.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 (61) hide show
  1. package/README.md +69 -3
  2. package/dist/acl/irwire/stdio-engine-client.d.ts +1 -1
  3. package/dist/acl/irwire/stdio-engine-client.js +3 -2
  4. package/dist/bin/pbuilder-codegen.js +59 -1
  5. package/dist/bin/pbuilder-conformance.d.ts +2 -0
  6. package/dist/bin/pbuilder-conformance.js +45 -0
  7. package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.d.ts +12 -3
  8. package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.js +23 -9
  9. package/dist/bounded-contexts/authoring/application/usecases/scaffold/expander.js +4 -4
  10. package/dist/bounded-contexts/authoring/domain/aggregates/session/session.d.ts +2 -1
  11. package/dist/bounded-contexts/authoring/domain/aggregates/session/session.js +56 -6
  12. package/dist/bounded-contexts/authoring/domain/entities/dialect-handle.d.ts +2 -1
  13. package/dist/bounded-contexts/authoring/domain/entities/dialect-handle.js +108 -30
  14. package/dist/bounded-contexts/authoring/domain/ports/engine-client.d.ts +1 -1
  15. package/dist/bounded-contexts/authoring/domain/services/define-dialect.d.ts +48 -10
  16. package/dist/bounded-contexts/authoring/domain/services/define-dialect.js +37 -9
  17. package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.d.ts +1 -0
  18. package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.js +4 -0
  19. package/dist/bounded-contexts/authoring/domain/services/schema/schema-parse.d.ts +3 -2
  20. package/dist/bounded-contexts/authoring/domain/services/schema/schema-parse.js +46 -4
  21. package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.d.ts +16 -1
  22. package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.js +125 -0
  23. package/dist/bounded-contexts/authoring/domain/valueobjects/authoring-error.d.ts +3 -2
  24. package/dist/bounded-contexts/authoring/domain/valueobjects/authoring-error.js +2 -0
  25. package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.d.ts +17 -0
  26. package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.js +1 -0
  27. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.d.ts +1 -0
  28. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.js +23 -0
  29. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.js +2 -2
  30. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.d.ts +8 -5
  31. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.js +7 -4
  32. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/ops.d.ts +1 -1
  33. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/ops.js +20 -7
  34. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.d.ts +20 -2
  35. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.js +19 -3
  36. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/ops.d.ts +5 -0
  37. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/ops.js +89 -20
  38. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.js +2 -2
  39. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/ast.d.ts +2 -0
  40. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/ast.js +4 -0
  41. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.js +3 -3
  42. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/ast.d.ts +2 -0
  43. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/ast.js +4 -0
  44. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.js +2 -2
  45. package/dist/bounded-contexts/authoring/testing/conformance/index.d.ts +10 -12
  46. package/dist/bounded-contexts/authoring/testing/conformance/index.js +17 -2
  47. package/dist/bounded-contexts/authoring/testing/conformance/run-package.d.ts +37 -0
  48. package/dist/bounded-contexts/authoring/testing/conformance/run-package.js +209 -0
  49. package/dist/bounded-contexts/authoring/testing/harness/index.d.ts +13 -4
  50. package/dist/bounded-contexts/authoring/testing/harness/index.js +10 -4
  51. package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.d.ts +3 -0
  52. package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.js +2 -0
  53. package/dist/bounded-contexts/runner-hosting/infrastructure/in/runner.js +69 -3
  54. package/dist/bounded-contexts/runner-hosting/infrastructure/in/single-instance-probe.d.ts +24 -0
  55. package/dist/bounded-contexts/runner-hosting/infrastructure/in/single-instance-probe.js +34 -1
  56. package/dist/conformance/index.d.ts +1 -0
  57. package/dist/conformance/index.js +1 -0
  58. package/dist/dialect/index.d.ts +2 -0
  59. package/dist/dialect/index.js +3 -0
  60. package/dist/runner-manifest.json +12 -12
  61. package/package.json +8 -2
@@ -21,3 +21,27 @@ export type SingleInstanceProbeResult = {
21
21
  * with the REAL default resolver in the split/unresolvable test cases.
22
22
  */
23
23
  export declare function probeSingleInstance(factoryUrl: string, resolveSpecifier?: (specifier: string, anchorUrl: string) => string): SingleInstanceProbeResult;
24
+ /** A published dialect, installed into the Cache: `root` is the package the Lock pins. */
25
+ export interface PublishedDialect {
26
+ kind?: undefined;
27
+ name: string;
28
+ version: string;
29
+ root: string;
30
+ }
31
+ /** A local dialect (CA-18): `root` is the folder the engine hashed, `path` its base file. */
32
+ export interface LocalDeclaredDialect {
33
+ kind: "local";
34
+ name: string;
35
+ root: string;
36
+ path: string;
37
+ }
38
+ /** One dialect the Frame's library declares (CA-5): published unless its `kind` is `"local"`. */
39
+ export type DeclaredDialect = PublishedDialect | LocalDeclaredDialect;
40
+ /**
41
+ * A-16 / A-4: before the factory starts, resolves each declared dialect's name from the factory's
42
+ * location, the same resolution its own `import` gets, and requires the real path inside the copy
43
+ * the Lock pins. A local dialect's name is no specifier, so its base file's real path must sit inside
44
+ * its folder instead (CA-18). It keeps the dialect that runs the pinned one; it is no security boundary.
45
+ * Resolution-only, like `probeSingleInstance`; an unresolvable name fails the same way.
46
+ */
47
+ export declare function probeDeclaredDialects(factoryUrl: string, dialects: readonly DeclaredDialect[], resolveSpecifier?: (specifier: string, anchorUrl: string) => string): SingleInstanceProbeResult;
@@ -30,7 +30,7 @@
30
30
  import { existsSync, realpathSync } from "node:fs";
31
31
  import { createRequire } from "node:module";
32
32
  import { fileURLToPath } from "node:url";
33
- import { dirname, join } from "node:path";
33
+ import { dirname, isAbsolute, join, relative } from "node:path";
34
34
  import { toProjectRelativePath } from "../../../../platform/error-text.js";
35
35
  const SDK_SPECIFIER = "@pbuilder/sdk";
36
36
  // Resolution-only: never `import()`s the target, only locates it.
@@ -117,3 +117,36 @@ export function probeSingleInstance(factoryUrl, resolveSpecifier = resolveSpecif
117
117
  return { ok: true };
118
118
  return { ok: false, message: splitMessage(runnerRoot, factoryRoot) };
119
119
  }
120
+ function isInside(root, file) {
121
+ try {
122
+ const path = relative(realpathSync(root), realpathSync(file));
123
+ return path !== "" && !path.startsWith("..") && !isAbsolute(path);
124
+ }
125
+ catch {
126
+ return false;
127
+ }
128
+ }
129
+ function resolvesInside(dialect, factoryUrl, resolveSpecifier) {
130
+ if (dialect.kind === "local")
131
+ return isInside(dialect.root, dialect.path);
132
+ try {
133
+ return isInside(dialect.root, resolveSpecifier(dialect.name, factoryUrl));
134
+ }
135
+ catch {
136
+ return false;
137
+ }
138
+ }
139
+ /**
140
+ * A-16 / A-4: before the factory starts, resolves each declared dialect's name from the factory's
141
+ * location, the same resolution its own `import` gets, and requires the real path inside the copy
142
+ * the Lock pins. A local dialect's name is no specifier, so its base file's real path must sit inside
143
+ * its folder instead (CA-18). It keeps the dialect that runs the pinned one; it is no security boundary.
144
+ * Resolution-only, like `probeSingleInstance`; an unresolvable name fails the same way.
145
+ */
146
+ export function probeDeclaredDialects(factoryUrl, dialects, resolveSpecifier = resolveSpecifierPath) {
147
+ const outside = dialects.find((dialect) => !resolvesInside(dialect, factoryUrl, resolveSpecifier));
148
+ if (outside === undefined)
149
+ return { ok: true };
150
+ const place = outside.kind === "local" ? "the folder of its base file" : "the package the Lock pins";
151
+ return { ok: false, message: `the factory does not start because the dialect "${outside.name}" resolves outside ${place}` };
152
+ }
@@ -1 +1,2 @@
1
1
  export * from "../bounded-contexts/authoring/testing/conformance/index.ts";
2
+ export { checkDialectPackage, checkLocalDialect, type LocalDialect, type ConformanceFailure, type ConformanceReport, } from "../bounded-contexts/authoring/testing/conformance/run-package.ts";
@@ -1 +1,2 @@
1
1
  export * from "../bounded-contexts/authoring/testing/conformance/index.js";
2
+ export { checkDialectPackage, checkLocalDialect, } from "../bounded-contexts/authoring/testing/conformance/run-package.js";
@@ -0,0 +1,2 @@
1
+ export { defineAuthorDialect as defineDialect, defineOpPack, withOps, withoutOps, overrideOps, byExtension, query, } from "../bounded-contexts/authoring/domain/services/define-dialect.ts";
2
+ export type { Dialect, DialectAst, DialectDescriptor, ExtensionRouter, Handle, Op, OpPack, Query, } from "../bounded-contexts/authoring/domain/services/define-dialect.ts";
@@ -0,0 +1,3 @@
1
+ // The author-facing dialect kit (A-16): the one part of the core kit that leaves the ADR-0009
2
+ // boundary, so an author can build, compose and route a Dialect of their own.
3
+ export { defineAuthorDialect as defineDialect, defineOpPack, withOps, withoutOps, overrideOps, byExtension, query, } from "../bounded-contexts/authoring/domain/services/define-dialect.js";
@@ -2,7 +2,7 @@
2
2
  "manifestVersion": 1,
3
3
  "algorithm": "sha256",
4
4
  "entry": "dist/bin/pbuilder-runner.js",
5
- "packageVersion": "0.17.0",
5
+ "packageVersion": "0.19.0",
6
6
  "files": [
7
7
  {
8
8
  "path": "dist/acl/irwire/frame-reader.js",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  {
12
12
  "path": "dist/acl/irwire/stdio-engine-client.js",
13
- "sha256": "ce4192c2d177ef64c9931b99b34d4b7c5cd9c87aaab80e7495e333a09dbac039"
13
+ "sha256": "a7b8f09a1c2c63c90d605d28f4376a2772504bb7b89b8e2ea46ba5b103ce63fe"
14
14
  },
15
15
  {
16
16
  "path": "dist/bin/pbuilder-runner.js",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "path": "dist/bounded-contexts/authoring/application/usecases/run-factory/context.js",
21
- "sha256": "cbc476d322490393fb20524017748ec2392c30b3f19208c07f0dbc80e04c5903"
21
+ "sha256": "a2521108c576a7b3dfcda1bd05cdd6547f01a53c51b930b3d891d7d36f0ecf07"
22
22
  },
23
23
  {
24
24
  "path": "dist/bounded-contexts/authoring/application/usecases/run-factory/driving.js",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  {
28
28
  "path": "dist/bounded-contexts/authoring/domain/aggregates/session/session.js",
29
- "sha256": "6d38cebbed54516ad508eb096e7248a53da911e5b1dbad9e7118d93541712cf2"
29
+ "sha256": "d766298100d79ee9d3f2486cb36a951d0950a507b87564a48d3f9f17e4624be1"
30
30
  },
31
31
  {
32
32
  "path": "dist/bounded-contexts/authoring/domain/ports/emit-rejection.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  {
48
48
  "path": "dist/bounded-contexts/authoring/domain/services/schema/input-rejection.js",
49
- "sha256": "b99aab6adaf706442f472b50a66ac10e2c57dd39de8b8c553dad40f69555ac38"
49
+ "sha256": "31aacefce17622b2b6fd22af8834311c69e6a8c95afdf079bcee04c2a4d06a28"
50
50
  },
51
51
  {
52
52
  "path": "dist/bounded-contexts/authoring/domain/services/schema/schema-files.js",
@@ -58,19 +58,19 @@
58
58
  },
59
59
  {
60
60
  "path": "dist/bounded-contexts/authoring/domain/services/schema/schema-parse.js",
61
- "sha256": "b38e93759275c6f544b6d45b6fca2f1ffd95054ff9fd0bbba338f9c3ad82c427"
61
+ "sha256": "5b356f9778b604bb25540e260fe1b040f8bcf46112418c561f492ea3329973ef"
62
62
  },
63
63
  {
64
64
  "path": "dist/bounded-contexts/authoring/domain/services/schema/schema-validate.js",
65
- "sha256": "377f028c80bf44999efed5318784e74930bd6eda1c1f0e6d3532be9d4fa7af57"
65
+ "sha256": "ba0da0e1feec8c74a14992ad720e44b53088e5e2c9866e31168ec9dcd492fd6d"
66
66
  },
67
67
  {
68
68
  "path": "dist/bounded-contexts/authoring/domain/valueobjects/authoring-error.js",
69
- "sha256": "3c0d3a5c62c2f679acba2e0cae2a4e73fda65f46eddff1c243b8ed9b073bc950"
69
+ "sha256": "12bcb05ddffaade8ba3cadea33c30d469909e9c034415554456a1e4a765bfd19"
70
70
  },
71
71
  {
72
72
  "path": "dist/bounded-contexts/authoring/domain/valueobjects/schema-model.js",
73
- "sha256": "7e9e3077326d3aa54ac431d1b6243d2f1302178f095be073ddc2caf365d2600d"
73
+ "sha256": "6d015200921c8a72ef27941d287d460275bc944620ee9a7c140ad73354bbfc82"
74
74
  },
75
75
  {
76
76
  "path": "dist/bounded-contexts/authoring/domain/valueobjects/wire.js",
@@ -94,11 +94,11 @@
94
94
  },
95
95
  {
96
96
  "path": "dist/bounded-contexts/runner-hosting/infrastructure/in/runner.js",
97
- "sha256": "7cbd24c7cd55f307ed6a99281973a67d964f2ed56890422a17477a1e2f80ce73"
97
+ "sha256": "78aee0804a9fe9b110821a41dfb171dab635708c6220ad5aba986e167109ed50"
98
98
  },
99
99
  {
100
100
  "path": "dist/bounded-contexts/runner-hosting/infrastructure/in/single-instance-probe.js",
101
- "sha256": "345639841efda1cb206951bc8c6c251bc0d5c17451d22a22210cc8e80dff06b5"
101
+ "sha256": "5166df63dd3f9aef16b9d53b788cbdc8f67a0337bf537f2b8e166ff214752a96"
102
102
  },
103
103
  {
104
104
  "path": "dist/platform/error-text.js",
@@ -122,7 +122,7 @@
122
122
  },
123
123
  {
124
124
  "path": "package.json",
125
- "sha256": "3eb04bed3bfdd43ea2f25b0c13267688c052056eddc410ec6cfc0b7f0f7df927"
125
+ "sha256": "19ccb4ace24caa2a75a77a044363d75601cdd64465a66e89601920a45d1bfc88"
126
126
  }
127
127
  ]
128
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pbuilder/sdk",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "The public TypeScript/Bun authoring layer for Project Builder schematics. Authors file mutations (create, replaceContent, remove, rename, move, copy, copyIn), lowers them to IR, and talks to the Project Builder engine over framed stdio (see docs/engine-sdk-wire-spec.md).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,7 +34,8 @@
34
34
  "schemas"
35
35
  ],
36
36
  "bin": {
37
- "pbuilder-codegen": "dist/bin/pbuilder-codegen.js"
37
+ "pbuilder-codegen": "dist/bin/pbuilder-codegen.js",
38
+ "pbuilder-conformance": "dist/bin/pbuilder-conformance.js"
38
39
  },
39
40
  "main": "./dist/index.js",
40
41
  "exports": {
@@ -53,6 +54,11 @@
53
54
  "import": "./dist/conformance/index.js",
54
55
  "default": "./dist/conformance/index.js"
55
56
  },
57
+ "./dialect": {
58
+ "types": "./dist/dialect/index.d.ts",
59
+ "import": "./dist/dialect/index.js",
60
+ "default": "./dist/dialect/index.js"
61
+ },
56
62
  "./testing": {
57
63
  "types": "./dist/testing/index.d.ts",
58
64
  "import": "./dist/testing/index.js",