@baseplate-dev/project-builder-server 0.6.4 → 0.6.5
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/CHANGELOG.md +32 -0
- package/dist/actions/definition/build-ts-description-registry.d.ts +18 -0
- package/dist/actions/definition/build-ts-description-registry.d.ts.map +1 -0
- package/dist/actions/definition/build-ts-description-registry.js +48 -0
- package/dist/actions/definition/build-ts-description-registry.js.map +1 -0
- package/dist/actions/definition/configure-plugin.action.d.ts.map +1 -1
- package/dist/actions/definition/configure-plugin.action.js +84 -19
- package/dist/actions/definition/configure-plugin.action.js.map +1 -1
- package/dist/actions/definition/disable-plugin.action.d.ts.map +1 -1
- package/dist/actions/definition/disable-plugin.action.js +14 -1
- package/dist/actions/definition/disable-plugin.action.js.map +1 -1
- package/dist/actions/definition/draft-session.d.ts +3 -0
- package/dist/actions/definition/draft-session.d.ts.map +1 -1
- package/dist/actions/definition/draft-session.js +2 -0
- package/dist/actions/definition/draft-session.js.map +1 -1
- package/dist/actions/definition/find-plugin-by-key.d.ts +6 -0
- package/dist/actions/definition/find-plugin-by-key.d.ts.map +1 -0
- package/dist/actions/definition/find-plugin-by-key.js +15 -0
- package/dist/actions/definition/find-plugin-by-key.js.map +1 -0
- package/dist/actions/definition/get-entity-schema.action.d.ts.map +1 -1
- package/dist/actions/definition/get-entity-schema.action.js +2 -6
- package/dist/actions/definition/get-entity-schema.action.js.map +1 -1
- package/dist/actions/definition/get-plugin-info.action.d.ts +21 -0
- package/dist/actions/definition/get-plugin-info.action.d.ts.map +1 -0
- package/dist/actions/definition/get-plugin-info.action.js +118 -0
- package/dist/actions/definition/get-plugin-info.action.js.map +1 -0
- package/dist/actions/definition/index.d.ts +1 -0
- package/dist/actions/definition/index.d.ts.map +1 -1
- package/dist/actions/definition/index.js +1 -0
- package/dist/actions/definition/index.js.map +1 -1
- package/dist/actions/definition/schema-to-type-string.d.ts +11 -0
- package/dist/actions/definition/schema-to-type-string.d.ts.map +1 -0
- package/dist/actions/definition/schema-to-type-string.js +20 -0
- package/dist/actions/definition/schema-to-type-string.js.map +1 -0
- package/dist/actions/definition/stage-update-entity.action.d.ts.map +1 -1
- package/dist/actions/definition/stage-update-entity.action.js +2 -2
- package/dist/actions/definition/stage-update-entity.action.js.map +1 -1
- package/dist/actions/definition/validate-draft.d.ts +6 -5
- package/dist/actions/definition/validate-draft.d.ts.map +1 -1
- package/dist/actions/definition/validate-draft.js +12 -8
- package/dist/actions/definition/validate-draft.js.map +1 -1
- package/dist/actions/diff/diff-project.action.d.ts.map +1 -1
- package/dist/actions/diff/diff-project.action.js +10 -12
- package/dist/actions/diff/diff-project.action.js.map +1 -1
- package/dist/actions/registry.d.ts +36 -0
- package/dist/actions/registry.d.ts.map +1 -1
- package/dist/actions/registry.js +2 -1
- package/dist/actions/registry.js.map +1 -1
- package/dist/actions/sync/sync-all-projects.action.d.ts.map +1 -1
- package/dist/actions/sync/sync-all-projects.action.js +7 -0
- package/dist/actions/sync/sync-all-projects.action.js.map +1 -1
- package/dist/actions/sync/sync-project.action.d.ts.map +1 -1
- package/dist/actions/sync/sync-project.action.js +4 -0
- package/dist/actions/sync/sync-project.action.js.map +1 -1
- package/dist/actions/utils/run-in-worker.js.map +1 -1
- package/dist/actions/utils/trpc.js +1 -1
- package/dist/actions/utils/trpc.js.map +1 -1
- package/dist/compiler/backend/authorizer-compiler.d.ts +13 -8
- package/dist/compiler/backend/authorizer-compiler.d.ts.map +1 -1
- package/dist/compiler/backend/authorizer-compiler.js +183 -39
- package/dist/compiler/backend/authorizer-compiler.js.map +1 -1
- package/dist/compiler/backend/authorizer-expression-codegen-utils.d.ts +23 -0
- package/dist/compiler/backend/authorizer-expression-codegen-utils.d.ts.map +1 -0
- package/dist/compiler/backend/authorizer-expression-codegen-utils.js +36 -0
- package/dist/compiler/backend/authorizer-expression-codegen-utils.js.map +1 -0
- package/dist/compiler/backend/graphql.d.ts.map +1 -1
- package/dist/compiler/backend/graphql.js +1 -0
- package/dist/compiler/backend/graphql.js.map +1 -1
- package/dist/compiler/backend/query-filter-compiler.d.ts +0 -6
- package/dist/compiler/backend/query-filter-compiler.d.ts.map +1 -1
- package/dist/compiler/backend/query-filter-compiler.js +54 -29
- package/dist/compiler/backend/query-filter-compiler.js.map +1 -1
- package/dist/compiler/compile-packages.d.ts +2 -2
- package/dist/compiler/compile-packages.js +3 -3
- package/dist/compiler/compile-packages.js.map +1 -1
- package/dist/compiler/root/root-package-compiler.d.ts.map +1 -1
- package/dist/compiler/root/root-package-compiler.js +14 -5
- package/dist/compiler/root/root-package-compiler.js.map +1 -1
- package/dist/compiler/web/web-compiler.d.ts.map +1 -1
- package/dist/compiler/web/web-compiler.js +6 -2
- package/dist/compiler/web/web-compiler.js.map +1 -1
- package/dist/core-modules/index.d.ts.map +1 -1
- package/dist/core-modules/index.js +14 -10
- package/dist/core-modules/index.js.map +1 -1
- package/dist/dev-server/auth-plugin.d.ts.map +1 -1
- package/dist/dev-server/auth-plugin.js +2 -1
- package/dist/dev-server/auth-plugin.js.map +1 -1
- package/dist/diff/formatters.d.ts +16 -7
- package/dist/diff/formatters.d.ts.map +1 -1
- package/dist/diff/formatters.js +63 -68
- package/dist/diff/formatters.js.map +1 -1
- package/dist/fastify-plugins/graceful-shutdown.js +1 -1
- package/dist/service/builder-service.js +1 -1
- package/dist/service/builder-service.js.map +1 -1
- package/dist/sync/sync-metadata-service.d.ts.map +1 -1
- package/dist/sync/sync-metadata-service.js +2 -1
- package/dist/sync/sync-metadata-service.js.map +1 -1
- package/dist/template-extractor/delete-template.js +1 -1
- package/dist/template-extractor/delete-template.js.map +1 -1
- package/dist/templates/utils/extractor-config.js +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @baseplate-dev/project-builder-server
|
|
2
2
|
|
|
3
|
+
## 0.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#869](https://github.com/halfdomelabs/baseplate/pull/869) [`860b82d`](https://github.com/halfdomelabs/baseplate/commit/860b82da0466386ad11128c619595179ee76d0a4) Thanks [@kingston](https://github.com/kingston)! - Add AI development agents plugin that generates AGENTS.md, .agents/ directory, and conditionally CLAUDE.md for Baseplate projects. Also adds `rootCompilerSpec` to enable plugins to contribute generators to the monorepo root package.
|
|
8
|
+
|
|
9
|
+
- [#854](https://github.com/halfdomelabs/baseplate/pull/854) [`9708637`](https://github.com/halfdomelabs/baseplate/commit/97086370718861d2c3170ec6d83af84793fbd09e) Thanks [@kingston](https://github.com/kingston)! - Add optional description field to enum values that flows through to Pothos GraphQL enum type definitions
|
|
10
|
+
|
|
11
|
+
- [#868](https://github.com/halfdomelabs/baseplate/pull/868) [`8dcf7b3`](https://github.com/halfdomelabs/baseplate/commit/8dcf7b3c909672487bad61b7a4465d1860092363) Thanks [@kingston](https://github.com/kingston)! - Add get-plugin-info MCP action and improve configure-plugin usability
|
|
12
|
+
|
|
13
|
+
- [#862](https://github.com/halfdomelabs/baseplate/pull/862) [`5f7f3f1`](https://github.com/halfdomelabs/baseplate/commit/5f7f3f190e107d96764541a4146320badfe0186d) Thanks [@kingston](https://github.com/kingston)! - Fix sync metadata file occasionally becoming empty by using unique temp file names to prevent collisions during concurrent writes
|
|
14
|
+
|
|
15
|
+
- [#866](https://github.com/halfdomelabs/baseplate/pull/866) [`5e182c3`](https://github.com/halfdomelabs/baseplate/commit/5e182c308c51b8d6f735b213ae12ba475c34dbd2) Thanks [@kingston](https://github.com/kingston)! - Detect and block disabling plugins whose types (transformers, package types, etc.) are still in use, showing a dialog listing the affected items
|
|
16
|
+
|
|
17
|
+
- [#858](https://github.com/halfdomelabs/baseplate/pull/858) [`594e5a1`](https://github.com/halfdomelabs/baseplate/commit/594e5a15cbbff303fd19388ac5ec1639460444bc) Thanks [@kingston](https://github.com/kingston)! - Order package runner to compile library packages before app packages, ensuring library dependencies are built first
|
|
18
|
+
|
|
19
|
+
- [#857](https://github.com/halfdomelabs/baseplate/pull/857) [`e18f3e8`](https://github.com/halfdomelabs/baseplate/commit/e18f3e82e86c58fabead4a95bac84d18dfaf3eb6) Thanks [@kingston](https://github.com/kingston)! - Prevent overwrite mode from being used on user projects to protect manual changes
|
|
20
|
+
|
|
21
|
+
- [#839](https://github.com/halfdomelabs/baseplate/pull/839) [`85d957d`](https://github.com/halfdomelabs/baseplate/commit/85d957d4a2ab4b3a55a96c8dbba9a79d2f72511c) Thanks [@kingston](https://github.com/kingston)! - Support `exists()` and `all()` relation filter functions in authorization expressions for checking conditions on 1:many related records
|
|
22
|
+
|
|
23
|
+
- [#860](https://github.com/halfdomelabs/baseplate/pull/860) [`2a514a6`](https://github.com/halfdomelabs/baseplate/commit/2a514a63e741e1b16b3b1b168b84a60965141887) Thanks [@kingston](https://github.com/kingston)! - Support renames in reference expressions: when fields, relations, or roles are renamed, authorizer expressions are automatically updated to use the new names
|
|
24
|
+
|
|
25
|
+
- [#847](https://github.com/halfdomelabs/baseplate/pull/847) [`497904a`](https://github.com/halfdomelabs/baseplate/commit/497904a9b5088171f95c5e16bcda542fb5e98610) Thanks [@kingston](https://github.com/kingston)! - Connect theme builder UI to code generation. Theme color configuration from the project definition now drives the generated `styles.css` instead of hardcoded values. Default theme uses slate base with indigo primary. Remove explicit hover color variables (primaryHover, secondaryHover, destructiveHover) and linkVisited — hover is now computed via `color-mix` in CSS. Add palette swatch selection to theme color picker. Split preview into surface and interactive sections with input group and alert components.
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`37b6d8f`](https://github.com/halfdomelabs/baseplate/commit/37b6d8fd76086dab2953e12e48543334c5056f15), [`860b82d`](https://github.com/halfdomelabs/baseplate/commit/860b82da0466386ad11128c619595179ee76d0a4), [`9708637`](https://github.com/halfdomelabs/baseplate/commit/97086370718861d2c3170ec6d83af84793fbd09e), [`9708637`](https://github.com/halfdomelabs/baseplate/commit/97086370718861d2c3170ec6d83af84793fbd09e), [`8dcf7b3`](https://github.com/halfdomelabs/baseplate/commit/8dcf7b3c909672487bad61b7a4465d1860092363), [`06f5173`](https://github.com/halfdomelabs/baseplate/commit/06f517371c4904482873a4e30fe9b23b4fd2e36d), [`c24a24a`](https://github.com/halfdomelabs/baseplate/commit/c24a24ac9d2b66623acb0fda9c6ff2b3b80c0a6d), [`9688ca3`](https://github.com/halfdomelabs/baseplate/commit/9688ca348fd995a228bff597069f58644d7e9459), [`71146cd`](https://github.com/halfdomelabs/baseplate/commit/71146cd1ab784f45e4409fef7e6e447750047e48), [`fc8f158`](https://github.com/halfdomelabs/baseplate/commit/fc8f1582f1702d2d6f6eaa60607da7bb777750b5), [`5e182c3`](https://github.com/halfdomelabs/baseplate/commit/5e182c308c51b8d6f735b213ae12ba475c34dbd2), [`0ba6744`](https://github.com/halfdomelabs/baseplate/commit/0ba67445708689622341f3031502b3308f71f68e), [`53b8635`](https://github.com/halfdomelabs/baseplate/commit/53b86354ee6bc4b46d1966f657e3d6c942cf1eb1), [`85d957d`](https://github.com/halfdomelabs/baseplate/commit/85d957d4a2ab4b3a55a96c8dbba9a79d2f72511c), [`8d30c14`](https://github.com/halfdomelabs/baseplate/commit/8d30c145ce5d72dcfc038ff076ed0746d2d763cc), [`ed5d250`](https://github.com/halfdomelabs/baseplate/commit/ed5d250146f0b48386a8208741150f9011892a35), [`efcf233`](https://github.com/halfdomelabs/baseplate/commit/efcf2338c018ad46b08e8fef3994630dea511723), [`2a514a6`](https://github.com/halfdomelabs/baseplate/commit/2a514a63e741e1b16b3b1b168b84a60965141887), [`497904a`](https://github.com/halfdomelabs/baseplate/commit/497904a9b5088171f95c5e16bcda542fb5e98610), [`87a2218`](https://github.com/halfdomelabs/baseplate/commit/87a2218266f957bb4beacd6b13cb3d610fd15a41), [`c7131f5`](https://github.com/halfdomelabs/baseplate/commit/c7131f5caebda203ece99d30fcf2d58ead3abdb8), [`adc5f55`](https://github.com/halfdomelabs/baseplate/commit/adc5f55dbf3a1451f4402cd6bd126e15f60b8ed8), [`c7131f5`](https://github.com/halfdomelabs/baseplate/commit/c7131f5caebda203ece99d30fcf2d58ead3abdb8), [`c7131f5`](https://github.com/halfdomelabs/baseplate/commit/c7131f5caebda203ece99d30fcf2d58ead3abdb8)]:
|
|
28
|
+
- @baseplate-dev/project-builder-lib@0.6.5
|
|
29
|
+
- @baseplate-dev/fastify-generators@0.6.5
|
|
30
|
+
- @baseplate-dev/utils@0.6.5
|
|
31
|
+
- @baseplate-dev/react-generators@0.6.5
|
|
32
|
+
- @baseplate-dev/core-generators@0.6.5
|
|
33
|
+
- @baseplate-dev/sync@0.6.5
|
|
34
|
+
|
|
3
35
|
## 0.6.4
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a Zod registry with description metadata for use with `zodToTs`.
|
|
4
|
+
*
|
|
5
|
+
* Walks the schema using `walkSchemaStructure` and populates descriptions
|
|
6
|
+
* from two sources:
|
|
7
|
+
* 1. `definitionRefRegistry` — annotates reference fields (@ref) and entity
|
|
8
|
+
* arrays (@entity) so callers know which fields are references
|
|
9
|
+
* 2. `validationHintRegistry` — annotates fields with validation constraints
|
|
10
|
+
* like casing requirements (e.g., "CONSTANT_CASE", "camelCase")
|
|
11
|
+
*
|
|
12
|
+
* The returned registry can be passed as `metadataRegistry` to `zodToTs`
|
|
13
|
+
* which will render the descriptions as JSDoc comments in the output.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildTsDescriptionRegistry(schema: z.ZodType): ReturnType<typeof z.registry<{
|
|
16
|
+
description?: string;
|
|
17
|
+
}>>;
|
|
18
|
+
//# sourceMappingURL=build-ts-description-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-ts-description-registry.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/build-ts-description-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,CAAC,CAAC,OAAO,GAChB,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAwCzD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { definitionRefRegistry, walkSchemaStructure, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { validationHintRegistry } from '@baseplate-dev/utils';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* Builds a Zod registry with description metadata for use with `zodToTs`.
|
|
6
|
+
*
|
|
7
|
+
* Walks the schema using `walkSchemaStructure` and populates descriptions
|
|
8
|
+
* from two sources:
|
|
9
|
+
* 1. `definitionRefRegistry` — annotates reference fields (@ref) and entity
|
|
10
|
+
* arrays (@entity) so callers know which fields are references
|
|
11
|
+
* 2. `validationHintRegistry` — annotates fields with validation constraints
|
|
12
|
+
* like casing requirements (e.g., "CONSTANT_CASE", "camelCase")
|
|
13
|
+
*
|
|
14
|
+
* The returned registry can be passed as `metadataRegistry` to `zodToTs`
|
|
15
|
+
* which will render the descriptions as JSDoc comments in the output.
|
|
16
|
+
*/
|
|
17
|
+
export function buildTsDescriptionRegistry(schema) {
|
|
18
|
+
const registry = z.registry();
|
|
19
|
+
const visitor = {
|
|
20
|
+
visit(visitedSchema) {
|
|
21
|
+
const descriptions = [];
|
|
22
|
+
// Check for ref/entity metadata from definitionRefRegistry
|
|
23
|
+
const metaList = definitionRefRegistry.getAll(visitedSchema);
|
|
24
|
+
for (const meta of metaList) {
|
|
25
|
+
if (meta.kind === 'reference') {
|
|
26
|
+
descriptions.push(`@ref(${meta.type.name}) - Reference to a '${meta.type.name}' entity. Use entity name, not ID.`);
|
|
27
|
+
}
|
|
28
|
+
else if (meta.kind === 'entity') {
|
|
29
|
+
descriptions.push(`@entity(${meta.type.name}) - Entity type '${meta.type.name}'. IDs are auto-generated; omit the id field.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Check for validation hints from validationHintRegistry
|
|
33
|
+
const hint = validationHintRegistry.get(visitedSchema);
|
|
34
|
+
if (hint?.description) {
|
|
35
|
+
descriptions.push(hint.description);
|
|
36
|
+
}
|
|
37
|
+
if (descriptions.length > 0) {
|
|
38
|
+
registry.add(visitedSchema, {
|
|
39
|
+
description: descriptions.join(' '),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
walkSchemaStructure(schema, [visitor]);
|
|
46
|
+
return registry;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=build-ts-description-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-ts-description-registry.js","sourceRoot":"","sources":["../../../src/actions/definition/build-ts-description-registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAiB;IAEjB,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,EAA4B,CAAC;IAExD,MAAM,OAAO,GAA2B;QACtC,KAAK,CAAC,aAAa;YACjB,MAAM,YAAY,GAAa,EAAE,CAAC;YAElC,2DAA2D;YAC3D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC7D,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;oBAC9B,YAAY,CAAC,IAAI,CACf,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,uBAAuB,IAAI,CAAC,IAAI,CAAC,IAAI,oCAAoC,CAChG,CAAC;gBACJ,CAAC;qBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAClC,YAAY,CAAC,IAAI,CACf,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,oBAAoB,IAAI,CAAC,IAAI,CAAC,IAAI,+CAA+C,CAC3G,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,yDAAyD;YACzD,MAAM,IAAI,GAAG,sBAAsB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACvD,IAAI,IAAI,EAAE,WAAW,EAAE,CAAC;gBACtB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtC,CAAC;YAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE;oBAC1B,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;iBACpC,CAAC,CAAC;YACL,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;IAEF,mBAAmB,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEvC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-plugin.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/configure-plugin.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure-plugin.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/configure-plugin.action.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4DxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;kBAmHhC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assignEntityIds, createDefinitionSchemaParserContext, createPluginImplementationStoreWithNewPlugins, pluginConfigSpec, pluginEntityType, ProjectDefinitionContainer, } from '@baseplate-dev/project-builder-lib';
|
|
2
2
|
import { produce } from 'immer';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { createServiceAction } from '#src/actions/types.js';
|
|
5
5
|
import { getOrCreateDraftSession } from './draft-session.js';
|
|
6
|
+
import { findPluginByKey } from './find-plugin-by-key.js';
|
|
6
7
|
import { definitionIssueSchema, mapIssueToOutput, validateAndSaveDraft, writeIssuesCliOutput, } from './validate-draft.js';
|
|
7
8
|
const configurePluginInputSchema = z.object({
|
|
8
9
|
project: z.string().describe('The name or ID of the project.'),
|
|
@@ -10,7 +11,9 @@ const configurePluginInputSchema = z.object({
|
|
|
10
11
|
config: z
|
|
11
12
|
.record(z.string(), z.unknown())
|
|
12
13
|
.optional()
|
|
13
|
-
.describe('Optional plugin configuration.
|
|
14
|
+
.describe('Optional plugin configuration object. Use get-plugin-info to see the expected schema. ' +
|
|
15
|
+
'Reference fields accept entity names (not IDs). IDs for nested entities are auto-generated. ' +
|
|
16
|
+
'Defaults to empty config.'),
|
|
14
17
|
});
|
|
15
18
|
const configurePluginOutputSchema = z.object({
|
|
16
19
|
message: z.string().describe('A summary of the staged change.'),
|
|
@@ -19,33 +22,95 @@ const configurePluginOutputSchema = z.object({
|
|
|
19
22
|
.optional()
|
|
20
23
|
.describe('Definition issues found after staging.'),
|
|
21
24
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Auto-generates IDs for nested entities in a plugin config using the
|
|
27
|
+
* plugin's config schema. Existing IDs are preserved.
|
|
28
|
+
*/
|
|
29
|
+
function assignConfigEntityIds(pluginConfig, pluginMetadata, pluginStore, existingIds) {
|
|
30
|
+
const pluginConfigService = pluginStore.use(pluginConfigSpec);
|
|
31
|
+
const schemaCreator = pluginConfigService.getSchemaCreator(pluginMetadata.key);
|
|
32
|
+
if (!schemaCreator) {
|
|
33
|
+
return pluginConfig;
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
const defCtx = createDefinitionSchemaParserContext({ plugins: pluginStore });
|
|
36
|
+
const configSchema = schemaCreator(defCtx);
|
|
37
|
+
return assignEntityIds(configSchema, pluginConfig, {
|
|
38
|
+
isExistingId: (id) => existingIds.has(id),
|
|
39
|
+
});
|
|
29
40
|
}
|
|
30
41
|
export const configurePluginAction = createServiceAction({
|
|
31
42
|
name: 'configure-plugin',
|
|
32
43
|
title: 'Configure Plugin',
|
|
33
|
-
description: 'Enable a plugin or update its configuration in the draft session.
|
|
44
|
+
description: 'Enable a plugin or update its configuration in the draft session. ' +
|
|
45
|
+
'Use get-plugin-info first to see the config schema and current config. ' +
|
|
46
|
+
'Reference fields accept entity names (not IDs). IDs for nested entities are auto-generated. ' +
|
|
47
|
+
'Changes are not persisted until commit-draft is called.',
|
|
34
48
|
inputSchema: configurePluginInputSchema,
|
|
35
49
|
outputSchema: configurePluginOutputSchema,
|
|
36
50
|
handler: async (input, context) => {
|
|
37
51
|
const { session, parserContext, projectDirectory } = await getOrCreateDraftSession(input.project, context);
|
|
38
52
|
const pluginMetadata = findPluginByKey(context.plugins, input.pluginKey);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const pluginEntityId = pluginEntityType.idFromKey(pluginMetadata.key);
|
|
54
|
+
const serializedDef = session.draftDefinition;
|
|
55
|
+
const serializedPlugins = (serializedDef.plugins ?? []);
|
|
56
|
+
const isNew = !serializedPlugins.some((p) => p.id === pluginEntityId);
|
|
57
|
+
// Build a plugin store that includes this plugin (needed for schema
|
|
58
|
+
// creation and migration version lookup even if the plugin is new).
|
|
59
|
+
// Cast is safe: only the plugins[] array is accessed for ID matching.
|
|
60
|
+
const pluginStore = createPluginImplementationStoreWithNewPlugins(parserContext.pluginStore, [pluginMetadata], serializedDef);
|
|
61
|
+
// Collect all existing entity IDs from the definition so that
|
|
62
|
+
// assignEntityIds can preserve them and avoid collisions.
|
|
63
|
+
const defContainer = ProjectDefinitionContainer.fromSerializedConfig(serializedDef, parserContext);
|
|
64
|
+
const existingIds = new Set([
|
|
65
|
+
...defContainer.entities.map((e) => e.id),
|
|
66
|
+
pluginEntityId,
|
|
67
|
+
]);
|
|
68
|
+
// Auto-generate IDs for nested entities in the config
|
|
69
|
+
const rawConfig = input.config ?? {};
|
|
70
|
+
const processedConfig = assignConfigEntityIds(rawConfig, pluginMetadata, pluginStore, existingIds);
|
|
71
|
+
// Inject the plugin config into the serialized definition.
|
|
72
|
+
// This works with entity names (not IDs) — the deserialization pipeline
|
|
73
|
+
// in validateAndSaveDraft handles name→ID resolution automatically.
|
|
74
|
+
const pluginConfigService = pluginStore.use(pluginConfigSpec);
|
|
75
|
+
const lastMigrationVersion = pluginConfigService.getLastMigrationVersion(pluginMetadata.key);
|
|
76
|
+
let updatedDef;
|
|
77
|
+
if (isNew) {
|
|
78
|
+
const newPlugin = {
|
|
79
|
+
id: pluginEntityId,
|
|
80
|
+
name: pluginMetadata.name,
|
|
81
|
+
version: pluginMetadata.version,
|
|
82
|
+
packageName: pluginMetadata.packageName,
|
|
83
|
+
config: processedConfig,
|
|
84
|
+
};
|
|
85
|
+
if (lastMigrationVersion !== undefined) {
|
|
86
|
+
newPlugin.configSchemaVersion = lastMigrationVersion;
|
|
87
|
+
}
|
|
88
|
+
updatedDef = produce(serializedDef, (draft) => {
|
|
89
|
+
const plugins = (draft.plugins ?? []);
|
|
90
|
+
plugins.push(newPlugin);
|
|
91
|
+
draft.plugins = plugins;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
updatedDef = produce(serializedDef, (draft) => {
|
|
96
|
+
const plugins = draft.plugins;
|
|
97
|
+
const idx = plugins.findIndex((p) => p.id === pluginEntityId);
|
|
98
|
+
if (idx !== -1) {
|
|
99
|
+
const updated = {
|
|
100
|
+
...plugins[idx],
|
|
101
|
+
config: processedConfig,
|
|
102
|
+
};
|
|
103
|
+
if (lastMigrationVersion === undefined) {
|
|
104
|
+
delete updated.configSchemaVersion;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
updated.configSchemaVersion = lastMigrationVersion;
|
|
108
|
+
}
|
|
109
|
+
plugins[idx] = updated;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const { warnings } = await validateAndSaveDraft(updatedDef, parserContext, session, projectDirectory);
|
|
49
114
|
const action = isNew ? 'Enabled' : 'Updated configuration for';
|
|
50
115
|
return {
|
|
51
116
|
message: `${action} plugin "${pluginMetadata.displayName}". Use commit-draft to persist.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-plugin.action.js","sourceRoot":"","sources":["../../../src/actions/definition/configure-plugin.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure-plugin.action.js","sourceRoot":"","sources":["../../../src/actions/definition/configure-plugin.action.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,eAAe,EACf,mCAAmC,EACnC,6CAA6C,EAC7C,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC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E,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC;gBAC9D,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;oBACf,MAAM,OAAO,GAA4B;wBACvC,GAAG,OAAO,CAAC,GAAG,CAAC;wBACf,MAAM,EAAE,eAAe;qBACxB,CAAC;oBACF,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;wBACvC,OAAO,OAAO,CAAC,mBAAmB,CAAC;oBACrC,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,mBAAmB,GAAG,oBAAoB,CAAC;oBACrD,CAAC;oBACD,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;gBACzB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,oBAAoB,CAC7C,UAAU,EACV,aAAa,EACb,OAAO,EACP,gBAAgB,CACjB,CAAC;QAEF,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC;QAE/D,OAAO;YACL,OAAO,EAAE,GAAG,MAAM,YAAY,cAAc,CAAC,WAAW,iCAAiC;YACzF,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SACzE,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable-plugin.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/disable-plugin.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disable-plugin.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/disable-plugin.action.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;kBAyE9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginUtils, ProjectDefinitionContainer, serializeSchema, } from '@baseplate-dev/project-builder-lib';
|
|
1
|
+
import { createDefinitionSchemaParserContext, createPluginSpecStore, createProjectDefinitionSchema, findOrphanedUnionItems, PluginUtils, ProjectDefinitionContainer, serializeSchema, } from '@baseplate-dev/project-builder-lib';
|
|
2
2
|
import { produce } from 'immer';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { createServiceAction } from '#src/actions/types.js';
|
|
@@ -35,6 +35,19 @@ export const disablePluginAction = createServiceAction({
|
|
|
35
35
|
})(container.definition);
|
|
36
36
|
// Serialize back to name-based format
|
|
37
37
|
const serializedDef = serializeSchema(container.schema, newDefinition);
|
|
38
|
+
// Detect orphaned discriminated union items before parsing.
|
|
39
|
+
// When a plugin is disabled, its types are removed from the schema.
|
|
40
|
+
// Items referencing those types would cause parse failures, so we
|
|
41
|
+
// detect and report them as errors before proceeding.
|
|
42
|
+
const pluginStore = createPluginSpecStore(parserContext.pluginStore, serializedDef);
|
|
43
|
+
const defSchema = createProjectDefinitionSchema(createDefinitionSchemaParserContext({ plugins: pluginStore }));
|
|
44
|
+
const orphanedItems = findOrphanedUnionItems(defSchema, serializedDef);
|
|
45
|
+
if (orphanedItems.length > 0) {
|
|
46
|
+
const details = orphanedItems
|
|
47
|
+
.map((item) => `"${item.discriminatorValue}" (${item.discriminator}) at ${item.path.join('.')}`)
|
|
48
|
+
.join('; ');
|
|
49
|
+
throw new Error(`Cannot disable plugin "${input.pluginKey}": types still in use: ${details}`);
|
|
50
|
+
}
|
|
38
51
|
const { warnings } = await validateAndSaveDraft(serializedDef, parserContext, session, projectDirectory);
|
|
39
52
|
return {
|
|
40
53
|
message: `Disabled plugin "${input.pluginKey}". Use commit-draft to persist.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable-plugin.action.js","sourceRo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AC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAExD,MAAM,SAAS,GAAG,0BAA0B,CAAC,oBAAoB,CAC/D,OAAO,CAAC,eAAe,EACvB,aAAa,CACd,CAAC;QAEF,yCAAyC;QACzC,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,CACtC,SAAS,CAAC,UAAU,EACpB,KAAK,CAAC,SAAS,CAChB,CAAC;QACF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,CAAC,SAAS,6BAA6B,CAAC,CAAC;QAC3E,CAAC;QAED,kCAAkC;QAClC,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,KAAwB,EAAE,EAAE;YACzD,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAEzB,sCAAsC;QACtC,MAAM,aAAa,GAAG,eAAe,CACnC,SAAS,CAAC,MAAM,EAChB,aAAa,CACa,CAAC;QAE7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,oBAAoB,CAC7C,aAAa,EACb,aAAa,EACb,OAAO,EACP,gBAAgB,CACjB,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,oBAAoB,KAAK,CAAC,SAAS,iCAAiC;YAC7E,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SACzE,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"disable-plugin.action.js","sourceRoot":"","sources":["../../../src/actions/definition/disable-plugin.action.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EAC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I,KAAK,CACb,0BAA0B,KAAK,CAAC,SAAS,0BAA0B,OAAO,EAAE,CAC7E,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,oBAAoB,CAC7C,aAAa,EACb,aAAa,EACb,OAAO,EACP,gBAAgB,CACjB,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,oBAAoB,KAAK,CAAC,SAAS,iCAAiC;YAC7E,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SACzE,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EntityServiceContext, SchemaParserContext } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import type { ResolvedZodRefPayload } from '@baseplate-dev/project-builder-lib';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import type { ServiceActionContext } from '#src/actions/types.js';
|
|
4
5
|
declare const draftSessionMetadataSchema: z.ZodObject<{
|
|
@@ -23,6 +24,8 @@ export declare function deleteDraftSession(projectDirectory: string): Promise<vo
|
|
|
23
24
|
export interface DraftSessionContext {
|
|
24
25
|
session: DraftSession;
|
|
25
26
|
entityContext: EntityServiceContext;
|
|
27
|
+
/** Ref payload from the current draft (before the pending edit), used for rename detection. */
|
|
28
|
+
oldRefPayload: ResolvedZodRefPayload<unknown>;
|
|
26
29
|
parserContext: SchemaParserContext;
|
|
27
30
|
projectDirectory: string;
|
|
28
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft-session.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/draft-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"draft-session.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;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB"}
|
|
@@ -86,6 +86,7 @@ export async function getOrCreateDraftSession(projectNameOrId, context) {
|
|
|
86
86
|
return {
|
|
87
87
|
session: existingDraft,
|
|
88
88
|
entityContext,
|
|
89
|
+
oldRefPayload: draftContainer.refPayload,
|
|
89
90
|
parserContext,
|
|
90
91
|
projectDirectory: project.directory,
|
|
91
92
|
};
|
|
@@ -101,6 +102,7 @@ export async function getOrCreateDraftSession(projectNameOrId, context) {
|
|
|
101
102
|
return {
|
|
102
103
|
session,
|
|
103
104
|
entityContext,
|
|
105
|
+
oldRefPayload: container.refPayload,
|
|
104
106
|
parserContext,
|
|
105
107
|
projectDirectory: project.directory,
|
|
106
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft-session.js","sourceRoot":"","sources":["../../../src/actions/definition/draft-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draft-session.js","sourceRoot":"","sources":["../../../src/actions/definition/draft-session.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAE3F,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AAiB;QAC5B,SAAS;QACT,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,aAAa,CAAC,oBAAoB;KACpD,CAAC;IAEF,OAAO;QACL,OAAO;QACP,aAAa;QACb,aAAa,EAAE,SAAS,CAAC,UAAU;QACnC,aAAa;QACb,gBAAgB,EAAE,OAAO,CAAC,SAAS;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,gBAAwB;IAExB,MAAM,YAAY,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PluginMetadataWithPaths } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
/**
|
|
3
|
+
* Finds a plugin by its key, throwing an error with available plugins if not found.
|
|
4
|
+
*/
|
|
5
|
+
export declare function findPluginByKey(plugins: PluginMetadataWithPaths[], pluginKey: string): PluginMetadataWithPaths;
|
|
6
|
+
//# sourceMappingURL=find-plugin-by-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-plugin-by-key.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/find-plugin-by-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,uBAAuB,EAAE,EAClC,SAAS,EAAE,MAAM,GAChB,uBAAuB,CAYzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds a plugin by its key, throwing an error with available plugins if not found.
|
|
3
|
+
*/
|
|
4
|
+
export function findPluginByKey(plugins, pluginKey) {
|
|
5
|
+
const plugin = plugins.find((p) => p.key === pluginKey);
|
|
6
|
+
if (!plugin) {
|
|
7
|
+
const available = plugins
|
|
8
|
+
.filter((p) => !p.hidden)
|
|
9
|
+
.map((p) => p.key)
|
|
10
|
+
.join(', ');
|
|
11
|
+
throw new Error(`Plugin "${pluginKey}" not found. Available plugins: ${available}`);
|
|
12
|
+
}
|
|
13
|
+
return plugin;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=find-plugin-by-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-plugin-by-key.js","sourceRoot":"","sources":["../../../src/actions/definition/find-plugin-by-key.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAkC,EAClC,SAAiB;IAEjB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,OAAO;aACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;aACxB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;aACjB,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CACb,WAAW,SAAS,mCAAmC,SAAS,EAAE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entity-schema.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/get-entity-schema.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,eAAO,MAAM,qBAAqB;;;;;;;
|
|
1
|
+
{"version":3,"file":"get-entity-schema.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/get-entity-schema.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,eAAO,MAAM,qBAAqB;;;;;;;kBA+BhC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { createAuxiliaryTypeStore, printNode, zodToTs } from 'zod-to-ts';
|
|
3
2
|
import { createServiceAction } from '#src/actions/types.js';
|
|
4
3
|
import { loadEntityServiceContext } from './load-entity-service-context.js';
|
|
4
|
+
import { schemaToTypeString } from './schema-to-type-string.js';
|
|
5
5
|
const getEntitySchemaInputSchema = z.object({
|
|
6
6
|
project: z.string().describe('The name or ID of the project.'),
|
|
7
7
|
entityTypeName: z
|
|
@@ -33,11 +33,7 @@ export const getEntitySchemaAction = createServiceAction({
|
|
|
33
33
|
if (!metadata) {
|
|
34
34
|
throw new Error(`Unknown entity type: "${input.entityTypeName}". Use list-entities with entityTypeName "*" to discover available types.`);
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
auxiliaryTypeStore: createAuxiliaryTypeStore(),
|
|
38
|
-
unrepresentable: 'any',
|
|
39
|
-
});
|
|
40
|
-
const schemaText = printNode(node);
|
|
36
|
+
const schemaText = schemaToTypeString(metadata.elementSchema);
|
|
41
37
|
return {
|
|
42
38
|
entityTypeName: input.entityTypeName,
|
|
43
39
|
parentEntityTypeName: metadata.parentEntityTypeName ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entity-schema.action.js","sourceRoot":"","sources":["../../../src/actions/definition/get-entity-schema.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"get-entity-schema.action.js","sourceRoot":"","sources":["../../../src/actions/definition/get-entity-schema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AAM,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACvE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,yBAAyB,KAAK,CAAC,cAAc,2EAA2E,CACzH,CAAC;QACJ,CAAC;QAED,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAE9D,OAAO;YACL,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,IAAI,IAAI;YAC3D,MAAM,EAAE,UAAU;SACnB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getPluginInfoAction: import("#src/actions/types.js").ServiceAction<z.ZodObject<{
|
|
3
|
+
project: z.ZodString;
|
|
4
|
+
pluginKey: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
key: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
displayName: z.ZodString;
|
|
9
|
+
description: z.ZodString;
|
|
10
|
+
packageName: z.ZodString;
|
|
11
|
+
version: z.ZodString;
|
|
12
|
+
enabled: z.ZodBoolean;
|
|
13
|
+
managedBy: z.ZodOptional<z.ZodString>;
|
|
14
|
+
pluginDependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
plugin: z.ZodString;
|
|
16
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
}, z.core.$strip>>>;
|
|
18
|
+
configSchema: z.ZodNullable<z.ZodString>;
|
|
19
|
+
currentConfig: z.ZodNullable<z.ZodUnknown>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
//# sourceMappingURL=get-plugin-info.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-plugin-info.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/get-plugin-info.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;kBA4F9B,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createDefinitionSchemaParserContext, createPluginImplementationStoreWithNewPlugins, pluginConfigSpec, pluginEntityType, PluginUtils, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { createServiceAction } from '#src/actions/types.js';
|
|
4
|
+
import { findPluginByKey } from './find-plugin-by-key.js';
|
|
5
|
+
import { loadEntityServiceContext } from './load-entity-service-context.js';
|
|
6
|
+
import { schemaToTypeString } from './schema-to-type-string.js';
|
|
7
|
+
const getPluginInfoInputSchema = z.object({
|
|
8
|
+
project: z.string().describe('The name or ID of the project.'),
|
|
9
|
+
pluginKey: z.string().describe('The unique plugin key.'),
|
|
10
|
+
});
|
|
11
|
+
const pluginDependencySchema = z.object({
|
|
12
|
+
plugin: z.string().describe('Fully qualified name of the dependency plugin.'),
|
|
13
|
+
optional: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Whether this dependency is optional.'),
|
|
17
|
+
});
|
|
18
|
+
const getPluginInfoOutputSchema = z.object({
|
|
19
|
+
key: z.string().describe('The unique plugin key.'),
|
|
20
|
+
name: z.string().describe('The plugin name.'),
|
|
21
|
+
displayName: z.string().describe('Human-readable display name.'),
|
|
22
|
+
description: z.string().describe('Plugin description.'),
|
|
23
|
+
packageName: z.string().describe('The npm package name.'),
|
|
24
|
+
version: z.string().describe('The plugin version.'),
|
|
25
|
+
enabled: z.boolean().describe('Whether the plugin is currently enabled.'),
|
|
26
|
+
managedBy: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Fully qualified name of the plugin that manages this one, if any.'),
|
|
30
|
+
pluginDependencies: z
|
|
31
|
+
.array(pluginDependencySchema)
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Plugins that this plugin depends on.'),
|
|
34
|
+
configSchema: z
|
|
35
|
+
.string()
|
|
36
|
+
.nullable()
|
|
37
|
+
.describe('TypeScript type representation of the config schema, or null if no config schema exists.'),
|
|
38
|
+
currentConfig: z
|
|
39
|
+
.unknown()
|
|
40
|
+
.nullable()
|
|
41
|
+
.describe('The current config for this plugin if enabled, or null if not enabled.'),
|
|
42
|
+
});
|
|
43
|
+
export const getPluginInfoAction = createServiceAction({
|
|
44
|
+
name: 'get-plugin-info',
|
|
45
|
+
title: 'Get Plugin Info',
|
|
46
|
+
description: 'Get detailed information about a plugin, including its config schema and current configuration. Use this before configure-plugin to understand what config fields are available.',
|
|
47
|
+
inputSchema: getPluginInfoInputSchema,
|
|
48
|
+
outputSchema: getPluginInfoOutputSchema,
|
|
49
|
+
writeCliOutput: (output) => {
|
|
50
|
+
console.info(`Plugin: ${output.displayName} [${output.key}]`);
|
|
51
|
+
console.info(` Package: ${output.packageName}@${output.version}`);
|
|
52
|
+
console.info(` Enabled: ${output.enabled ? 'Yes' : 'No'}`);
|
|
53
|
+
if (output.managedBy) {
|
|
54
|
+
console.info(` Managed by: ${output.managedBy}`);
|
|
55
|
+
}
|
|
56
|
+
if (output.pluginDependencies?.length) {
|
|
57
|
+
console.info(` Dependencies:`);
|
|
58
|
+
for (const dep of output.pluginDependencies) {
|
|
59
|
+
console.info(` - ${dep.plugin}${dep.optional ? ' (optional)' : ''}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (output.configSchema) {
|
|
63
|
+
console.info(` Config schema:`);
|
|
64
|
+
console.info(` ${output.configSchema}`);
|
|
65
|
+
}
|
|
66
|
+
if (output.currentConfig != null) {
|
|
67
|
+
console.info(` Current config:`);
|
|
68
|
+
console.info(` ${JSON.stringify(output.currentConfig, null, 2)}`);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
handler: async (input, context) => {
|
|
72
|
+
const { entityContext, container } = await loadEntityServiceContext(input.project, context);
|
|
73
|
+
const pluginMetadata = findPluginByKey(context.plugins, input.pluginKey);
|
|
74
|
+
// Check if enabled
|
|
75
|
+
const enabled = PluginUtils.byKey(container.definition, input.pluginKey) != null;
|
|
76
|
+
// Get config schema via zodToTs.
|
|
77
|
+
// When the plugin is not enabled, its config spec isn't registered in the
|
|
78
|
+
// current plugin store. Create a temporary store that includes the target
|
|
79
|
+
// plugin so we can still retrieve its schema creator.
|
|
80
|
+
const pluginStore = enabled
|
|
81
|
+
? container.pluginStore
|
|
82
|
+
: createPluginImplementationStoreWithNewPlugins(container.parserContext.pluginStore, [pluginMetadata], container.definition);
|
|
83
|
+
const pluginConfigService = pluginStore.use(pluginConfigSpec);
|
|
84
|
+
const schemaCreator = pluginConfigService.getSchemaCreator(pluginMetadata.key);
|
|
85
|
+
let configSchema = null;
|
|
86
|
+
if (schemaCreator) {
|
|
87
|
+
const defCtx = createDefinitionSchemaParserContext({
|
|
88
|
+
plugins: pluginStore,
|
|
89
|
+
});
|
|
90
|
+
const zodSchema = schemaCreator(defCtx);
|
|
91
|
+
configSchema = schemaToTypeString(zodSchema);
|
|
92
|
+
}
|
|
93
|
+
// Get current config from serialized definition
|
|
94
|
+
let currentConfig = null;
|
|
95
|
+
if (enabled) {
|
|
96
|
+
const pluginEntityId = pluginEntityType.idFromKey(pluginMetadata.key);
|
|
97
|
+
const serializedPlugins = entityContext.serializedDefinition.plugins;
|
|
98
|
+
const pluginDef = serializedPlugins?.find((p) => p.id === pluginEntityId);
|
|
99
|
+
currentConfig = pluginDef?.config ?? null;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
key: pluginMetadata.key,
|
|
103
|
+
name: pluginMetadata.name,
|
|
104
|
+
displayName: pluginMetadata.displayName,
|
|
105
|
+
description: pluginMetadata.description,
|
|
106
|
+
packageName: pluginMetadata.packageName,
|
|
107
|
+
version: pluginMetadata.version,
|
|
108
|
+
enabled,
|
|
109
|
+
managedBy: pluginMetadata.managedBy,
|
|
110
|
+
pluginDependencies: pluginMetadata.pluginDependencies?.length
|
|
111
|
+
? pluginMetadata.pluginDependencies
|
|
112
|
+
: undefined,
|
|
113
|
+
configSchema,
|
|
114
|
+
currentConfig,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=get-plugin-info.action.js.map
|