@iiasa/ixmp4-ts 0.1.1 → 0.1.2
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/dist/cjs/core/iamc/data.js +73 -9
- package/dist/cjs/core/meta.js +21 -3
- package/dist/cjs/core/platform.js +2 -2
- package/dist/cjs/core/run.js +1 -1
- package/dist/cjs/data/base.js +96 -46
- package/dist/cjs/data/docs.js +1 -4
- package/dist/cjs/data/iamc/datapoint.js +15 -22
- package/dist/cjs/data/iamc/timeseries.js +12 -9
- package/dist/cjs/data/iamc/variable.js +5 -6
- package/dist/cjs/data/meta.js +4 -8
- package/dist/cjs/data/model.js +5 -6
- package/dist/cjs/data/region.js +5 -6
- package/dist/cjs/data/run.js +5 -9
- package/dist/cjs/data/scenario.js +6 -7
- package/dist/cjs/data/unit.js +5 -6
- package/dist/esm/core/iamc/data.js +61 -8
- package/dist/esm/core/meta.js +9 -3
- package/dist/esm/core/platform.js +2 -2
- package/dist/esm/core/run.js +2 -2
- package/dist/esm/data/base.js +69 -45
- package/dist/esm/data/docs.js +1 -4
- package/dist/esm/data/iamc/datapoint.js +11 -11
- package/dist/esm/data/iamc/timeseries.js +12 -9
- package/dist/esm/data/iamc/variable.js +5 -6
- package/dist/esm/data/meta.js +4 -8
- package/dist/esm/data/model.js +5 -6
- package/dist/esm/data/region.js +5 -6
- package/dist/esm/data/run.js +5 -9
- package/dist/esm/data/scenario.js +6 -7
- package/dist/esm/data/unit.js +5 -6
- package/dist/types/core/iamc/data.d.ts +28 -4
- package/dist/types/core/iamc/variable.d.ts +1 -1
- package/dist/types/core/meta.d.ts +5 -3
- package/dist/types/core/platform.d.ts +2 -2
- package/dist/types/core/run.d.ts +2 -2
- package/dist/types/data/base.d.ts +28 -6
- package/dist/types/data/docs.d.ts +0 -2
- package/dist/types/data/iamc/datapoint.d.ts +6 -7
- package/dist/types/data/iamc/timeseries.d.ts +9 -5
- package/dist/types/data/iamc/variable.d.ts +2 -3
- package/dist/types/data/meta.d.ts +2 -5
- package/dist/types/data/model.d.ts +2 -3
- package/dist/types/data/region.d.ts +2 -3
- package/dist/types/data/run.d.ts +2 -5
- package/dist/types/data/scenario.d.ts +2 -3
- package/dist/types/data/unit.d.ts +2 -3
- package/dist/types/index.d.ts +1 -2
- package/package.json +11 -4
- package/dist/cjs/core/iamc/repository.js +0 -73
- package/dist/esm/core/iamc/repository.js +0 -51
- package/dist/types/core/iamc/repository.d.ts +0 -30
@@ -31,25 +31,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
32
|
});
|
33
33
|
};
|
34
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
35
|
+
var t = {};
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
37
|
+
t[p] = s[p];
|
38
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
39
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
41
|
+
t[p[i]] = s[p[i]];
|
42
|
+
}
|
43
|
+
return t;
|
44
|
+
};
|
34
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35
|
-
exports.
|
46
|
+
exports.PlatformIamcData = exports.RunIamcData = void 0;
|
36
47
|
const dfd = __importStar(require("danfojs"));
|
37
48
|
const base_1 = require("../base");
|
38
|
-
const repository_1 = require("./repository");
|
39
49
|
const utils_1 = require("../utils");
|
50
|
+
const variable_1 = require("./variable");
|
40
51
|
/**
|
41
|
-
* Represents
|
52
|
+
* Represents IAMC format data for a specific Run.
|
42
53
|
*/
|
43
|
-
class
|
54
|
+
class RunIamcData extends base_1.BaseFacade {
|
44
55
|
/**
|
45
|
-
* Constructs a new instance of the
|
56
|
+
* Constructs a new instance of the RunIamcData class.
|
46
57
|
* @param backend The backend instance.
|
47
58
|
* @param run The run associated with the IAMC data.
|
48
59
|
*/
|
49
60
|
constructor(backend, run) {
|
50
61
|
super(backend);
|
51
62
|
this.run = run;
|
52
|
-
this.repository = new
|
63
|
+
this.repository = new PlatformIamcData(this.backend);
|
53
64
|
}
|
54
65
|
/**
|
55
66
|
* Adds timeseries data in IAMC format.
|
@@ -103,7 +114,7 @@ class IamcData extends base_1.BaseFacade {
|
|
103
114
|
throw new Error(`Illegal filter for 'iamc.tabulate()': ${illegalFilter}`);
|
104
115
|
}
|
105
116
|
}
|
106
|
-
return yield this.repository.tabulate(Object.assign({ run: { id: this.run.id }, joinRuns: false }, filter));
|
117
|
+
return yield this.repository.tabulate(Object.assign({ run: { id: this.run.id, defaultOnly: false }, joinRuns: false }, filter));
|
107
118
|
});
|
108
119
|
}
|
109
120
|
contractParameters(df) {
|
@@ -113,7 +124,10 @@ class IamcData extends base_1.BaseFacade {
|
|
113
124
|
.agg({ run__id: 'min' })
|
114
125
|
.loc({ columns: ['region', 'variable', 'unit', 'run__id'] });
|
115
126
|
yield this.backend.iamc.timeseries.bulkUpsert(timeseriesDf, true);
|
116
|
-
timeseriesDf = yield this.backend.iamc.timeseries.tabulate(
|
127
|
+
timeseriesDf = yield this.backend.iamc.timeseries.tabulate({
|
128
|
+
filter: { run: { id: this.run.id, defaultOnly: false } },
|
129
|
+
joinParameters: true,
|
130
|
+
});
|
117
131
|
timeseriesDf = timeseriesDf.rename({ id: 'time_series__id' });
|
118
132
|
// mimick pandas merge suffix option by manually renaming overlapping columns
|
119
133
|
df.columns
|
@@ -130,4 +144,54 @@ class IamcData extends base_1.BaseFacade {
|
|
130
144
|
});
|
131
145
|
}
|
132
146
|
}
|
133
|
-
exports.
|
147
|
+
exports.RunIamcData = RunIamcData;
|
148
|
+
/**
|
149
|
+
* Represents IAMC format data for a specific a modling platform.
|
150
|
+
*/
|
151
|
+
class PlatformIamcData extends base_1.BaseFacade {
|
152
|
+
/**
|
153
|
+
* Constructs a new instance of the PlatformIamcData class.
|
154
|
+
* @param backend The backend instance used for data retrieval.
|
155
|
+
*/
|
156
|
+
constructor(backend) {
|
157
|
+
super(backend);
|
158
|
+
this.variables = new variable_1.VariableRepository(this.backend);
|
159
|
+
}
|
160
|
+
/**
|
161
|
+
* Tabulates IAMC data with optional filtering.
|
162
|
+
* @param filter Optional. Filter for retrieving IAMC data.
|
163
|
+
* @param filter.joinRuns Optional. Whether to join runs or not, defaults to true.
|
164
|
+
* @returns A Promise that resolves to a dfd.DataFrame containing the tabulated data.
|
165
|
+
*/
|
166
|
+
tabulate(_a = {
|
167
|
+
joinRuns: true,
|
168
|
+
}) {
|
169
|
+
var { joinRuns = true } = _a, filter = __rest(_a, ["joinRuns"]);
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
171
|
+
if (filter === undefined) {
|
172
|
+
filter = {};
|
173
|
+
}
|
174
|
+
// return only default runs unless a run-filter is provided
|
175
|
+
if (!Object.hasOwn(filter, 'run')) {
|
176
|
+
filter['run'] = { defaultOnly: true };
|
177
|
+
}
|
178
|
+
const joinParameters = true;
|
179
|
+
let df = yield this.backend.iamc.datapoints.tabulate({
|
180
|
+
joinRuns,
|
181
|
+
joinParameters,
|
182
|
+
filter,
|
183
|
+
});
|
184
|
+
df = df.dropNa({ axis: 1 });
|
185
|
+
if (df.columns.includes('time_series__id')) {
|
186
|
+
df = df.drop({ columns: ['time_series__id'] });
|
187
|
+
}
|
188
|
+
if (df.columns.includes('unit')) {
|
189
|
+
// TODO report bug to danfojs: df.replace('oldValue', '', { columns: ['column_name'] }) throws: Params Error: Must specify param 'newValue' to replace with (probably newValue is cast to boolean and emty string is falsy)
|
190
|
+
df = df.replace('dimensionless', ' ', { columns: ['unit'] });
|
191
|
+
console.warn(`Unit name "dimensionless" has been replaced with ' ', this will be rejected by ixmp4.`);
|
192
|
+
}
|
193
|
+
return df;
|
194
|
+
});
|
195
|
+
}
|
196
|
+
}
|
197
|
+
exports.PlatformIamcData = PlatformIamcData;
|
package/dist/cjs/core/meta.js
CHANGED
@@ -31,6 +31,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
32
|
});
|
33
33
|
};
|
34
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
35
|
+
var t = {};
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
37
|
+
t[p] = s[p];
|
38
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
39
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
41
|
+
t[p[i]] = s[p[i]];
|
42
|
+
}
|
43
|
+
return t;
|
44
|
+
};
|
34
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35
46
|
exports.RunMetaIndicatorRepository = exports.MetaIndicatorRepository = void 0;
|
36
47
|
const dfd = __importStar(require("danfojs"));
|
@@ -41,12 +52,19 @@ const base_1 = require("./base");
|
|
41
52
|
class MetaIndicatorRepository extends base_1.BaseFacade {
|
42
53
|
/**
|
43
54
|
* Tabulates meta indicators based on the provided filter.
|
44
|
-
* @param filter The filter to apply to the meta indicators.
|
55
|
+
* @param filter Optional. The filter to apply to the meta indicators.
|
56
|
+
* @param joinRunIndex Optional. Whether to join the run index to the tabulated data, defaults to true.
|
45
57
|
* @returns A promise that resolves to a dfd.DataFrame containing the tabulated meta indicators.
|
46
58
|
*/
|
47
|
-
tabulate(
|
59
|
+
tabulate(_a = {
|
60
|
+
joinRunIndex: true,
|
61
|
+
}) {
|
62
|
+
var { joinRunIndex = true } = _a, filter = __rest(_a, ["joinRunIndex"]);
|
48
63
|
return __awaiter(this, void 0, void 0, function* () {
|
49
|
-
|
64
|
+
if (filter === undefined) {
|
65
|
+
filter = {};
|
66
|
+
}
|
67
|
+
return (yield this.backend.meta.tabulate(filter, joinRunIndex)).drop({
|
50
68
|
columns: ['id', 'type'],
|
51
69
|
});
|
52
70
|
});
|
@@ -15,7 +15,7 @@ const run_1 = require("./run");
|
|
15
15
|
const scenario_1 = require("./scenario");
|
16
16
|
const meta_1 = require("./meta");
|
17
17
|
const model_1 = require("./model");
|
18
|
-
const
|
18
|
+
const data_1 = require("./iamc/data");
|
19
19
|
const region_1 = require("./region");
|
20
20
|
const unit_1 = require("./unit");
|
21
21
|
/**
|
@@ -35,7 +35,7 @@ class Platform {
|
|
35
35
|
constructor(backend) {
|
36
36
|
this.backend = backend;
|
37
37
|
this.runs = new run_1.RunRepository(backend);
|
38
|
-
this.iamc = new
|
38
|
+
this.iamc = new data_1.PlatformIamcData(backend);
|
39
39
|
this.scenarios = new scenario_1.ScenarioRepository(backend);
|
40
40
|
this.models = new model_1.ModelRepository(backend);
|
41
41
|
this.meta = new meta_1.MetaIndicatorRepository(backend);
|
package/dist/cjs/core/run.js
CHANGED
@@ -24,7 +24,7 @@ class Run extends base_1.BaseModelFacade {
|
|
24
24
|
*/
|
25
25
|
constructor(backend, model) {
|
26
26
|
super(backend, model);
|
27
|
-
this.iamc = new data_1.
|
27
|
+
this.iamc = new data_1.RunIamcData(this.backend, this.dataModel);
|
28
28
|
this.meta = new meta_1.RunMetaIndicatorRepository(this.backend, this.dataModel);
|
29
29
|
}
|
30
30
|
/**
|
package/dist/cjs/data/base.js
CHANGED
@@ -1,4 +1,27 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -10,17 +33,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
33
|
};
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
35
|
exports.BaseRepository = void 0;
|
36
|
+
const dfd = __importStar(require("danfojs"));
|
13
37
|
const exceptions_1 = require("../core/exceptions");
|
14
38
|
const utils_1 = require("./utils");
|
15
39
|
class BaseRepository {
|
16
|
-
constructor(client, prefix
|
40
|
+
constructor(client, prefix) {
|
41
|
+
var _a;
|
17
42
|
this.client = client;
|
18
|
-
|
43
|
+
// use static porperties of extending classes via this.constructor
|
44
|
+
// @ts-ignore
|
45
|
+
this.prefix = prefix !== null && prefix !== void 0 ? prefix : this.constructor.prefix;
|
46
|
+
if (!this.prefix)
|
19
47
|
throw new TypeError('Cannot instantiate repository without URL prefix.');
|
20
|
-
|
21
|
-
this.enumerationMethod = enumerationMethod !== null &&
|
48
|
+
// @ts-ignore
|
49
|
+
this.enumerationMethod = (_a = this.constructor.enumerationMethod) !== null && _a !== void 0 ? _a : 'PATCH';
|
22
50
|
}
|
23
|
-
_request(url, method, params,
|
51
|
+
_request(url, method, params, body) {
|
24
52
|
var _a;
|
25
53
|
return __awaiter(this, void 0, void 0, function* () {
|
26
54
|
const config = {};
|
@@ -28,8 +56,8 @@ class BaseRepository {
|
|
28
56
|
config.method = method;
|
29
57
|
if (params !== undefined)
|
30
58
|
config.params = params;
|
31
|
-
if (
|
32
|
-
config.data =
|
59
|
+
if (body !== undefined)
|
60
|
+
config.data = body;
|
33
61
|
try {
|
34
62
|
const res = yield this.client.request(config);
|
35
63
|
return res.data;
|
@@ -41,7 +69,7 @@ class BaseRepository {
|
|
41
69
|
}
|
42
70
|
_get(filter) {
|
43
71
|
return __awaiter(this, void 0, void 0, function* () {
|
44
|
-
const list = yield this._list(filter);
|
72
|
+
const list = yield this._list({ filter });
|
45
73
|
if (list.length !== 1) {
|
46
74
|
throw new exceptions_1.NotFound({
|
47
75
|
messsage: `Expected exactly one result, got ${list.length} instead.`,
|
@@ -72,54 +100,79 @@ class BaseRepository {
|
|
72
100
|
return yield this._request(url, 'DELETE');
|
73
101
|
});
|
74
102
|
}
|
75
|
-
|
103
|
+
/**
|
104
|
+
* Convenience method for requests to the enumeration endpoint.
|
105
|
+
*/
|
106
|
+
_requestEnumeration(params = {}, body = {}, table = false) {
|
76
107
|
return __awaiter(this, void 0, void 0, function* () {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
if (Object.hasOwn(filter, 'join_parameters')) {
|
81
|
-
params['join_parameters'] = filter['join_parameters'];
|
82
|
-
delete filter['join_parameters'];
|
83
|
-
}
|
84
|
-
if (Object.hasOwn(filter, 'join_runs')) {
|
85
|
-
params['join_runs'] = filter['join_runs'];
|
86
|
-
delete filter['join_runs'];
|
87
|
-
}
|
88
|
-
if (Object.hasOwn(filter, 'join_run_index')) {
|
89
|
-
params['join_run_index'] = filter['join_run_index'];
|
90
|
-
delete filter['join_run_index'];
|
91
|
-
}
|
92
|
-
if (table) {
|
93
|
-
params['table'] = true;
|
94
|
-
}
|
95
|
-
if (this.enumerationMethod === 'GET') {
|
96
|
-
for (const [key, value] of Object.entries(filter)) {
|
97
|
-
params[key] = value;
|
98
|
-
}
|
108
|
+
params = (0, utils_1.convertToSnakeCase)(params);
|
109
|
+
if (body !== undefined && Object.keys(body).length === 0) {
|
110
|
+
body = undefined;
|
99
111
|
}
|
100
112
|
else {
|
101
|
-
|
113
|
+
body = (0, utils_1.convertToSnakeCase)(body);
|
102
114
|
}
|
103
|
-
|
104
|
-
|
115
|
+
const res = yield this._request(this.prefix, this.enumerationMethod, Object.assign(Object.assign({}, params), { table }), body);
|
116
|
+
return res;
|
117
|
+
});
|
118
|
+
}
|
119
|
+
/**
|
120
|
+
* Convenience method for paginated requests to the enumeration endpoint.
|
121
|
+
*
|
122
|
+
* @returns A list of lists of results.
|
123
|
+
*/
|
124
|
+
_handlePagination(page, table, params, body) {
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
126
|
+
const total = page.total;
|
127
|
+
const pagination = page.pagination;
|
128
|
+
const offset = pagination === null || pagination === void 0 ? void 0 : pagination.offset;
|
129
|
+
const limit = pagination === null || pagination === void 0 ? void 0 : pagination.limit;
|
130
|
+
if (total <= offset + limit) {
|
131
|
+
return [page.results];
|
105
132
|
}
|
106
|
-
|
107
|
-
|
133
|
+
else {
|
134
|
+
const newParams = { limit, offset: offset + limit };
|
135
|
+
params = Object.assign(Object.assign({}, params), newParams);
|
136
|
+
const nextData = yield this._requestEnumeration(params, body, table);
|
137
|
+
const pages = yield this._handlePagination(nextData, table, params, body);
|
138
|
+
return [page.results, ...pages];
|
108
139
|
}
|
109
|
-
const res = yield this._request(this.prefix, this.enumerationMethod, params, data);
|
110
|
-
return res;
|
111
140
|
});
|
112
141
|
}
|
113
|
-
_list(filter) {
|
142
|
+
_list({ filter, params, }) {
|
114
143
|
return __awaiter(this, void 0, void 0, function* () {
|
115
|
-
|
144
|
+
const data = yield this._requestEnumeration(params, filter, false);
|
145
|
+
const pagination = data.pagination;
|
146
|
+
if (pagination !== undefined) {
|
147
|
+
const pages = yield this._handlePagination(data, false, params, filter);
|
148
|
+
return pages.flatMap((page) => page);
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
return data;
|
152
|
+
}
|
116
153
|
});
|
117
154
|
}
|
118
|
-
_tabulate(filter) {
|
155
|
+
_tabulate({ filter, params, }) {
|
119
156
|
return __awaiter(this, void 0, void 0, function* () {
|
120
|
-
const jdf = yield this._enumerate(filter, true);
|
121
157
|
// TODO: test what happens if we get a number that cannot be represented as float32 (or int32)
|
122
|
-
|
158
|
+
const data = yield this._requestEnumeration(params, filter, true);
|
159
|
+
const pagination = data.pagination;
|
160
|
+
if (pagination !== undefined) {
|
161
|
+
const pages = yield this._handlePagination(data, true, params, filter);
|
162
|
+
// return a single dataframe if there is only one page, since dfd.concat() does not handle that properly
|
163
|
+
if (pages.length === 1) {
|
164
|
+
return (0, utils_1.jsonToDf)(pages[0]);
|
165
|
+
}
|
166
|
+
else {
|
167
|
+
const dfList = pages
|
168
|
+
.map((page) => (0, utils_1.jsonToDf)(page))
|
169
|
+
.filter((df) => df.length !== undefined);
|
170
|
+
return dfd.concat({ dfList: dfList, axis: 0 });
|
171
|
+
}
|
172
|
+
}
|
173
|
+
else {
|
174
|
+
return (0, utils_1.jsonToDf)(data);
|
175
|
+
}
|
123
176
|
});
|
124
177
|
}
|
125
178
|
_bulkUpsert(df, params) {
|
@@ -132,9 +185,6 @@ class BaseRepository {
|
|
132
185
|
return yield this._request(`${this.prefix}bulk/`, 'PATCH', params, (0, utils_1.dfToJson)(df));
|
133
186
|
});
|
134
187
|
}
|
135
|
-
static requestInfo(config) {
|
136
|
-
return `path:${config.url} method:${config.method}; params:${JSON.stringify(config.params)}; data:${JSON.stringify(config.data)};`;
|
137
|
-
}
|
138
188
|
static throwRemoteException(res, statusCode) {
|
139
189
|
const json = res === null || res === void 0 ? void 0 : res.data;
|
140
190
|
if (typeof json !== 'object' ||
|
package/dist/cjs/data/docs.js
CHANGED
@@ -12,9 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DocsRepository = void 0;
|
13
13
|
const base_1 = require("./base");
|
14
14
|
class DocsRepository extends base_1.BaseRepository {
|
15
|
-
constructor(client, prefix) {
|
16
|
-
super(client, prefix, DocsRepository.enumerationMethod);
|
17
|
-
}
|
18
15
|
get(dimensionId) {
|
19
16
|
return __awaiter(this, void 0, void 0, function* () {
|
20
17
|
return yield this._get({ dimension_id: dimensionId });
|
@@ -30,7 +27,7 @@ class DocsRepository extends base_1.BaseRepository {
|
|
30
27
|
}
|
31
28
|
list(dimensionId) {
|
32
29
|
return __awaiter(this, void 0, void 0, function* () {
|
33
|
-
return yield this._list({ dimension_id: dimensionId });
|
30
|
+
return yield this._list({ filter: { dimension_id: dimensionId } });
|
34
31
|
});
|
35
32
|
}
|
36
33
|
delete(dimensionId) {
|
@@ -8,17 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
12
|
-
var t = {};
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
14
|
-
t[p] = s[p];
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
18
|
-
t[p[i]] = s[p[i]];
|
19
|
-
}
|
20
|
-
return t;
|
21
|
-
};
|
22
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
23
12
|
exports.DataPointType = exports.DataPointRepository = void 0;
|
24
13
|
const base_1 = require("../base");
|
@@ -29,25 +18,30 @@ var DataPointType;
|
|
29
18
|
DataPointType["DATETIME"] = "DATETIME";
|
30
19
|
})(DataPointType || (exports.DataPointType = DataPointType = {}));
|
31
20
|
class DataPointRepository extends base_1.BaseRepository {
|
32
|
-
|
33
|
-
super(client, DataPointRepository.prefix, DataPointRepository.enumerationMethod);
|
34
|
-
}
|
35
|
-
list(_a = {
|
21
|
+
list({ joinParameters = false, filter = {}, } = {
|
36
22
|
joinParameters: false,
|
23
|
+
filter: {},
|
37
24
|
}) {
|
38
|
-
var { joinParameters = false } = _a, filter = __rest(_a, ["joinParameters"]);
|
39
25
|
return __awaiter(this, void 0, void 0, function* () {
|
40
|
-
return (yield this._list(
|
26
|
+
return (yield this._list({
|
27
|
+
filter,
|
28
|
+
params: { joinParameters },
|
29
|
+
}));
|
41
30
|
});
|
42
31
|
}
|
43
|
-
tabulate(
|
32
|
+
tabulate({ joinParameters = false, joinRuns = false, filter = {}, } = {
|
44
33
|
joinParameters: false,
|
45
34
|
joinRuns: false,
|
35
|
+
filter: {},
|
46
36
|
}) {
|
47
|
-
var { joinParameters = false, joinRuns = false } = _a, filter = __rest(_a, ["joinParameters", "joinRuns"]);
|
48
37
|
return __awaiter(this, void 0, void 0, function* () {
|
49
|
-
return yield this._tabulate(
|
50
|
-
|
38
|
+
return yield this._tabulate({
|
39
|
+
filter,
|
40
|
+
params: {
|
41
|
+
joinParameters,
|
42
|
+
joinRuns,
|
43
|
+
},
|
44
|
+
});
|
51
45
|
});
|
52
46
|
}
|
53
47
|
bulkUpsert(df) {
|
@@ -63,4 +57,3 @@ class DataPointRepository extends base_1.BaseRepository {
|
|
63
57
|
}
|
64
58
|
exports.DataPointRepository = DataPointRepository;
|
65
59
|
DataPointRepository.prefix = 'iamc/datapoints/';
|
66
|
-
DataPointRepository.enumerationMethod = 'PATCH';
|
@@ -13,9 +13,6 @@ exports.TimeSeriesRepository = void 0;
|
|
13
13
|
const base_1 = require("../base");
|
14
14
|
const exceptions_1 = require("../../core/exceptions");
|
15
15
|
class TimeSeriesRepository extends base_1.BaseRepository {
|
16
|
-
constructor(client) {
|
17
|
-
super(client, TimeSeriesRepository.prefix);
|
18
|
-
}
|
19
16
|
create(runId, parameters) {
|
20
17
|
return __awaiter(this, void 0, void 0, function* () {
|
21
18
|
return (yield this._post({
|
@@ -52,19 +49,25 @@ class TimeSeriesRepository extends base_1.BaseRepository {
|
|
52
49
|
}
|
53
50
|
});
|
54
51
|
}
|
55
|
-
list(
|
52
|
+
list({ joinParameters = false, filter = {}, } = {
|
53
|
+
joinParameters: false,
|
54
|
+
filter: {},
|
55
|
+
}) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
57
|
return (yield this._list({
|
58
|
-
|
59
|
-
joinParameters,
|
58
|
+
filter,
|
59
|
+
params: { joinParameters },
|
60
60
|
}));
|
61
61
|
});
|
62
62
|
}
|
63
|
-
tabulate(
|
63
|
+
tabulate({ joinParameters = false, filter = {}, } = {
|
64
|
+
joinParameters: false,
|
65
|
+
filter: {},
|
66
|
+
}) {
|
64
67
|
return __awaiter(this, void 0, void 0, function* () {
|
65
68
|
return yield this._tabulate({
|
66
|
-
|
67
|
-
joinParameters,
|
69
|
+
filter,
|
70
|
+
params: { joinParameters },
|
68
71
|
});
|
69
72
|
});
|
70
73
|
}
|
@@ -14,17 +14,17 @@ const base_1 = require("../base");
|
|
14
14
|
const docs_1 = require("../docs");
|
15
15
|
class VariableRepository extends base_1.BaseRepository {
|
16
16
|
constructor(client) {
|
17
|
-
super(client
|
17
|
+
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/iamc/variables/');
|
19
19
|
}
|
20
|
-
list(
|
20
|
+
list(filter = {}) {
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
22
|
-
return yield this._list(
|
22
|
+
return yield this._list({ filter });
|
23
23
|
});
|
24
24
|
}
|
25
|
-
tabulate(
|
25
|
+
tabulate(filter = {}) {
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
27
|
-
return yield this._tabulate(
|
27
|
+
return yield this._tabulate({ filter });
|
28
28
|
});
|
29
29
|
}
|
30
30
|
create(name) {
|
@@ -40,4 +40,3 @@ class VariableRepository extends base_1.BaseRepository {
|
|
40
40
|
}
|
41
41
|
exports.VariableRepository = VariableRepository;
|
42
42
|
VariableRepository.prefix = 'iamc/variables/';
|
43
|
-
VariableRepository.enumerationMethod = 'PATCH';
|
package/dist/cjs/data/meta.js
CHANGED
@@ -19,17 +19,14 @@ var MetaIndicatorType;
|
|
19
19
|
MetaIndicatorType["BOOL"] = "BOOL";
|
20
20
|
})(MetaIndicatorType || (MetaIndicatorType = {}));
|
21
21
|
class MetaIndicatorRepository extends base_1.BaseRepository {
|
22
|
-
|
23
|
-
super(client, MetaIndicatorRepository.prefix, MetaIndicatorRepository.enumerationMethod);
|
24
|
-
}
|
25
|
-
list(f = {}) {
|
22
|
+
list(filter = {}) {
|
26
23
|
return __awaiter(this, void 0, void 0, function* () {
|
27
|
-
return yield this._list(
|
24
|
+
return yield this._list(filter);
|
28
25
|
});
|
29
26
|
}
|
30
|
-
tabulate(
|
27
|
+
tabulate(filter = {}, joinRunIndex) {
|
31
28
|
return __awaiter(this, void 0, void 0, function* () {
|
32
|
-
return yield this._tabulate(
|
29
|
+
return yield this._tabulate({ filter, params: { joinRunIndex } });
|
33
30
|
});
|
34
31
|
}
|
35
32
|
create(run__id, key, value) {
|
@@ -65,4 +62,3 @@ class MetaIndicatorRepository extends base_1.BaseRepository {
|
|
65
62
|
}
|
66
63
|
exports.MetaIndicatorRepository = MetaIndicatorRepository;
|
67
64
|
MetaIndicatorRepository.prefix = 'meta/';
|
68
|
-
MetaIndicatorRepository.enumerationMethod = 'PATCH';
|
package/dist/cjs/data/model.js
CHANGED
@@ -14,17 +14,17 @@ const base_1 = require("./base");
|
|
14
14
|
const docs_1 = require("./docs");
|
15
15
|
class ModelRepository extends base_1.BaseRepository {
|
16
16
|
constructor(client) {
|
17
|
-
super(client
|
17
|
+
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/models/');
|
19
19
|
}
|
20
|
-
list(
|
20
|
+
list(filter = {}) {
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
22
|
-
return yield this._list(
|
22
|
+
return yield this._list({ filter });
|
23
23
|
});
|
24
24
|
}
|
25
|
-
tabulate(
|
25
|
+
tabulate(filter = {}) {
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
27
|
-
return yield this._tabulate(
|
27
|
+
return yield this._tabulate({ filter });
|
28
28
|
});
|
29
29
|
}
|
30
30
|
create(name) {
|
@@ -41,4 +41,3 @@ class ModelRepository extends base_1.BaseRepository {
|
|
41
41
|
}
|
42
42
|
exports.ModelRepository = ModelRepository;
|
43
43
|
ModelRepository.prefix = 'models/';
|
44
|
-
ModelRepository.enumerationMethod = 'PATCH';
|
package/dist/cjs/data/region.js
CHANGED
@@ -14,18 +14,18 @@ const base_1 = require("./base");
|
|
14
14
|
const docs_1 = require("./docs");
|
15
15
|
class RegionRepository extends base_1.BaseRepository {
|
16
16
|
constructor(client) {
|
17
|
-
super(client
|
17
|
+
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/regions/');
|
19
19
|
}
|
20
|
-
list(
|
20
|
+
list(filter = {}) {
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
22
|
-
const Regions = yield this._list(
|
22
|
+
const Regions = yield this._list({ filter });
|
23
23
|
return Regions;
|
24
24
|
});
|
25
25
|
}
|
26
|
-
tabulate(
|
26
|
+
tabulate(filter = {}) {
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
28
|
-
return yield this._tabulate(
|
28
|
+
return yield this._tabulate({ filter });
|
29
29
|
});
|
30
30
|
}
|
31
31
|
create(name, hierarchy) {
|
@@ -50,4 +50,3 @@ class RegionRepository extends base_1.BaseRepository {
|
|
50
50
|
}
|
51
51
|
exports.RegionRepository = RegionRepository;
|
52
52
|
RegionRepository.prefix = 'regions/';
|
53
|
-
RegionRepository.enumerationMethod = 'PATCH';
|
package/dist/cjs/data/run.js
CHANGED
@@ -13,17 +13,14 @@ exports.RunRepository = void 0;
|
|
13
13
|
const base_1 = require("./base");
|
14
14
|
const exceptions_1 = require("../core/exceptions");
|
15
15
|
class RunRepository extends base_1.BaseRepository {
|
16
|
-
|
17
|
-
super(client, RunRepository.prefix, RunRepository.enumerationMethod);
|
18
|
-
}
|
19
|
-
list(f = {}) {
|
16
|
+
list(filter = {}) {
|
20
17
|
return __awaiter(this, void 0, void 0, function* () {
|
21
|
-
return yield this._list(
|
18
|
+
return yield this._list({ filter });
|
22
19
|
});
|
23
20
|
}
|
24
|
-
tabulate(
|
21
|
+
tabulate(filter = {}) {
|
25
22
|
return __awaiter(this, void 0, void 0, function* () {
|
26
|
-
return yield this._tabulate(
|
23
|
+
return yield this._tabulate({ filter });
|
27
24
|
});
|
28
25
|
}
|
29
26
|
create(modelName, scenarioName) {
|
@@ -53,7 +50,7 @@ class RunRepository extends base_1.BaseRepository {
|
|
53
50
|
scenario: { name: scenarioName },
|
54
51
|
isDefault: true,
|
55
52
|
};
|
56
|
-
const list = yield this._list(filter);
|
53
|
+
const list = yield this._list({ filter });
|
57
54
|
if (list.length !== 1) {
|
58
55
|
throw new exceptions_1.NotFound({ message: 'Run has no default version.' });
|
59
56
|
}
|
@@ -73,4 +70,3 @@ class RunRepository extends base_1.BaseRepository {
|
|
73
70
|
}
|
74
71
|
exports.RunRepository = RunRepository;
|
75
72
|
RunRepository.prefix = 'runs/';
|
76
|
-
RunRepository.enumerationMethod = 'PATCH';
|