@backstage/plugin-scaffolder-node 0.0.0-nightly-20230124022523

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 ADDED
@@ -0,0 +1,12 @@
1
+ # @backstage/plugin-scaffolder-node
2
+
3
+ ## 0.0.0-nightly-20230124022523
4
+
5
+ ### Minor Changes
6
+
7
+ - d72866f0cc: New package that takes over some of the types and functionality from `@backstage/plugin-scaffolder-backend` that are shared with other modules
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/backend-plugin-api@0.0.0-nightly-20230124022523
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # plugin-scaffolder-node
2
+
3
+ Houses types and utilities for building scaffolder-related modules.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@backstage/plugin-scaffolder-node",
3
+ "version": "0.0.0-nightly-20230124022523",
4
+ "main": "../dist/index.cjs.js",
5
+ "types": "../dist/index.alpha.d.ts"
6
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The scaffolder-node module for `@backstage/plugin-scaffolder-backend`.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ /// <reference types="node" />
8
+
9
+ import { ExtensionPoint } from '@backstage/backend-plugin-api';
10
+ import { JsonObject } from '@backstage/types';
11
+ import { JsonValue } from '@backstage/types';
12
+ import { Logger } from 'winston';
13
+ import { Schema } from 'jsonschema';
14
+ import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
15
+ import { UserEntity } from '@backstage/catalog-model';
16
+ import { Writable } from 'stream';
17
+
18
+ /**
19
+ * ActionContext is passed into scaffolder actions.
20
+ * @public
21
+ */
22
+ export declare type ActionContext<TInput extends JsonObject> = {
23
+ logger: Logger;
24
+ logStream: Writable;
25
+ secrets?: TaskSecrets;
26
+ workspacePath: string;
27
+ input: TInput;
28
+ output(name: string, value: JsonValue): void;
29
+ /**
30
+ * Creates a temporary directory for use by the action, which is then cleaned up automatically.
31
+ */
32
+ createTemporaryDirectory(): Promise<string>;
33
+ templateInfo?: TemplateInfo;
34
+ /**
35
+ * Whether this action invocation is a dry-run or not.
36
+ * This will only ever be true if the actions as marked as supporting dry-runs.
37
+ */
38
+ isDryRun?: boolean;
39
+ /**
40
+ * The user which triggered the action.
41
+ */
42
+ user?: {
43
+ /**
44
+ * The decorated entity from the Catalog
45
+ */
46
+ entity?: UserEntity;
47
+ /**
48
+ * An entity ref for the author of the task
49
+ */
50
+ ref?: string;
51
+ };
52
+ };
53
+
54
+ /**
55
+ * This function is used to create new template actions to get type safety.
56
+ *
57
+ * @public
58
+ */
59
+ export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
60
+
61
+ /**
62
+ * Extension point for managing scaffolder actions.
63
+ *
64
+ * @alpha
65
+ */
66
+ export declare interface ScaffolderActionsExtensionPoint {
67
+ addActions(...actions: TemplateAction<any>[]): void;
68
+ }
69
+
70
+ /**
71
+ * Extension point for managing scaffolder actions.
72
+ *
73
+ * @alpha
74
+ */
75
+ export declare const scaffolderActionsExtensionPoint: ExtensionPoint<ScaffolderActionsExtensionPoint>;
76
+
77
+ /**
78
+ * TaskSecrets
79
+ *
80
+ * @public
81
+ */
82
+ export declare type TaskSecrets = Record<string, string> & {
83
+ backstageToken?: string;
84
+ };
85
+
86
+ /** @public */
87
+ export declare type TemplateAction<TInput extends JsonObject> = {
88
+ id: string;
89
+ description?: string;
90
+ examples?: {
91
+ description: string;
92
+ example: string;
93
+ }[];
94
+ supportsDryRun?: boolean;
95
+ schema?: {
96
+ input?: Schema;
97
+ output?: Schema;
98
+ };
99
+ handler: (ctx: ActionContext<TInput>) => Promise<void>;
100
+ };
101
+
102
+ export { }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The scaffolder-node module for `@backstage/plugin-scaffolder-backend`.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ /// <reference types="node" />
8
+
9
+ import { ExtensionPoint } from '@backstage/backend-plugin-api';
10
+ import { JsonObject } from '@backstage/types';
11
+ import { JsonValue } from '@backstage/types';
12
+ import { Logger } from 'winston';
13
+ import { Schema } from 'jsonschema';
14
+ import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
15
+ import { UserEntity } from '@backstage/catalog-model';
16
+ import { Writable } from 'stream';
17
+
18
+ /**
19
+ * ActionContext is passed into scaffolder actions.
20
+ * @public
21
+ */
22
+ export declare type ActionContext<TInput extends JsonObject> = {
23
+ logger: Logger;
24
+ logStream: Writable;
25
+ secrets?: TaskSecrets;
26
+ workspacePath: string;
27
+ input: TInput;
28
+ output(name: string, value: JsonValue): void;
29
+ /**
30
+ * Creates a temporary directory for use by the action, which is then cleaned up automatically.
31
+ */
32
+ createTemporaryDirectory(): Promise<string>;
33
+ templateInfo?: TemplateInfo;
34
+ /**
35
+ * Whether this action invocation is a dry-run or not.
36
+ * This will only ever be true if the actions as marked as supporting dry-runs.
37
+ */
38
+ isDryRun?: boolean;
39
+ /**
40
+ * The user which triggered the action.
41
+ */
42
+ user?: {
43
+ /**
44
+ * The decorated entity from the Catalog
45
+ */
46
+ entity?: UserEntity;
47
+ /**
48
+ * An entity ref for the author of the task
49
+ */
50
+ ref?: string;
51
+ };
52
+ };
53
+
54
+ /**
55
+ * This function is used to create new template actions to get type safety.
56
+ *
57
+ * @public
58
+ */
59
+ export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
60
+
61
+ /* Excluded from this release type: ScaffolderActionsExtensionPoint */
62
+
63
+ /* Excluded from this release type: scaffolderActionsExtensionPoint */
64
+
65
+ /**
66
+ * TaskSecrets
67
+ *
68
+ * @public
69
+ */
70
+ export declare type TaskSecrets = Record<string, string> & {
71
+ backstageToken?: string;
72
+ };
73
+
74
+ /** @public */
75
+ export declare type TemplateAction<TInput extends JsonObject> = {
76
+ id: string;
77
+ description?: string;
78
+ examples?: {
79
+ description: string;
80
+ example: string;
81
+ }[];
82
+ supportsDryRun?: boolean;
83
+ schema?: {
84
+ input?: Schema;
85
+ output?: Schema;
86
+ };
87
+ handler: (ctx: ActionContext<TInput>) => Promise<void>;
88
+ };
89
+
90
+ export { }
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var backendPluginApi = require('@backstage/backend-plugin-api');
6
+
7
+ const createTemplateAction = (templateAction) => {
8
+ return templateAction;
9
+ };
10
+
11
+ const scaffolderActionsExtensionPoint = backendPluginApi.createExtensionPoint({
12
+ id: "scaffolder.actions"
13
+ });
14
+
15
+ exports.createTemplateAction = createTemplateAction;
16
+ exports.scaffolderActionsExtensionPoint = scaffolderActionsExtensionPoint;
17
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/actions/createTemplateAction.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { JsonObject } from '@backstage/types';\nimport { TemplateAction } from './types';\n\n/**\n * This function is used to create new template actions to get type safety.\n *\n * @public\n */\nexport const createTemplateAction = <TInput extends JsonObject>(\n templateAction: TemplateAction<TInput>,\n): TemplateAction<TInput> => {\n // TODO(blam): Can add some more validation here to validate the action later on\n return templateAction;\n};\n","/*\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 { TemplateAction } from './actions';\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport interface ScaffolderActionsExtensionPoint {\n addActions(...actions: TemplateAction<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"],"names":["createExtensionPoint"],"mappings":";;;;;;AAwBa,MAAA,oBAAA,GAAuB,CAClC,cAC2B,KAAA;AAE3B,EAAO,OAAA,cAAA,CAAA;AACT;;ACIO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;;;;"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The scaffolder-node module for `@backstage/plugin-scaffolder-backend`.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ /// <reference types="node" />
8
+
9
+ import { ExtensionPoint } from '@backstage/backend-plugin-api';
10
+ import { JsonObject } from '@backstage/types';
11
+ import { JsonValue } from '@backstage/types';
12
+ import { Logger } from 'winston';
13
+ import { Schema } from 'jsonschema';
14
+ import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
15
+ import { UserEntity } from '@backstage/catalog-model';
16
+ import { Writable } from 'stream';
17
+
18
+ /**
19
+ * ActionContext is passed into scaffolder actions.
20
+ * @public
21
+ */
22
+ export declare type ActionContext<TInput extends JsonObject> = {
23
+ logger: Logger;
24
+ logStream: Writable;
25
+ secrets?: TaskSecrets;
26
+ workspacePath: string;
27
+ input: TInput;
28
+ output(name: string, value: JsonValue): void;
29
+ /**
30
+ * Creates a temporary directory for use by the action, which is then cleaned up automatically.
31
+ */
32
+ createTemporaryDirectory(): Promise<string>;
33
+ templateInfo?: TemplateInfo;
34
+ /**
35
+ * Whether this action invocation is a dry-run or not.
36
+ * This will only ever be true if the actions as marked as supporting dry-runs.
37
+ */
38
+ isDryRun?: boolean;
39
+ /**
40
+ * The user which triggered the action.
41
+ */
42
+ user?: {
43
+ /**
44
+ * The decorated entity from the Catalog
45
+ */
46
+ entity?: UserEntity;
47
+ /**
48
+ * An entity ref for the author of the task
49
+ */
50
+ ref?: string;
51
+ };
52
+ };
53
+
54
+ /**
55
+ * This function is used to create new template actions to get type safety.
56
+ *
57
+ * @public
58
+ */
59
+ export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
60
+
61
+ /* Excluded from this release type: ScaffolderActionsExtensionPoint */
62
+
63
+ /* Excluded from this release type: scaffolderActionsExtensionPoint */
64
+
65
+ /**
66
+ * TaskSecrets
67
+ *
68
+ * @public
69
+ */
70
+ export declare type TaskSecrets = Record<string, string> & {
71
+ backstageToken?: string;
72
+ };
73
+
74
+ /** @public */
75
+ export declare type TemplateAction<TInput extends JsonObject> = {
76
+ id: string;
77
+ description?: string;
78
+ examples?: {
79
+ description: string;
80
+ example: string;
81
+ }[];
82
+ supportsDryRun?: boolean;
83
+ schema?: {
84
+ input?: Schema;
85
+ output?: Schema;
86
+ };
87
+ handler: (ctx: ActionContext<TInput>) => Promise<void>;
88
+ };
89
+
90
+ export { }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@backstage/plugin-scaffolder-node",
3
+ "description": "The plugin-scaffolder-node module for @backstage/plugin-scaffolder-backend",
4
+ "version": "0.0.0-nightly-20230124022523",
5
+ "main": "dist/index.cjs.js",
6
+ "types": "dist/index.d.ts",
7
+ "license": "Apache-2.0",
8
+ "publishConfig": {
9
+ "access": "public",
10
+ "alphaTypes": "dist/index.alpha.d.ts",
11
+ "main": "dist/index.cjs.js",
12
+ "types": "dist/index.d.ts"
13
+ },
14
+ "backstage": {
15
+ "role": "node-library"
16
+ },
17
+ "scripts": {
18
+ "start": "backstage-cli package start",
19
+ "build": "backstage-cli package build --experimental-type-build",
20
+ "lint": "backstage-cli package lint",
21
+ "test": "backstage-cli package test",
22
+ "clean": "backstage-cli package clean",
23
+ "prepack": "backstage-cli package prepack",
24
+ "postpack": "backstage-cli package postpack"
25
+ },
26
+ "dependencies": {
27
+ "@backstage/backend-plugin-api": "^0.0.0-nightly-20230124022523",
28
+ "@backstage/catalog-model": "^1.1.5",
29
+ "@backstage/plugin-scaffolder-common": "^1.2.4",
30
+ "@backstage/types": "^1.0.2",
31
+ "jsonschema": "^1.2.6",
32
+ "winston": "^3.2.1"
33
+ },
34
+ "devDependencies": {
35
+ "@backstage/cli": "^0.22.1"
36
+ },
37
+ "files": [
38
+ "alpha",
39
+ "dist"
40
+ ]
41
+ }