@backstage/plugin-scaffolder-react 1.2.0 → 1.3.0-next.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/CHANGELOG.md +45 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +55 -7
- package/dist/alpha.esm.js +174 -45
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/ref-6fdfc121.esm.js +45 -0
- package/dist/esm/ref-6fdfc121.esm.js.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.esm.js +15 -44
- package/dist/index.esm.js.map +1 -1
- package/package.json +22 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import React__default, { PropsWithChildren } from 'react';
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
4
|
import { ApiHolder, Extension } from '@backstage/core-plugin-api';
|
|
5
5
|
import { FieldValidation, FieldProps } from '@rjsf/core';
|
|
@@ -66,7 +66,7 @@ declare function createScaffolderFieldExtension<TReturnValue = unknown, TInputPr
|
|
|
66
66
|
*
|
|
67
67
|
* @public
|
|
68
68
|
*/
|
|
69
|
-
declare const ScaffolderFieldExtensions:
|
|
69
|
+
declare const ScaffolderFieldExtensions: React__default.ComponentType<React__default.PropsWithChildren<{}>>;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* The shape of each entry of parameters which gets rendered
|
|
@@ -109,7 +109,7 @@ declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
|
|
|
109
109
|
*
|
|
110
110
|
* @public
|
|
111
111
|
*/
|
|
112
|
-
declare type ScaffolderTaskStatus = '
|
|
112
|
+
declare type ScaffolderTaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing' | 'skipped';
|
|
113
113
|
/**
|
|
114
114
|
* The shape of each task returned from the `scaffolder-backend`
|
|
115
115
|
*
|
|
@@ -170,7 +170,7 @@ declare type ScaffolderTaskOutput = {
|
|
|
170
170
|
* @public
|
|
171
171
|
*/
|
|
172
172
|
declare type LogEvent = {
|
|
173
|
-
type: 'log' | 'completion';
|
|
173
|
+
type: 'log' | 'completion' | 'cancelled';
|
|
174
174
|
body: {
|
|
175
175
|
message: string;
|
|
176
176
|
stepId?: string;
|
|
@@ -263,6 +263,12 @@ interface ScaffolderApi {
|
|
|
263
263
|
*/
|
|
264
264
|
scaffold(options: ScaffolderScaffoldOptions): Promise<ScaffolderScaffoldResponse>;
|
|
265
265
|
getTask(taskId: string): Promise<ScaffolderTask>;
|
|
266
|
+
/**
|
|
267
|
+
* Sends a signal to a task broker to cancel the running task by taskId.
|
|
268
|
+
*
|
|
269
|
+
* @param taskId - the id of the task
|
|
270
|
+
*/
|
|
271
|
+
cancelTask(taskId: string): Promise<void>;
|
|
266
272
|
listTasks?(options: {
|
|
267
273
|
filterByOwnership: 'owned' | 'all';
|
|
268
274
|
}): Promise<{
|
|
@@ -342,6 +348,7 @@ declare type ScaffolderStep = {
|
|
|
342
348
|
* @public
|
|
343
349
|
*/
|
|
344
350
|
declare type TaskStream = {
|
|
351
|
+
cancelled: boolean;
|
|
345
352
|
loading: boolean;
|
|
346
353
|
error?: Error;
|
|
347
354
|
stepLogs: {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { attachComponentData,
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { attachComponentData, useElementFilter, useApi } from '@backstage/core-plugin-api';
|
|
2
|
+
import { F as FIELD_EXTENSION_WRAPPER_KEY, a as FIELD_EXTENSION_KEY, s as scaffolderApiRef } from './esm/ref-6fdfc121.esm.js';
|
|
3
|
+
export { S as SecretsContextProvider, s as scaffolderApiRef, u as useTemplateSecrets } from './esm/ref-6fdfc121.esm.js';
|
|
4
4
|
import { useImmerReducer } from 'use-immer';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const FIELD_EXTENSION_KEY = "scaffolder.extensions.field.v1";
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import '@backstage/version-bridge';
|
|
8
7
|
|
|
9
8
|
function createScaffolderFieldExtension(options) {
|
|
10
9
|
return {
|
|
@@ -26,42 +25,6 @@ attachComponentData(
|
|
|
26
25
|
true
|
|
27
26
|
);
|
|
28
27
|
|
|
29
|
-
const SecretsContext = createVersionedContext("secrets-context");
|
|
30
|
-
const SecretsContextProvider = (props) => {
|
|
31
|
-
const [secrets, setSecrets] = useState({});
|
|
32
|
-
return /* @__PURE__ */ React.createElement(
|
|
33
|
-
SecretsContext.Provider,
|
|
34
|
-
{
|
|
35
|
-
value: createVersionedValueMap({ 1: { secrets, setSecrets } })
|
|
36
|
-
},
|
|
37
|
-
props.children
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
const useTemplateSecrets = () => {
|
|
41
|
-
var _a;
|
|
42
|
-
const value = (_a = useContext(SecretsContext)) == null ? void 0 : _a.atVersion(1);
|
|
43
|
-
if (!value) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
"useTemplateSecrets must be used within a SecretsContextProvider"
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
const { setSecrets: updateSecrets, secrets = {} } = value;
|
|
49
|
-
const setSecrets = useCallback(
|
|
50
|
-
(input) => {
|
|
51
|
-
updateSecrets((currentSecrets) => ({ ...currentSecrets, ...input }));
|
|
52
|
-
},
|
|
53
|
-
[updateSecrets]
|
|
54
|
-
);
|
|
55
|
-
return { setSecrets, secrets };
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const scaffolderApiRef = getOrCreateGlobalSingleton(
|
|
59
|
-
"scaffolder:scaffolder-api-ref",
|
|
60
|
-
() => createApiRef({
|
|
61
|
-
id: "plugin.scaffolder.service"
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
|
|
65
28
|
const useCustomFieldExtensions = (outlet) => {
|
|
66
29
|
return useElementFilter(
|
|
67
30
|
outlet,
|
|
@@ -119,7 +82,7 @@ function reducer(draft, action) {
|
|
|
119
82
|
if (currentStep.status === "processing") {
|
|
120
83
|
currentStep.startedAt = entry.createdAt;
|
|
121
84
|
}
|
|
122
|
-
if (["cancelled", "
|
|
85
|
+
if (["cancelled", "completed", "failed"].includes(currentStep.status)) {
|
|
123
86
|
currentStep.endedAt = entry.createdAt;
|
|
124
87
|
}
|
|
125
88
|
}
|
|
@@ -133,6 +96,10 @@ function reducer(draft, action) {
|
|
|
133
96
|
draft.error = action.data.body.error;
|
|
134
97
|
return;
|
|
135
98
|
}
|
|
99
|
+
case "CANCELLED": {
|
|
100
|
+
draft.cancelled = true;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
136
103
|
case "ERROR": {
|
|
137
104
|
draft.error = action.data;
|
|
138
105
|
draft.loading = false;
|
|
@@ -146,6 +113,7 @@ function reducer(draft, action) {
|
|
|
146
113
|
const useTaskEventStream = (taskId) => {
|
|
147
114
|
const scaffolderApi = useApi(scaffolderApiRef);
|
|
148
115
|
const [state, dispatch] = useImmerReducer(reducer, {
|
|
116
|
+
cancelled: false,
|
|
149
117
|
loading: true,
|
|
150
118
|
completed: false,
|
|
151
119
|
stepLogs: {},
|
|
@@ -178,6 +146,9 @@ const useTaskEventStream = (taskId) => {
|
|
|
178
146
|
switch (event.type) {
|
|
179
147
|
case "log":
|
|
180
148
|
return collectedLogEvents.push(event);
|
|
149
|
+
case "cancelled":
|
|
150
|
+
dispatch({ type: "CANCELLED" });
|
|
151
|
+
return void 0;
|
|
181
152
|
case "completion":
|
|
182
153
|
emitLogs();
|
|
183
154
|
dispatch({ type: "COMPLETED", data: event });
|
|
@@ -225,5 +196,5 @@ function createScaffolderLayout(options) {
|
|
|
225
196
|
const ScaffolderLayouts = () => null;
|
|
226
197
|
attachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);
|
|
227
198
|
|
|
228
|
-
export { ScaffolderFieldExtensions, ScaffolderLayouts,
|
|
199
|
+
export { ScaffolderFieldExtensions, ScaffolderLayouts, createScaffolderFieldExtension, createScaffolderLayout, useCustomFieldExtensions, useCustomLayouts, useTaskEventStream };
|
|
229
200
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/extensions/keys.ts","../src/extensions/index.tsx","../src/secrets/SecretsContext.tsx","../src/api/ref.ts","../src/hooks/useCustomFieldExtensions.ts","../src/layouts/keys.ts","../src/hooks/useCustomLayouts.ts","../src/hooks/useEventStream.ts","../src/layouts/createScaffolderLayout.ts"],"sourcesContent":["/*\n * Copyright 2023 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\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\n/**\n * The key used to store the field extension data for any `<FieldExtension />` component\n */\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n","/*\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 React from 'react';\nimport {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps = unknown,\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\nexport type {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\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 */\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport React, {\n useState,\n useCallback,\n useContext,\n PropsWithChildren,\n} from 'react';\n\n/**\n * The contents of the `SecretsContext`\n */\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The context to hold the Secrets.\n */\nconst SecretsContext = createVersionedContext<{\n 1: SecretsContextContents;\n}>('secrets-context');\n\n/**\n * The Context Provider that holds the state for the secrets.\n * @public\n */\nexport const SecretsContextProvider = (props: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider\n value={createVersionedValueMap({ 1: { secrets, setSecrets } })}\n >\n {props.children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * The return type from the useTemplateSecrets hook.\n * @public\n */\nexport interface ScaffolderUseTemplateSecrets {\n setSecrets: (input: Record<string, string>) => void;\n secrets: Record<string, string>;\n}\n\n/**\n * Hook to access the secrets context to be able to set secrets that are\n * passed to the Scaffolder backend.\n * @public\n */\nexport const useTemplateSecrets = (): ScaffolderUseTemplateSecrets => {\n const value = useContext(SecretsContext)?.atVersion(1);\n\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets: updateSecrets, secrets = {} } = value;\n\n const setSecrets = useCallback(\n (input: Record<string, string>) => {\n updateSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [updateSecrets],\n );\n\n return { setSecrets, secrets };\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 { createApiRef } from '@backstage/core-plugin-api';\nimport { ScaffolderApi } from './types';\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\n\n/** @public */\nexport const scaffolderApiRef = getOrCreateGlobalSingleton(\n 'scaffolder:scaffolder-api-ref',\n () =>\n createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n }),\n);\n","/*\n * Copyright 2023 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 */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n","/*\n * Copyright 2023 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 */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n","/*\n * Copyright 2023 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 */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n","/*\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 */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n LogEvent,\n scaffolderApiRef,\n ScaffolderTask,\n ScaffolderTaskOutput,\n ScaffolderTaskStatus,\n} from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.loading = false;\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'failed', 'completed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n\n scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel) {\n return;\n }\n dispatch({ type: 'INIT', data: task });\n\n // TODO(blam): Use a normal fetch to fetch the current log for the event stream\n // and use that for an INIT_EVENTs dispatch event, and then\n // use the last event ID to subscribe using after option to\n // stream logs. Without this, if you have a lot of logs, it can look like the\n // task is being rebuilt on load as it progresses through the steps at a slower\n // rate whilst it builds the status from the event logs\n const observable = scaffolderApi.streamLogs({ taskId });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(\n 0,\n collectedLogEvents.length,\n );\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'completion':\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n return undefined;\n default:\n throw new Error(\n `Unhandled event type ${event.type} in observer`,\n );\n }\n },\n error: error => {\n emitLogs();\n dispatch({ type: 'ERROR', data: error });\n },\n });\n },\n error => {\n if (!didCancel) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n\n return () => {\n didCancel = true;\n if (subscription) {\n subscription.unsubscribe();\n }\n if (logPusher) {\n clearInterval(logPusher);\n }\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n","/*\n * Copyright 2023 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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core-v5';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: React.ComponentType = (): JSX.Element | null =>\n null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,2BAA8B,GAAA,kCAAA,CAAA;AAIpC,MAAM,mBAAsB,GAAA,gCAAA;;ACkB5B,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA,CAAA;AAE5C,MAAA,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ACP,MAAA,MAAM,mBAAwB,MAAM,IAAA,CAAA;AAEpC,MAAoB,mBAAA,CAAA,gBAAA,EAAkB,aAAa,OAAO,CAAA,CAAA;AAE1D,MAAO,OAAA,gBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,oBAAyC,MACpD,KAAA;AAEF,mBAAoB,CAAA,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/extensions/index.tsx","../src/hooks/useCustomFieldExtensions.ts","../src/layouts/keys.ts","../src/hooks/useCustomLayouts.ts","../src/hooks/useEventStream.ts","../src/layouts/createScaffolderLayout.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 React from 'react';\nimport {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n} from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\nimport { FIELD_EXTENSION_KEY, FIELD_EXTENSION_WRAPPER_KEY } from './keys';\n\n/**\n * The type used to wrap up the Layout and embed the input props\n *\n * @public\n */\nexport type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;\n\n/**\n * Method for creating field extensions that can be used in the scaffolder\n * frontend form.\n * @public\n */\nexport function createScaffolderFieldExtension<\n TReturnValue = unknown,\n TInputProps = unknown,\n>(\n options: FieldExtensionOptions<TReturnValue, TInputProps>,\n): Extension<FieldExtensionComponent<TReturnValue, TInputProps>> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\n/**\n * The Wrapping component for defining fields extensions inside\n *\n * @public\n */\nexport const ScaffolderFieldExtensions: React.ComponentType<\n React.PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\nexport type {\n CustomFieldExtensionSchema,\n CustomFieldValidator,\n FieldExtensionOptions,\n FieldExtensionComponentProps,\n};\n","/*\n * Copyright 2023 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 */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { FieldExtensionOptions } from '../extensions';\nimport {\n FIELD_EXTENSION_KEY,\n FIELD_EXTENSION_WRAPPER_KEY,\n} from '../extensions/keys';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomFieldExtensions = <\n TComponentDataType = FieldExtensionOptions,\n>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n};\n","/*\n * Copyright 2023 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 */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n","/*\n * Copyright 2023 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 */\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../layouts/keys';\nimport { LayoutOptions } from '../layouts';\n\n/**\n * Hook that returns all custom field extensions from the current outlet.\n * @public\n */\nexport const useCustomLayouts = <TComponentDataType = LayoutOptions>(\n outlet: React.ReactNode,\n) => {\n return useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUTS_WRAPPER_KEY,\n })\n .findComponentData<TComponentDataType>({\n key: LAYOUTS_KEY,\n }),\n );\n};\n","/*\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 */\nimport { useImmerReducer } from 'use-immer';\nimport { useEffect } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Subscription } from '@backstage/types';\nimport {\n LogEvent,\n scaffolderApiRef,\n ScaffolderTask,\n ScaffolderTaskOutput,\n ScaffolderTaskStatus,\n} from '../api';\n\n/**\n * The status of the step being processed\n *\n * @public\n */\nexport type ScaffolderStep = {\n id: string;\n status: ScaffolderTaskStatus;\n endedAt?: string;\n startedAt?: string;\n};\n\n/**\n * A task event from the event stream\n *\n * @public\n */\nexport type TaskStream = {\n cancelled: boolean;\n loading: boolean;\n error?: Error;\n stepLogs: { [stepId in string]: string[] };\n completed: boolean;\n task?: ScaffolderTask;\n steps: { [stepId in string]: ScaffolderStep };\n output?: ScaffolderTaskOutput;\n};\n\ntype ReducerLogEntry = {\n createdAt: string;\n body: {\n stepId?: string;\n status?: ScaffolderTaskStatus;\n message: string;\n output?: ScaffolderTaskOutput;\n error?: Error;\n };\n};\n\ntype ReducerAction =\n | { type: 'INIT'; data: ScaffolderTask }\n | { type: 'CANCELLED' }\n | { type: 'LOGS'; data: ReducerLogEntry[] }\n | { type: 'COMPLETED'; data: ReducerLogEntry }\n | { type: 'ERROR'; data: Error };\n\nfunction reducer(draft: TaskStream, action: ReducerAction) {\n switch (action.type) {\n case 'INIT': {\n draft.steps = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = { status: 'open', id: next.id };\n return current;\n }, {} as { [stepId in string]: ScaffolderStep });\n draft.stepLogs = action.data.spec.steps.reduce((current, next) => {\n current[next.id] = [];\n return current;\n }, {} as { [stepId in string]: string[] });\n draft.loading = false;\n draft.error = undefined;\n draft.completed = false;\n draft.task = action.data;\n return;\n }\n\n case 'LOGS': {\n const entries = action.data;\n const logLines = [];\n\n for (const entry of entries) {\n const logLine = `${entry.createdAt} ${entry.body.message}`;\n logLines.push(logLine);\n\n if (!entry.body.stepId || !draft.steps?.[entry.body.stepId]) {\n continue;\n }\n\n const currentStepLog = draft.stepLogs?.[entry.body.stepId];\n const currentStep = draft.steps?.[entry.body.stepId];\n\n if (entry.body.status && entry.body.status !== currentStep.status) {\n currentStep.status = entry.body.status;\n\n if (currentStep.status === 'processing') {\n currentStep.startedAt = entry.createdAt;\n }\n\n if (\n ['cancelled', 'completed', 'failed'].includes(currentStep.status)\n ) {\n currentStep.endedAt = entry.createdAt;\n }\n }\n\n currentStepLog?.push(logLine);\n }\n\n return;\n }\n\n case 'COMPLETED': {\n draft.completed = true;\n draft.output = action.data.body.output;\n draft.error = action.data.body.error;\n\n return;\n }\n\n case 'CANCELLED': {\n draft.cancelled = true;\n return;\n }\n\n case 'ERROR': {\n draft.error = action.data;\n draft.loading = false;\n draft.completed = true;\n return;\n }\n\n default:\n return;\n }\n}\n\n/**\n * A hook to stream the logs of a task being processed\n *\n * @public\n */\nexport const useTaskEventStream = (taskId: string): TaskStream => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const [state, dispatch] = useImmerReducer(reducer, {\n cancelled: false,\n loading: true,\n completed: false,\n stepLogs: {} as { [stepId in string]: string[] },\n steps: {} as { [stepId in string]: ScaffolderStep },\n });\n\n useEffect(() => {\n let didCancel = false;\n let subscription: Subscription | undefined;\n let logPusher: NodeJS.Timeout | undefined;\n\n scaffolderApi.getTask(taskId).then(\n task => {\n if (didCancel) {\n return;\n }\n dispatch({ type: 'INIT', data: task });\n\n // TODO(blam): Use a normal fetch to fetch the current log for the event stream\n // and use that for an INIT_EVENTs dispatch event, and then\n // use the last event ID to subscribe using after option to\n // stream logs. Without this, if you have a lot of logs, it can look like the\n // task is being rebuilt on load as it progresses through the steps at a slower\n // rate whilst it builds the status from the event logs\n const observable = scaffolderApi.streamLogs({ taskId });\n\n const collectedLogEvents = new Array<LogEvent>();\n\n function emitLogs() {\n if (collectedLogEvents.length) {\n const logs = collectedLogEvents.splice(\n 0,\n collectedLogEvents.length,\n );\n dispatch({ type: 'LOGS', data: logs });\n }\n }\n\n logPusher = setInterval(emitLogs, 500);\n\n subscription = observable.subscribe({\n next: event => {\n switch (event.type) {\n case 'log':\n return collectedLogEvents.push(event);\n case 'cancelled':\n dispatch({ type: 'CANCELLED' });\n return undefined;\n case 'completion':\n emitLogs();\n dispatch({ type: 'COMPLETED', data: event });\n return undefined;\n default:\n throw new Error(\n `Unhandled event type ${event.type} in observer`,\n );\n }\n },\n error: error => {\n emitLogs();\n dispatch({ type: 'ERROR', data: error });\n },\n });\n },\n error => {\n if (!didCancel) {\n dispatch({ type: 'ERROR', data: error });\n }\n },\n );\n\n return () => {\n didCancel = true;\n if (subscription) {\n subscription.unsubscribe();\n }\n if (logPusher) {\n clearInterval(logPusher);\n }\n };\n }, [scaffolderApi, dispatch, taskId]);\n\n return state;\n};\n","/*\n * Copyright 2023 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 { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core-v5';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: React.ComponentType = (): JSX.Element | null =>\n null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;;;;;AAsCO,SAAS,+BAId,OAC+D,EAAA;AAC/D,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,2BAAgC,MAAM,IAAA,CAAA;AAE5C,MAAA,mBAAA;AAAA,QACE,wBAAA;AAAA,QACA,mBAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,wBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,4BAET,MAA0B,KAAA;AAE9B,mBAAA;AAAA,EACE,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AACF,CAAA;;AC9Ca,MAAA,wBAAA,GAA2B,CAGtC,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,2BAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA,mBAAA;AAAA,KACN,CAAA;AAAA,GACL,CAAA;AACF;;ACzBO,MAAM,WAAc,GAAA,sBAAA,CAAA;AACpB,MAAM,mBAAsB,GAAA,+BAAA;;ACOtB,MAAA,gBAAA,GAAmB,CAC9B,MACG,KAAA;AACH,EAAO,OAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KAC9B,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,mBAAA;AAAA,KACN,EACA,iBAAsC,CAAA;AAAA,MACrC,GAAK,EAAA,WAAA;AAAA,KACN,CAAA;AAAA,GACL,CAAA;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AAA,SACD,CAAA,CAAA;AAAA,OACH;AAAA,MACA,CAAS,KAAA,KAAA;AACP,QAAA,IAAI,CAAC,SAAW,EAAA;AACd,UAAA,QAAA,CAAS,EAAE,IAAA,EAAM,OAAS,EAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAAA,SACzC;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,OAAO,MAAM;AACX,MAAY,SAAA,GAAA,IAAA,CAAA;AACZ,MAAA,IAAI,YAAc,EAAA;AAChB,QAAA,YAAA,CAAa,WAAY,EAAA,CAAA;AAAA,OAC3B;AACA,MAAA,IAAI,SAAW,EAAA;AACb,QAAA,aAAA,CAAc,SAAS,CAAA,CAAA;AAAA,OACzB;AAAA,KACF,CAAA;AAAA,GACC,EAAA,CAAC,aAAe,EAAA,QAAA,EAAU,MAAM,CAAC,CAAA,CAAA;AAEpC,EAAO,OAAA,KAAA,CAAA;AACT;;AClMO,SAAS,uBACd,OACyC,EAAA;AACzC,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA,CAAA;AAEpC,MAAoB,mBAAA,CAAA,gBAAA,EAAkB,aAAa,OAAO,CAAA,CAAA;AAE1D,MAAO,OAAA,gBAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AACF,CAAA;AAOO,MAAM,oBAAyC,MACpD,KAAA;AAEF,mBAAoB,CAAA,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-react",
|
|
3
3
|
"description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0-next.1",
|
|
5
5
|
"main": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -45,25 +45,26 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@backstage/catalog-client": "^1.4.0",
|
|
47
47
|
"@backstage/catalog-model": "^1.2.1",
|
|
48
|
-
"@backstage/core-components": "^0.12.
|
|
49
|
-
"@backstage/core-plugin-api": "^1.5.0",
|
|
48
|
+
"@backstage/core-components": "^0.12.6-next.1",
|
|
49
|
+
"@backstage/core-plugin-api": "^1.5.1-next.0",
|
|
50
50
|
"@backstage/errors": "^1.1.5",
|
|
51
|
-
"@backstage/plugin-catalog-react": "^1.4.
|
|
52
|
-
"@backstage/plugin-scaffolder-common": "^1.2.
|
|
53
|
-
"@backstage/theme": "^0.2.
|
|
51
|
+
"@backstage/plugin-catalog-react": "^1.4.1-next.1",
|
|
52
|
+
"@backstage/plugin-scaffolder-common": "^1.2.7-next.1",
|
|
53
|
+
"@backstage/theme": "^0.2.19-next.0",
|
|
54
54
|
"@backstage/types": "^1.0.2",
|
|
55
|
-
"@backstage/version-bridge": "^1.0.
|
|
55
|
+
"@backstage/version-bridge": "^1.0.4-next.0",
|
|
56
56
|
"@material-ui/core": "^4.12.2",
|
|
57
57
|
"@material-ui/icons": "^4.9.1",
|
|
58
|
-
"@material-ui/lab": "4.0.0-alpha.
|
|
58
|
+
"@material-ui/lab": "4.0.0-alpha.61",
|
|
59
59
|
"@react-hookz/web": "^20.0.0",
|
|
60
60
|
"@rjsf/core": "^3.2.1",
|
|
61
|
-
"@rjsf/core-v5": "npm:@rjsf/core@5.1
|
|
61
|
+
"@rjsf/core-v5": "npm:@rjsf/core@5.3.1",
|
|
62
62
|
"@rjsf/material-ui": "^3.2.1",
|
|
63
|
-
"@rjsf/material-ui-v5": "npm:@rjsf/material-ui@5.1
|
|
64
|
-
"@rjsf/utils": "5.1
|
|
65
|
-
"@rjsf/validator-ajv8": "5.1
|
|
63
|
+
"@rjsf/material-ui-v5": "npm:@rjsf/material-ui@5.3.1",
|
|
64
|
+
"@rjsf/utils": "5.3.1",
|
|
65
|
+
"@rjsf/validator-ajv8": "5.3.1",
|
|
66
66
|
"@types/json-schema": "^7.0.9",
|
|
67
|
+
"@types/react": "^16.13.1 || ^17.0.0",
|
|
67
68
|
"classnames": "^2.2.6",
|
|
68
69
|
"humanize-duration": "^3.25.1",
|
|
69
70
|
"immer": "^9.0.1",
|
|
@@ -75,20 +76,21 @@
|
|
|
75
76
|
"react-use": "^17.2.4",
|
|
76
77
|
"use-immer": "^0.8.0",
|
|
77
78
|
"zen-observable": "^0.10.0",
|
|
78
|
-
"zod": "
|
|
79
|
-
"zod-to-json-schema": "
|
|
79
|
+
"zod": "^3.21.4",
|
|
80
|
+
"zod-to-json-schema": "^3.20.4"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
|
-
"@types/react": "^16.13.1 || ^17.0.0",
|
|
83
83
|
"react": "^16.13.1 || ^17.0.0",
|
|
84
|
+
"react-dom": "^16.13.1 || ^17.0.0",
|
|
84
85
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
87
|
-
"@backstage/cli": "^0.22.
|
|
88
|
-
"@backstage/core-app-api": "^1.
|
|
89
|
-
"@backstage/plugin-catalog": "^1.
|
|
90
|
-
"@backstage/plugin-catalog-common": "^1.0.
|
|
91
|
-
"@backstage/test-utils": "^1.
|
|
88
|
+
"@backstage/cli": "^0.22.6-next.1",
|
|
89
|
+
"@backstage/core-app-api": "^1.7.0-next.1",
|
|
90
|
+
"@backstage/plugin-catalog": "^1.10.0-next.1",
|
|
91
|
+
"@backstage/plugin-catalog-common": "^1.0.13-next.0",
|
|
92
|
+
"@backstage/test-utils": "^1.3.0-next.1",
|
|
93
|
+
"@testing-library/dom": "^8.0.0",
|
|
92
94
|
"@testing-library/jest-dom": "^5.10.1",
|
|
93
95
|
"@testing-library/react": "^12.1.3",
|
|
94
96
|
"@testing-library/react-hooks": "^8.0.0",
|