scaffolder: mark new models as v1beta3
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -73,6 +73,11 @@ export type ConditionTransformer<TQuery> = (
|
||||
conditions: PermissionCriteria<PermissionCondition>,
|
||||
) => PermissionCriteria<TQuery>;
|
||||
|
||||
// @public
|
||||
export const createConditionAuthorizer: <TResource, TQuery>(
|
||||
rules: PermissionRule<TResource, TQuery, string, PermissionRuleParams>[],
|
||||
) => (decision: PolicyDecision, resource: TResource | undefined) => boolean;
|
||||
|
||||
// @public
|
||||
export const createConditionExports: <
|
||||
TResourceType extends string,
|
||||
@@ -111,11 +116,6 @@ export const createConditionTransformer: <
|
||||
permissionRules: [...TRules],
|
||||
) => ConditionTransformer<TQuery>;
|
||||
|
||||
// @public
|
||||
export const createIsAuthorized: <TResource, TQuery>(
|
||||
rules: PermissionRule<TResource, TQuery, string, PermissionRuleParams>[],
|
||||
) => (decision: PolicyDecision, resource: TResource | undefined) => boolean;
|
||||
|
||||
// @public
|
||||
export function createPermissionIntegrationRouter<
|
||||
TResourceType extends string,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateEntityStepV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateFilter } from '@backstage/plugin-scaffolder-backend';
|
||||
import { TemplateGlobal } from '@backstage/plugin-scaffolder-backend';
|
||||
import { TemplateParameter } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateParameterV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
|
||||
// @alpha
|
||||
export const catalogModuleTemplateKind: () => BackendFeature;
|
||||
@@ -32,7 +32,7 @@ export const createScaffolderConditionalDecision: (
|
||||
// @alpha
|
||||
export const scaffolderConditions: Conditions<{
|
||||
hasTag: PermissionRule<
|
||||
TemplateParameter | TemplateEntityStepV1beta3,
|
||||
TemplateParameterV1beta3 | TemplateEntityStepV1beta3,
|
||||
{},
|
||||
'scaffolder-template',
|
||||
{
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
import { makeCreatePermissionRule } from '@backstage/plugin-permission-node';
|
||||
import {
|
||||
TemplateEntityStepV1beta3,
|
||||
TemplateParameter,
|
||||
TemplateParameterV1beta3,
|
||||
} from '@backstage/plugin-scaffolder-common';
|
||||
import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
export const createScaffolderPermissionRule = makeCreatePermissionRule<
|
||||
TemplateEntityStepV1beta3 | TemplateParameter,
|
||||
TemplateEntityStepV1beta3 | TemplateParameterV1beta3,
|
||||
{},
|
||||
typeof RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
|
||||
>();
|
||||
|
||||
@@ -45,7 +45,7 @@ export interface TaskStep {
|
||||
// @public
|
||||
export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
// (undocumented)
|
||||
'backstage:permissions'?: TemplateSpecValuesMetadata;
|
||||
'backstage:permissions'?: TemplatePermissionsV1beta3;
|
||||
// (undocumented)
|
||||
action: string;
|
||||
// (undocumented)
|
||||
@@ -64,7 +64,7 @@ export interface TemplateEntityV1beta3 extends Entity {
|
||||
kind: 'Template';
|
||||
spec: {
|
||||
type: string;
|
||||
parameters?: TemplateParameter | TemplateParameter[];
|
||||
parameters?: TemplateParameterV1beta3 | TemplateParameterV1beta3[];
|
||||
steps: Array<TemplateEntityStepV1beta3>;
|
||||
output?: {
|
||||
[name: string]: string;
|
||||
@@ -86,13 +86,13 @@ export type TemplateInfo = {
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface TemplateParameter extends JsonObject {
|
||||
export interface TemplateParameterV1beta3 extends JsonObject {
|
||||
// (undocumented)
|
||||
'backstage:permissions'?: TemplateSpecValuesMetadata;
|
||||
'backstage:permissions'?: TemplatePermissionsV1beta3;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface TemplateSpecValuesMetadata extends JsonObject {
|
||||
export interface TemplatePermissionsV1beta3 extends JsonObject {
|
||||
// (undocumented)
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { entityKindSchemaValidator } from '@backstage/catalog-model';
|
||||
import type {
|
||||
TemplateEntityV1beta3,
|
||||
TemplateParameter,
|
||||
TemplateParameterV1beta3,
|
||||
} from './TemplateEntityV1beta3';
|
||||
import schema from './Template.v1beta3.schema.json';
|
||||
|
||||
@@ -163,13 +163,14 @@ describe('templateEntityV1beta3Validator', () => {
|
||||
});
|
||||
|
||||
it('rejects parameters with wrong backstage:permissions', async () => {
|
||||
(entity.spec.parameters as TemplateParameter)[
|
||||
(entity.spec.parameters as TemplateParameterV1beta3)[
|
||||
'backstage:permissions'
|
||||
]!.tags = true as unknown as [];
|
||||
expect(() => validator(entity)).toThrow(/must be array/);
|
||||
|
||||
(entity.spec.parameters as TemplateParameter)['backstage:permissions'] =
|
||||
true as {};
|
||||
(entity.spec.parameters as TemplateParameterV1beta3)[
|
||||
'backstage:permissions'
|
||||
] = true as {};
|
||||
expect(() => validator(entity)).toThrow(/must be object/);
|
||||
});
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface TemplateEntityV1beta3 extends Entity {
|
||||
* to collect user input and validate it against that schema. This can then be used in the `steps` part below to template
|
||||
* variables passed from the user into each action in the template.
|
||||
*/
|
||||
parameters?: TemplateParameter | TemplateParameter[];
|
||||
parameters?: TemplateParameterV1beta3 | TemplateParameterV1beta3[];
|
||||
/**
|
||||
* A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying
|
||||
* javascript action and some optional input parameters that may or may not have been collected from the end user.
|
||||
@@ -78,7 +78,7 @@ export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
action: string;
|
||||
input?: JsonObject;
|
||||
if?: string | boolean;
|
||||
'backstage:permissions'?: TemplatePermissions;
|
||||
'backstage:permissions'?: TemplatePermissionsV1beta3;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,8 +86,8 @@ export interface TemplateEntityStepV1beta3 extends JsonObject {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface TemplateParameter extends JsonObject {
|
||||
'backstage:permissions'?: TemplatePermissions;
|
||||
export interface TemplateParameterV1beta3 extends JsonObject {
|
||||
'backstage:permissions'?: TemplatePermissionsV1beta3;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ export interface TemplateParameter extends JsonObject {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface TemplatePermissions extends JsonObject {
|
||||
export interface TemplatePermissionsV1beta3 extends JsonObject {
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ export {
|
||||
export type {
|
||||
TemplateEntityV1beta3,
|
||||
TemplateEntityStepV1beta3,
|
||||
TemplateParameter,
|
||||
TemplatePermissions as TemplateSpecValuesMetadata,
|
||||
TemplateParameterV1beta3,
|
||||
TemplatePermissionsV1beta3,
|
||||
} from './TemplateEntityV1beta3';
|
||||
|
||||
Reference in New Issue
Block a user