@electrolux-oss/plugin-infrawallet-backend 0.1.12 → 0.2.0
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/config.d.ts +29 -1
- package/dist/index.cjs.js +1021 -563
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/migrations/20241017141420_create-custom-cost-table.js +31 -0
- package/migrations/20241021105140_wallet-budgets.js +22 -0
- package/package.json +19 -13
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
|
16
16
|
*
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
declare const infraWalletPlugin:
|
|
19
|
+
declare const infraWalletPlugin: _backstage_backend_plugin_api.BackendFeature;
|
|
20
20
|
|
|
21
21
|
export { type RouterOptions, createRouter, infraWalletPlugin as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
exports.up = async function up(knex) {
|
|
6
|
+
await knex.schema.createTable('custom_costs', table => {
|
|
7
|
+
table.comment('Custom costs uploaded by users');
|
|
8
|
+
table.uuid('id').defaultTo(knex.fn.uuid()).primary().notNullable().comment('Auto-generated ID of a record');
|
|
9
|
+
table.string('provider').notNullable().comment('The provider name of this cost');
|
|
10
|
+
table.string('account').notNullable().comment('The account name under this provider');
|
|
11
|
+
table.string('service').comment('The service name of this cost, can be blank');
|
|
12
|
+
table.string('category').comment('The category that this cost belongs to, can be blank');
|
|
13
|
+
table.string('currency').defaultTo('USD').comment('The currency of the cost, default to USD');
|
|
14
|
+
table
|
|
15
|
+
.string('amortization_mode')
|
|
16
|
+
.comment('How the monthly custom costs are mapped to daily costs, support two values: average, as_it_is');
|
|
17
|
+
table.integer('usage_month').comment('The usage month of the cost, format YYYYMM');
|
|
18
|
+
table.decimal('cost').comment('The value of the cost');
|
|
19
|
+
table
|
|
20
|
+
.json('tags')
|
|
21
|
+
.comment('Other tags that this cost record has, in json format such as {"tag_a":"value_a", "tag_b":"value_b"}');
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param { import("knex").Knex } knex
|
|
27
|
+
* @returns { Promise<void> }
|
|
28
|
+
*/
|
|
29
|
+
exports.down = async function down(knex) {
|
|
30
|
+
await knex.schema.dropTableIfExists('custom_costs');
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
exports.up = async function up(knex) {
|
|
6
|
+
await knex.schema.createTable('budgets', table => {
|
|
7
|
+
table.comment('Wallet budgets');
|
|
8
|
+
table.uuid('id').defaultTo(knex.fn.uuid()).primary().notNullable().comment('Auto-generated ID of a budget');
|
|
9
|
+
table.uuid('wallet_id').notNullable().comment('The ID of the wallet that has this budget');
|
|
10
|
+
table.string('provider').notNullable().comment('The name of a cloud provider');
|
|
11
|
+
table.string('name').notNullable().comment('The name of a budget');
|
|
12
|
+
table.decimal('amount').notNullable().comment('The amount of a budget');
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param { import("knex").Knex } knex
|
|
18
|
+
* @returns { Promise<void> }
|
|
19
|
+
*/
|
|
20
|
+
exports.down = async function down(knex) {
|
|
21
|
+
await knex.schema.dropTableIfExists('budgets');
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electrolux-oss/plugin-infrawallet-backend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"backstage": {
|
|
5
|
-
"role": "backend-plugin"
|
|
5
|
+
"role": "backend-plugin",
|
|
6
|
+
"pluginId": "infrawallet",
|
|
7
|
+
"pluginPackages": [
|
|
8
|
+
"@electrolux-oss/plugin-infrawallet",
|
|
9
|
+
"@electrolux-oss/plugin-infrawallet-backend"
|
|
10
|
+
]
|
|
6
11
|
},
|
|
7
12
|
"publishConfig": {
|
|
8
13
|
"access": "public",
|
|
@@ -35,18 +40,18 @@
|
|
|
35
40
|
"test": "backstage-cli package test"
|
|
36
41
|
},
|
|
37
42
|
"dependencies": {
|
|
38
|
-
"@aws-sdk/client-cost-explorer": "^3.
|
|
39
|
-
"@aws-sdk/client-sts": "^3.
|
|
43
|
+
"@aws-sdk/client-cost-explorer": "^3.679.0",
|
|
44
|
+
"@aws-sdk/client-sts": "^3.679.0",
|
|
40
45
|
"@azure/arm-costmanagement": "1.0.0-beta.1",
|
|
41
46
|
"@azure/core-rest-pipeline": "1.17.0",
|
|
42
|
-
"@azure/identity": "4.
|
|
43
|
-
"@backstage/backend-common": "^0.
|
|
44
|
-
"@backstage/backend-defaults": "^0.
|
|
45
|
-
"@backstage/backend-plugin-api": "^0.
|
|
47
|
+
"@azure/identity": "4.5.0",
|
|
48
|
+
"@backstage/backend-common": "^0.25.0",
|
|
49
|
+
"@backstage/backend-defaults": "^0.5.0",
|
|
50
|
+
"@backstage/backend-plugin-api": "^1.0.0",
|
|
46
51
|
"@backstage/config": "^1.2.0",
|
|
47
52
|
"@backstage/types": "^1.1.1",
|
|
48
|
-
"@datadog/datadog-api-client": "^1.
|
|
49
|
-
"@google-cloud/bigquery": "7.9.
|
|
53
|
+
"@datadog/datadog-api-client": "^1.29.0",
|
|
54
|
+
"@google-cloud/bigquery": "7.9.1",
|
|
50
55
|
"@types/express": "*",
|
|
51
56
|
"express": "^4.17.1",
|
|
52
57
|
"express-promise-router": "^4.1.0",
|
|
@@ -59,10 +64,11 @@
|
|
|
59
64
|
"yn": "^4.0.0"
|
|
60
65
|
},
|
|
61
66
|
"devDependencies": {
|
|
62
|
-
"@backstage/cli": "^0.
|
|
63
|
-
"@backstage/plugin-auth-backend": "^0.
|
|
64
|
-
"@backstage/plugin-auth-backend-module-guest-provider": "^0.
|
|
67
|
+
"@backstage/cli": "^0.27.1",
|
|
68
|
+
"@backstage/plugin-auth-backend": "^0.23.0",
|
|
69
|
+
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.0",
|
|
65
70
|
"@types/supertest": "^2.0.8",
|
|
71
|
+
"knex": "^3.1.0",
|
|
66
72
|
"msw": "^1.0.0",
|
|
67
73
|
"supertest": "^6.2.4"
|
|
68
74
|
},
|