@red-hat-developer-hub/backstage-plugin-orchestrator-common 1.24.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 +228 -0
- package/README.md +5 -0
- package/config.d.ts +81 -0
- package/dist/QueryParams.cjs.js +12 -0
- package/dist/QueryParams.cjs.js.map +1 -0
- package/dist/QueryParams.esm.js +7 -0
- package/dist/QueryParams.esm.js.map +1 -0
- package/dist/constants.cjs.js +16 -0
- package/dist/constants.cjs.js.map +1 -0
- package/dist/constants.esm.js +9 -0
- package/dist/constants.esm.js.map +1 -0
- package/dist/generated/api/definition.cjs.js +7 -0
- package/dist/generated/api/definition.cjs.js.map +1 -0
- package/dist/generated/api/definition.esm.js +5 -0
- package/dist/generated/api/definition.esm.js.map +1 -0
- package/dist/generated/client/api.cjs.js +761 -0
- package/dist/generated/client/api.cjs.js.map +1 -0
- package/dist/generated/client/api.esm.js +744 -0
- package/dist/generated/client/api.esm.js.map +1 -0
- package/dist/generated/client/base.cjs.js +34 -0
- package/dist/generated/client/base.cjs.js.map +1 -0
- package/dist/generated/client/base.esm.js +25 -0
- package/dist/generated/client/base.esm.js.map +1 -0
- package/dist/generated/client/common.cjs.js +55 -0
- package/dist/generated/client/common.cjs.js.map +1 -0
- package/dist/generated/client/common.esm.js +48 -0
- package/dist/generated/client/common.esm.js.map +1 -0
- package/dist/generated/client/configuration.cjs.js +87 -0
- package/dist/generated/client/configuration.cjs.js.map +1 -0
- package/dist/generated/client/configuration.esm.js +85 -0
- package/dist/generated/client/configuration.esm.js.map +1 -0
- package/dist/index.cjs.js +63 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1570 -0
- package/dist/index.esm.js +11 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/models.cjs.js +34 -0
- package/dist/models.cjs.js.map +1 -0
- package/dist/models.esm.js +29 -0
- package/dist/models.esm.js.map +1 -0
- package/dist/permissions.cjs.js +45 -0
- package/dist/permissions.cjs.js.map +1 -0
- package/dist/permissions.esm.js +38 -0
- package/dist/permissions.esm.js.map +1 -0
- package/dist/types.cjs.js +18 -0
- package/dist/types.cjs.js.map +1 -0
- package/dist/types.esm.js +14 -0
- package/dist/types.esm.js.map +1 -0
- package/dist/utils/StringUtils.cjs.js +8 -0
- package/dist/utils/StringUtils.cjs.js.map +1 -0
- package/dist/utils/StringUtils.esm.js +5 -0
- package/dist/utils/StringUtils.esm.js.map +1 -0
- package/dist/workflow.cjs.js +96 -0
- package/dist/workflow.cjs.js.map +1 -0
- package/dist/workflow.esm.js +87 -0
- package/dist/workflow.esm.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { WorkflowCategory, isComposedSchema, isJsonObjectSchema } from './types.esm.js';
|
|
2
|
+
export { openApiDocument } from './generated/api/definition.esm.js';
|
|
3
|
+
export { DefaultApi, DefaultApiAxiosParamCreator, DefaultApiFactory, DefaultApiFp, FieldFilterOperatorEnum, LogicalFilterOperatorEnum, PaginationInfoDTOOrderDirectionEnum, ProcessInstanceStatusDTO, WorkflowCategoryDTO, WorkflowFormatDTO, WorkflowResultDTOCompletedWithEnum, WorkflowResultDTOOutputsInnerFormatEnum } from './generated/client/api.esm.js';
|
|
4
|
+
export { Configuration } from './generated/client/configuration.esm.js';
|
|
5
|
+
export { ASSESSMENT_WORKFLOW_TYPE, DEFAULT_SONATAFLOW_BASE_URL, DEFAULT_SONATAFLOW_CONTAINER_IMAGE, DEFAULT_SONATAFLOW_PERSISTENCE_PATH, DEFAULT_WORKFLOWS_PATH, INFRASTRUCTURE_WORKFLOW_TYPE } from './constants.esm.js';
|
|
6
|
+
export { MilestoneStatus, ProcessInstanceState, TypeKind, TypeName } from './models.esm.js';
|
|
7
|
+
export { extractWorkflowFormat, extractWorkflowFormatFromUri, fromWorkflowSource, getWorkflowCategory, parseWorkflowVariables, toWorkflowJson, toWorkflowString, toWorkflowYaml } from './workflow.esm.js';
|
|
8
|
+
export { QUERY_PARAM_ASSESSMENT_INSTANCE_ID, QUERY_PARAM_BUSINESS_KEY, QUERY_PARAM_INCLUDE_ASSESSMENT, QUERY_PARAM_INSTANCE_ID } from './QueryParams.esm.js';
|
|
9
|
+
export { capitalize, ellipsis } from './utils/StringUtils.esm.js';
|
|
10
|
+
export { orchestratorPermissions, orchestratorWorkflowExecutePermission, orchestratorWorkflowInstanceAbortPermission, orchestratorWorkflowInstanceReadPermission, orchestratorWorkflowInstancesReadPermission, orchestratorWorkflowReadPermission } from './permissions.esm.js';
|
|
11
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ProcessInstanceState = /* @__PURE__ */ ((ProcessInstanceState2) => {
|
|
4
|
+
ProcessInstanceState2["Active"] = "ACTIVE";
|
|
5
|
+
ProcessInstanceState2["Completed"] = "COMPLETED";
|
|
6
|
+
ProcessInstanceState2["Aborted"] = "ABORTED";
|
|
7
|
+
ProcessInstanceState2["Suspended"] = "SUSPENDED";
|
|
8
|
+
ProcessInstanceState2["Error"] = "ERROR";
|
|
9
|
+
ProcessInstanceState2["Pending"] = "PENDING";
|
|
10
|
+
return ProcessInstanceState2;
|
|
11
|
+
})(ProcessInstanceState || {});
|
|
12
|
+
var MilestoneStatus = /* @__PURE__ */ ((MilestoneStatus2) => {
|
|
13
|
+
MilestoneStatus2["Available"] = "AVAILABLE";
|
|
14
|
+
MilestoneStatus2["Active"] = "ACTIVE";
|
|
15
|
+
MilestoneStatus2["Completed"] = "COMPLETED";
|
|
16
|
+
return MilestoneStatus2;
|
|
17
|
+
})(MilestoneStatus || {});
|
|
18
|
+
var TypeKind = /* @__PURE__ */ ((TypeKind2) => {
|
|
19
|
+
TypeKind2["InputObject"] = "INPUT_OBJECT";
|
|
20
|
+
return TypeKind2;
|
|
21
|
+
})(TypeKind || {});
|
|
22
|
+
var TypeName = /* @__PURE__ */ ((TypeName2) => {
|
|
23
|
+
TypeName2["Id"] = "IdArgument";
|
|
24
|
+
TypeName2["String"] = "StringArgument";
|
|
25
|
+
TypeName2["StringArray"] = "StringArrayArgument";
|
|
26
|
+
TypeName2["Date"] = "DateArgument";
|
|
27
|
+
return TypeName2;
|
|
28
|
+
})(TypeName || {});
|
|
29
|
+
|
|
30
|
+
exports.MilestoneStatus = MilestoneStatus;
|
|
31
|
+
exports.ProcessInstanceState = ProcessInstanceState;
|
|
32
|
+
exports.TypeKind = TypeKind;
|
|
33
|
+
exports.TypeName = TypeName;
|
|
34
|
+
//# sourceMappingURL=models.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.cjs.js","sources":["../src/models.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { WorkflowCategory, WorkflowDefinition } from './types';\n\nexport enum ProcessInstanceState {\n Active = 'ACTIVE',\n Completed = 'COMPLETED',\n Aborted = 'ABORTED',\n Suspended = 'SUSPENDED',\n Error = 'ERROR',\n Pending = 'PENDING',\n}\n\nexport type ProcessInstanceStateValues = Uppercase<\n keyof typeof ProcessInstanceState\n>;\n\nexport enum MilestoneStatus {\n Available = 'AVAILABLE',\n Active = 'ACTIVE',\n Completed = 'COMPLETED',\n}\n\nexport interface NodeInstance {\n __typename?: 'NodeInstance';\n id: string;\n name: string;\n type: string;\n enter: string;\n exit?: string;\n definitionId: string;\n nodeId: string;\n}\n\nexport interface TriggerableNode {\n id: number;\n name: string;\n type: string;\n uniqueId: string;\n nodeDefinitionId: string;\n}\n\nexport interface Milestone {\n __typename?: 'Milestone';\n id: string;\n name: string;\n status: MilestoneStatus;\n}\n\nexport interface ProcessInstanceError {\n __typename?: 'ProcessInstanceError';\n nodeDefinitionId: string;\n message?: string;\n}\n\nexport type ProcessInstanceVariables = Record<string, unknown>;\n\nexport interface ProcessInstance {\n id: string;\n processId: string;\n processName?: string;\n parentProcessInstanceId?: string;\n rootProcessInstanceId?: string;\n rootProcessId?: string;\n roles?: string[];\n state?: ProcessInstanceStateValues;\n endpoint: string;\n serviceUrl?: string;\n nodes: NodeInstance[];\n milestones?: Milestone[];\n variables?: ProcessInstanceVariables | string;\n /** Format: date-time */\n start?: string;\n /** Format: date-time */\n end?: string;\n parentProcessInstance?: ProcessInstance;\n childProcessInstances?: ProcessInstance[];\n error?: ProcessInstanceError;\n addons?: string[];\n businessKey?: string;\n isSelected?: boolean;\n errorMessage?: string;\n isOpen?: boolean;\n diagram?: string;\n nodeDefinitions?: TriggerableNode[];\n source?: string;\n category?: WorkflowCategory;\n description?: WorkflowDefinition['description'];\n}\nexport interface IntrospectionQuery {\n __type: IntrospectionType | null;\n}\n\nexport interface IntrospectionType {\n name: string;\n kind: TypeKind;\n description: string | null;\n fields: IntrospectionField[] | null;\n}\n\nexport interface IntrospectionField {\n name: string;\n type: IntrospectionTypeRef;\n}\n\nexport interface IntrospectionTypeRef {\n kind: TypeKind;\n name: TypeName;\n ofType: IntrospectionTypeRef | null;\n}\n\nexport enum TypeKind {\n InputObject = 'INPUT_OBJECT',\n}\n\nexport enum TypeName {\n Id = 'IdArgument',\n String = 'StringArgument',\n StringArray = 'StringArrayArgument',\n Date = 'DateArgument',\n}\n"],"names":["ProcessInstanceState","MilestoneStatus","TypeKind","TypeName"],"mappings":";;AAiBY,IAAA,oBAAA,qBAAAA,qBAAL,KAAA;AACL,EAAAA,sBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,sBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,sBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,sBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,sBAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,sBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AANA,EAAAA,OAAAA,qBAAAA,CAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA,EAAA;AAaA,IAAA,eAAA,qBAAAC,gBAAL,KAAA;AACL,EAAAA,iBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,iBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,iBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AAHF,EAAAA,OAAAA,gBAAAA,CAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA,EAAA;AA8FA,IAAA,QAAA,qBAAAC,SAAL,KAAA;AACL,EAAAA,UAAA,aAAc,CAAA,GAAA,cAAA,CAAA;AADJ,EAAAA,OAAAA,SAAAA,CAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA,EAAA;AAIA,IAAA,QAAA,qBAAAC,SAAL,KAAA;AACL,EAAAA,UAAA,IAAK,CAAA,GAAA,YAAA,CAAA;AACL,EAAAA,UAAA,QAAS,CAAA,GAAA,gBAAA,CAAA;AACT,EAAAA,UAAA,aAAc,CAAA,GAAA,qBAAA,CAAA;AACd,EAAAA,UAAA,MAAO,CAAA,GAAA,cAAA,CAAA;AAJG,EAAAA,OAAAA,SAAAA,CAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA;;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var ProcessInstanceState = /* @__PURE__ */ ((ProcessInstanceState2) => {
|
|
2
|
+
ProcessInstanceState2["Active"] = "ACTIVE";
|
|
3
|
+
ProcessInstanceState2["Completed"] = "COMPLETED";
|
|
4
|
+
ProcessInstanceState2["Aborted"] = "ABORTED";
|
|
5
|
+
ProcessInstanceState2["Suspended"] = "SUSPENDED";
|
|
6
|
+
ProcessInstanceState2["Error"] = "ERROR";
|
|
7
|
+
ProcessInstanceState2["Pending"] = "PENDING";
|
|
8
|
+
return ProcessInstanceState2;
|
|
9
|
+
})(ProcessInstanceState || {});
|
|
10
|
+
var MilestoneStatus = /* @__PURE__ */ ((MilestoneStatus2) => {
|
|
11
|
+
MilestoneStatus2["Available"] = "AVAILABLE";
|
|
12
|
+
MilestoneStatus2["Active"] = "ACTIVE";
|
|
13
|
+
MilestoneStatus2["Completed"] = "COMPLETED";
|
|
14
|
+
return MilestoneStatus2;
|
|
15
|
+
})(MilestoneStatus || {});
|
|
16
|
+
var TypeKind = /* @__PURE__ */ ((TypeKind2) => {
|
|
17
|
+
TypeKind2["InputObject"] = "INPUT_OBJECT";
|
|
18
|
+
return TypeKind2;
|
|
19
|
+
})(TypeKind || {});
|
|
20
|
+
var TypeName = /* @__PURE__ */ ((TypeName2) => {
|
|
21
|
+
TypeName2["Id"] = "IdArgument";
|
|
22
|
+
TypeName2["String"] = "StringArgument";
|
|
23
|
+
TypeName2["StringArray"] = "StringArrayArgument";
|
|
24
|
+
TypeName2["Date"] = "DateArgument";
|
|
25
|
+
return TypeName2;
|
|
26
|
+
})(TypeName || {});
|
|
27
|
+
|
|
28
|
+
export { MilestoneStatus, ProcessInstanceState, TypeKind, TypeName };
|
|
29
|
+
//# sourceMappingURL=models.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.esm.js","sources":["../src/models.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { WorkflowCategory, WorkflowDefinition } from './types';\n\nexport enum ProcessInstanceState {\n Active = 'ACTIVE',\n Completed = 'COMPLETED',\n Aborted = 'ABORTED',\n Suspended = 'SUSPENDED',\n Error = 'ERROR',\n Pending = 'PENDING',\n}\n\nexport type ProcessInstanceStateValues = Uppercase<\n keyof typeof ProcessInstanceState\n>;\n\nexport enum MilestoneStatus {\n Available = 'AVAILABLE',\n Active = 'ACTIVE',\n Completed = 'COMPLETED',\n}\n\nexport interface NodeInstance {\n __typename?: 'NodeInstance';\n id: string;\n name: string;\n type: string;\n enter: string;\n exit?: string;\n definitionId: string;\n nodeId: string;\n}\n\nexport interface TriggerableNode {\n id: number;\n name: string;\n type: string;\n uniqueId: string;\n nodeDefinitionId: string;\n}\n\nexport interface Milestone {\n __typename?: 'Milestone';\n id: string;\n name: string;\n status: MilestoneStatus;\n}\n\nexport interface ProcessInstanceError {\n __typename?: 'ProcessInstanceError';\n nodeDefinitionId: string;\n message?: string;\n}\n\nexport type ProcessInstanceVariables = Record<string, unknown>;\n\nexport interface ProcessInstance {\n id: string;\n processId: string;\n processName?: string;\n parentProcessInstanceId?: string;\n rootProcessInstanceId?: string;\n rootProcessId?: string;\n roles?: string[];\n state?: ProcessInstanceStateValues;\n endpoint: string;\n serviceUrl?: string;\n nodes: NodeInstance[];\n milestones?: Milestone[];\n variables?: ProcessInstanceVariables | string;\n /** Format: date-time */\n start?: string;\n /** Format: date-time */\n end?: string;\n parentProcessInstance?: ProcessInstance;\n childProcessInstances?: ProcessInstance[];\n error?: ProcessInstanceError;\n addons?: string[];\n businessKey?: string;\n isSelected?: boolean;\n errorMessage?: string;\n isOpen?: boolean;\n diagram?: string;\n nodeDefinitions?: TriggerableNode[];\n source?: string;\n category?: WorkflowCategory;\n description?: WorkflowDefinition['description'];\n}\nexport interface IntrospectionQuery {\n __type: IntrospectionType | null;\n}\n\nexport interface IntrospectionType {\n name: string;\n kind: TypeKind;\n description: string | null;\n fields: IntrospectionField[] | null;\n}\n\nexport interface IntrospectionField {\n name: string;\n type: IntrospectionTypeRef;\n}\n\nexport interface IntrospectionTypeRef {\n kind: TypeKind;\n name: TypeName;\n ofType: IntrospectionTypeRef | null;\n}\n\nexport enum TypeKind {\n InputObject = 'INPUT_OBJECT',\n}\n\nexport enum TypeName {\n Id = 'IdArgument',\n String = 'StringArgument',\n StringArray = 'StringArrayArgument',\n Date = 'DateArgument',\n}\n"],"names":["ProcessInstanceState","MilestoneStatus","TypeKind","TypeName"],"mappings":"AAiBY,IAAA,oBAAA,qBAAAA,qBAAL,KAAA;AACL,EAAAA,sBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,sBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,sBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,sBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,sBAAA,OAAQ,CAAA,GAAA,OAAA,CAAA;AACR,EAAAA,sBAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AANA,EAAAA,OAAAA,qBAAAA,CAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA,EAAA;AAaA,IAAA,eAAA,qBAAAC,gBAAL,KAAA;AACL,EAAAA,iBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AACZ,EAAAA,iBAAA,QAAS,CAAA,GAAA,QAAA,CAAA;AACT,EAAAA,iBAAA,WAAY,CAAA,GAAA,WAAA,CAAA;AAHF,EAAAA,OAAAA,gBAAAA,CAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA,EAAA;AA8FA,IAAA,QAAA,qBAAAC,SAAL,KAAA;AACL,EAAAA,UAAA,aAAc,CAAA,GAAA,cAAA,CAAA;AADJ,EAAAA,OAAAA,SAAAA,CAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA,EAAA;AAIA,IAAA,QAAA,qBAAAC,SAAL,KAAA;AACL,EAAAA,UAAA,IAAK,CAAA,GAAA,YAAA,CAAA;AACL,EAAAA,UAAA,QAAS,CAAA,GAAA,gBAAA,CAAA;AACT,EAAAA,UAAA,aAAc,CAAA,GAAA,qBAAA,CAAA;AACd,EAAAA,UAAA,MAAO,CAAA,GAAA,cAAA,CAAA;AAJG,EAAAA,OAAAA,SAAAA,CAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var pluginPermissionCommon = require('@backstage/plugin-permission-common');
|
|
4
|
+
|
|
5
|
+
const orchestratorWorkflowInstancesReadPermission = pluginPermissionCommon.createPermission({
|
|
6
|
+
name: "orchestrator.workflowInstances.read",
|
|
7
|
+
attributes: {
|
|
8
|
+
action: "read"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const orchestratorWorkflowInstanceReadPermission = pluginPermissionCommon.createPermission({
|
|
12
|
+
name: "orchestrator.workflowInstance.read",
|
|
13
|
+
attributes: {
|
|
14
|
+
action: "read"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const orchestratorWorkflowReadPermission = pluginPermissionCommon.createPermission({
|
|
18
|
+
name: "orchestrator.workflow.read",
|
|
19
|
+
attributes: {
|
|
20
|
+
action: "read"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const orchestratorWorkflowExecutePermission = pluginPermissionCommon.createPermission({
|
|
24
|
+
name: "orchestrator.workflow.execute",
|
|
25
|
+
attributes: {}
|
|
26
|
+
});
|
|
27
|
+
const orchestratorWorkflowInstanceAbortPermission = pluginPermissionCommon.createPermission({
|
|
28
|
+
name: "orchestrator.workflowInstance.abort",
|
|
29
|
+
attributes: {}
|
|
30
|
+
});
|
|
31
|
+
const orchestratorPermissions = [
|
|
32
|
+
orchestratorWorkflowReadPermission,
|
|
33
|
+
orchestratorWorkflowExecutePermission,
|
|
34
|
+
orchestratorWorkflowInstancesReadPermission,
|
|
35
|
+
orchestratorWorkflowInstanceReadPermission,
|
|
36
|
+
orchestratorWorkflowInstanceAbortPermission
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
exports.orchestratorPermissions = orchestratorPermissions;
|
|
40
|
+
exports.orchestratorWorkflowExecutePermission = orchestratorWorkflowExecutePermission;
|
|
41
|
+
exports.orchestratorWorkflowInstanceAbortPermission = orchestratorWorkflowInstanceAbortPermission;
|
|
42
|
+
exports.orchestratorWorkflowInstanceReadPermission = orchestratorWorkflowInstanceReadPermission;
|
|
43
|
+
exports.orchestratorWorkflowInstancesReadPermission = orchestratorWorkflowInstancesReadPermission;
|
|
44
|
+
exports.orchestratorWorkflowReadPermission = orchestratorWorkflowReadPermission;
|
|
45
|
+
//# sourceMappingURL=permissions.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.cjs.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { createPermission } from '@backstage/plugin-permission-common';\n\nexport const orchestratorWorkflowInstancesReadPermission = createPermission({\n name: 'orchestrator.workflowInstances.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowInstanceReadPermission = createPermission({\n name: 'orchestrator.workflowInstance.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowReadPermission = createPermission({\n name: 'orchestrator.workflow.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowExecutePermission = createPermission({\n name: 'orchestrator.workflow.execute',\n attributes: {},\n});\n\nexport const orchestratorWorkflowInstanceAbortPermission = createPermission({\n name: 'orchestrator.workflowInstance.abort',\n attributes: {},\n});\n\nexport const orchestratorPermissions = [\n orchestratorWorkflowReadPermission,\n orchestratorWorkflowExecutePermission,\n orchestratorWorkflowInstancesReadPermission,\n orchestratorWorkflowInstanceReadPermission,\n orchestratorWorkflowInstanceAbortPermission,\n];\n"],"names":["createPermission"],"mappings":";;;;AAiBO,MAAM,8CAA8CA,uCAAiB,CAAA;AAAA,EAC1E,IAAM,EAAA,qCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,6CAA6CA,uCAAiB,CAAA;AAAA,EACzE,IAAM,EAAA,oCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,qCAAqCA,uCAAiB,CAAA;AAAA,EACjE,IAAM,EAAA,4BAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,wCAAwCA,uCAAiB,CAAA;AAAA,EACpE,IAAM,EAAA,+BAAA;AAAA,EACN,YAAY,EAAC;AACf,CAAC,EAAA;AAEM,MAAM,8CAA8CA,uCAAiB,CAAA;AAAA,EAC1E,IAAM,EAAA,qCAAA;AAAA,EACN,YAAY,EAAC;AACf,CAAC,EAAA;AAEM,MAAM,uBAA0B,GAAA;AAAA,EACrC,kCAAA;AAAA,EACA,qCAAA;AAAA,EACA,2CAAA;AAAA,EACA,0CAAA;AAAA,EACA,2CAAA;AACF;;;;;;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createPermission } from '@backstage/plugin-permission-common';
|
|
2
|
+
|
|
3
|
+
const orchestratorWorkflowInstancesReadPermission = createPermission({
|
|
4
|
+
name: "orchestrator.workflowInstances.read",
|
|
5
|
+
attributes: {
|
|
6
|
+
action: "read"
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const orchestratorWorkflowInstanceReadPermission = createPermission({
|
|
10
|
+
name: "orchestrator.workflowInstance.read",
|
|
11
|
+
attributes: {
|
|
12
|
+
action: "read"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const orchestratorWorkflowReadPermission = createPermission({
|
|
16
|
+
name: "orchestrator.workflow.read",
|
|
17
|
+
attributes: {
|
|
18
|
+
action: "read"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const orchestratorWorkflowExecutePermission = createPermission({
|
|
22
|
+
name: "orchestrator.workflow.execute",
|
|
23
|
+
attributes: {}
|
|
24
|
+
});
|
|
25
|
+
const orchestratorWorkflowInstanceAbortPermission = createPermission({
|
|
26
|
+
name: "orchestrator.workflowInstance.abort",
|
|
27
|
+
attributes: {}
|
|
28
|
+
});
|
|
29
|
+
const orchestratorPermissions = [
|
|
30
|
+
orchestratorWorkflowReadPermission,
|
|
31
|
+
orchestratorWorkflowExecutePermission,
|
|
32
|
+
orchestratorWorkflowInstancesReadPermission,
|
|
33
|
+
orchestratorWorkflowInstanceReadPermission,
|
|
34
|
+
orchestratorWorkflowInstanceAbortPermission
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export { orchestratorPermissions, orchestratorWorkflowExecutePermission, orchestratorWorkflowInstanceAbortPermission, orchestratorWorkflowInstanceReadPermission, orchestratorWorkflowInstancesReadPermission, orchestratorWorkflowReadPermission };
|
|
38
|
+
//# sourceMappingURL=permissions.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.esm.js","sources":["../src/permissions.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { createPermission } from '@backstage/plugin-permission-common';\n\nexport const orchestratorWorkflowInstancesReadPermission = createPermission({\n name: 'orchestrator.workflowInstances.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowInstanceReadPermission = createPermission({\n name: 'orchestrator.workflowInstance.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowReadPermission = createPermission({\n name: 'orchestrator.workflow.read',\n attributes: {\n action: 'read',\n },\n});\n\nexport const orchestratorWorkflowExecutePermission = createPermission({\n name: 'orchestrator.workflow.execute',\n attributes: {},\n});\n\nexport const orchestratorWorkflowInstanceAbortPermission = createPermission({\n name: 'orchestrator.workflowInstance.abort',\n attributes: {},\n});\n\nexport const orchestratorPermissions = [\n orchestratorWorkflowReadPermission,\n orchestratorWorkflowExecutePermission,\n orchestratorWorkflowInstancesReadPermission,\n orchestratorWorkflowInstanceReadPermission,\n orchestratorWorkflowInstanceAbortPermission,\n];\n"],"names":[],"mappings":";;AAiBO,MAAM,8CAA8C,gBAAiB,CAAA;AAAA,EAC1E,IAAM,EAAA,qCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,6CAA6C,gBAAiB,CAAA;AAAA,EACzE,IAAM,EAAA,oCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,qCAAqC,gBAAiB,CAAA;AAAA,EACjE,IAAM,EAAA,4BAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AACF,CAAC,EAAA;AAEM,MAAM,wCAAwC,gBAAiB,CAAA;AAAA,EACpE,IAAM,EAAA,+BAAA;AAAA,EACN,YAAY,EAAC;AACf,CAAC,EAAA;AAEM,MAAM,8CAA8C,gBAAiB,CAAA;AAAA,EAC1E,IAAM,EAAA,qCAAA;AAAA,EACN,YAAY,EAAC;AACf,CAAC,EAAA;AAEM,MAAM,uBAA0B,GAAA;AAAA,EACrC,kCAAA;AAAA,EACA,qCAAA;AAAA,EACA,2CAAA;AAAA,EACA,0CAAA;AAAA,EACA,2CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isJsonObjectSchema = (schema) => typeof schema === "object" && !!schema.properties && Object.values(schema.properties).filter(
|
|
4
|
+
(curSchema) => typeof curSchema !== "object"
|
|
5
|
+
).length === 0;
|
|
6
|
+
const isComposedSchema = (schema) => !!schema.properties && Object.values(schema.properties).filter(
|
|
7
|
+
(curSchema) => !isJsonObjectSchema(curSchema)
|
|
8
|
+
).length === 0;
|
|
9
|
+
var WorkflowCategory = /* @__PURE__ */ ((WorkflowCategory2) => {
|
|
10
|
+
WorkflowCategory2["ASSESSMENT"] = "assessment";
|
|
11
|
+
WorkflowCategory2["INFRASTRUCTURE"] = "infrastructure";
|
|
12
|
+
return WorkflowCategory2;
|
|
13
|
+
})(WorkflowCategory || {});
|
|
14
|
+
|
|
15
|
+
exports.WorkflowCategory = WorkflowCategory;
|
|
16
|
+
exports.isComposedSchema = isComposedSchema;
|
|
17
|
+
exports.isJsonObjectSchema = isJsonObjectSchema;
|
|
18
|
+
//# sourceMappingURL=types.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright 2024 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 type { JsonObject } from '@backstage/types';\n\nimport type { Specification } from '@severlessworkflow/sdk-typescript';\nimport type { JSONSchema7, JSONSchema7Definition } from 'json-schema';\n\nimport type { ProcessInstance, ProcessInstanceStateValues } from './models';\n\ntype Id<T> = { [P in keyof T]: T[P] };\n\ntype OmitDistributive<T, K extends PropertyKey> = T extends any\n ? T extends object\n ? Id<OmitRecursively<T, K>>\n : T\n : never;\n\nexport type OmitRecursively<T, K extends PropertyKey> = Omit<\n { [P in keyof T]: OmitDistributive<T[P], K> },\n K\n>;\n\nexport type WorkflowDefinition = OmitRecursively<\n Specification.Workflow,\n 'normalize'\n>;\n\nexport type WorkflowListResult = {\n items: WorkflowDefinition[];\n totalCount: number;\n offset: number;\n limit: number;\n};\n\nexport type WorkflowOverviewListResult = {\n items: WorkflowOverview[];\n totalCount: number;\n offset: number;\n limit: number;\n};\n\nexport type WorkflowFormat = 'yaml' | 'json';\n\nexport type WorkflowInputSchemaStep = {\n schema: JsonObjectSchema;\n title: string;\n key: string;\n data: JsonObject;\n readonlyKeys: string[];\n};\n\nexport type JsonObjectSchema = Omit<JSONSchema7, 'properties'> & {\n properties: { [key: string]: JSONSchema7 };\n};\n\nexport type ComposedSchema = Omit<JSONSchema7, 'properties'> & {\n properties: {\n [key: string]: Omit<JSONSchema7, 'properties'> & {\n properties: { [key: string]: JsonObjectSchema };\n };\n };\n};\n\nexport const isJsonObjectSchema = (\n schema: JSONSchema7 | JsonObjectSchema | JSONSchema7Definition,\n): schema is JsonObjectSchema =>\n typeof schema === 'object' &&\n !!schema.properties &&\n Object.values(schema.properties).filter(\n curSchema => typeof curSchema !== 'object',\n ).length === 0;\n\nexport const isComposedSchema = (\n schema: JSONSchema7 | ComposedSchema,\n): schema is ComposedSchema =>\n !!schema.properties &&\n Object.values(schema.properties).filter(\n curSchema => !isJsonObjectSchema(curSchema),\n ).length === 0;\n\nexport interface WorkflowExecutionResponse {\n id: string;\n}\n\nexport enum WorkflowCategory {\n ASSESSMENT = 'assessment',\n INFRASTRUCTURE = 'infrastructure',\n}\n\nexport interface WorkflowOverview {\n workflowId: string;\n format: WorkflowFormat;\n name?: string;\n lastRunId?: string;\n lastTriggeredMs?: number;\n lastRunStatus?: ProcessInstanceStateValues;\n category?: string;\n avgDurationMs?: number;\n description?: string;\n}\n\nexport interface WorkflowInfo {\n id: string;\n type?: string;\n name?: string;\n version?: string;\n annotations?: string[];\n description?: string;\n inputSchema?: JSONSchema7;\n endpoint?: string;\n serviceUrl?: string;\n roles?: string[];\n source?: string;\n metadata?: Map<string, string>;\n nodes?: Node[];\n}\n\nexport interface Node {\n id: string;\n type?: string;\n name?: string;\n uniqueId?: string;\n nodeDefinitionId?: string;\n}\n\nexport interface AssessedProcessInstance {\n instance: ProcessInstance;\n assessedBy?: ProcessInstance;\n}\n"],"names":["WorkflowCategory"],"mappings":";;AA4EO,MAAM,kBAAqB,GAAA,CAChC,MAEA,KAAA,OAAO,WAAW,QAClB,IAAA,CAAC,CAAC,MAAA,CAAO,UACT,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,CAAO,UAAU,CAAE,CAAA,MAAA;AAAA,EAC/B,CAAA,SAAA,KAAa,OAAO,SAAc,KAAA,QAAA;AACpC,CAAA,CAAE,MAAW,KAAA,EAAA;AAEF,MAAA,gBAAA,GAAmB,CAC9B,MAAA,KAEA,CAAC,CAAC,MAAO,CAAA,UAAA,IACT,MAAO,CAAA,MAAA,CAAO,MAAO,CAAA,UAAU,CAAE,CAAA,MAAA;AAAA,EAC/B,CAAA,SAAA,KAAa,CAAC,kBAAA,CAAmB,SAAS,CAAA;AAC5C,CAAA,CAAE,MAAW,KAAA,EAAA;AAMH,IAAA,gBAAA,qBAAAA,iBAAL,KAAA;AACL,EAAAA,kBAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,kBAAA,gBAAiB,CAAA,GAAA,gBAAA,CAAA;AAFP,EAAAA,OAAAA,iBAAAA,CAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const isJsonObjectSchema = (schema) => typeof schema === "object" && !!schema.properties && Object.values(schema.properties).filter(
|
|
2
|
+
(curSchema) => typeof curSchema !== "object"
|
|
3
|
+
).length === 0;
|
|
4
|
+
const isComposedSchema = (schema) => !!schema.properties && Object.values(schema.properties).filter(
|
|
5
|
+
(curSchema) => !isJsonObjectSchema(curSchema)
|
|
6
|
+
).length === 0;
|
|
7
|
+
var WorkflowCategory = /* @__PURE__ */ ((WorkflowCategory2) => {
|
|
8
|
+
WorkflowCategory2["ASSESSMENT"] = "assessment";
|
|
9
|
+
WorkflowCategory2["INFRASTRUCTURE"] = "infrastructure";
|
|
10
|
+
return WorkflowCategory2;
|
|
11
|
+
})(WorkflowCategory || {});
|
|
12
|
+
|
|
13
|
+
export { WorkflowCategory, isComposedSchema, isJsonObjectSchema };
|
|
14
|
+
//# sourceMappingURL=types.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright 2024 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 type { JsonObject } from '@backstage/types';\n\nimport type { Specification } from '@severlessworkflow/sdk-typescript';\nimport type { JSONSchema7, JSONSchema7Definition } from 'json-schema';\n\nimport type { ProcessInstance, ProcessInstanceStateValues } from './models';\n\ntype Id<T> = { [P in keyof T]: T[P] };\n\ntype OmitDistributive<T, K extends PropertyKey> = T extends any\n ? T extends object\n ? Id<OmitRecursively<T, K>>\n : T\n : never;\n\nexport type OmitRecursively<T, K extends PropertyKey> = Omit<\n { [P in keyof T]: OmitDistributive<T[P], K> },\n K\n>;\n\nexport type WorkflowDefinition = OmitRecursively<\n Specification.Workflow,\n 'normalize'\n>;\n\nexport type WorkflowListResult = {\n items: WorkflowDefinition[];\n totalCount: number;\n offset: number;\n limit: number;\n};\n\nexport type WorkflowOverviewListResult = {\n items: WorkflowOverview[];\n totalCount: number;\n offset: number;\n limit: number;\n};\n\nexport type WorkflowFormat = 'yaml' | 'json';\n\nexport type WorkflowInputSchemaStep = {\n schema: JsonObjectSchema;\n title: string;\n key: string;\n data: JsonObject;\n readonlyKeys: string[];\n};\n\nexport type JsonObjectSchema = Omit<JSONSchema7, 'properties'> & {\n properties: { [key: string]: JSONSchema7 };\n};\n\nexport type ComposedSchema = Omit<JSONSchema7, 'properties'> & {\n properties: {\n [key: string]: Omit<JSONSchema7, 'properties'> & {\n properties: { [key: string]: JsonObjectSchema };\n };\n };\n};\n\nexport const isJsonObjectSchema = (\n schema: JSONSchema7 | JsonObjectSchema | JSONSchema7Definition,\n): schema is JsonObjectSchema =>\n typeof schema === 'object' &&\n !!schema.properties &&\n Object.values(schema.properties).filter(\n curSchema => typeof curSchema !== 'object',\n ).length === 0;\n\nexport const isComposedSchema = (\n schema: JSONSchema7 | ComposedSchema,\n): schema is ComposedSchema =>\n !!schema.properties &&\n Object.values(schema.properties).filter(\n curSchema => !isJsonObjectSchema(curSchema),\n ).length === 0;\n\nexport interface WorkflowExecutionResponse {\n id: string;\n}\n\nexport enum WorkflowCategory {\n ASSESSMENT = 'assessment',\n INFRASTRUCTURE = 'infrastructure',\n}\n\nexport interface WorkflowOverview {\n workflowId: string;\n format: WorkflowFormat;\n name?: string;\n lastRunId?: string;\n lastTriggeredMs?: number;\n lastRunStatus?: ProcessInstanceStateValues;\n category?: string;\n avgDurationMs?: number;\n description?: string;\n}\n\nexport interface WorkflowInfo {\n id: string;\n type?: string;\n name?: string;\n version?: string;\n annotations?: string[];\n description?: string;\n inputSchema?: JSONSchema7;\n endpoint?: string;\n serviceUrl?: string;\n roles?: string[];\n source?: string;\n metadata?: Map<string, string>;\n nodes?: Node[];\n}\n\nexport interface Node {\n id: string;\n type?: string;\n name?: string;\n uniqueId?: string;\n nodeDefinitionId?: string;\n}\n\nexport interface AssessedProcessInstance {\n instance: ProcessInstance;\n assessedBy?: ProcessInstance;\n}\n"],"names":["WorkflowCategory"],"mappings":"AA4EO,MAAM,kBAAqB,GAAA,CAChC,MAEA,KAAA,OAAO,WAAW,QAClB,IAAA,CAAC,CAAC,MAAA,CAAO,UACT,IAAA,MAAA,CAAO,MAAO,CAAA,MAAA,CAAO,UAAU,CAAE,CAAA,MAAA;AAAA,EAC/B,CAAA,SAAA,KAAa,OAAO,SAAc,KAAA,QAAA;AACpC,CAAA,CAAE,MAAW,KAAA,EAAA;AAEF,MAAA,gBAAA,GAAmB,CAC9B,MAAA,KAEA,CAAC,CAAC,MAAO,CAAA,UAAA,IACT,MAAO,CAAA,MAAA,CAAO,MAAO,CAAA,UAAU,CAAE,CAAA,MAAA;AAAA,EAC/B,CAAA,SAAA,KAAa,CAAC,kBAAA,CAAmB,SAAS,CAAA;AAC5C,CAAA,CAAE,MAAW,KAAA,EAAA;AAMH,IAAA,gBAAA,qBAAAA,iBAAL,KAAA;AACL,EAAAA,kBAAA,YAAa,CAAA,GAAA,YAAA,CAAA;AACb,EAAAA,kBAAA,gBAAiB,CAAA,GAAA,gBAAA,CAAA;AAFP,EAAAA,OAAAA,iBAAAA,CAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const capitalize = (text) => text[0].toLocaleUpperCase("en-US") + text.slice(1).toLocaleLowerCase("en-US");
|
|
4
|
+
const ellipsis = (text, prefixLength = 8) => `${text.slice(0, prefixLength)}...`;
|
|
5
|
+
|
|
6
|
+
exports.capitalize = capitalize;
|
|
7
|
+
exports.ellipsis = ellipsis;
|
|
8
|
+
//# sourceMappingURL=StringUtils.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringUtils.cjs.js","sources":["../../src/utils/StringUtils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 type Capitalized<S extends string> = Capitalize<Lowercase<S>>;\n\nexport const capitalize = <S extends string>(text: S): Capitalized<S> =>\n (text[0].toLocaleUpperCase('en-US') +\n text.slice(1).toLocaleLowerCase('en-US')) as Capitalized<S>;\n\nexport const ellipsis = <S extends string>(text: S, prefixLength: number = 8) =>\n `${text.slice(0, prefixLength)}...`;\n"],"names":[],"mappings":";;AAkBO,MAAM,UAAa,GAAA,CAAmB,IAC1C,KAAA,IAAA,CAAK,CAAC,CAAE,CAAA,iBAAA,CAAkB,OAAO,CAAA,GAChC,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,kBAAkB,OAAO,EAAA;AAE9B,MAAA,QAAA,GAAW,CAAmB,IAAA,EAAS,YAAuB,GAAA,CAAA,KACzE,GAAG,IAAK,CAAA,KAAA,CAAM,CAAG,EAAA,YAAY,CAAC,CAAA,GAAA;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const capitalize = (text) => text[0].toLocaleUpperCase("en-US") + text.slice(1).toLocaleLowerCase("en-US");
|
|
2
|
+
const ellipsis = (text, prefixLength = 8) => `${text.slice(0, prefixLength)}...`;
|
|
3
|
+
|
|
4
|
+
export { capitalize, ellipsis };
|
|
5
|
+
//# sourceMappingURL=StringUtils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringUtils.esm.js","sources":["../../src/utils/StringUtils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 type Capitalized<S extends string> = Capitalize<Lowercase<S>>;\n\nexport const capitalize = <S extends string>(text: S): Capitalized<S> =>\n (text[0].toLocaleUpperCase('en-US') +\n text.slice(1).toLocaleLowerCase('en-US')) as Capitalized<S>;\n\nexport const ellipsis = <S extends string>(text: S, prefixLength: number = 8) =>\n `${text.slice(0, prefixLength)}...`;\n"],"names":[],"mappings":"AAkBO,MAAM,UAAa,GAAA,CAAmB,IAC1C,KAAA,IAAA,CAAK,CAAC,CAAE,CAAA,iBAAA,CAAkB,OAAO,CAAA,GAChC,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,kBAAkB,OAAO,EAAA;AAE9B,MAAA,QAAA,GAAW,CAAmB,IAAA,EAAS,YAAuB,GAAA,CAAA,KACzE,GAAG,IAAK,CAAA,KAAA,CAAM,CAAG,EAAA,YAAY,CAAC,CAAA,GAAA;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var sdkTypescript = require('@severlessworkflow/sdk-typescript');
|
|
4
|
+
var jsYaml = require('js-yaml');
|
|
5
|
+
var constants = require('./constants.cjs.js');
|
|
6
|
+
var types = require('./types.cjs.js');
|
|
7
|
+
|
|
8
|
+
function fromWorkflowSource(content) {
|
|
9
|
+
const parsed = sdkTypescript.Specification.Workflow.fromSource(content);
|
|
10
|
+
const workflow = parsed.sourceModel ?? parsed;
|
|
11
|
+
return removeProperty(workflow, "normalize");
|
|
12
|
+
}
|
|
13
|
+
function toWorkflowString(definition, format) {
|
|
14
|
+
switch (format) {
|
|
15
|
+
case "json":
|
|
16
|
+
return toWorkflowJson(definition);
|
|
17
|
+
case "yaml":
|
|
18
|
+
return toWorkflowYaml(definition);
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(`Unsupported format ${format}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function toWorkflowJson(definition) {
|
|
24
|
+
return JSON.stringify(definition, null, 2);
|
|
25
|
+
}
|
|
26
|
+
function toWorkflowYaml(definition) {
|
|
27
|
+
return jsYaml.dump(definition);
|
|
28
|
+
}
|
|
29
|
+
function extractWorkflowFormatFromUri(uri) {
|
|
30
|
+
const match = RegExp(/\.sw\.(json|yaml|yml)$/).exec(uri);
|
|
31
|
+
if (match) {
|
|
32
|
+
if (match[1] === "yml" || match[1] === "yaml") {
|
|
33
|
+
return "yaml";
|
|
34
|
+
}
|
|
35
|
+
if (match[1] === "json") {
|
|
36
|
+
return "json";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unsupported workflow format for uri ${uri}`);
|
|
40
|
+
}
|
|
41
|
+
function getWorkflowCategory(definition) {
|
|
42
|
+
if (definition === void 0) {
|
|
43
|
+
return types.WorkflowCategory.INFRASTRUCTURE;
|
|
44
|
+
}
|
|
45
|
+
return definition?.annotations?.find(
|
|
46
|
+
(annotation) => annotation === constants.ASSESSMENT_WORKFLOW_TYPE
|
|
47
|
+
) ? types.WorkflowCategory.ASSESSMENT : types.WorkflowCategory.INFRASTRUCTURE;
|
|
48
|
+
}
|
|
49
|
+
function removeProperty(obj, propToDelete) {
|
|
50
|
+
if (typeof obj !== "object" || obj === null) {
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(obj)) {
|
|
54
|
+
return obj.map((item) => removeProperty(item, propToDelete));
|
|
55
|
+
}
|
|
56
|
+
const newObj = {};
|
|
57
|
+
for (const key in obj) {
|
|
58
|
+
if (key !== propToDelete) {
|
|
59
|
+
newObj[key] = removeProperty(obj[key], propToDelete);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return newObj;
|
|
63
|
+
}
|
|
64
|
+
function parseWorkflowVariables(variables) {
|
|
65
|
+
if (variables === void 0) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
if (typeof variables === "string") {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(variables);
|
|
71
|
+
} catch {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Error when parsing process instance variables: ${variables}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return variables;
|
|
78
|
+
}
|
|
79
|
+
function extractWorkflowFormat(source) {
|
|
80
|
+
try {
|
|
81
|
+
JSON.parse(source);
|
|
82
|
+
return "json";
|
|
83
|
+
} catch (_) {
|
|
84
|
+
return "yaml";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exports.extractWorkflowFormat = extractWorkflowFormat;
|
|
89
|
+
exports.extractWorkflowFormatFromUri = extractWorkflowFormatFromUri;
|
|
90
|
+
exports.fromWorkflowSource = fromWorkflowSource;
|
|
91
|
+
exports.getWorkflowCategory = getWorkflowCategory;
|
|
92
|
+
exports.parseWorkflowVariables = parseWorkflowVariables;
|
|
93
|
+
exports.toWorkflowJson = toWorkflowJson;
|
|
94
|
+
exports.toWorkflowString = toWorkflowString;
|
|
95
|
+
exports.toWorkflowYaml = toWorkflowYaml;
|
|
96
|
+
//# sourceMappingURL=workflow.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.cjs.js","sources":["../src/workflow.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Specification } from '@severlessworkflow/sdk-typescript';\nimport { dump } from 'js-yaml';\n\nimport { ASSESSMENT_WORKFLOW_TYPE } from './constants';\nimport { WorkflowCategory, WorkflowDefinition, WorkflowFormat } from './types';\n\nexport function fromWorkflowSource(content: string): WorkflowDefinition {\n const parsed = Specification.Workflow.fromSource(content);\n const workflow = parsed.sourceModel ?? parsed;\n return removeProperty(workflow, 'normalize');\n}\n\nexport function toWorkflowString(\n definition: WorkflowDefinition,\n format: WorkflowFormat,\n): string {\n switch (format) {\n case 'json':\n return toWorkflowJson(definition);\n case 'yaml':\n return toWorkflowYaml(definition);\n default:\n throw new Error(`Unsupported format ${format}`);\n }\n}\n\nexport function toWorkflowJson(definition: WorkflowDefinition): string {\n return JSON.stringify(definition, null, 2);\n}\n\nexport function toWorkflowYaml(definition: WorkflowDefinition): string {\n return dump(definition);\n}\n\nexport function extractWorkflowFormatFromUri(uri: string): WorkflowFormat {\n const match = RegExp(/\\.sw\\.(json|yaml|yml)$/).exec(uri);\n if (match) {\n if (match[1] === 'yml' || match[1] === 'yaml') {\n return 'yaml';\n }\n if (match[1] === 'json') {\n return 'json';\n }\n }\n throw new Error(`Unsupported workflow format for uri ${uri}`);\n}\n\nexport function getWorkflowCategory(\n definition: WorkflowDefinition | undefined,\n): WorkflowCategory {\n if (definition === undefined) {\n return WorkflowCategory.INFRASTRUCTURE;\n }\n return definition?.annotations?.find(\n annotation => annotation === ASSESSMENT_WORKFLOW_TYPE,\n )\n ? WorkflowCategory.ASSESSMENT\n : WorkflowCategory.INFRASTRUCTURE;\n}\n\nfunction removeProperty<T>(obj: T, propToDelete: string): T {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => removeProperty(item, propToDelete)) as T;\n }\n\n const newObj: any = {};\n\n for (const key in obj) {\n if (key !== propToDelete) {\n newObj[key] = removeProperty(obj[key], propToDelete); // Recurse into nested objects\n }\n }\n\n return newObj;\n}\n\nexport function parseWorkflowVariables(variables?: object): object | undefined {\n if (variables === undefined) {\n return undefined;\n }\n\n if (typeof variables === 'string') {\n try {\n return JSON.parse(variables);\n } catch {\n throw new Error(\n `Error when parsing process instance variables: ${variables}`,\n );\n }\n }\n\n return variables;\n}\n\nexport function extractWorkflowFormat(source: string): WorkflowFormat {\n try {\n JSON.parse(source);\n return 'json';\n } catch (_) {\n return 'yaml';\n }\n}\n"],"names":["Specification","dump","WorkflowCategory","ASSESSMENT_WORKFLOW_TYPE"],"mappings":"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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Specification } from '@severlessworkflow/sdk-typescript';
|
|
2
|
+
import { dump } from 'js-yaml';
|
|
3
|
+
import { ASSESSMENT_WORKFLOW_TYPE } from './constants.esm.js';
|
|
4
|
+
import { WorkflowCategory } from './types.esm.js';
|
|
5
|
+
|
|
6
|
+
function fromWorkflowSource(content) {
|
|
7
|
+
const parsed = Specification.Workflow.fromSource(content);
|
|
8
|
+
const workflow = parsed.sourceModel ?? parsed;
|
|
9
|
+
return removeProperty(workflow, "normalize");
|
|
10
|
+
}
|
|
11
|
+
function toWorkflowString(definition, format) {
|
|
12
|
+
switch (format) {
|
|
13
|
+
case "json":
|
|
14
|
+
return toWorkflowJson(definition);
|
|
15
|
+
case "yaml":
|
|
16
|
+
return toWorkflowYaml(definition);
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Unsupported format ${format}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function toWorkflowJson(definition) {
|
|
22
|
+
return JSON.stringify(definition, null, 2);
|
|
23
|
+
}
|
|
24
|
+
function toWorkflowYaml(definition) {
|
|
25
|
+
return dump(definition);
|
|
26
|
+
}
|
|
27
|
+
function extractWorkflowFormatFromUri(uri) {
|
|
28
|
+
const match = RegExp(/\.sw\.(json|yaml|yml)$/).exec(uri);
|
|
29
|
+
if (match) {
|
|
30
|
+
if (match[1] === "yml" || match[1] === "yaml") {
|
|
31
|
+
return "yaml";
|
|
32
|
+
}
|
|
33
|
+
if (match[1] === "json") {
|
|
34
|
+
return "json";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Unsupported workflow format for uri ${uri}`);
|
|
38
|
+
}
|
|
39
|
+
function getWorkflowCategory(definition) {
|
|
40
|
+
if (definition === void 0) {
|
|
41
|
+
return WorkflowCategory.INFRASTRUCTURE;
|
|
42
|
+
}
|
|
43
|
+
return definition?.annotations?.find(
|
|
44
|
+
(annotation) => annotation === ASSESSMENT_WORKFLOW_TYPE
|
|
45
|
+
) ? WorkflowCategory.ASSESSMENT : WorkflowCategory.INFRASTRUCTURE;
|
|
46
|
+
}
|
|
47
|
+
function removeProperty(obj, propToDelete) {
|
|
48
|
+
if (typeof obj !== "object" || obj === null) {
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(obj)) {
|
|
52
|
+
return obj.map((item) => removeProperty(item, propToDelete));
|
|
53
|
+
}
|
|
54
|
+
const newObj = {};
|
|
55
|
+
for (const key in obj) {
|
|
56
|
+
if (key !== propToDelete) {
|
|
57
|
+
newObj[key] = removeProperty(obj[key], propToDelete);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return newObj;
|
|
61
|
+
}
|
|
62
|
+
function parseWorkflowVariables(variables) {
|
|
63
|
+
if (variables === void 0) {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
if (typeof variables === "string") {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(variables);
|
|
69
|
+
} catch {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Error when parsing process instance variables: ${variables}`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return variables;
|
|
76
|
+
}
|
|
77
|
+
function extractWorkflowFormat(source) {
|
|
78
|
+
try {
|
|
79
|
+
JSON.parse(source);
|
|
80
|
+
return "json";
|
|
81
|
+
} catch (_) {
|
|
82
|
+
return "yaml";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { extractWorkflowFormat, extractWorkflowFormatFromUri, fromWorkflowSource, getWorkflowCategory, parseWorkflowVariables, toWorkflowJson, toWorkflowString, toWorkflowYaml };
|
|
87
|
+
//# sourceMappingURL=workflow.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.esm.js","sources":["../src/workflow.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Specification } from '@severlessworkflow/sdk-typescript';\nimport { dump } from 'js-yaml';\n\nimport { ASSESSMENT_WORKFLOW_TYPE } from './constants';\nimport { WorkflowCategory, WorkflowDefinition, WorkflowFormat } from './types';\n\nexport function fromWorkflowSource(content: string): WorkflowDefinition {\n const parsed = Specification.Workflow.fromSource(content);\n const workflow = parsed.sourceModel ?? parsed;\n return removeProperty(workflow, 'normalize');\n}\n\nexport function toWorkflowString(\n definition: WorkflowDefinition,\n format: WorkflowFormat,\n): string {\n switch (format) {\n case 'json':\n return toWorkflowJson(definition);\n case 'yaml':\n return toWorkflowYaml(definition);\n default:\n throw new Error(`Unsupported format ${format}`);\n }\n}\n\nexport function toWorkflowJson(definition: WorkflowDefinition): string {\n return JSON.stringify(definition, null, 2);\n}\n\nexport function toWorkflowYaml(definition: WorkflowDefinition): string {\n return dump(definition);\n}\n\nexport function extractWorkflowFormatFromUri(uri: string): WorkflowFormat {\n const match = RegExp(/\\.sw\\.(json|yaml|yml)$/).exec(uri);\n if (match) {\n if (match[1] === 'yml' || match[1] === 'yaml') {\n return 'yaml';\n }\n if (match[1] === 'json') {\n return 'json';\n }\n }\n throw new Error(`Unsupported workflow format for uri ${uri}`);\n}\n\nexport function getWorkflowCategory(\n definition: WorkflowDefinition | undefined,\n): WorkflowCategory {\n if (definition === undefined) {\n return WorkflowCategory.INFRASTRUCTURE;\n }\n return definition?.annotations?.find(\n annotation => annotation === ASSESSMENT_WORKFLOW_TYPE,\n )\n ? WorkflowCategory.ASSESSMENT\n : WorkflowCategory.INFRASTRUCTURE;\n}\n\nfunction removeProperty<T>(obj: T, propToDelete: string): T {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => removeProperty(item, propToDelete)) as T;\n }\n\n const newObj: any = {};\n\n for (const key in obj) {\n if (key !== propToDelete) {\n newObj[key] = removeProperty(obj[key], propToDelete); // Recurse into nested objects\n }\n }\n\n return newObj;\n}\n\nexport function parseWorkflowVariables(variables?: object): object | undefined {\n if (variables === undefined) {\n return undefined;\n }\n\n if (typeof variables === 'string') {\n try {\n return JSON.parse(variables);\n } catch {\n throw new Error(\n `Error when parsing process instance variables: ${variables}`,\n );\n }\n }\n\n return variables;\n}\n\nexport function extractWorkflowFormat(source: string): WorkflowFormat {\n try {\n JSON.parse(source);\n return 'json';\n } catch (_) {\n return 'yaml';\n }\n}\n"],"names":[],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@red-hat-developer-hub/backstage-plugin-orchestrator-common",
|
|
3
|
+
"version": "1.24.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"main": "dist/index.cjs.js",
|
|
10
|
+
"module": "dist/index.esm.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "common-library",
|
|
15
|
+
"supported-versions": "1.32.5",
|
|
16
|
+
"pluginId": "orchestrator",
|
|
17
|
+
"pluginPackages": [
|
|
18
|
+
"@red-hat-developer-hub/backstage-plugin-orchestrator",
|
|
19
|
+
"@red-hat-developer-hub/backstage-plugin-orchestrator-backend",
|
|
20
|
+
"@red-hat-developer-hub/backstage-plugin-orchestrator-common"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://red.ht/rhdh",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/redhat-developer/rhdh-plugins",
|
|
27
|
+
"directory": "workspaces/orchestrator/plugins/orchestrator-common"
|
|
28
|
+
},
|
|
29
|
+
"bugs": "https://github.com/redhat-developer/rhdh-plugins/issues",
|
|
30
|
+
"keywords": [
|
|
31
|
+
"support:tech-preview",
|
|
32
|
+
"lifecycle:active",
|
|
33
|
+
"backstage",
|
|
34
|
+
"plugin",
|
|
35
|
+
"orchestrator",
|
|
36
|
+
"workflows"
|
|
37
|
+
],
|
|
38
|
+
"files": [
|
|
39
|
+
"config.d.ts",
|
|
40
|
+
"dist",
|
|
41
|
+
"src/generated/docs/html"
|
|
42
|
+
],
|
|
43
|
+
"configSchema": "config.d.ts",
|
|
44
|
+
"sideEffects": false,
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "backstage-cli package build",
|
|
47
|
+
"tsc": "tsc",
|
|
48
|
+
"prettier:check": "prettier --ignore-unknown --check .",
|
|
49
|
+
"prettier:fix": "prettier --ignore-unknown --write .",
|
|
50
|
+
"lint:check": "backstage-cli package lint",
|
|
51
|
+
"lint:fix": "backstage-cli package lint --fix",
|
|
52
|
+
"test": "backstage-cli package test --passWithNoTests --coverage",
|
|
53
|
+
"clean": "backstage-cli package clean",
|
|
54
|
+
"prepack": "backstage-cli package prepack",
|
|
55
|
+
"postpack": "backstage-cli package postpack",
|
|
56
|
+
"openapi:generate": "./scripts/openapi.sh generate",
|
|
57
|
+
"openapi:check": "./scripts/openapi.sh check"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@backstage/plugin-permission-common": "^0.8.1",
|
|
61
|
+
"@backstage/types": "^1.1.1",
|
|
62
|
+
"@severlessworkflow/sdk-typescript": "^3.0.3",
|
|
63
|
+
"axios": "^1.7.4",
|
|
64
|
+
"js-yaml": "^4.1.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@backstage/cli": "0.28.2",
|
|
68
|
+
"@backstage/plugin-permission-common": "^0.8.1",
|
|
69
|
+
"@backstage/types": "1.1.1",
|
|
70
|
+
"@openapitools/openapi-generator-cli": "2.13.4",
|
|
71
|
+
"@severlessworkflow/sdk-typescript": "3.0.3",
|
|
72
|
+
"axios": "^1.7.4",
|
|
73
|
+
"js-yaml": "^4.1.0",
|
|
74
|
+
"js-yaml-cli": "0.6.0",
|
|
75
|
+
"json-schema": "0.4.0",
|
|
76
|
+
"prettier": "3.3.3"
|
|
77
|
+
},
|
|
78
|
+
"maintainers": [
|
|
79
|
+
"@mlibra",
|
|
80
|
+
"@batzionb",
|
|
81
|
+
"@gciavarrini"
|
|
82
|
+
],
|
|
83
|
+
"author": "The Backstage Community",
|
|
84
|
+
"module": "dist/index.esm.js"
|
|
85
|
+
}
|