@baseplate-dev/project-builder-lib 0.4.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/admin-crud-action-compiler.d.ts +18 -0
- package/dist/compiler/admin-crud-action-compiler.d.ts.map +1 -0
- package/dist/compiler/admin-crud-action-compiler.js +6 -0
- package/dist/compiler/admin-crud-action-compiler.js.map +1 -0
- package/dist/compiler/admin-crud-column-compiler-spec.d.ts +6 -12
- package/dist/compiler/admin-crud-column-compiler-spec.d.ts.map +1 -1
- package/dist/compiler/admin-crud-column-compiler-spec.js +6 -29
- package/dist/compiler/admin-crud-column-compiler-spec.js.map +1 -1
- package/dist/compiler/admin-crud-input-spec.d.ts +6 -11
- package/dist/compiler/admin-crud-input-spec.d.ts.map +1 -1
- package/dist/compiler/admin-crud-input-spec.js +6 -26
- package/dist/compiler/admin-crud-input-spec.js.map +1 -1
- package/dist/compiler/app-compiler-spec.d.ts +8 -12
- package/dist/compiler/app-compiler-spec.d.ts.map +1 -1
- package/dist/compiler/app-compiler-spec.js +11 -18
- package/dist/compiler/app-compiler-spec.js.map +1 -1
- package/dist/compiler/index.d.ts +1 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +1 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/model-transformer-compiler-spec.d.ts +6 -11
- package/dist/compiler/model-transformer-compiler-spec.d.ts.map +1 -1
- package/dist/compiler/model-transformer-compiler-spec.js +6 -26
- package/dist/compiler/model-transformer-compiler-spec.js.map +1 -1
- package/dist/definition/index.d.ts +1 -0
- package/dist/definition/index.d.ts.map +1 -1
- package/dist/definition/index.js +1 -0
- package/dist/definition/index.js.map +1 -1
- package/dist/definition/model/model-field-utils.d.ts +2 -0
- package/dist/definition/model/model-field-utils.d.ts.map +1 -1
- package/dist/definition/model/model-field-utils.js +8 -0
- package/dist/definition/model/model-field-utils.js.map +1 -1
- package/dist/definition/model/model-transformer-utils.d.ts +4 -6
- package/dist/definition/model/model-transformer-utils.d.ts.map +1 -1
- package/dist/definition/model/model-transformer-utils.js +8 -10
- package/dist/definition/model/model-transformer-utils.js.map +1 -1
- package/dist/definition/model/model-utils.d.ts +2 -0
- package/dist/definition/model/model-utils.d.ts.map +1 -1
- package/dist/definition/model/model-utils.js +5 -0
- package/dist/definition/model/model-utils.js.map +1 -1
- package/dist/definition/packages/package-utils.d.ts +18 -0
- package/dist/definition/packages/package-utils.d.ts.map +1 -0
- package/dist/definition/packages/package-utils.js +34 -0
- package/dist/definition/packages/package-utils.js.map +1 -0
- package/dist/definition/plugins/plugin-utils.d.ts.map +1 -1
- package/dist/definition/plugins/plugin-utils.js +2 -2
- package/dist/definition/plugins/plugin-utils.js.map +1 -1
- package/dist/definition/project-definition-container.d.ts +3 -3
- package/dist/definition/project-definition-container.d.ts.map +1 -1
- package/dist/definition/project-definition-container.js +2 -2
- package/dist/definition/project-definition-container.js.map +1 -1
- package/dist/definition/project-definition-container.test-utils.d.ts.map +1 -1
- package/dist/definition/project-definition-container.test-utils.js +8 -4
- package/dist/definition/project-definition-container.test-utils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/migration-022-rename-packages-to-libraries.d.ts +37 -0
- package/dist/migrations/migration-022-rename-packages-to-libraries.d.ts.map +1 -0
- package/dist/migrations/migration-022-rename-packages-to-libraries.js +45 -0
- package/dist/migrations/migration-022-rename-packages-to-libraries.js.map +1 -0
- package/dist/parser/parser.d.ts +4 -4
- package/dist/parser/parser.d.ts.map +1 -1
- package/dist/parser/parser.js +17 -42
- package/dist/parser/parser.js.map +1 -1
- package/dist/plugin-tools/plugin-loader.js +3 -3
- package/dist/plugin-tools/plugin-loader.js.map +1 -1
- package/dist/plugins/context/index.d.ts +2 -0
- package/dist/plugins/context/index.d.ts.map +1 -0
- package/dist/plugins/context/index.js +2 -0
- package/dist/plugins/context/index.js.map +1 -0
- package/dist/plugins/context/plugin-context.d.ts +30 -0
- package/dist/plugins/context/plugin-context.d.ts.map +1 -0
- package/dist/plugins/context/plugin-context.js +38 -0
- package/dist/plugins/context/plugin-context.js.map +1 -0
- package/dist/plugins/imports/loader.d.ts +11 -20
- package/dist/plugins/imports/loader.d.ts.map +1 -1
- package/dist/plugins/imports/loader.js +28 -69
- package/dist/plugins/imports/loader.js.map +1 -1
- package/dist/plugins/imports/types.d.ts +72 -13
- package/dist/plugins/imports/types.d.ts.map +1 -1
- package/dist/plugins/imports/types.js +17 -1
- package/dist/plugins/imports/types.js.map +1 -1
- package/dist/plugins/index.d.ts +3 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +3 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/migrations/run-migrations.d.ts +2 -2
- package/dist/plugins/migrations/run-migrations.d.ts.map +1 -1
- package/dist/plugins/migrations/run-migrations.js +2 -2
- package/dist/plugins/migrations/run-migrations.js.map +1 -1
- package/dist/plugins/spec/auth-config-spec.d.ts +13 -9
- package/dist/plugins/spec/auth-config-spec.d.ts.map +1 -1
- package/dist/plugins/spec/auth-config-spec.js +16 -3
- package/dist/plugins/spec/auth-config-spec.js.map +1 -1
- package/dist/plugins/spec/auth-models-spec.d.ts +16 -0
- package/dist/plugins/spec/auth-models-spec.d.ts.map +1 -0
- package/dist/plugins/spec/auth-models-spec.js +16 -0
- package/dist/plugins/spec/auth-models-spec.js.map +1 -0
- package/dist/plugins/spec/config-spec.d.ts +8 -13
- package/dist/plugins/spec/config-spec.d.ts.map +1 -1
- package/dist/plugins/spec/config-spec.js +20 -35
- package/dist/plugins/spec/config-spec.js.map +1 -1
- package/dist/plugins/spec/index.d.ts +1 -1
- package/dist/plugins/spec/index.d.ts.map +1 -1
- package/dist/plugins/spec/index.js +1 -1
- package/dist/plugins/spec/index.js.map +1 -1
- package/dist/plugins/spec/types.d.ts +66 -25
- package/dist/plugins/spec/types.d.ts.map +1 -1
- package/dist/plugins/spec/types.js +27 -10
- package/dist/plugins/spec/types.js.map +1 -1
- package/dist/plugins/spec/web-config-spec.d.ts +7 -10
- package/dist/plugins/spec/web-config-spec.d.ts.map +1 -1
- package/dist/plugins/spec/web-config-spec.js +6 -19
- package/dist/plugins/spec/web-config-spec.js.map +1 -1
- package/dist/plugins/store/index.d.ts.map +1 -0
- package/dist/plugins/store/index.js.map +1 -0
- package/dist/plugins/store/store.d.ts +23 -0
- package/dist/plugins/store/store.d.ts.map +1 -0
- package/dist/plugins/store/store.js +36 -0
- package/dist/plugins/store/store.js.map +1 -0
- package/dist/plugins/utils/create-field-map-spec.d.ts +17 -0
- package/dist/plugins/utils/create-field-map-spec.d.ts.map +1 -0
- package/dist/plugins/utils/create-field-map-spec.js +27 -0
- package/dist/plugins/utils/create-field-map-spec.js.map +1 -0
- package/dist/plugins/utils/create-plugin-field-map.d.ts +24 -0
- package/dist/plugins/utils/create-plugin-field-map.d.ts.map +1 -0
- package/dist/plugins/utils/create-plugin-field-map.js +29 -0
- package/dist/plugins/utils/create-plugin-field-map.js.map +1 -0
- package/dist/plugins/utils/index.d.ts +3 -0
- package/dist/plugins/utils/index.d.ts.map +1 -0
- package/dist/plugins/utils/index.js +3 -0
- package/dist/plugins/utils/index.js.map +1 -0
- package/dist/schema/apps/backend/index.d.ts +0 -2
- package/dist/schema/apps/backend/index.d.ts.map +1 -1
- package/dist/schema/apps/backend/index.js +0 -1
- package/dist/schema/apps/backend/index.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-action-spec.d.ts +6 -13
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-action-spec.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-action-spec.js +5 -26
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-action-spec.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-crud-action.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-crud-action.js +1 -3
- package/dist/schema/apps/web/admin/sections/crud-actions/admin-crud-action.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-column-spec.d.ts +6 -12
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-column-spec.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-column-spec.js +5 -26
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-column-spec.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-crud-column.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-crud-column.js +1 -3
- package/dist/schema/apps/web/admin/sections/crud-columns/admin-crud-column.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-form/admin-crud-input.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-form/admin-crud-input.js +1 -3
- package/dist/schema/apps/web/admin/sections/crud-form/admin-crud-input.js.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-form/admin-input-spec.d.ts +7 -13
- package/dist/schema/apps/web/admin/sections/crud-form/admin-input-spec.d.ts.map +1 -1
- package/dist/schema/apps/web/admin/sections/crud-form/admin-input-spec.js +5 -26
- package/dist/schema/apps/web/admin/sections/crud-form/admin-input-spec.js.map +1 -1
- package/dist/schema/creator/types.d.ts +3 -3
- package/dist/schema/creator/types.d.ts.map +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/libraries/base.d.ts +13 -0
- package/dist/schema/libraries/base.d.ts.map +1 -0
- package/dist/schema/libraries/base.js +10 -0
- package/dist/schema/libraries/base.js.map +1 -0
- package/dist/schema/libraries/index.d.ts +3 -0
- package/dist/schema/libraries/index.d.ts.map +1 -0
- package/dist/schema/libraries/index.js +3 -0
- package/dist/schema/libraries/index.js.map +1 -0
- package/dist/schema/libraries/library.d.ts +19 -0
- package/dist/schema/libraries/library.d.ts.map +1 -0
- package/dist/schema/libraries/library.js +13 -0
- package/dist/schema/libraries/library.js.map +1 -0
- package/dist/schema/libraries/types.d.ts +2 -0
- package/dist/schema/libraries/types.d.ts.map +1 -0
- package/dist/schema/libraries/types.js +3 -0
- package/dist/schema/libraries/types.js.map +1 -0
- package/dist/schema/models/transformers/model-transformer-spec.d.ts +5 -11
- package/dist/schema/models/transformers/model-transformer-spec.d.ts.map +1 -1
- package/dist/schema/models/transformers/model-transformer-spec.js +5 -30
- package/dist/schema/models/transformers/model-transformer-spec.js.map +1 -1
- package/dist/schema/models/transformers/transformers.d.ts.map +1 -1
- package/dist/schema/models/transformers/transformers.js +2 -4
- package/dist/schema/models/transformers/transformers.js.map +1 -1
- package/dist/schema/plugins/definition.js +1 -1
- package/dist/schema/plugins/definition.js.map +1 -1
- package/dist/schema/project-definition.d.ts +18 -8
- package/dist/schema/project-definition.d.ts.map +1 -1
- package/dist/schema/project-definition.js +2 -0
- package/dist/schema/project-definition.js.map +1 -1
- package/dist/schema/settings/monorepo.d.ts +2 -2
- package/dist/schema/settings/monorepo.d.ts.map +1 -1
- package/dist/schema/settings/monorepo.js +17 -2
- package/dist/schema/settings/monorepo.js.map +1 -1
- package/dist/schema/settings/settings.d.ts +1 -0
- package/dist/schema/settings/settings.d.ts.map +1 -1
- package/dist/specs/index.d.ts +2 -0
- package/dist/specs/index.d.ts.map +1 -0
- package/dist/specs/index.js +2 -0
- package/dist/specs/index.js.map +1 -0
- package/dist/specs/packages/index.d.ts +3 -0
- package/dist/specs/packages/index.d.ts.map +1 -0
- package/dist/specs/packages/index.js +3 -0
- package/dist/specs/packages/index.js.map +1 -0
- package/dist/specs/packages/library-type-spec.d.ts +76 -0
- package/dist/specs/packages/library-type-spec.d.ts.map +1 -0
- package/dist/specs/packages/library-type-spec.js +31 -0
- package/dist/specs/packages/library-type-spec.js.map +1 -0
- package/dist/specs/packages/package-compiler-types.d.ts +111 -0
- package/dist/specs/packages/package-compiler-types.d.ts.map +1 -0
- package/dist/specs/packages/package-compiler-types.js +85 -0
- package/dist/specs/packages/package-compiler-types.js.map +1 -0
- package/dist/web/hooks/use-project-definition.d.ts +2 -2
- package/dist/web/hooks/use-project-definition.d.ts.map +1 -1
- package/dist/web/specs/admin-crud-action-web-spec.d.ts +6 -12
- package/dist/web/specs/admin-crud-action-web-spec.d.ts.map +1 -1
- package/dist/web/specs/admin-crud-action-web-spec.js +6 -29
- package/dist/web/specs/admin-crud-action-web-spec.js.map +1 -1
- package/dist/web/specs/admin-crud-column-web-spec.d.ts +6 -12
- package/dist/web/specs/admin-crud-column-web-spec.d.ts.map +1 -1
- package/dist/web/specs/admin-crud-column-web-spec.js +6 -29
- package/dist/web/specs/admin-crud-column-web-spec.js.map +1 -1
- package/dist/web/specs/admin-crud-input-web-spec.d.ts +6 -12
- package/dist/web/specs/admin-crud-input-web-spec.d.ts.map +1 -1
- package/dist/web/specs/admin-crud-input-web-spec.js +6 -29
- package/dist/web/specs/admin-crud-input-web-spec.js.map +1 -1
- package/dist/web/specs/model-transformer-web-spec.d.ts +8 -13
- package/dist/web/specs/model-transformer-web-spec.d.ts.map +1 -1
- package/dist/web/specs/model-transformer-web-spec.js +16 -28
- package/dist/web/specs/model-transformer-web-spec.js.map +1 -1
- package/package.json +6 -6
- package/dist/compiler/admin-crud-action-spec.d.ts +0 -26
- package/dist/compiler/admin-crud-action-spec.d.ts.map +0 -1
- package/dist/compiler/admin-crud-action-spec.js +0 -29
- package/dist/compiler/admin-crud-action-spec.js.map +0 -1
- package/dist/plugins/schema/index.d.ts.map +0 -1
- package/dist/plugins/schema/index.js.map +0 -1
- package/dist/plugins/schema/store.d.ts +0 -8
- package/dist/plugins/schema/store.d.ts.map +0 -1
- package/dist/plugins/schema/store.js +0 -17
- package/dist/plugins/schema/store.js.map +0 -1
- package/dist/plugins/spec/auth-model-config-spec.d.ts +0 -14
- package/dist/plugins/spec/auth-model-config-spec.d.ts.map +0 -1
- package/dist/plugins/spec/auth-model-config-spec.js +0 -6
- package/dist/plugins/spec/auth-model-config-spec.js.map +0 -1
- /package/dist/plugins/{schema → store}/index.d.ts +0 -0
- /package/dist/plugins/{schema → store}/index.js +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFieldMapSpec } from '../utils/create-field-map-spec.js';
|
|
2
|
+
export const authModelsSpec = createFieldMapSpec('core/auth-models', (t) => ({
|
|
3
|
+
getAuthModels: t.scalar(),
|
|
4
|
+
}), {
|
|
5
|
+
use: (values) => ({
|
|
6
|
+
getAuthModels: (definition) => values.getAuthModels?.(definition),
|
|
7
|
+
getAuthModelsOrThrow: (definition) => {
|
|
8
|
+
const authModels = values.getAuthModels?.(definition);
|
|
9
|
+
if (!authModels) {
|
|
10
|
+
throw new Error('Auth models not found');
|
|
11
|
+
}
|
|
12
|
+
return authModels;
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=auth-models-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-models-spec.js","sourceRoot":"","sources":["../../../src/plugins/spec/auth-models-spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAMvE,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAC9C,kBAAkB,EAClB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAoB;CAC5C,CAAC,EACF;IACE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChB,aAAa,EAAE,CAAC,UAA6B,EAAE,EAAE,CAC/C,MAAM,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC;QACpC,oBAAoB,EAAE,CAAC,UAA6B,EAAE,EAAE;YACtD,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC;YACtD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;CACH,CACF,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DefinitionSchemaCreator } from '#src/schema/index.js';
|
|
2
|
-
import type { PluginSpecImplementation } from './types.js';
|
|
3
2
|
export interface PluginMigrationResult {
|
|
4
3
|
updatedConfig?: unknown;
|
|
5
4
|
updateProjectDefinition?: (draft: unknown) => void;
|
|
@@ -16,17 +15,6 @@ export interface PluginConfigMigration {
|
|
|
16
15
|
*/
|
|
17
16
|
migrate: (config: unknown, projectDefinition: unknown) => PluginMigrationResult;
|
|
18
17
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Spec for registering plugin config schema
|
|
21
|
-
*/
|
|
22
|
-
export interface PluginConfigSpec extends PluginSpecImplementation {
|
|
23
|
-
registerSchemaCreator: (pluginKey: string, schemaCreator: DefinitionSchemaCreator) => void;
|
|
24
|
-
registerMigrations: (pluginKey: string, migrations: PluginConfigMigration[]) => void;
|
|
25
|
-
getSchemaCreator(pluginKey: string): DefinitionSchemaCreator | undefined;
|
|
26
|
-
getMigrations(pluginKey: string): PluginConfigMigration[] | undefined;
|
|
27
|
-
getLastMigrationVersion(pluginKey: string): number | undefined;
|
|
28
|
-
}
|
|
29
|
-
export declare function createPluginConfigImplementation(): PluginConfigSpec;
|
|
30
18
|
/**
|
|
31
19
|
* Spec for adding config for the plugin in the core plugin e.g.
|
|
32
20
|
* {
|
|
@@ -38,5 +26,12 @@ export declare function createPluginConfigImplementation(): PluginConfigSpec;
|
|
|
38
26
|
* }]
|
|
39
27
|
* }
|
|
40
28
|
*/
|
|
41
|
-
export declare const pluginConfigSpec: import("./types.js").
|
|
29
|
+
export declare const pluginConfigSpec: import("./types.js").PluginSpec<{
|
|
30
|
+
schemas: import("@baseplate-dev/utils").MapContainer<string, DefinitionSchemaCreator>;
|
|
31
|
+
migrations: import("@baseplate-dev/utils").MapContainer<string, PluginConfigMigration[]>;
|
|
32
|
+
}, {
|
|
33
|
+
getSchemaCreator: (pluginKey: string) => DefinitionSchemaCreator | undefined;
|
|
34
|
+
getMigrations: (pluginKey: string) => PluginConfigMigration[] | undefined;
|
|
35
|
+
getLastMigrationVersion: (pluginKey: string) => number | undefined;
|
|
36
|
+
}>;
|
|
42
37
|
//# sourceMappingURL=config-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-spec.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/config-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-spec.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/config-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAIpE,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,OAAO,EAAE,CACP,MAAM,EAAE,OAAO,EACf,iBAAiB,EAAE,OAAO,KACvB,qBAAqB,CAAC;CAC5B;AAyBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;kCAcS,MAAM;+BACT,MAAM;yCAEI,MAAM;EAOlD,CAAC"}
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { mapValuesOfMap } from '@baseplate-dev/utils';
|
|
2
|
+
import { createFieldMapSpec } from '../utils/create-field-map-spec.js';
|
|
3
|
+
function sortAndValidateMigrations(migrations, pluginKey) {
|
|
3
4
|
// make sure migrations are sorted by version and they are all unique
|
|
4
5
|
const sortedMigrations = [...migrations].sort((a, b) => a.version - b.version);
|
|
5
6
|
if (sortedMigrations.some((m) => m.version <= 0)) {
|
|
6
|
-
throw new Error(`
|
|
7
|
+
throw new Error(`All migrations for plugin ${pluginKey} must have a positive version`);
|
|
7
8
|
}
|
|
8
9
|
for (let i = 0; i < sortedMigrations.length - 1; i++) {
|
|
9
10
|
if (sortedMigrations[i].version === sortedMigrations[i + 1].version) {
|
|
10
|
-
throw new Error(`
|
|
11
|
+
throw new Error(`All migrations for plugin ${pluginKey} must have a unique version`);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
return sortedMigrations;
|
|
14
15
|
}
|
|
15
|
-
export function createPluginConfigImplementation() {
|
|
16
|
-
const schemas = new Map();
|
|
17
|
-
const migrationsMap = new Map();
|
|
18
|
-
return {
|
|
19
|
-
registerSchemaCreator(pluginKey, schemaCreator) {
|
|
20
|
-
if (schemas.has(pluginKey)) {
|
|
21
|
-
throw new Error(`Schema for plugin ${pluginKey} is already registered`);
|
|
22
|
-
}
|
|
23
|
-
schemas.set(pluginKey, schemaCreator);
|
|
24
|
-
},
|
|
25
|
-
registerMigrations(pluginKey, migrations) {
|
|
26
|
-
if (migrationsMap.has(pluginKey)) {
|
|
27
|
-
throw new Error(`Migrations for plugin ${pluginKey} are already registered`);
|
|
28
|
-
}
|
|
29
|
-
const sortedMigrations = sortAndValidateMigrations(migrations);
|
|
30
|
-
migrationsMap.set(pluginKey, sortedMigrations);
|
|
31
|
-
},
|
|
32
|
-
getSchemaCreator(pluginKey) {
|
|
33
|
-
return schemas.get(pluginKey);
|
|
34
|
-
},
|
|
35
|
-
getMigrations(pluginKey) {
|
|
36
|
-
return migrationsMap.get(pluginKey);
|
|
37
|
-
},
|
|
38
|
-
getLastMigrationVersion(pluginKey) {
|
|
39
|
-
const migrations = migrationsMap.get(pluginKey);
|
|
40
|
-
return migrations?.[migrations.length - 1]?.version;
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
16
|
/**
|
|
45
17
|
* Spec for adding config for the plugin in the core plugin e.g.
|
|
46
18
|
* {
|
|
@@ -52,7 +24,20 @@ export function createPluginConfigImplementation() {
|
|
|
52
24
|
* }]
|
|
53
25
|
* }
|
|
54
26
|
*/
|
|
55
|
-
export const pluginConfigSpec =
|
|
56
|
-
|
|
27
|
+
export const pluginConfigSpec = createFieldMapSpec('core/plugin-config', (t) => ({
|
|
28
|
+
schemas: t.map(),
|
|
29
|
+
migrations: t.map(),
|
|
30
|
+
}), {
|
|
31
|
+
use: (values) => {
|
|
32
|
+
const validatedMigrations = mapValuesOfMap(values.migrations, (migrations, pluginKey) => sortAndValidateMigrations(migrations, pluginKey));
|
|
33
|
+
return {
|
|
34
|
+
getSchemaCreator: (pluginKey) => values.schemas.get(pluginKey),
|
|
35
|
+
getMigrations: (pluginKey) => validatedMigrations.get(pluginKey),
|
|
36
|
+
getLastMigrationVersion: (pluginKey) => {
|
|
37
|
+
const migrations = values.migrations.get(pluginKey);
|
|
38
|
+
return migrations?.[migrations.length - 1]?.version;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
57
42
|
});
|
|
58
43
|
//# sourceMappingURL=config-spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-spec.js","sourceRoot":"","sources":["../../../src/plugins/spec/config-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-spec.js","sourceRoot":"","sources":["../../../src/plugins/spec/config-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAuBvE,SAAS,yBAAyB,CAChC,UAAmC,EACnC,SAAiB;IAEjB,qEAAqE;IACrE,MAAM,gBAAgB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAC3C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAChC,CAAC;IACF,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACb,6BAA6B,SAAS,+BAA+B,CACtE,CAAC;IACJ,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACrD,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CACb,6BAA6B,SAAS,6BAA6B,CACpE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAChD,oBAAoB,EACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,GAAG,EAAmC;IACjD,UAAU,EAAE,CAAC,CAAC,GAAG,EAAmC;CACrD,CAAC,EACF;IACE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;QACd,MAAM,mBAAmB,GAAG,cAAc,CACxC,MAAM,CAAC,UAAU,EACjB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,CACxB,yBAAyB,CAAC,UAAU,EAAE,SAAS,CAAC,CACnD,CAAC;QACF,OAAO;YACL,gBAAgB,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;YACtE,aAAa,EAAE,CAAC,SAAiB,EAAE,EAAE,CACnC,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC;YACpC,uBAAuB,EAAE,CAAC,SAAiB,EAAE,EAAE;gBAC7C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACpD,OAAO,UAAU,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;YACtD,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,29 +1,70 @@
|
|
|
1
|
-
type PluginSpecPlatform = 'web' | 'node';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export type PluginSpecPlatform = 'web' | 'node';
|
|
2
|
+
/**
|
|
3
|
+
* Result returned by a plugin spec initializer.
|
|
4
|
+
* Contains separate interfaces for init (mutable) and use (read-only) phases.
|
|
5
|
+
*/
|
|
6
|
+
export interface PluginSpecInitializerResult<TInit extends object = object, TUse extends object = object> {
|
|
7
|
+
/** Init interface - mutable methods for registration during plugin initialization */
|
|
8
|
+
init: TInit;
|
|
9
|
+
/** Use interface - read-only methods for consumption after initialization */
|
|
10
|
+
use: () => TUse;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Options for creating a plugin spec.
|
|
14
|
+
*/
|
|
15
|
+
export interface PluginSpecOptions<TInit extends object, TUse extends object> {
|
|
16
|
+
/** Initializer function that creates the init and use interfaces */
|
|
17
|
+
initializer: () => PluginSpecInitializerResult<TInit, TUse>;
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A plugin spec defines a shared capability that can be registered to during
|
|
21
|
+
* plugin initialization and consumed afterwards.
|
|
22
|
+
*
|
|
23
|
+
* Specs use two separate interfaces:
|
|
24
|
+
* - `init`: Mutable interface used during plugin initialization for registration
|
|
25
|
+
* - `use`: Read-only interface used after initialization (compilation, UI, etc.)
|
|
26
|
+
*
|
|
27
|
+
* This separation is enforced by TypeScript - callers must explicitly choose
|
|
28
|
+
* which interface to use, preventing accidental mutations after initialization.
|
|
29
|
+
*/
|
|
30
|
+
export interface PluginSpec<TInit extends object = object, TUse extends object = object> {
|
|
31
|
+
readonly type: 'plugin-spec';
|
|
32
|
+
readonly name: string;
|
|
33
|
+
/** Initializer function that creates the init and use interfaces */
|
|
34
|
+
readonly initializer: () => PluginSpecInitializerResult<TInit, TUse>;
|
|
18
35
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Extracts the init type from a PluginSpec.
|
|
38
|
+
*/
|
|
39
|
+
export type InferPluginSpecInit<T> = T extends PluginSpec<infer I> ? I : never;
|
|
40
|
+
/**
|
|
41
|
+
* Extracts the use type from a PluginSpec.
|
|
42
|
+
*/
|
|
43
|
+
export type InferPluginSpecUse<T> = T extends PluginSpec<object, infer U> ? U : never;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a plugin spec with init and use phases.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const mySpec = createPluginSpec('core/my-spec', {
|
|
50
|
+
* initializer: () => {
|
|
51
|
+
* const items = new Map<string, Item>();
|
|
52
|
+
* return {
|
|
53
|
+
* init: {
|
|
54
|
+
* register: (item: Item) => items.set(item.name, item),
|
|
55
|
+
* },
|
|
56
|
+
* use: () => ({
|
|
57
|
+
* get: (name: string) => items.get(name),
|
|
58
|
+
* getAll: () => [...items.values()],
|
|
59
|
+
* }),
|
|
60
|
+
* };
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @param name - Unique identifier for the spec (e.g., 'core/my-spec')
|
|
66
|
+
* @param options - Options including the initializer function
|
|
67
|
+
* @returns A plugin spec that can be used with SpecStore
|
|
68
|
+
*/
|
|
69
|
+
export declare function createPluginSpec<TInit extends object, TUse extends object>(name: string, options: PluginSpecOptions<TInit, TUse>): PluginSpec<TInit, TUse>;
|
|
29
70
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAC1C,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,IAAI,SAAS,MAAM,GAAG,MAAM;IAE5B,qFAAqF;IACrF,IAAI,EAAE,KAAK,CAAC;IACZ,6EAA6E;IAC7E,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM;IAC1E,oEAAoE;IACpE,WAAW,EAAE,MAAM,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;CAC7D;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU,CACzB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,IAAI,SAAS,MAAM,GAAG,MAAM;IAE5B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;CACtE;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC9B,CAAC,SAAS,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,EACxE,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,GACtC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAOzB"}
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Creates a plugin spec with init and use phases.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const mySpec = createPluginSpec('core/my-spec', {
|
|
7
|
+
* initializer: () => {
|
|
8
|
+
* const items = new Map<string, Item>();
|
|
9
|
+
* return {
|
|
10
|
+
* init: {
|
|
11
|
+
* register: (item: Item) => items.set(item.name, item),
|
|
12
|
+
* },
|
|
13
|
+
* use: () => ({
|
|
14
|
+
* get: (name: string) => items.get(name),
|
|
15
|
+
* getAll: () => [...items.values()],
|
|
16
|
+
* }),
|
|
17
|
+
* };
|
|
18
|
+
* },
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param name - Unique identifier for the spec (e.g., 'core/my-spec')
|
|
23
|
+
* @param options - Options including the initializer function
|
|
24
|
+
* @returns A plugin spec that can be used with SpecStore
|
|
25
|
+
*/
|
|
4
26
|
export function createPluginSpec(name, options) {
|
|
5
|
-
const {
|
|
27
|
+
const { initializer } = options;
|
|
6
28
|
return {
|
|
7
29
|
type: 'plugin-spec',
|
|
8
30
|
name,
|
|
9
|
-
|
|
10
|
-
isOptional: false,
|
|
11
|
-
optional() {
|
|
12
|
-
return { ...this, isOptional: true };
|
|
13
|
-
},
|
|
14
|
-
defaultInitializer,
|
|
31
|
+
initializer,
|
|
15
32
|
};
|
|
16
33
|
}
|
|
17
34
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/spec/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/spec/types.ts"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,OAAuC;IAEvC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI;QACJ,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { BasePluginDefinition } from '#src/schema/index.js';
|
|
3
3
|
import type { PluginMetadataWithPaths } from '../metadata/types.js';
|
|
4
|
-
import type { PluginSpecImplementation } from './types.js';
|
|
5
4
|
export interface WebConfigProps {
|
|
6
5
|
definition: BasePluginDefinition | undefined;
|
|
7
6
|
metadata: PluginMetadataWithPaths;
|
|
8
7
|
onSave: () => void;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Spec for allowing the plugin to be configured from the plugins page
|
|
12
|
-
*/
|
|
13
|
-
export interface WebConfigSpec extends PluginSpecImplementation {
|
|
14
|
-
registerWebConfigComponent: (pluginKey: string, ConfigComponent: React.FC<WebConfigProps>) => void;
|
|
15
|
-
getWebConfigComponent: (pluginKey: string) => React.FC<WebConfigProps> | undefined;
|
|
16
|
-
}
|
|
17
|
-
export declare function createWebConfigImplementation(): WebConfigSpec;
|
|
18
9
|
/**
|
|
19
10
|
* Spec for adding config component for plugin
|
|
11
|
+
*
|
|
12
|
+
* Keyed by plugin key, value is the config component.
|
|
20
13
|
*/
|
|
21
|
-
export declare const webConfigSpec: import("./types.js").
|
|
14
|
+
export declare const webConfigSpec: import("./types.js").PluginSpec<{
|
|
15
|
+
components: import("@baseplate-dev/utils").MapContainer<string, React.FC<WebConfigProps>>;
|
|
16
|
+
}, import("@baseplate-dev/utils").FieldMapValues<{
|
|
17
|
+
components: import("@baseplate-dev/utils").MapContainer<string, React.FC<WebConfigProps>>;
|
|
18
|
+
}>>;
|
|
22
19
|
//# sourceMappingURL=web-config-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-config-spec.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/web-config-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"web-config-spec.d.ts","sourceRoot":"","sources":["../../../src/plugins/spec/web-config-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAIpE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,uBAAuB,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;GAEvB,CAAC"}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function createWebConfigImplementation() {
|
|
3
|
-
const components = new Map();
|
|
4
|
-
return {
|
|
5
|
-
registerWebConfigComponent(pluginKey, ConfigComponent) {
|
|
6
|
-
if (components.has(pluginKey)) {
|
|
7
|
-
throw new Error(`Web config component for plugin ${pluginKey} is already registered`);
|
|
8
|
-
}
|
|
9
|
-
components.set(pluginKey, ConfigComponent);
|
|
10
|
-
},
|
|
11
|
-
getWebConfigComponent(pluginKey) {
|
|
12
|
-
return components.get(pluginKey);
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
1
|
+
import { createFieldMapSpec } from '../utils/create-field-map-spec.js';
|
|
16
2
|
/**
|
|
17
3
|
* Spec for adding config component for plugin
|
|
4
|
+
*
|
|
5
|
+
* Keyed by plugin key, value is the config component.
|
|
18
6
|
*/
|
|
19
|
-
export const webConfigSpec =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
7
|
+
export const webConfigSpec = createFieldMapSpec('core/web-config', (t) => ({
|
|
8
|
+
components: t.map(),
|
|
9
|
+
}));
|
|
23
10
|
//# sourceMappingURL=web-config-spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-config-spec.js","sourceRoot":"","sources":["../../../src/plugins/spec/web-config-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-config-spec.js","sourceRoot":"","sources":["../../../src/plugins/spec/web-config-spec.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAQvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzE,UAAU,EAAE,CAAC,CAAC,GAAG,EAAoC;CACtD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginSpec, PluginSpecInitializerResult } from '../spec/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Store for managing plugin spec instances with lazy initialization.
|
|
4
|
+
*
|
|
5
|
+
* Each spec is initialized once on first access, and both its init and use
|
|
6
|
+
* interfaces are cached for subsequent access.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PluginSpecStore {
|
|
9
|
+
private instances;
|
|
10
|
+
private useInstances;
|
|
11
|
+
constructor(instances?: Map<string, PluginSpecInitializerResult<object, object>>);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the use interface for a spec.
|
|
14
|
+
*
|
|
15
|
+
* Use this after initialization to access registered items.
|
|
16
|
+
* The use interface provides read-only methods for consumption.
|
|
17
|
+
*
|
|
18
|
+
* @param spec - The plugin spec to get the use interface for
|
|
19
|
+
* @returns The use interface for the spec
|
|
20
|
+
*/
|
|
21
|
+
use<TUse extends object, TInit extends object>(spec: PluginSpec<TInit, TUse>): TUse;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/plugins/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAEhF;;;;;GAKG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,YAAY,CAA6B;gBAErC,SAAS,2DAAiD;IAItE;;;;;;;;OAQG;IACH,GAAG,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAC3C,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,GAC5B,IAAI;CAiBR"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store for managing plugin spec instances with lazy initialization.
|
|
3
|
+
*
|
|
4
|
+
* Each spec is initialized once on first access, and both its init and use
|
|
5
|
+
* interfaces are cached for subsequent access.
|
|
6
|
+
*/
|
|
7
|
+
export class PluginSpecStore {
|
|
8
|
+
instances;
|
|
9
|
+
useInstances = new Map();
|
|
10
|
+
constructor(instances = new Map()) {
|
|
11
|
+
this.instances = instances;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the use interface for a spec.
|
|
15
|
+
*
|
|
16
|
+
* Use this after initialization to access registered items.
|
|
17
|
+
* The use interface provides read-only methods for consumption.
|
|
18
|
+
*
|
|
19
|
+
* @param spec - The plugin spec to get the use interface for
|
|
20
|
+
* @returns The use interface for the spec
|
|
21
|
+
*/
|
|
22
|
+
use(spec) {
|
|
23
|
+
let specInstance = this.instances.get(spec.name);
|
|
24
|
+
if (!specInstance) {
|
|
25
|
+
specInstance = spec.initializer();
|
|
26
|
+
this.instances.set(spec.name, specInstance);
|
|
27
|
+
}
|
|
28
|
+
let useInstance = this.useInstances.get(spec.name);
|
|
29
|
+
if (!useInstance) {
|
|
30
|
+
useInstance = specInstance.use();
|
|
31
|
+
this.useInstances.set(spec.name, useInstance);
|
|
32
|
+
}
|
|
33
|
+
return useInstance;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/plugins/store/store.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAClB,SAAS,CAA2C;IACpD,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEjD,YAAY,YAAY,IAAI,GAAG,EAAuC;QACpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CACD,IAA6B;QAE7B,IAAI,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAElC,CAAC;QACd,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;YACjC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,WAAmB,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FieldMapSchema, FieldMapSchemaBuilder, FieldMapValues } from '@baseplate-dev/utils';
|
|
2
|
+
import type { PluginSpec } from '../spec/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a plugin spec backed by a FieldMap for automatic source tracking.
|
|
5
|
+
*
|
|
6
|
+
* @param name - Unique identifier for the spec
|
|
7
|
+
* @param schemaBuilder - Function that builds the field map schema
|
|
8
|
+
* @param options - Optional configuration including custom use interface
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFieldMapSpec<T extends FieldMapSchema, TUse extends object = FieldMapValues<T>>(name: string, schemaBuilder: (t: FieldMapSchemaBuilder) => T, options?: {
|
|
11
|
+
/**
|
|
12
|
+
* Custom use interface builder. Receives the field map values and returns
|
|
13
|
+
* the use interface. If not provided, returns the raw field map values.
|
|
14
|
+
*/
|
|
15
|
+
use?: (values: FieldMapValues<T>) => TUse;
|
|
16
|
+
}): PluginSpec<T, TUse>;
|
|
17
|
+
//# sourceMappingURL=create-field-map-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-field-map-spec.d.ts","sourceRoot":"","sources":["../../../src/plugins/utils/create-field-map-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,cAAc,EACxB,IAAI,SAAS,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,EAEvC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,CAAC,EAC9C,OAAO,CAAC,EAAE;IACR;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC3C,GACA,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAgBrB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createPluginSpec } from '../spec/types.js';
|
|
2
|
+
import { createPluginFieldMap } from './create-plugin-field-map.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a plugin spec backed by a FieldMap for automatic source tracking.
|
|
5
|
+
*
|
|
6
|
+
* @param name - Unique identifier for the spec
|
|
7
|
+
* @param schemaBuilder - Function that builds the field map schema
|
|
8
|
+
* @param options - Optional configuration including custom use interface
|
|
9
|
+
*/
|
|
10
|
+
export function createFieldMapSpec(name, schemaBuilder, options) {
|
|
11
|
+
return createPluginSpec(name, {
|
|
12
|
+
initializer: () => {
|
|
13
|
+
const fieldMap = createPluginFieldMap(schemaBuilder);
|
|
14
|
+
return {
|
|
15
|
+
init: fieldMap,
|
|
16
|
+
use: () => {
|
|
17
|
+
const values = fieldMap.getValues();
|
|
18
|
+
if (options?.use) {
|
|
19
|
+
return options.use(values);
|
|
20
|
+
}
|
|
21
|
+
return values;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=create-field-map-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-field-map-spec.js","sourceRoot":"","sources":["../../../src/plugins/utils/create-field-map-spec.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAIhC,IAAY,EACZ,aAA8C,EAC9C,OAMC;IAED,OAAO,gBAAgB,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,GAAG,EAAE;YAChB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;YACrD,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,GAAG,EAAE;oBACR,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;oBACpC,IAAI,OAAO,EAAE,GAAG,EAAE,CAAC;wBACjB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBAC7B,CAAC;oBACD,OAAO,MAAc,CAAC;gBACxB,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FieldMap, FieldMapSchema, FieldMapSchemaBuilder } from '@baseplate-dev/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a field map that automatically tracks which plugin registered each value.
|
|
4
|
+
*
|
|
5
|
+
* Similar to `createConfigFieldMap` in the sync package, this utility uses the
|
|
6
|
+
* current plugin context to track the source of registrations. This enables
|
|
7
|
+
* clear error messages when registration conflicts occur.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const fieldMap = createPluginFieldMap((t) => ({
|
|
12
|
+
* transformers: t.map<string, Transformer>(),
|
|
13
|
+
* }));
|
|
14
|
+
*
|
|
15
|
+
* // When a plugin tries to overwrite a value:
|
|
16
|
+
* // Error: Value for key 'myTransformer' has already been set by plugin-auth
|
|
17
|
+
* // and cannot be overwritten by plugin-storage
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param schemaBuilder - A function that builds the field map schema
|
|
21
|
+
* @returns A field map with automatic source tracking
|
|
22
|
+
*/
|
|
23
|
+
export declare function createPluginFieldMap<S extends FieldMapSchema>(schemaBuilder: (t: FieldMapSchemaBuilder) => S): FieldMap<S>;
|
|
24
|
+
//# sourceMappingURL=create-plugin-field-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plugin-field-map.d.ts","sourceRoot":"","sources":["../../../src/plugins/utils/create-plugin-field-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAM9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,aAAa,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,CAAC,GAC7C,QAAQ,CAAC,CAAC,CAAC,CAIb"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createFieldMap } from '@baseplate-dev/utils';
|
|
2
|
+
import { getPluginContext } from '../context/plugin-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a field map that automatically tracks which plugin registered each value.
|
|
5
|
+
*
|
|
6
|
+
* Similar to `createConfigFieldMap` in the sync package, this utility uses the
|
|
7
|
+
* current plugin context to track the source of registrations. This enables
|
|
8
|
+
* clear error messages when registration conflicts occur.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const fieldMap = createPluginFieldMap((t) => ({
|
|
13
|
+
* transformers: t.map<string, Transformer>(),
|
|
14
|
+
* }));
|
|
15
|
+
*
|
|
16
|
+
* // When a plugin tries to overwrite a value:
|
|
17
|
+
* // Error: Value for key 'myTransformer' has already been set by plugin-auth
|
|
18
|
+
* // and cannot be overwritten by plugin-storage
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param schemaBuilder - A function that builds the field map schema
|
|
22
|
+
* @returns A field map with automatic source tracking
|
|
23
|
+
*/
|
|
24
|
+
export function createPluginFieldMap(schemaBuilder) {
|
|
25
|
+
return createFieldMap(schemaBuilder, {
|
|
26
|
+
getDynamicSource: () => getPluginContext()?.pluginKey,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=create-plugin-field-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plugin-field-map.js","sourceRoot":"","sources":["../../../src/plugins/utils/create-plugin-field-map.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oBAAoB,CAClC,aAA8C;IAE9C,OAAO,cAAc,CAAC,aAAa,EAAE;QACnC,gBAAgB,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,EAAE,SAAS;KACtD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
|