@backstage/plugin-scaffolder-node 0.8.0-next.2 → 0.8.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/dist/alpha/filters/createTemplateFilter.cjs.js +1 -1
- package/dist/alpha/filters/createTemplateFilter.cjs.js.map +1 -1
- package/dist/alpha/globals/createTemplateGlobal.cjs.js +1 -1
- package/dist/alpha/globals/createTemplateGlobal.cjs.js.map +1 -1
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +31 -19
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-node
|
|
2
2
|
|
|
3
|
+
## 0.8.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 497d47a: Document the internal built-in filters, and ensure that the types are validated when using `createTemplateFilter` and `createTemplateGlobalFunction` from the `zod` schema.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-plugin-api@1.2.1
|
|
10
|
+
- @backstage/catalog-model@1.7.3
|
|
11
|
+
- @backstage/errors@1.2.7
|
|
12
|
+
- @backstage/integration@1.16.2
|
|
13
|
+
- @backstage/types@1.2.1
|
|
14
|
+
- @backstage/plugin-scaffolder-common@1.5.10
|
|
15
|
+
|
|
16
|
+
## 0.8.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 1a58846: **DEPRECATION**: We've deprecated the old way of defining actions using `createTemplateAction` with raw `JSONSchema` and type parameters, as well as using `zod` through an import. You can now use the new format to define `createTemplateActions` with `zod` provided by the framework. This change also removes support for `logStream` in the `context` as well as moving the `logger` to an instance of `LoggerService`.
|
|
21
|
+
|
|
22
|
+
Before:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
createTemplateAction<{ repoUrl: string }, { test: string }>({
|
|
26
|
+
id: 'test',
|
|
27
|
+
schema: {
|
|
28
|
+
input: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
required: ['repoUrl'],
|
|
31
|
+
properties: {
|
|
32
|
+
repoUrl: { type: 'string' },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
output: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
required: ['test'],
|
|
38
|
+
properties: {
|
|
39
|
+
test: { type: 'string' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
handler: async ctx => {
|
|
44
|
+
ctx.logStream.write('blob');
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// or
|
|
49
|
+
|
|
50
|
+
createTemplateAction({
|
|
51
|
+
id: 'test',
|
|
52
|
+
schema: {
|
|
53
|
+
input: z.object({
|
|
54
|
+
repoUrl: z.string(),
|
|
55
|
+
}),
|
|
56
|
+
output: z.object({
|
|
57
|
+
test: z.string(),
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
handler: async ctx => {
|
|
61
|
+
ctx.logStream.write('something');
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
After:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
createTemplateAction({
|
|
70
|
+
id: 'test',
|
|
71
|
+
schema: {
|
|
72
|
+
input: {
|
|
73
|
+
repoUrl: d => d.string(),
|
|
74
|
+
},
|
|
75
|
+
output: {
|
|
76
|
+
test: d => d.string(),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
handler: async ctx => {
|
|
80
|
+
// you can just use ctx.logger.log('...'), or if you really need a log stream you can do this:
|
|
81
|
+
const logStream = new PassThrough();
|
|
82
|
+
logStream.on('data', chunk => {
|
|
83
|
+
ctx.logger.info(chunk.toString());
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- 09cf038: Got rid of most `@backstage/backend-common` usages
|
|
92
|
+
- 4f8b5b6: Allow signing git commits using configured private PGP key in scaffolder
|
|
93
|
+
- Updated dependencies
|
|
94
|
+
- @backstage/integration@1.16.2
|
|
95
|
+
- @backstage/plugin-scaffolder-common@1.5.10
|
|
96
|
+
- @backstage/backend-plugin-api@1.2.1
|
|
97
|
+
- @backstage/catalog-model@1.7.3
|
|
98
|
+
- @backstage/errors@1.2.7
|
|
99
|
+
- @backstage/types@1.2.1
|
|
100
|
+
|
|
3
101
|
## 0.8.0-next.2
|
|
4
102
|
|
|
5
103
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTemplateFilter.cjs.js","sources":["../../../src/alpha/filters/createTemplateFilter.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"createTemplateFilter.cjs.js","sources":["../../../src/alpha/filters/createTemplateFilter.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ZodFunctionSchema } from '../types';\nimport { CreatedTemplateFilter, TemplateFilterExample } from './types';\nimport { z } from 'zod';\n\n/**\n * This function is used to create new template filters in type-safe manner.\n * @alpha\n */\nexport const createTemplateFilter = <\n TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]],\n TReturnType extends z.ZodTypeAny,\n>(options: {\n id: string;\n description?: string;\n examples?: TemplateFilterExample[];\n schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;\n filter: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;\n}): CreatedTemplateFilter<TFunctionArgs, TReturnType> => options;\n"],"names":[],"mappings":";;AAwBa,MAAA,oBAAA,GAAuB,CAGlC,OAMuD,KAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const createTemplateGlobalValue = (v) => v;
|
|
4
|
-
const createTemplateGlobalFunction = (
|
|
4
|
+
const createTemplateGlobalFunction = (options) => options;
|
|
5
5
|
|
|
6
6
|
exports.createTemplateGlobalFunction = createTemplateGlobalFunction;
|
|
7
7
|
exports.createTemplateGlobalValue = createTemplateGlobalValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTemplateGlobal.cjs.js","sources":["../../../src/alpha/globals/createTemplateGlobal.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport {\n CreatedTemplateGlobalFunction,\n CreatedTemplateGlobalValue,\n
|
|
1
|
+
{"version":3,"file":"createTemplateGlobal.cjs.js","sources":["../../../src/alpha/globals/createTemplateGlobal.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport {\n CreatedTemplateGlobalFunction,\n CreatedTemplateGlobalValue,\n TemplateGlobalFunctionExample,\n} from './types';\nimport { ZodFunctionSchema } from '../types';\n\n/**\n * This function is used to create new template global values in type-safe manner.\n * @param t - CreatedTemplateGlobalValue | CreatedTemplateGlobalFunction\n * @returns t\n * @alpha\n */\nexport const createTemplateGlobalValue = (\n v: CreatedTemplateGlobalValue,\n): CreatedTemplateGlobalValue => v;\n\n/**\n * This function is used to create new template global functions in type-safe manner.\n * @param fn - CreatedTemplateGlobalFunction\n * @returns fn\n * @alpha\n */\nexport const createTemplateGlobalFunction = <\n TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]],\n TReturnType extends z.ZodTypeAny,\n>(options: {\n id: string;\n description?: string;\n examples?: TemplateGlobalFunctionExample[];\n schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;\n fn: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;\n}): CreatedTemplateGlobalFunction<TFunctionArgs, TReturnType> => options;\n"],"names":[],"mappings":";;AA8Ba,MAAA,yBAAA,GAA4B,CACvC,CAC+B,KAAA;AAQpB,MAAA,4BAAA,GAA+B,CAG1C,OAM+D,KAAA;;;;;"}
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/alpha/index.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport { CreatedTemplateFilter } from './filters';\nimport { CreatedTemplateGlobal } from './globals';\n\nexport * from '../tasks/alpha';\nexport * from './filters';\nexport * from './globals';\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport interface ScaffolderActionsExtensionPoint {\n addActions(...actions: TemplateAction<any, any, any>[]): void;\n}\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport const scaffolderActionsExtensionPoint =\n createExtensionPoint<ScaffolderActionsExtensionPoint>({\n id: 'scaffolder.actions',\n });\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport interface ScaffolderTaskBrokerExtensionPoint {\n setTaskBroker(taskBroker: TaskBroker): void;\n}\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport const scaffolderTaskBrokerExtensionPoint =\n createExtensionPoint<ScaffolderTaskBrokerExtensionPoint>({\n id: 'scaffolder.taskBroker',\n });\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport interface ScaffolderTemplatingExtensionPoint {\n addTemplateFilters(\n filters: Record<string, TemplateFilter> | CreatedTemplateFilter[],\n ): void;\n\n addTemplateGlobals(\n globals: Record<string, TemplateGlobal> | CreatedTemplateGlobal[],\n ): void;\n}\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport const scaffolderTemplatingExtensionPoint =\n createExtensionPoint<ScaffolderTemplatingExtensionPoint>({\n id: 'scaffolder.templating',\n });\n\n/**\n * Autocomplete handler for the scaffolder.\n * @alpha\n */\nexport type AutocompleteHandler = ({\n resource,\n token,\n context,\n}: {\n resource: string;\n token: string;\n context: Record<string, string>;\n}) => Promise<{ results: { title?: string; id: string }[] }>;\n\n/**\n * Extension point for adding autocomplete handler providers\n * @alpha\n */\nexport interface ScaffolderAutocompleteExtensionPoint {\n addAutocompleteProvider({\n id,\n handler,\n }: {\n id: string;\n handler: AutocompleteHandler;\n }): void;\n}\n\n/**\n * Extension point for adding autocomplete handlers.\n *\n * @alpha\n */\nexport const scaffolderAutocompleteExtensionPoint =\n createExtensionPoint<ScaffolderAutocompleteExtensionPoint>({\n id: 'scaffolder.autocomplete',\n });\n\n/**\n * This provider has to be implemented to make it possible to serialize/deserialize scaffolder workspace.\n *\n * @alpha\n */\nexport interface WorkspaceProvider {\n serializeWorkspace({\n path,\n taskId,\n }: {\n path: string;\n taskId: string;\n }): Promise<void>;\n\n cleanWorkspace(options: { taskId: string }): Promise<void>;\n\n rehydrateWorkspace(options: {\n taskId: string;\n targetPath: string;\n }): Promise<void>;\n}\n\n/**\n * Extension point for adding workspace providers.\n *\n * @alpha\n */\nexport interface ScaffolderWorkspaceProviderExtensionPoint {\n addProviders(providers: Record<string, WorkspaceProvider>): void;\n}\n\n/**\n * Extension point for adding workspace providers.\n *\n * @alpha\n */\nexport const scaffolderWorkspaceProviderExtensionPoint =\n createExtensionPoint<ScaffolderWorkspaceProviderExtensionPoint>({\n id: 'scaffolder.workspace.provider',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/alpha/index.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport { CreatedTemplateFilter } from './filters';\nimport { CreatedTemplateGlobal } from './globals';\n\nexport * from '../tasks/alpha';\nexport * from './filters';\nexport * from './globals';\nexport * from './types';\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport interface ScaffolderActionsExtensionPoint {\n addActions(...actions: TemplateAction<any, any, any>[]): void;\n}\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport const scaffolderActionsExtensionPoint =\n createExtensionPoint<ScaffolderActionsExtensionPoint>({\n id: 'scaffolder.actions',\n });\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport interface ScaffolderTaskBrokerExtensionPoint {\n setTaskBroker(taskBroker: TaskBroker): void;\n}\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport const scaffolderTaskBrokerExtensionPoint =\n createExtensionPoint<ScaffolderTaskBrokerExtensionPoint>({\n id: 'scaffolder.taskBroker',\n });\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport interface ScaffolderTemplatingExtensionPoint {\n addTemplateFilters(\n filters: Record<string, TemplateFilter> | CreatedTemplateFilter<any, any>[],\n ): void;\n\n addTemplateGlobals(\n globals: Record<string, TemplateGlobal> | CreatedTemplateGlobal[],\n ): void;\n}\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport const scaffolderTemplatingExtensionPoint =\n createExtensionPoint<ScaffolderTemplatingExtensionPoint>({\n id: 'scaffolder.templating',\n });\n\n/**\n * Autocomplete handler for the scaffolder.\n * @alpha\n */\nexport type AutocompleteHandler = ({\n resource,\n token,\n context,\n}: {\n resource: string;\n token: string;\n context: Record<string, string>;\n}) => Promise<{ results: { title?: string; id: string }[] }>;\n\n/**\n * Extension point for adding autocomplete handler providers\n * @alpha\n */\nexport interface ScaffolderAutocompleteExtensionPoint {\n addAutocompleteProvider({\n id,\n handler,\n }: {\n id: string;\n handler: AutocompleteHandler;\n }): void;\n}\n\n/**\n * Extension point for adding autocomplete handlers.\n *\n * @alpha\n */\nexport const scaffolderAutocompleteExtensionPoint =\n createExtensionPoint<ScaffolderAutocompleteExtensionPoint>({\n id: 'scaffolder.autocomplete',\n });\n\n/**\n * This provider has to be implemented to make it possible to serialize/deserialize scaffolder workspace.\n *\n * @alpha\n */\nexport interface WorkspaceProvider {\n serializeWorkspace({\n path,\n taskId,\n }: {\n path: string;\n taskId: string;\n }): Promise<void>;\n\n cleanWorkspace(options: { taskId: string }): Promise<void>;\n\n rehydrateWorkspace(options: {\n taskId: string;\n targetPath: string;\n }): Promise<void>;\n}\n\n/**\n * Extension point for adding workspace providers.\n *\n * @alpha\n */\nexport interface ScaffolderWorkspaceProviderExtensionPoint {\n addProviders(providers: Record<string, WorkspaceProvider>): void;\n}\n\n/**\n * Extension point for adding workspace providers.\n *\n * @alpha\n */\nexport const scaffolderWorkspaceProviderExtensionPoint =\n createExtensionPoint<ScaffolderWorkspaceProviderExtensionPoint>({\n id: 'scaffolder.workspace.provider',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;;;;AA6CO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA;AACN,CAAC;AAgBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA;AACN,CAAC;AAsBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA;AACN,CAAC;AAmCI,MAAM,uCACXA,qCAA2D,CAAA;AAAA,EACzD,EAAI,EAAA;AACN,CAAC;AAsCI,MAAM,4CACXA,qCAAgE,CAAA;AAAA,EAC9D,EAAI,EAAA;AACN,CAAC;;;;;;;;;;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
-
import { TemplateAction, TaskBroker, TemplateFilter
|
|
2
|
+
import { TemplateAction, TaskBroker, TemplateFilter, TemplateGlobal } from '@backstage/plugin-scaffolder-node';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { T as TemplateFilter, a as TemplateGlobal } from './types/types.d-C0fXdKnD.js';
|
|
5
4
|
import { JsonValue } from '@backstage/types';
|
|
5
|
+
export { T as TemplateFilter, a as TemplateGlobal } from './types/types.d-C0fXdKnD.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
type ZodFunctionSchema<TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]], TReturnType extends z.ZodTypeAny> = (zod: typeof z) => z.ZodFunction<z.ZodTuple<TFunctionArgs, null>, TReturnType> | z.ZodType<(...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>>;
|
|
6
11
|
|
|
7
|
-
/** @alpha */
|
|
8
|
-
type TemplateFilterSchema<Args extends z.ZodTuple<[z.ZodType<JsonValue>] | [z.ZodType<JsonValue>, ...(z.ZodType<JsonValue> | z.ZodUnknown)[]], z.ZodType<JsonValue> | z.ZodUnknown | null>, Result extends z.ZodType<JsonValue> | z.ZodUndefined> = (zod: typeof z) => z.ZodFunction<Args, Result>;
|
|
9
12
|
/** @alpha */
|
|
10
13
|
type TemplateFilterExample = {
|
|
11
14
|
description?: string;
|
|
@@ -13,19 +16,25 @@ type TemplateFilterExample = {
|
|
|
13
16
|
notes?: string;
|
|
14
17
|
};
|
|
15
18
|
/** @alpha */
|
|
16
|
-
type CreatedTemplateFilter<
|
|
19
|
+
type CreatedTemplateFilter<TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]], TReturnType extends z.ZodTypeAny> = {
|
|
17
20
|
id: string;
|
|
18
21
|
description?: string;
|
|
19
22
|
examples?: TemplateFilterExample[];
|
|
20
|
-
schema?:
|
|
21
|
-
filter:
|
|
23
|
+
schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;
|
|
24
|
+
filter: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* This function is used to create new template filters in type-safe manner.
|
|
26
29
|
* @alpha
|
|
27
30
|
*/
|
|
28
|
-
declare const createTemplateFilter: <
|
|
31
|
+
declare const createTemplateFilter: <TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]], TReturnType extends z.ZodTypeAny>(options: {
|
|
32
|
+
id: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
examples?: TemplateFilterExample[];
|
|
35
|
+
schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;
|
|
36
|
+
filter: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;
|
|
37
|
+
}) => CreatedTemplateFilter<TFunctionArgs, TReturnType>;
|
|
29
38
|
|
|
30
39
|
/** @alpha */
|
|
31
40
|
type CreatedTemplateGlobalValue<T extends JsonValue = JsonValue> = {
|
|
@@ -34,24 +43,21 @@ type CreatedTemplateGlobalValue<T extends JsonValue = JsonValue> = {
|
|
|
34
43
|
description?: string;
|
|
35
44
|
};
|
|
36
45
|
/** @alpha */
|
|
37
|
-
type TemplateGlobalFunctionSchema<Args extends z.ZodTuple<[
|
|
38
|
-
] | [z.ZodType<JsonValue>, ...(z.ZodType<JsonValue> | z.ZodUnknown)[]], z.ZodType<JsonValue> | z.ZodUnknown | null>, Result extends z.ZodType<JsonValue> | z.ZodUndefined> = (zod: typeof z) => z.ZodFunction<Args, Result>;
|
|
39
|
-
/** @alpha */
|
|
40
46
|
type TemplateGlobalFunctionExample = {
|
|
41
47
|
description?: string;
|
|
42
48
|
example: string;
|
|
43
49
|
notes?: string;
|
|
44
50
|
};
|
|
45
51
|
/** @alpha */
|
|
46
|
-
type CreatedTemplateGlobalFunction<
|
|
52
|
+
type CreatedTemplateGlobalFunction<TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]], TReturnType extends z.ZodTypeAny> = {
|
|
47
53
|
id: string;
|
|
48
54
|
description?: string;
|
|
49
55
|
examples?: TemplateGlobalFunctionExample[];
|
|
50
|
-
schema?:
|
|
51
|
-
fn:
|
|
56
|
+
schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;
|
|
57
|
+
fn: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;
|
|
52
58
|
};
|
|
53
59
|
/** @alpha */
|
|
54
|
-
type CreatedTemplateGlobal = CreatedTemplateGlobalValue | CreatedTemplateGlobalFunction<
|
|
60
|
+
type CreatedTemplateGlobal = CreatedTemplateGlobalValue | CreatedTemplateGlobalFunction<any, any>;
|
|
55
61
|
|
|
56
62
|
/**
|
|
57
63
|
* This function is used to create new template global values in type-safe manner.
|
|
@@ -66,7 +72,13 @@ declare const createTemplateGlobalValue: (v: CreatedTemplateGlobalValue) => Crea
|
|
|
66
72
|
* @returns fn
|
|
67
73
|
* @alpha
|
|
68
74
|
*/
|
|
69
|
-
declare const createTemplateGlobalFunction: <
|
|
75
|
+
declare const createTemplateGlobalFunction: <TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]], TReturnType extends z.ZodTypeAny>(options: {
|
|
76
|
+
id: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
examples?: TemplateGlobalFunctionExample[];
|
|
79
|
+
schema?: ZodFunctionSchema<TFunctionArgs, TReturnType>;
|
|
80
|
+
fn: (...args: z.infer<z.ZodTuple<TFunctionArgs>>) => z.infer<TReturnType>;
|
|
81
|
+
}) => CreatedTemplateGlobalFunction<TFunctionArgs, TReturnType>;
|
|
70
82
|
|
|
71
83
|
/**
|
|
72
84
|
* Serializes provided path into tar archive
|
|
@@ -122,8 +134,8 @@ declare const scaffolderTaskBrokerExtensionPoint: _backstage_backend_plugin_api.
|
|
|
122
134
|
* @alpha
|
|
123
135
|
*/
|
|
124
136
|
interface ScaffolderTemplatingExtensionPoint {
|
|
125
|
-
addTemplateFilters(filters: Record<string, TemplateFilter
|
|
126
|
-
addTemplateGlobals(globals: Record<string, TemplateGlobal
|
|
137
|
+
addTemplateFilters(filters: Record<string, TemplateFilter> | CreatedTemplateFilter<any, any>[]): void;
|
|
138
|
+
addTemplateGlobals(globals: Record<string, TemplateGlobal> | CreatedTemplateGlobal[]): void;
|
|
127
139
|
}
|
|
128
140
|
/**
|
|
129
141
|
* Extension point for adding template filters and globals.
|
|
@@ -194,4 +206,4 @@ interface ScaffolderWorkspaceProviderExtensionPoint {
|
|
|
194
206
|
*/
|
|
195
207
|
declare const scaffolderWorkspaceProviderExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<ScaffolderWorkspaceProviderExtensionPoint>;
|
|
196
208
|
|
|
197
|
-
export { type AutocompleteHandler, type CreatedTemplateFilter, type CreatedTemplateGlobal, type CreatedTemplateGlobalFunction, type CreatedTemplateGlobalValue, type ScaffolderActionsExtensionPoint, type ScaffolderAutocompleteExtensionPoint, type ScaffolderTaskBrokerExtensionPoint, type ScaffolderTemplatingExtensionPoint, type ScaffolderWorkspaceProviderExtensionPoint,
|
|
209
|
+
export { type AutocompleteHandler, type CreatedTemplateFilter, type CreatedTemplateGlobal, type CreatedTemplateGlobalFunction, type CreatedTemplateGlobalValue, type ScaffolderActionsExtensionPoint, type ScaffolderAutocompleteExtensionPoint, type ScaffolderTaskBrokerExtensionPoint, type ScaffolderTemplatingExtensionPoint, type ScaffolderWorkspaceProviderExtensionPoint, type TemplateFilterExample, type TemplateGlobalFunctionExample, type WorkspaceProvider, type ZodFunctionSchema, createTemplateFilter, createTemplateGlobalFunction, createTemplateGlobalValue, restoreWorkspace, scaffolderActionsExtensionPoint, scaffolderAutocompleteExtensionPoint, scaffolderTaskBrokerExtensionPoint, scaffolderTemplatingExtensionPoint, scaffolderWorkspaceProviderExtensionPoint, serializeWorkspace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-node",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-next.0",
|
|
4
4
|
"description": "The plugin-scaffolder-node module for @backstage/plugin-scaffolder-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"test": "backstage-cli package test"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@backstage/backend-plugin-api": "1.2.1
|
|
65
|
+
"@backstage/backend-plugin-api": "1.2.1",
|
|
66
66
|
"@backstage/catalog-model": "1.7.3",
|
|
67
67
|
"@backstage/errors": "1.2.7",
|
|
68
|
-
"@backstage/integration": "1.16.2
|
|
69
|
-
"@backstage/plugin-scaffolder-common": "1.5.10
|
|
68
|
+
"@backstage/integration": "1.16.2",
|
|
69
|
+
"@backstage/plugin-scaffolder-common": "1.5.10",
|
|
70
70
|
"@backstage/types": "1.2.1",
|
|
71
71
|
"@isomorphic-git/pgp-plugin": "^0.0.7",
|
|
72
72
|
"concat-stream": "^2.0.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"zod-to-json-schema": "^3.20.4"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@backstage/backend-test-utils": "1.3.
|
|
86
|
-
"@backstage/cli": "0.
|
|
85
|
+
"@backstage/backend-test-utils": "1.3.2-next.0",
|
|
86
|
+
"@backstage/cli": "0.32.0-next.0",
|
|
87
87
|
"@backstage/config": "1.3.2"
|
|
88
88
|
}
|
|
89
89
|
}
|