@red-hat-developer-hub/plugin-cost-management-common 2.0.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 +49 -0
- package/README.md +17 -0
- package/dist/DefaultApiClient.cjs.js +8 -0
- package/dist/DefaultApiClient.cjs.js.map +1 -0
- package/dist/DefaultApiClient.d.ts +83 -0
- package/dist/DefaultApiClient.esm.js +2 -0
- package/dist/DefaultApiClient.esm.js.map +1 -0
- package/dist/clients/cost-management/CostManagementSlimClient.cjs.js +378 -0
- package/dist/clients/cost-management/CostManagementSlimClient.cjs.js.map +1 -0
- package/dist/clients/cost-management/CostManagementSlimClient.esm.js +372 -0
- package/dist/clients/cost-management/CostManagementSlimClient.esm.js.map +1 -0
- package/dist/clients/optimizations/OptimizationsClient.cjs.js +99 -0
- package/dist/clients/optimizations/OptimizationsClient.cjs.js.map +1 -0
- package/dist/clients/optimizations/OptimizationsClient.esm.js +92 -0
- package/dist/clients/optimizations/OptimizationsClient.esm.js.map +1 -0
- package/dist/clients/orchestrator-slim/OrchestratorSlimClient.cjs.js +107 -0
- package/dist/clients/orchestrator-slim/OrchestratorSlimClient.cjs.js.map +1 -0
- package/dist/clients/orchestrator-slim/OrchestratorSlimClient.esm.js +105 -0
- package/dist/clients/orchestrator-slim/OrchestratorSlimClient.esm.js.map +1 -0
- package/dist/clients.cjs.js +12 -0
- package/dist/clients.cjs.js.map +1 -0
- package/dist/clients.d.ts +432 -0
- package/dist/clients.esm.js +4 -0
- package/dist/clients.esm.js.map +1 -0
- package/dist/generated/apis/DefaultApi.client.cjs.js +91 -0
- package/dist/generated/apis/DefaultApi.client.cjs.js.map +1 -0
- package/dist/generated/apis/DefaultApi.client.esm.js +66 -0
- package/dist/generated/apis/DefaultApi.client.esm.js.map +1 -0
- package/dist/generated/pluginId.cjs.js +6 -0
- package/dist/generated/pluginId.cjs.js.map +1 -0
- package/dist/generated/pluginId.esm.js +4 -0
- package/dist/generated/pluginId.esm.js.map +1 -0
- package/dist/index.cjs.js +14 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +5 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/json-utils.cjs.js +22 -0
- package/dist/json-utils.cjs.js.map +1 -0
- package/dist/json-utils.d.ts +46 -0
- package/dist/json-utils.esm.js +20 -0
- package/dist/json-utils.esm.js.map +1 -0
- package/dist/models.cjs.js +3 -0
- package/dist/models.cjs.js.map +1 -0
- package/dist/models.d.ts +25 -0
- package/dist/models.esm.js +2 -0
- package/dist/models.esm.js.map +1 -0
- package/dist/permissions.cjs.js +47 -0
- package/dist/permissions.cjs.js.map +1 -0
- package/dist/permissions.d.ts +24 -0
- package/dist/permissions.esm.js +36 -0
- package/dist/permissions.esm.js.map +1 -0
- package/dist/types/RecommendationList.model.d-J74WXrJI.d.ts +414 -0
- package/dist/util/lib/json.cjs.js +20 -0
- package/dist/util/lib/json.cjs.js.map +1 -0
- package/dist/util/lib/json.esm.js +15 -0
- package/dist/util/lib/json.esm.js.map +1 -0
- package/dist/util/lib/json_node.cjs.js +191 -0
- package/dist/util/lib/json_node.cjs.js.map +1 -0
- package/dist/util/lib/json_node.esm.js +189 -0
- package/dist/util/lib/json_node.esm.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { maybeJsonObject, maybeJsonArray } from './json.esm.js';
|
|
2
|
+
|
|
3
|
+
const refs = /* @__PURE__ */ new Set();
|
|
4
|
+
function detectCircularReference(nodeValue) {
|
|
5
|
+
if (refs.has(nodeValue)) {
|
|
6
|
+
throw new TypeError("Converting circular structure");
|
|
7
|
+
} else {
|
|
8
|
+
refs.add(nodeValue);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class Visitor {
|
|
12
|
+
#onVisitObjectKey;
|
|
13
|
+
#skipList;
|
|
14
|
+
#isDebugEnabled;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.#onVisitObjectKey = options?.onVisitJsonObjectKey;
|
|
17
|
+
this.#skipList = options?.skipList ?? [];
|
|
18
|
+
this.#isDebugEnabled = options?.debug ?? false;
|
|
19
|
+
}
|
|
20
|
+
visitScalar(node) {
|
|
21
|
+
if (this.#isDebugEnabled) {
|
|
22
|
+
console.log(node.jsonpath);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
visitArray(node) {
|
|
26
|
+
if (this.#isDebugEnabled) {
|
|
27
|
+
console.log(node.jsonpath);
|
|
28
|
+
}
|
|
29
|
+
node.children?.forEach((child) => child.accept(this));
|
|
30
|
+
}
|
|
31
|
+
visitObject(node) {
|
|
32
|
+
if (this.#isDebugEnabled) {
|
|
33
|
+
console.log(node.jsonpath);
|
|
34
|
+
}
|
|
35
|
+
node.children?.forEach((child) => {
|
|
36
|
+
const newKey = this.#skipList.some((regex) => regex.test(child.jsonpath)) ? child.key : this.#onVisitObjectKey?.(child.key) ?? child.key;
|
|
37
|
+
child.key = newKey;
|
|
38
|
+
child.accept(this);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class JsonNode {
|
|
43
|
+
static Visitor = Visitor;
|
|
44
|
+
static #toJsonPathSegment(value) {
|
|
45
|
+
if (typeof value === "number") {
|
|
46
|
+
return `[${value}]`;
|
|
47
|
+
}
|
|
48
|
+
const regex = /(\s|\.)/;
|
|
49
|
+
return regex.test(value) ? `['${value}']` : `.${value}`;
|
|
50
|
+
}
|
|
51
|
+
#parent;
|
|
52
|
+
#children;
|
|
53
|
+
#kind;
|
|
54
|
+
#value;
|
|
55
|
+
#jsonpath;
|
|
56
|
+
key;
|
|
57
|
+
/**
|
|
58
|
+
* Constructs a new Node instance.
|
|
59
|
+
*
|
|
60
|
+
* @param key - The key associated with this node, which can be a string or number.
|
|
61
|
+
* @param value - The value associated with this node.
|
|
62
|
+
* @param parent - The parent node of this node, if any.
|
|
63
|
+
*
|
|
64
|
+
* @throws {TypeError} If the key is not "$" and the parent node is not provided.
|
|
65
|
+
*/
|
|
66
|
+
constructor(key, value, parent) {
|
|
67
|
+
this.key = key;
|
|
68
|
+
this.#value = value;
|
|
69
|
+
this.#jsonpath = [];
|
|
70
|
+
if (key === "$") {
|
|
71
|
+
this.#parent = null;
|
|
72
|
+
this.#jsonpath.push(key);
|
|
73
|
+
} else {
|
|
74
|
+
if (!parent) {
|
|
75
|
+
throw new TypeError("Parent node is required");
|
|
76
|
+
}
|
|
77
|
+
this.#parent = parent;
|
|
78
|
+
this.#jsonpath.push(
|
|
79
|
+
...this.#parent.jsonpath,
|
|
80
|
+
`${JsonNode.#toJsonPathSegment(key)}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
switch (true) {
|
|
84
|
+
case maybeJsonArray(value):
|
|
85
|
+
detectCircularReference(value);
|
|
86
|
+
this.#kind = "array";
|
|
87
|
+
this.#children = value.map(
|
|
88
|
+
(jsonValue, idx) => new JsonNode(idx, jsonValue, this)
|
|
89
|
+
);
|
|
90
|
+
break;
|
|
91
|
+
case maybeJsonObject(value):
|
|
92
|
+
detectCircularReference(value);
|
|
93
|
+
this.#kind = "object";
|
|
94
|
+
this.#children = [];
|
|
95
|
+
for (const [k, jsonValue] of Object.entries(value)) {
|
|
96
|
+
if (typeof jsonValue !== "undefined") {
|
|
97
|
+
this.#children.push(new JsonNode(k, jsonValue, this));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
this.#kind = "scalar";
|
|
103
|
+
this.#children = null;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (this.parent === null) {
|
|
107
|
+
refs.clear();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
get value() {
|
|
111
|
+
return this.#value;
|
|
112
|
+
}
|
|
113
|
+
get kind() {
|
|
114
|
+
return this.#kind;
|
|
115
|
+
}
|
|
116
|
+
get parent() {
|
|
117
|
+
return this.#parent;
|
|
118
|
+
}
|
|
119
|
+
get children() {
|
|
120
|
+
return this.#children;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns the JSONPath expression corresponding to this node's location in the data structure.
|
|
124
|
+
*
|
|
125
|
+
* @returns {string} The JSONPath expression.
|
|
126
|
+
*/
|
|
127
|
+
get jsonpath() {
|
|
128
|
+
return this.#jsonpath.join("");
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Accepts a visitor and calls the appropriate visit method based on the node's kind.
|
|
132
|
+
*
|
|
133
|
+
* @param visitor - The visitor instance that will process the node.
|
|
134
|
+
*
|
|
135
|
+
* The method will call one of the following visitor methods based on the node's kind:
|
|
136
|
+
* - `visitScalar` if the node is a scalar.
|
|
137
|
+
* - `visitArray` if the node is an array.
|
|
138
|
+
* - `visitObject` if the node is an object.
|
|
139
|
+
*/
|
|
140
|
+
accept(visitor) {
|
|
141
|
+
switch (this.#kind) {
|
|
142
|
+
case "scalar":
|
|
143
|
+
visitor.visitScalar(this);
|
|
144
|
+
break;
|
|
145
|
+
case "array":
|
|
146
|
+
visitor.visitArray(this);
|
|
147
|
+
break;
|
|
148
|
+
case "object":
|
|
149
|
+
visitor.visitObject(this);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Converts the current instance to a JSON value.
|
|
155
|
+
*
|
|
156
|
+
* Depending on the type of the instance (`scalar`, `array`, or `object`),
|
|
157
|
+
* this method will return the corresponding JSON representation.
|
|
158
|
+
*
|
|
159
|
+
* - If the instance is a scalar, it returns the scalar value.
|
|
160
|
+
* - If the instance is an array, it returns an array of JSON values by
|
|
161
|
+
* recursively calling `toJsonValue` on each child.
|
|
162
|
+
* - If the instance is an object, it returns a JSON object by recursively
|
|
163
|
+
* calling `toJsonValue` on each child and using their keys as the object's keys.
|
|
164
|
+
*
|
|
165
|
+
* @returns {JsonValue} The JSON representation of the current instance.
|
|
166
|
+
*/
|
|
167
|
+
toJsonValue() {
|
|
168
|
+
let obj = {};
|
|
169
|
+
switch (this.#kind) {
|
|
170
|
+
case "scalar":
|
|
171
|
+
obj = this.#value;
|
|
172
|
+
break;
|
|
173
|
+
case "array":
|
|
174
|
+
obj = this.#children.map((child) => child.toJsonValue());
|
|
175
|
+
break;
|
|
176
|
+
case "object": {
|
|
177
|
+
const tmpObj = {};
|
|
178
|
+
for (const child of this.#children ?? []) {
|
|
179
|
+
tmpObj[child.key] = child.toJsonValue();
|
|
180
|
+
}
|
|
181
|
+
obj = tmpObj;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return obj;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export { JsonNode };
|
|
189
|
+
//# sourceMappingURL=json_node.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_node.esm.js","sources":["../../../src/util/lib/json_node.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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\n/* eslint-disable no-console */\n/* eslint-disable default-case */\n/*\n * Copyright 2025 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 type JsonArray,\n type JsonObject,\n type JsonScalar,\n type JsonValue,\n maybeJsonArray,\n maybeJsonObject,\n} from './json';\nimport type { JsonNodeVisitor } from './json_node_visitor';\n\nconst refs = new Set<JsonObject | JsonArray>();\nfunction detectCircularReference(nodeValue: JsonObject | JsonArray): void {\n if (refs.has(nodeValue)) {\n throw new TypeError('Converting circular structure');\n } else {\n refs.add(nodeValue);\n }\n}\n\nexport type ObjectKeyMutatorFunction = (key: string | number) => string;\n\n/**\n * Options for configuring the JSON visitor.\n */\nexport interface JsonNodeVisitorOptions {\n /**\n * A list of regular expression matching the JSONPath (RFC 9535) of a key in the data structure.\n * Every time a key is found in the data structure, its JSONPath is tested for a match against the entries in the list.\n * If at least one match is found, then that key won't be processed by the `JsonNodeVisitorOptions#onVisitJsonObjectKey` callback.\n */\n skipList?: Array<RegExp>;\n\n /**\n * An optional flag to enable debug mode.\n * When set to true, each time a node is visited, its JSONPath will be logged.\n */\n debug?: boolean;\n\n /**\n * A function that can be used to process the object keys names.\n * The string returned by this function will be used to replace the name of the object key being visited.\n */\n onVisitJsonObjectKey?: ObjectKeyMutatorFunction;\n}\n\nclass Visitor implements JsonNodeVisitor {\n readonly #onVisitObjectKey?: ObjectKeyMutatorFunction;\n readonly #skipList: Array<RegExp>;\n readonly #isDebugEnabled: boolean;\n\n constructor(options?: JsonNodeVisitorOptions) {\n this.#onVisitObjectKey = options?.onVisitJsonObjectKey;\n this.#skipList = options?.skipList ?? [];\n this.#isDebugEnabled = options?.debug ?? false;\n }\n\n visitScalar(node: JsonNode<JsonScalar>): void {\n if (this.#isDebugEnabled) {\n console.log(node.jsonpath);\n }\n }\n\n visitArray(node: JsonNode<JsonArray>): void {\n if (this.#isDebugEnabled) {\n console.log(node.jsonpath);\n }\n\n node.children?.forEach(child => child.accept(this));\n }\n\n visitObject(node: JsonNode<JsonObject>): void {\n if (this.#isDebugEnabled) {\n console.log(node.jsonpath);\n }\n\n node.children?.forEach(child => {\n const newKey = this.#skipList.some(regex => regex.test(child.jsonpath))\n ? child.key\n : this.#onVisitObjectKey?.(child.key) ?? child.key;\n child.key = newKey;\n child.accept(this);\n });\n }\n}\n\n/** Represents a node in a tree structure where each node can be a scalar, array, or object. */\nexport class JsonNode<T extends JsonValue> {\n static readonly Visitor = Visitor;\n static #toJsonPathSegment(value: string | number): string {\n if (typeof value === 'number') {\n return `[${value}]`;\n }\n\n const regex = /(\\s|\\.)/;\n return regex.test(value) ? `['${value}']` : `.${value}`;\n }\n\n readonly #parent: JsonNode<JsonValue> | null;\n readonly #children: Array<JsonNode<JsonValue>> | null;\n readonly #kind: 'scalar' | 'array' | 'object';\n readonly #value: T;\n readonly #jsonpath: Array<string>;\n key: string | number;\n\n /**\n * Constructs a new Node instance.\n *\n * @param key - The key associated with this node, which can be a string or number.\n * @param value - The value associated with this node.\n * @param parent - The parent node of this node, if any.\n *\n * @throws {TypeError} If the key is not \"$\" and the parent node is not provided.\n */\n constructor(key: string | number, value: T, parent?: JsonNode<T>) {\n this.key = key;\n this.#value = value;\n this.#jsonpath = [];\n\n if (key === '$') {\n this.#parent = null;\n this.#jsonpath.push(key);\n } else {\n if (!parent) {\n throw new TypeError('Parent node is required');\n }\n\n this.#parent = parent;\n this.#jsonpath.push(\n ...this.#parent.jsonpath,\n `${JsonNode.#toJsonPathSegment(key)}`,\n );\n }\n\n switch (true) {\n case maybeJsonArray(value):\n detectCircularReference(value);\n this.#kind = 'array';\n this.#children = value.map(\n (jsonValue, idx) => new JsonNode(idx, jsonValue, this),\n );\n break;\n case maybeJsonObject(value):\n detectCircularReference(value);\n this.#kind = 'object';\n this.#children = [];\n for (const [k, jsonValue] of Object.entries(value)) {\n if (typeof jsonValue !== 'undefined') {\n this.#children.push(new JsonNode(k, jsonValue, this));\n }\n }\n break;\n default:\n this.#kind = 'scalar';\n this.#children = null;\n break;\n }\n\n if (this.parent === null) {\n refs.clear();\n }\n }\n\n get value(): T {\n return this.#value;\n }\n\n get kind(): 'scalar' | 'array' | 'object' {\n return this.#kind;\n }\n\n get parent(): JsonNode<JsonValue> | null {\n return this.#parent;\n }\n\n get children(): Array<JsonNode<JsonValue>> | null {\n return this.#children;\n }\n\n /**\n * Returns the JSONPath expression corresponding to this node's location in the data structure.\n *\n * @returns {string} The JSONPath expression.\n */\n get jsonpath(): string {\n return this.#jsonpath.join('');\n }\n\n /**\n * Accepts a visitor and calls the appropriate visit method based on the node's kind.\n *\n * @param visitor - The visitor instance that will process the node.\n *\n * The method will call one of the following visitor methods based on the node's kind:\n * - `visitScalar` if the node is a scalar.\n * - `visitArray` if the node is an array.\n * - `visitObject` if the node is an object.\n */\n accept(visitor: Visitor) {\n switch (this.#kind) {\n case 'scalar':\n visitor.visitScalar(this as JsonNode<JsonScalar>);\n break;\n case 'array':\n visitor.visitArray(this as JsonNode<JsonArray>);\n break;\n case 'object':\n visitor.visitObject(this as JsonNode<JsonObject>);\n break;\n }\n }\n\n /**\n * Converts the current instance to a JSON value.\n *\n * Depending on the type of the instance (`scalar`, `array`, or `object`),\n * this method will return the corresponding JSON representation.\n *\n * - If the instance is a scalar, it returns the scalar value.\n * - If the instance is an array, it returns an array of JSON values by\n * recursively calling `toJsonValue` on each child.\n * - If the instance is an object, it returns a JSON object by recursively\n * calling `toJsonValue` on each child and using their keys as the object's keys.\n *\n * @returns {JsonValue} The JSON representation of the current instance.\n */\n toJsonValue(): JsonValue {\n let obj: JsonValue = {};\n switch (this.#kind) {\n case 'scalar':\n obj = this.#value;\n break;\n case 'array':\n obj = this.#children!.map(child => child.toJsonValue());\n break;\n case 'object': {\n const tmpObj: JsonObject = {};\n for (const child of this.#children ?? []) {\n tmpObj[child.key] = child.toJsonValue();\n }\n obj = tmpObj;\n }\n }\n return obj;\n }\n}\n"],"names":[],"mappings":";;AA2CA,MAAM,IAAA,uBAAW,GAA4B,EAAA;AAC7C,SAAS,wBAAwB,SAAyC,EAAA;AACxE,EAAI,IAAA,IAAA,CAAK,GAAI,CAAA,SAAS,CAAG,EAAA;AACvB,IAAM,MAAA,IAAI,UAAU,+BAA+B,CAAA;AAAA,GAC9C,MAAA;AACL,IA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,IAAA,CAAK,EAAE,CAAA;AAAA;AAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,OAAO,OAAkB,EAAA;AACvB,IAAA,QAAQ,KAAK,KAAO;AAAA,MAClB,KAAK,QAAA;AACH,QAAA,OAAA,CAAQ,YAAY,IAA4B,CAAA;AAChD,QAAA;AAAA,MACF,KAAK,OAAA;AACH,QAAA,OAAA,CAAQ,WAAW,IAA2B,CAAA;AAC9C,QAAA;AAAA,MACF,KAAK,QAAA;AACH,QAAA,OAAA,CAAQ,YAAY,IAA4B,CAAA;AAChD,QAAA;AAAA;AACJ;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,WAAyB,GAAA;AACvB,IAAA,IAAI,MAAiB,EAAC;AACtB,IAAA,QAAQ,KAAK,KAAO;AAAA,MAClB,KAAK,QAAA;AACH,QAAA,GAAA,GAAM,IAAK,CAAA,MAAA;AACX,QAAA;AAAA,MACF,KAAK,OAAA;AACH,QAAA,GAAA,GAAM,KAAK,SAAW,CAAA,GAAA,CAAI,CAAS,KAAA,KAAA,KAAA,CAAM,aAAa,CAAA;AACtD,QAAA;AAAA,MACF,KAAK,QAAU,EAAA;AACb,QAAA,MAAM,SAAqB,EAAC;AAC5B,QAAA,KAAA,MAAW,KAAS,IAAA,IAAA,CAAK,SAAa,IAAA,EAAI,EAAA;AACxC,UAAA,MAAA,CAAO,KAAM,CAAA,GAAG,CAAI,GAAA,KAAA,CAAM,WAAY,EAAA;AAAA;AAExC,QAAM,GAAA,GAAA,MAAA;AAAA;AACR;AAEF,IAAO,OAAA,GAAA;AAAA;AAEX;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@red-hat-developer-hub/plugin-cost-management-common",
|
|
3
|
+
"description": "Common functionalities for the cost-management plugin",
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"backstage": {
|
|
6
|
+
"pluginId": "cost-management",
|
|
7
|
+
"pluginPackages": [
|
|
8
|
+
"@red-hat-developer-hub/plugin-cost-management",
|
|
9
|
+
"@red-hat-developer-hub/plugin-cost-management-backend",
|
|
10
|
+
"@red-hat-developer-hub/plugin-cost-management-common"
|
|
11
|
+
],
|
|
12
|
+
"role": "common-library"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@backstage-community/plugin-rbac-common": "^1.12.2",
|
|
16
|
+
"@backstage/core-plugin-api": "^1.10.3",
|
|
17
|
+
"@backstage/plugin-permission-common": "^0.8.4",
|
|
18
|
+
"cross-fetch": "^4.0.0",
|
|
19
|
+
"lodash": "^4.17.21",
|
|
20
|
+
"uri-template": "^2.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@backstage/cli": "^0.29.4",
|
|
24
|
+
"@backstage/types": "^1.2.1",
|
|
25
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
26
|
+
"@types/lodash": "^4.17.5",
|
|
27
|
+
"msw": "^2.3.4",
|
|
28
|
+
"ts-morph": "^23.0.0",
|
|
29
|
+
"yaml": "^2.4.2"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/index.esm.js",
|
|
34
|
+
"require": "./dist/index.cjs.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.cjs.js"
|
|
37
|
+
},
|
|
38
|
+
"./models": {
|
|
39
|
+
"import": "./dist/models.esm.js",
|
|
40
|
+
"require": "./dist/models.cjs.js",
|
|
41
|
+
"types": "./dist/models.d.ts",
|
|
42
|
+
"default": "./dist/models.cjs.js"
|
|
43
|
+
},
|
|
44
|
+
"./clients": {
|
|
45
|
+
"import": "./dist/clients.esm.js",
|
|
46
|
+
"require": "./dist/clients.cjs.js",
|
|
47
|
+
"types": "./dist/clients.d.ts",
|
|
48
|
+
"default": "./dist/clients.cjs.js"
|
|
49
|
+
},
|
|
50
|
+
"./DefaultApiClient": {
|
|
51
|
+
"import": "./dist/DefaultApiClient.esm.js",
|
|
52
|
+
"require": "./dist/DefaultApiClient.cjs.js",
|
|
53
|
+
"types": "./dist/DefaultApiClient.d.ts",
|
|
54
|
+
"default": "./dist/DefaultApiClient.cjs.js"
|
|
55
|
+
},
|
|
56
|
+
"./json-utils": {
|
|
57
|
+
"import": "./dist/json-utils.esm.js",
|
|
58
|
+
"require": "./dist/json-utils.cjs.js",
|
|
59
|
+
"types": "./dist/json-utils.d.ts",
|
|
60
|
+
"default": "./dist/json-utils.cjs.js"
|
|
61
|
+
},
|
|
62
|
+
"./permissions": {
|
|
63
|
+
"import": "./dist/permissions.esm.js",
|
|
64
|
+
"require": "./dist/permissions.cjs.js",
|
|
65
|
+
"types": "./dist/permissions.d.ts",
|
|
66
|
+
"default": "./dist/permissions.cjs.js"
|
|
67
|
+
},
|
|
68
|
+
"./package.json": "./package.json"
|
|
69
|
+
},
|
|
70
|
+
"typesVersions": {
|
|
71
|
+
"*": {
|
|
72
|
+
"index": [
|
|
73
|
+
"dist/index.d.ts"
|
|
74
|
+
],
|
|
75
|
+
"models": [
|
|
76
|
+
"dist/models.d.ts"
|
|
77
|
+
],
|
|
78
|
+
"clients": [
|
|
79
|
+
"dist/clients.d.ts"
|
|
80
|
+
],
|
|
81
|
+
"DefaultApiClient": [
|
|
82
|
+
"dist/DefaultApiClient.d.ts"
|
|
83
|
+
],
|
|
84
|
+
"json-utils": [
|
|
85
|
+
"dist/json-utils.d.ts"
|
|
86
|
+
],
|
|
87
|
+
"permissions": [
|
|
88
|
+
"dist/permissions.d.ts"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dist"
|
|
94
|
+
],
|
|
95
|
+
"jest": {
|
|
96
|
+
"testEnvironmentOptions": {
|
|
97
|
+
"customExportConditions": []
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"license": "Apache-2.0",
|
|
101
|
+
"main": "./dist/index.cjs.js",
|
|
102
|
+
"publishConfig": {
|
|
103
|
+
"access": "public"
|
|
104
|
+
},
|
|
105
|
+
"repository": {
|
|
106
|
+
"directory": "workspaces/cost-management/plugins/cost-management-common",
|
|
107
|
+
"type": "git",
|
|
108
|
+
"url": "https://github.com/redhat-developer/rhdh-plugins"
|
|
109
|
+
},
|
|
110
|
+
"scripts": {
|
|
111
|
+
"build": "backstage-cli package build",
|
|
112
|
+
"clean": "backstage-cli package clean",
|
|
113
|
+
"generate-client": "scripts/generate_client.mjs",
|
|
114
|
+
"lint": "backstage-cli package lint",
|
|
115
|
+
"postpack": "backstage-cli package postpack",
|
|
116
|
+
"prepack": "backstage-cli package prepack",
|
|
117
|
+
"test": "backstage-cli package test",
|
|
118
|
+
"tsc": "yarn run -T tsc",
|
|
119
|
+
"tsc:dry-run": "yarn run -T tsc --noEmit --emitDeclarationOnly false"
|
|
120
|
+
},
|
|
121
|
+
"sideEffects": false,
|
|
122
|
+
"types": "./dist/index.d.ts",
|
|
123
|
+
"module": "./dist/index.esm.js"
|
|
124
|
+
}
|