@backstage/frontend-test-utils 0.5.1-next.1 → 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/CHANGELOG.md +34 -0
- package/dist/apis/AlertApi/MockAlertApi.esm.js.map +1 -1
- package/dist/apis/AnalyticsApi/MockAnalyticsApi.esm.js.map +1 -1
- package/dist/apis/ConfigApi/MockConfigApi.esm.js.map +1 -1
- package/dist/apis/ErrorApi/MockErrorApi.esm.js.map +1 -1
- package/dist/apis/FeatureFlagsApi/MockFeatureFlagsApi.esm.js.map +1 -1
- package/dist/apis/FetchApi/MockFetchApi.esm.js.map +1 -1
- package/dist/apis/PermissionApi/MockPermissionApi.esm.js.map +1 -1
- package/dist/apis/StorageApi/MockStorageApi.esm.js.map +1 -1
- package/dist/apis/TranslationApi/MockTranslationApi.esm.js.map +1 -1
- package/dist/apis/mockApis.esm.js.map +1 -1
- package/dist/app/renderInTestApp.esm.js +3 -3
- package/dist/app/renderInTestApp.esm.js.map +1 -1
- package/dist/app/renderTestApp.esm.js +3 -3
- package/dist/app/renderTestApp.esm.js.map +1 -1
- package/dist/frontend-app-api/src/tree/instantiateAppNodeTree.esm.js +72 -15
- package/dist/frontend-app-api/src/tree/instantiateAppNodeTree.esm.js.map +1 -1
- package/dist/frontend-app-api/src/tree/resolveAppNodeSpecs.esm.js +50 -9
- package/dist/frontend-app-api/src/tree/resolveAppNodeSpecs.esm.js.map +1 -1
- package/dist/frontend-app-api/src/wiring/createErrorCollector.esm.js.map +1 -1
- package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
- package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/createFrontendModule.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/dist/index.d.ts +35 -14
- package/package.json +16 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveExtensionDefinition.esm.js","sources":["../../../../../frontend-plugin-api/src/wiring/resolveExtensionDefinition.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\nimport { ApiHolder, AppNode } from '../apis';\nimport {\n ExtensionDefinitionAttachTo,\n ExtensionDefinition,\n ExtensionDefinitionParameters,\n ResolvedExtensionInputs,\n} from './createExtension';\nimport { PortableSchema } from '../schema';\nimport { ExtensionInput } from './createExtensionInput';\nimport { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';\nimport {\n OpaqueExtensionDefinition,\n OpaqueExtensionInput,\n} from '@internal/frontend';\n\n/** @public */\nexport type ExtensionAttachTo
|
|
1
|
+
{"version":3,"file":"resolveExtensionDefinition.esm.js","sources":["../../../../../frontend-plugin-api/src/wiring/resolveExtensionDefinition.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\nimport { ApiHolder, AppNode } from '../apis';\nimport {\n ExtensionDefinitionAttachTo,\n ExtensionDefinition,\n ExtensionDefinitionParameters,\n ResolvedExtensionInputs,\n} from './createExtension';\nimport { PortableSchema } from '../schema';\nimport { ExtensionInput } from './createExtensionInput';\nimport { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';\nimport {\n OpaqueExtensionDefinition,\n OpaqueExtensionInput,\n} from '@internal/frontend';\nimport { FilterPredicate } from '@backstage/filter-predicates';\n\n/** @public */\nexport type ExtensionAttachTo = { id: string; input: string };\n\n/** @public */\nexport interface Extension<TConfig, TConfigInput = TConfig> {\n $$type: '@backstage/Extension';\n readonly id: string;\n readonly attachTo: ExtensionAttachTo;\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<TConfig, TConfigInput>;\n}\n\n/** @internal */\nexport type InternalExtension<TConfig, TConfigInput> = Extension<\n TConfig,\n TConfigInput\n> &\n (\n | {\n readonly version: 'v1';\n readonly inputs: {\n [inputName in string]: {\n $$type: '@backstage/ExtensionInput';\n extensionData: {\n [name in string]: ExtensionDataRef;\n };\n config: { optional: boolean; singleton: boolean };\n };\n };\n readonly output: {\n [name in string]: ExtensionDataRef;\n };\n factory(context: {\n apis: ApiHolder;\n node: AppNode;\n config: TConfig;\n inputs: {\n [inputName in string]: unknown;\n };\n }): {\n [inputName in string]: unknown;\n };\n }\n | {\n readonly version: 'v2';\n readonly if?: FilterPredicate;\n readonly inputs: { [inputName in string]: ExtensionInput };\n readonly output: Array<ExtensionDataRef>;\n factory(options: {\n apis: ApiHolder;\n node: AppNode;\n config: TConfig;\n inputs: ResolvedExtensionInputs<{\n [inputName in string]: ExtensionInput;\n }>;\n }): Iterable<ExtensionDataValue<any, any>>;\n }\n );\n\n/** @internal */\nexport function toInternalExtension<TConfig, TConfigInput>(\n overrides: Extension<TConfig, TConfigInput>,\n): InternalExtension<TConfig, TConfigInput> {\n const internal = overrides as InternalExtension<TConfig, TConfigInput>;\n if (internal.$$type !== '@backstage/Extension') {\n throw new Error(\n `Invalid extension instance, bad type '${internal.$$type}'`,\n );\n }\n const version = internal.version;\n if (version !== 'v1' && version !== 'v2') {\n throw new Error(`Invalid extension instance, bad version '${version}'`);\n }\n return internal;\n}\n\n/** @ignore */\nexport type ResolveExtensionId<\n TExtension extends ExtensionDefinition,\n TNamespace extends string,\n> = TExtension extends ExtensionDefinition<{\n kind: infer IKind extends string | undefined;\n name: infer IName extends string | undefined;\n params: any;\n}>\n ? [string] extends [IKind | IName]\n ? never\n : (\n undefined extends IName ? TNamespace : `${TNamespace}/${IName}`\n ) extends infer INamePart extends string\n ? IKind extends string\n ? `${IKind}:${INamePart}`\n : INamePart\n : never\n : never;\n\nfunction resolveExtensionId(\n kind?: string,\n namespace?: string,\n name?: string,\n): string {\n const namePart =\n name && namespace ? `${namespace}/${name}` : namespace || name;\n if (!namePart) {\n throw new Error(\n `Extension must declare an explicit namespace or name as it could not be resolved from context, kind=${kind} namespace=${namespace} name=${name}`,\n );\n }\n\n return kind ? `${kind}:${namePart}` : namePart;\n}\n\nfunction resolveAttachTo(\n attachTo: ExtensionDefinitionAttachTo | ExtensionDefinitionAttachTo[],\n namespace?: string,\n): ExtensionAttachTo | ExtensionAttachTo[] {\n const resolveSpec = (\n spec: ExtensionDefinitionAttachTo,\n ): { id: string; input: string } => {\n if (OpaqueExtensionInput.isType(spec)) {\n const { context } = OpaqueExtensionInput.toInternal(spec);\n if (!context) {\n throw new Error(\n 'Invalid input object without a parent extension used as attachment point',\n );\n }\n return {\n id: resolveExtensionId(context.kind, namespace, context.name),\n input: context.input,\n };\n }\n if ('relative' in spec && spec.relative) {\n return {\n id: resolveExtensionId(\n spec.relative.kind,\n namespace,\n spec.relative.name,\n ),\n input: spec.input,\n };\n }\n if ('id' in spec) {\n return { id: spec.id, input: spec.input };\n }\n throw new Error('Invalid attachment point specification');\n };\n\n if (Array.isArray(attachTo)) {\n return attachTo.map(resolveSpec);\n }\n\n return resolveSpec(attachTo);\n}\n\n/** @internal */\nexport function resolveExtensionDefinition<\n T extends ExtensionDefinitionParameters,\n>(\n definition: ExtensionDefinition<T>,\n context?: { namespace?: string },\n): Extension<T['config'], T['configInput']> {\n const internalDefinition = OpaqueExtensionDefinition.toInternal(definition);\n\n const {\n name,\n kind,\n namespace: internalNamespace,\n override: _skip2,\n attachTo,\n ...rest\n } = internalDefinition;\n\n const namespace = internalNamespace ?? context?.namespace;\n const id = resolveExtensionId(kind, namespace, name);\n\n return {\n ...rest,\n attachTo: resolveAttachTo(attachTo, namespace) as ExtensionAttachTo,\n $$type: '@backstage/Extension',\n version: internalDefinition.version,\n id,\n toString() {\n return `Extension{id=${id}}`;\n },\n } as InternalExtension<T['config'], T['configInput']> & Object;\n}\n"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _backstage_config from '@backstage/config';
|
|
2
2
|
import { Config } from '@backstage/config';
|
|
3
3
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
4
|
-
import { ApiFactory, ApiRef, AlertApi, AlertMessage,
|
|
4
|
+
import { ApiFactory, ApiRef, AlertApi, AlertMessage, FeatureFlagsApi, FeatureFlagState, FeatureFlag, FeatureFlagsSaveOptions, AnalyticsApi, AnalyticsEvent, TranslationApi, TranslationRef, TranslationSnapshot, ConfigApi as ConfigApi$1, DiscoveryApi as DiscoveryApi$1, IdentityApi as IdentityApi$1, StorageApi as StorageApi$1, ErrorApi as ErrorApi$1, FetchApi as FetchApi$1, ExtensionDefinitionParameters, ExtensionDefinition, ExtensionDataRef, AppNode, RouteRef, FrontendFeature } from '@backstage/frontend-plugin-api';
|
|
5
5
|
import { PermissionApi } from '@backstage/plugin-permission-react';
|
|
6
6
|
import { Observable, JsonObject, JsonValue } from '@backstage/types';
|
|
7
7
|
import { EvaluatePermissionRequest, AuthorizeResult, EvaluatePermissionResponse } from '@backstage/plugin-permission-common';
|
|
@@ -100,9 +100,10 @@ declare function createApiMock<TApi>(apiRef: ApiRef<TApi>, mockFactory: () => je
|
|
|
100
100
|
* Mock implementation of {@link @backstage/frontend-plugin-api#AlertApi} for testing alert behavior.
|
|
101
101
|
*
|
|
102
102
|
* @public
|
|
103
|
+
* @deprecated Use `mockApis.alert()` instead.
|
|
103
104
|
* @example
|
|
104
105
|
* ```ts
|
|
105
|
-
* const alertApi =
|
|
106
|
+
* const alertApi = mockApis.alert();
|
|
106
107
|
* alertApi.post({ message: 'Test alert' });
|
|
107
108
|
* expect(alertApi.getAlerts()).toHaveLength(1);
|
|
108
109
|
* ```
|
|
@@ -134,6 +135,7 @@ declare class MockAlertApi implements AlertApi {
|
|
|
134
135
|
* Options for configuring {@link MockFeatureFlagsApi}.
|
|
135
136
|
*
|
|
136
137
|
* @public
|
|
138
|
+
* @deprecated Use `mockApis.featureFlags()` instead.
|
|
137
139
|
*/
|
|
138
140
|
interface MockFeatureFlagsApiOptions {
|
|
139
141
|
/**
|
|
@@ -145,10 +147,11 @@ interface MockFeatureFlagsApiOptions {
|
|
|
145
147
|
* Mock implementation of {@link @backstage/frontend-plugin-api#FeatureFlagsApi} for testing feature flag behavior.
|
|
146
148
|
*
|
|
147
149
|
* @public
|
|
150
|
+
* @deprecated Use `mockApis.featureFlags()` instead.
|
|
148
151
|
* @example
|
|
149
152
|
* ```ts
|
|
150
|
-
* const api =
|
|
151
|
-
* initialStates: { 'my-feature': FeatureFlagState.Active }
|
|
153
|
+
* const api = mockApis.featureFlags({
|
|
154
|
+
* initialStates: { 'my-feature': FeatureFlagState.Active },
|
|
152
155
|
* });
|
|
153
156
|
* expect(api.isActive('my-feature')).toBe(true);
|
|
154
157
|
* ```
|
|
@@ -180,6 +183,7 @@ declare class MockFeatureFlagsApi implements FeatureFlagsApi {
|
|
|
180
183
|
* Use getEvents in tests to verify captured events.
|
|
181
184
|
*
|
|
182
185
|
* @public
|
|
186
|
+
* @deprecated Use `mockApis.analytics()` instead.
|
|
183
187
|
*/
|
|
184
188
|
declare class MockAnalyticsApi implements AnalyticsApi {
|
|
185
189
|
private events;
|
|
@@ -192,9 +196,10 @@ declare class MockAnalyticsApi implements AnalyticsApi {
|
|
|
192
196
|
* that can be used to mock configuration using a plain object.
|
|
193
197
|
*
|
|
194
198
|
* @public
|
|
199
|
+
* @deprecated Use `mockApis.config()` instead.
|
|
195
200
|
* @example
|
|
196
201
|
* ```tsx
|
|
197
|
-
* const mockConfig =
|
|
202
|
+
* const mockConfig = mockApis.config({
|
|
198
203
|
* data: { app: { baseUrl: 'https://example.com' } },
|
|
199
204
|
* });
|
|
200
205
|
*
|
|
@@ -247,6 +252,7 @@ declare class MockConfigApi implements ConfigApi {
|
|
|
247
252
|
/**
|
|
248
253
|
* Constructor arguments for {@link MockErrorApi}
|
|
249
254
|
* @public
|
|
255
|
+
* @deprecated Use `mockApis.error()` instead.
|
|
250
256
|
*/
|
|
251
257
|
type MockErrorApiOptions = {
|
|
252
258
|
collect?: boolean;
|
|
@@ -254,6 +260,7 @@ type MockErrorApiOptions = {
|
|
|
254
260
|
/**
|
|
255
261
|
* ErrorWithContext contains error and ErrorApiErrorContext
|
|
256
262
|
* @public
|
|
263
|
+
* @deprecated Use the return type of `MockErrorApi.getErrors` instead.
|
|
257
264
|
*/
|
|
258
265
|
type ErrorWithContext = {
|
|
259
266
|
error: ErrorApiError;
|
|
@@ -263,19 +270,28 @@ type ErrorWithContext = {
|
|
|
263
270
|
* Mock implementation of the {@link core-plugin-api#ErrorApi} to be used in tests.
|
|
264
271
|
* Includes withForError and getErrors methods for error testing.
|
|
265
272
|
* @public
|
|
273
|
+
* @deprecated Use `mockApis.error()` instead.
|
|
266
274
|
*/
|
|
267
275
|
declare class MockErrorApi implements ErrorApi {
|
|
268
276
|
private readonly options;
|
|
269
277
|
private readonly errors;
|
|
270
278
|
private readonly waiters;
|
|
271
|
-
constructor(options?:
|
|
279
|
+
constructor(options?: {
|
|
280
|
+
collect?: boolean;
|
|
281
|
+
});
|
|
272
282
|
post(error: ErrorApiError, context?: ErrorApiErrorContext): void;
|
|
273
283
|
error$(): Observable<{
|
|
274
284
|
error: ErrorApiError;
|
|
275
285
|
context?: ErrorApiErrorContext;
|
|
276
286
|
}>;
|
|
277
|
-
getErrors():
|
|
278
|
-
|
|
287
|
+
getErrors(): {
|
|
288
|
+
error: ErrorApiError;
|
|
289
|
+
context?: ErrorApiErrorContext;
|
|
290
|
+
}[];
|
|
291
|
+
waitForError(pattern: RegExp, timeoutMs?: number): Promise<{
|
|
292
|
+
error: ErrorApiError;
|
|
293
|
+
context?: ErrorApiErrorContext;
|
|
294
|
+
}>;
|
|
279
295
|
}
|
|
280
296
|
|
|
281
297
|
/**
|
|
@@ -341,6 +357,7 @@ interface MockFetchApiOptions {
|
|
|
341
357
|
* A test helper implementation of {@link @backstage/core-plugin-api#FetchApi}.
|
|
342
358
|
*
|
|
343
359
|
* @public
|
|
360
|
+
* @deprecated Use `mockApis.fetch()` instead.
|
|
344
361
|
*/
|
|
345
362
|
declare class MockFetchApi implements FetchApi {
|
|
346
363
|
private readonly implementation;
|
|
@@ -353,9 +370,10 @@ declare class MockFetchApi implements FetchApi {
|
|
|
353
370
|
}
|
|
354
371
|
|
|
355
372
|
/**
|
|
356
|
-
* Mock implementation of the {@link core-plugin-api#StorageApi} to be used in tests
|
|
373
|
+
* Mock implementation of the {@link core-plugin-api#StorageApi} to be used in tests.
|
|
357
374
|
*
|
|
358
375
|
* @public
|
|
376
|
+
* @deprecated Use `mockApis.storage()` instead.
|
|
359
377
|
*/
|
|
360
378
|
declare class MockStorageApi implements StorageApi {
|
|
361
379
|
private readonly namespace;
|
|
@@ -381,6 +399,7 @@ declare class MockStorageApi implements StorageApi {
|
|
|
381
399
|
* request.
|
|
382
400
|
*
|
|
383
401
|
* @public
|
|
402
|
+
* @deprecated Use `mockApis.permission()` instead.
|
|
384
403
|
*/
|
|
385
404
|
declare class MockPermissionApi implements PermissionApi {
|
|
386
405
|
private readonly requestHandler;
|
|
@@ -392,6 +411,7 @@ declare class MockPermissionApi implements PermissionApi {
|
|
|
392
411
|
* Mock implementation of {@link @backstage/frontend-plugin-api#TranslationApi}.
|
|
393
412
|
*
|
|
394
413
|
* @public
|
|
414
|
+
* @deprecated Use `mockApis.translation()` instead.
|
|
395
415
|
*/
|
|
396
416
|
declare class MockTranslationApi implements TranslationApi {
|
|
397
417
|
#private;
|
|
@@ -452,7 +472,6 @@ declare namespace mockApis {
|
|
|
452
472
|
/**
|
|
453
473
|
* Mock helpers for {@link @backstage/frontend-plugin-api#AlertApi}.
|
|
454
474
|
*
|
|
455
|
-
* @see {@link @backstage/frontend-plugin-api#mockApis.alert}
|
|
456
475
|
* @public
|
|
457
476
|
*/
|
|
458
477
|
namespace alert {
|
|
@@ -479,11 +498,12 @@ declare namespace mockApis {
|
|
|
479
498
|
* expect(featureFlagsApi.isActive('my-feature')).toBe(true);
|
|
480
499
|
* ```
|
|
481
500
|
*/
|
|
482
|
-
function featureFlags(options?:
|
|
501
|
+
function featureFlags(options?: {
|
|
502
|
+
initialStates?: Record<string, FeatureFlagState>;
|
|
503
|
+
}): MockWithApiFactory<MockFeatureFlagsApi>;
|
|
483
504
|
/**
|
|
484
505
|
* Mock helpers for {@link @backstage/frontend-plugin-api#FeatureFlagsApi}.
|
|
485
506
|
*
|
|
486
|
-
* @see {@link @backstage/frontend-plugin-api#mockApis.featureFlags}
|
|
487
507
|
* @public
|
|
488
508
|
*/
|
|
489
509
|
namespace featureFlags {
|
|
@@ -521,7 +541,6 @@ declare namespace mockApis {
|
|
|
521
541
|
/**
|
|
522
542
|
* Mock helpers for {@link @backstage/frontend-plugin-api#TranslationApi}.
|
|
523
543
|
*
|
|
524
|
-
* @see {@link @backstage/frontend-plugin-api#mockApis.translation}
|
|
525
544
|
* @public
|
|
526
545
|
*/
|
|
527
546
|
namespace translation {
|
|
@@ -622,7 +641,9 @@ declare namespace mockApis {
|
|
|
622
641
|
*
|
|
623
642
|
* @public
|
|
624
643
|
*/
|
|
625
|
-
function error(options?:
|
|
644
|
+
function error(options?: {
|
|
645
|
+
collect?: boolean;
|
|
646
|
+
}): MockErrorApi & MockWithApiFactory<ErrorApi$1>;
|
|
626
647
|
/**
|
|
627
648
|
* Mock helpers for {@link @backstage/core-plugin-api#ErrorApi}.
|
|
628
649
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-test-utils",
|
|
3
|
-
"version": "0.5.1
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -31,24 +31,25 @@
|
|
|
31
31
|
"test": "backstage-cli package test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@backstage/config": "1.3.6",
|
|
35
|
-
"@backstage/core-app-api": "1.19.6
|
|
36
|
-
"@backstage/core-plugin-api": "1.12.4
|
|
37
|
-
"@backstage/
|
|
38
|
-
"@backstage/frontend-
|
|
39
|
-
"@backstage/plugin-
|
|
40
|
-
"@backstage/plugin-app
|
|
41
|
-
"@backstage/plugin-
|
|
42
|
-
"@backstage/plugin-permission-
|
|
43
|
-
"@backstage/
|
|
44
|
-
"@backstage/
|
|
45
|
-
"@backstage/
|
|
34
|
+
"@backstage/config": "^1.3.6",
|
|
35
|
+
"@backstage/core-app-api": "^1.19.6",
|
|
36
|
+
"@backstage/core-plugin-api": "^1.12.4",
|
|
37
|
+
"@backstage/filter-predicates": "^0.1.1",
|
|
38
|
+
"@backstage/frontend-app-api": "^0.16.0",
|
|
39
|
+
"@backstage/frontend-plugin-api": "^0.15.0",
|
|
40
|
+
"@backstage/plugin-app": "^0.4.1",
|
|
41
|
+
"@backstage/plugin-app-react": "^0.2.1",
|
|
42
|
+
"@backstage/plugin-permission-common": "^0.9.7",
|
|
43
|
+
"@backstage/plugin-permission-react": "^0.4.41",
|
|
44
|
+
"@backstage/test-utils": "^1.7.16",
|
|
45
|
+
"@backstage/types": "^1.2.2",
|
|
46
|
+
"@backstage/version-bridge": "^1.0.12",
|
|
46
47
|
"i18next": "^22.4.15",
|
|
47
48
|
"zen-observable": "^0.10.0",
|
|
48
|
-
"zod": "^3.25.76"
|
|
49
|
+
"zod": "^3.25.76 || ^4.0.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@backstage/cli": "0.36.0
|
|
52
|
+
"@backstage/cli": "^0.36.0",
|
|
52
53
|
"@testing-library/jest-dom": "^6.0.0",
|
|
53
54
|
"@types/jest": "*",
|
|
54
55
|
"@types/react": "^18.0.0",
|