@iiasa/ixmp4-ts 0.5.0 → 0.7.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/dist/cjs/backend.js +7 -4
- package/dist/cjs/core/exceptions.js +2 -2
- package/dist/cjs/core/iamc/data.js +56 -34
- package/dist/cjs/core/iamc/variable.js +10 -0
- package/dist/cjs/core/meta.js +15 -5
- package/dist/cjs/core/model.js +13 -2
- package/dist/cjs/core/region.js +13 -2
- package/dist/cjs/core/run.js +17 -6
- package/dist/cjs/core/scenario.js +15 -2
- package/dist/cjs/core/unit.js +12 -2
- package/dist/cjs/core/utils.js +207 -54
- package/dist/cjs/data/base.js +29 -7
- package/dist/cjs/data/docs.js +2 -2
- package/dist/cjs/data/iamc/datapoint.js +18 -11
- package/dist/cjs/data/iamc/timeseries.js +12 -12
- package/dist/cjs/data/iamc/variable.js +9 -4
- package/dist/cjs/data/meta.js +9 -4
- package/dist/cjs/data/model.js +9 -4
- package/dist/cjs/data/region.js +9 -4
- package/dist/cjs/data/run.js +9 -4
- package/dist/cjs/data/scenario.js +9 -4
- package/dist/cjs/data/unit.js +9 -4
- package/dist/cjs/data/utils.js +4 -5
- package/dist/cjs/dataframe/dataframe.js +1 -5
- package/dist/cjs/dataframe/utils.js +4 -5
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/esm/backend.js +7 -4
- package/dist/esm/core/iamc/data.js +50 -30
- package/dist/esm/core/iamc/variable.js +8 -0
- package/dist/esm/core/meta.js +8 -0
- package/dist/esm/core/model.js +11 -2
- package/dist/esm/core/region.js +11 -2
- package/dist/esm/core/run.js +11 -2
- package/dist/esm/core/scenario.js +13 -2
- package/dist/esm/core/unit.js +11 -3
- package/dist/esm/core/utils.js +196 -50
- package/dist/esm/data/base.js +20 -0
- package/dist/esm/data/docs.js +2 -2
- package/dist/esm/data/iamc/datapoint.js +5 -0
- package/dist/esm/data/iamc/variable.js +3 -0
- package/dist/esm/data/meta.js +3 -0
- package/dist/esm/data/model.js +3 -0
- package/dist/esm/data/region.js +3 -0
- package/dist/esm/data/run.js +3 -0
- package/dist/esm/data/scenario.js +3 -0
- package/dist/esm/data/unit.js +3 -0
- package/dist/esm/dataframe/dataframe.js +1 -5
- package/dist/esm/index.js +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/types/core/iamc/data.d.ts +33 -5
- package/dist/types/core/iamc/variable.d.ts +6 -0
- package/dist/types/core/meta.d.ts +6 -0
- package/dist/types/core/model.d.ts +9 -2
- package/dist/types/core/region.d.ts +7 -1
- package/dist/types/core/run.d.ts +7 -1
- package/dist/types/core/scenario.d.ts +7 -1
- package/dist/types/core/unit.d.ts +7 -1
- package/dist/types/core/utils.d.ts +43 -1
- package/dist/types/data/base.d.ts +4 -0
- package/dist/types/data/iamc/datapoint.d.ts +1 -0
- package/dist/types/data/iamc/variable.d.ts +1 -0
- package/dist/types/data/meta.d.ts +1 -0
- package/dist/types/data/model.d.ts +1 -0
- package/dist/types/data/region.d.ts +1 -0
- package/dist/types/data/run.d.ts +1 -0
- package/dist/types/data/scenario.d.ts +1 -0
- package/dist/types/data/unit.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/package.json +4 -5
package/dist/cjs/core/utils.js
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.substitudeType = substitudeType;
|
4
|
+
exports.unitToDimensionless = unitToDimensionless;
|
5
|
+
exports.dfToDimensionless = dfToDimensionless;
|
6
|
+
exports.standardizeIamcDf = standardizeIamcDf;
|
7
|
+
exports.toIamcWide = toIamcWide;
|
8
|
+
exports.withIamcDefault = withIamcDefault;
|
9
|
+
exports.getIamcRowIndex = getIamcRowIndex;
|
10
|
+
exports.sortTimesWithYearFirst = sortTimesWithYearFirst;
|
11
|
+
exports.splitDataFrameByType = splitDataFrameByType;
|
4
12
|
const dataframe_1 = require("../dataframe");
|
5
13
|
const datapoint_1 = require("../data/iamc/datapoint");
|
6
14
|
function substitudeType(df, type) {
|
@@ -23,91 +31,236 @@ function substitudeType(df, type) {
|
|
23
31
|
}
|
24
32
|
return df;
|
25
33
|
}
|
26
|
-
exports.substitudeType = substitudeType;
|
27
34
|
function unitToDimensionless(name) {
|
28
35
|
if (name === 'dimensionless') {
|
29
36
|
throw new Error("Unit name 'dimensionless' is reserved, use an empty string '' instead.");
|
30
37
|
}
|
31
38
|
return name === '' ? 'dimensionless' : name;
|
32
39
|
}
|
33
|
-
exports.unitToDimensionless = unitToDimensionless;
|
34
40
|
function dfToDimensionless(df) {
|
35
41
|
if (df
|
36
42
|
.loc({ columns: ['unit'] })
|
37
|
-
.values.map(
|
43
|
+
.values.map(String)
|
38
44
|
.includes('dimensionless')) {
|
39
45
|
throw new Error("Unit name 'dimensionless' is reserved, use an empty string '' instead.");
|
40
46
|
}
|
41
47
|
df.replaceValue('', 'dimensionless', 'unit');
|
42
48
|
return df;
|
43
49
|
}
|
44
|
-
|
50
|
+
/**
|
51
|
+
* Standardizes the columns of a DataFrame in IAMC format.
|
52
|
+
* @param df DataFrame in IAMC format
|
53
|
+
* @returns DataFrame in IAMC format with standardized columns
|
54
|
+
*/
|
55
|
+
function standardizeIamcDf(df) {
|
56
|
+
if (df.columns.includes('time_series__id')) {
|
57
|
+
df = df.dropColumns(['time_series__id']);
|
58
|
+
}
|
59
|
+
if (df.columns.includes('unit')) {
|
60
|
+
df = df.replaceValue('dimensionless', ' ', 'unit');
|
61
|
+
}
|
62
|
+
// Rename step_category to subannual
|
63
|
+
if (df.columns.includes('step_category')) {
|
64
|
+
df = df.renameColumns({ step_category: 'subannual' });
|
65
|
+
}
|
66
|
+
return df;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Converts a DataFrame in IAMC long format to wide format.
|
70
|
+
* @param df The DataFrame to convert
|
71
|
+
* @returns A DataFrame in IAMC wide format
|
72
|
+
*/
|
45
73
|
function toIamcWide(df) {
|
46
|
-
//
|
74
|
+
// empty df: drop long-format columns if present
|
47
75
|
if (df.shape[0] === 0) {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
const
|
63
|
-
|
64
|
-
|
65
|
-
const
|
66
|
-
|
76
|
+
const longCols = [
|
77
|
+
'step_year',
|
78
|
+
'step_datetime',
|
79
|
+
'step_category',
|
80
|
+
'subannual',
|
81
|
+
'value',
|
82
|
+
];
|
83
|
+
const toDrop = longCols.filter((c) => df.columns.includes(c));
|
84
|
+
return toDrop.length ? df.dropColumns(toDrop) : df;
|
85
|
+
}
|
86
|
+
// column index map
|
87
|
+
const colIdx = Object.fromEntries(df.columns.map((c, i) => [c, i]));
|
88
|
+
// collect unique, non-null times
|
89
|
+
const uniqueNonNull = (arr) => [...new Set(arr.filter((v) => v !== null && v !== undefined))];
|
90
|
+
const years = df.columns.includes('step_year')
|
91
|
+
? uniqueNonNull(df.columnValues('step_year')).sort((a, b) => a - b)
|
92
|
+
: [];
|
93
|
+
const datetimes = df.columns.includes('step_datetime')
|
94
|
+
? uniqueNonNull(df.columnValues('step_datetime')).sort()
|
95
|
+
: [];
|
96
|
+
const allTimes = sortTimesWithYearFirst(years, datetimes);
|
97
|
+
// indices to carry over (everything but time and value)
|
98
|
+
const takeOverIdx = df.columns
|
67
99
|
.map((_, i) => i)
|
68
|
-
.filter((i) =>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
const
|
76
|
-
|
77
|
-
|
100
|
+
.filter((i) => {
|
101
|
+
var _a, _b, _c;
|
102
|
+
return i !== ((_a = colIdx['step_year']) !== null && _a !== void 0 ? _a : -1) &&
|
103
|
+
i !== ((_b = colIdx['step_datetime']) !== null && _b !== void 0 ? _b : -1) &&
|
104
|
+
i !== ((_c = colIdx['value']) !== null && _c !== void 0 ? _c : -1);
|
105
|
+
});
|
106
|
+
// base schema (carry-over columns + dtypes)
|
107
|
+
const columns = takeOverIdx.map((i) => df.columns[i]);
|
108
|
+
const dtypes = takeOverIdx.map((i) => df.dtypes[i]);
|
109
|
+
// add time columns
|
110
|
+
const yearColIdx = new Map();
|
111
|
+
const dtColIdx = new Map();
|
112
|
+
for (const time of allTimes) {
|
113
|
+
columns.push(String(time));
|
78
114
|
dtypes.push(dataframe_1.DType.FLOAT32);
|
79
|
-
|
115
|
+
const newIdx = columns.length - 1;
|
116
|
+
if (typeof time === 'number')
|
117
|
+
yearColIdx.set(time, newIdx);
|
118
|
+
else
|
119
|
+
dtColIdx.set(time, newIdx);
|
80
120
|
}
|
81
|
-
|
121
|
+
// row identifiers: prefer step_category, fall back to subannual if present
|
122
|
+
const stepCategoryCol = df.columns.includes('step_category')
|
123
|
+
? 'step_category'
|
124
|
+
: df.columns.includes('subannual')
|
125
|
+
? 'subannual'
|
126
|
+
: undefined;
|
127
|
+
const idCols = [
|
82
128
|
'model',
|
83
129
|
'scenario',
|
84
130
|
'version',
|
85
131
|
'region',
|
86
132
|
'variable',
|
87
133
|
'unit',
|
88
|
-
|
134
|
+
'type',
|
135
|
+
stepCategoryCol,
|
136
|
+
].filter(Boolean);
|
137
|
+
const idIdxs = idCols.map((c) => colIdx[c]);
|
138
|
+
// data mapping
|
89
139
|
const dataMap = new Map();
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
140
|
+
const yearIdx = colIdx['step_year'];
|
141
|
+
const dtIdx = colIdx['step_datetime'];
|
142
|
+
const valueIdx = colIdx['value'];
|
143
|
+
for (const dfRow of df.values) {
|
144
|
+
const key = getIamcRowIndex(dfRow, idIdxs);
|
145
|
+
let wideRow = dataMap.get(key);
|
146
|
+
if (!wideRow) {
|
147
|
+
wideRow = takeOverIdx
|
148
|
+
.map((i) => dfRow[i])
|
149
|
+
.concat(Array(allTimes.length).fill(null));
|
150
|
+
dataMap.set(key, wideRow);
|
95
151
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
152
|
+
const year = yearIdx !== undefined ? dfRow[yearIdx] : undefined;
|
153
|
+
const dt = dtIdx !== undefined ? dfRow[dtIdx] : undefined;
|
154
|
+
let targetIdx;
|
155
|
+
if (year !== undefined && year !== null)
|
156
|
+
targetIdx = yearColIdx.get(year);
|
157
|
+
else if (dt !== undefined && dt !== null)
|
158
|
+
targetIdx = dtColIdx.get(dt);
|
159
|
+
if (targetIdx !== undefined) {
|
160
|
+
wideRow[targetIdx] = dfRow[valueIdx];
|
102
161
|
}
|
103
162
|
}
|
104
|
-
const wideIamcData =
|
105
|
-
for (const wideRow of dataMap.values()) {
|
106
|
-
wideIamcData.push(wideRow);
|
107
|
-
}
|
163
|
+
const wideIamcData = Array.from(dataMap.values());
|
108
164
|
return new dataframe_1.DataFrame(wideIamcData, { columns, dtypes });
|
109
165
|
}
|
110
|
-
|
166
|
+
/**
|
167
|
+
* Generates a unique row index for IAMC data based on the row's identifiers.
|
168
|
+
* @param row The row data as an array
|
169
|
+
* @param rowIdentifiers The indices of the identifiers in the row
|
170
|
+
* @returns A string that uniquely identifies the row
|
171
|
+
*/
|
111
172
|
function getIamcRowIndex(row, rowIdentifiers) {
|
112
173
|
return rowIdentifiers.map((i) => row[i]).join('_');
|
113
174
|
}
|
175
|
+
/**
|
176
|
+
* Processes the filter to ensure that IAMC filter is enabled by default unless explicitly disabled.
|
177
|
+
* When enabled, only entities with associated datapoints are returned.
|
178
|
+
* @param filter The filter to process
|
179
|
+
* @returns The processed filter with IAMC default settings
|
180
|
+
*/
|
181
|
+
function withIamcDefault(filter) {
|
182
|
+
if (!filter) {
|
183
|
+
return { iamc: true };
|
184
|
+
}
|
185
|
+
else if (filter.iamc === undefined) {
|
186
|
+
// If the IAMC filter is not explicitly set, default to true
|
187
|
+
filter.iamc = true;
|
188
|
+
}
|
189
|
+
else if (filter.iamc === null) {
|
190
|
+
// If the IAMC filter is explicitly set to null, leave it as is
|
191
|
+
return filter;
|
192
|
+
}
|
193
|
+
return filter;
|
194
|
+
}
|
195
|
+
function sortTimesWithYearFirst(years, dateTimes) {
|
196
|
+
// Create a combined array with type information
|
197
|
+
const combined = [];
|
198
|
+
// Add years with their metadata
|
199
|
+
for (const year of years) {
|
200
|
+
combined.push({ value: year, isYear: true, year });
|
201
|
+
}
|
202
|
+
// Add datetimes with their extracted year
|
203
|
+
for (const dateTime of dateTimes) {
|
204
|
+
// Extract year from datetime string (format: 2005-03-01T01:00:00)
|
205
|
+
const year = parseInt(dateTime.substring(0, 4), 10);
|
206
|
+
combined.push({ value: dateTime, isYear: false, year });
|
207
|
+
}
|
208
|
+
// Sort by year first, then by type (years before datetimes), then by value
|
209
|
+
combined.sort((a, b) => {
|
210
|
+
// First sort by year
|
211
|
+
if (a.year !== b.year) {
|
212
|
+
return a.year - b.year;
|
213
|
+
}
|
214
|
+
// Within the same year, years come before datetimes
|
215
|
+
if (a.isYear && !b.isYear) {
|
216
|
+
return -1;
|
217
|
+
}
|
218
|
+
if (!a.isYear && b.isYear) {
|
219
|
+
return 1;
|
220
|
+
}
|
221
|
+
// If both are the same type, sort by value
|
222
|
+
if (a.value < b.value) {
|
223
|
+
return -1;
|
224
|
+
}
|
225
|
+
if (a.value > b.value) {
|
226
|
+
return 1;
|
227
|
+
}
|
228
|
+
return 0;
|
229
|
+
});
|
230
|
+
// Return just the values
|
231
|
+
return combined.map((item) => item.value);
|
232
|
+
}
|
233
|
+
/**
|
234
|
+
* Splits a DataFrame into separate DataFrames based on DataPointType.
|
235
|
+
* @param df The DataFrame to split
|
236
|
+
* @returns An object containing DataFrames for each type present in the data
|
237
|
+
*/
|
238
|
+
function splitDataFrameByType(df) {
|
239
|
+
const result = {};
|
240
|
+
// If no type column exists, return the original dataframe as annual
|
241
|
+
if (!df.columns.includes('type')) {
|
242
|
+
result.annual = df;
|
243
|
+
return result;
|
244
|
+
}
|
245
|
+
// Get unique types in the dataframe
|
246
|
+
const typeValues = df.columnValues('type');
|
247
|
+
const uniqueTypes = [...new Set(typeValues)];
|
248
|
+
// Filter dataframe for each type present
|
249
|
+
for (const type of uniqueTypes) {
|
250
|
+
const filteredDf = df.query({
|
251
|
+
conditions: { column: 'type', predicate: (value) => value === type },
|
252
|
+
});
|
253
|
+
switch (type) {
|
254
|
+
case datapoint_1.DataPointType.ANNUAL:
|
255
|
+
result.annual = filteredDf;
|
256
|
+
break;
|
257
|
+
case datapoint_1.DataPointType.CATEGORICAL:
|
258
|
+
result.categorical = filteredDf;
|
259
|
+
break;
|
260
|
+
case datapoint_1.DataPointType.DATETIME:
|
261
|
+
result.datetime = filteredDf;
|
262
|
+
break;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
return result;
|
266
|
+
}
|
package/dist/cjs/data/base.js
CHANGED
@@ -26,8 +26,8 @@ class BaseRepository {
|
|
26
26
|
this.enumerationMethod = (_a = this.constructor.enumerationMethod) !== null && _a !== void 0 ? _a : 'PATCH';
|
27
27
|
}
|
28
28
|
_request(url, method, params, body) {
|
29
|
-
var _a;
|
30
29
|
return __awaiter(this, void 0, void 0, function* () {
|
30
|
+
var _a;
|
31
31
|
const config = {};
|
32
32
|
config.url = url;
|
33
33
|
config.method = method;
|
@@ -80,8 +80,8 @@ class BaseRepository {
|
|
80
80
|
/**
|
81
81
|
* Convenience method for requests to the enumeration endpoint.
|
82
82
|
*/
|
83
|
-
_requestEnumeration(
|
84
|
-
return __awaiter(this,
|
83
|
+
_requestEnumeration() {
|
84
|
+
return __awaiter(this, arguments, void 0, function* (params = {}, body = {}, table = false) {
|
85
85
|
params = (0, utils_1.convertToSnakeCase)(params);
|
86
86
|
if (body !== undefined && Object.keys(body).length === 0) {
|
87
87
|
body = undefined;
|
@@ -116,8 +116,12 @@ class BaseRepository {
|
|
116
116
|
}
|
117
117
|
});
|
118
118
|
}
|
119
|
-
_list(
|
120
|
-
return __awaiter(this,
|
119
|
+
_list(_a) {
|
120
|
+
return __awaiter(this, arguments, void 0, function* ({ filter, params, }) {
|
121
|
+
if (this.enumerationMethod === 'GET') {
|
122
|
+
params = Object.assign(Object.assign({}, params), filter);
|
123
|
+
filter = undefined;
|
124
|
+
}
|
121
125
|
const data = yield this._requestEnumeration(params, filter, false);
|
122
126
|
const pagination = data.pagination;
|
123
127
|
if (pagination !== undefined) {
|
@@ -129,8 +133,8 @@ class BaseRepository {
|
|
129
133
|
}
|
130
134
|
});
|
131
135
|
}
|
132
|
-
_tabulate(
|
133
|
-
return __awaiter(this,
|
136
|
+
_tabulate(_a) {
|
137
|
+
return __awaiter(this, arguments, void 0, function* ({ filter, params, }) {
|
134
138
|
// TODO: test what happens if we get a number that cannot be represented as float32 (or int32)
|
135
139
|
const data = yield this._requestEnumeration(params, filter, true);
|
136
140
|
const pagination = data.pagination;
|
@@ -152,6 +156,24 @@ class BaseRepository {
|
|
152
156
|
}
|
153
157
|
});
|
154
158
|
}
|
159
|
+
_count(_a) {
|
160
|
+
return __awaiter(this, arguments, void 0, function* ({ filter, params, }) {
|
161
|
+
if (this.enumerationMethod === 'GET') {
|
162
|
+
params = Object.assign(Object.assign(Object.assign({}, params), filter), { limit: 0 });
|
163
|
+
filter = undefined;
|
164
|
+
}
|
165
|
+
else {
|
166
|
+
params = Object.assign(Object.assign({}, params), { limit: 0 });
|
167
|
+
}
|
168
|
+
const data = yield this._requestEnumeration(params, filter, true);
|
169
|
+
if (data === undefined || data.total === undefined) {
|
170
|
+
throw new exceptions_1.UnknownApiError({
|
171
|
+
message: 'Count result does not contain total count.',
|
172
|
+
});
|
173
|
+
}
|
174
|
+
return data.total;
|
175
|
+
});
|
176
|
+
}
|
155
177
|
_bulkUpsert(df, params) {
|
156
178
|
return __awaiter(this, void 0, void 0, function* () {
|
157
179
|
return yield this._request(`${this.prefix}bulk/`, 'POST', params, (0, utils_1.dfToJson)(df));
|
package/dist/cjs/data/docs.js
CHANGED
@@ -14,7 +14,7 @@ const base_1 = require("./base");
|
|
14
14
|
class DocsRepository extends base_1.BaseRepository {
|
15
15
|
get(dimensionId) {
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
17
|
-
return yield this._get({
|
17
|
+
return yield this._get({ dimensionId });
|
18
18
|
});
|
19
19
|
}
|
20
20
|
set(dimensionId, description) {
|
@@ -27,7 +27,7 @@ class DocsRepository extends base_1.BaseRepository {
|
|
27
27
|
}
|
28
28
|
list(dimensionId) {
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
30
|
-
return yield this._list({ filter: {
|
30
|
+
return yield this._list({ filter: { dimensionId } });
|
31
31
|
});
|
32
32
|
}
|
33
33
|
delete(dimensionId) {
|
@@ -18,23 +18,23 @@ var DataPointType;
|
|
18
18
|
DataPointType["DATETIME"] = "DATETIME";
|
19
19
|
})(DataPointType || (exports.DataPointType = DataPointType = {}));
|
20
20
|
class DataPointRepository extends base_1.BaseRepository {
|
21
|
-
list(
|
22
|
-
joinParameters
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
list() {
|
22
|
+
return __awaiter(this, arguments, void 0, function* ({ joinParameters = false, filter = {}, } = {
|
23
|
+
joinParameters: false,
|
24
|
+
filter: {},
|
25
|
+
}) {
|
26
26
|
return (yield this._list({
|
27
27
|
filter,
|
28
28
|
params: { joinParameters },
|
29
29
|
}));
|
30
30
|
});
|
31
31
|
}
|
32
|
-
tabulate(
|
33
|
-
joinParameters
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
tabulate() {
|
33
|
+
return __awaiter(this, arguments, void 0, function* ({ joinParameters = false, joinRuns = false, filter = {}, } = {
|
34
|
+
joinParameters: false,
|
35
|
+
joinRuns: false,
|
36
|
+
filter: {},
|
37
|
+
}) {
|
38
38
|
return yield this._tabulate({
|
39
39
|
filter,
|
40
40
|
params: {
|
@@ -44,6 +44,13 @@ class DataPointRepository extends base_1.BaseRepository {
|
|
44
44
|
});
|
45
45
|
});
|
46
46
|
}
|
47
|
+
count() {
|
48
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
49
|
+
return yield this._count({
|
50
|
+
filter,
|
51
|
+
});
|
52
|
+
});
|
53
|
+
}
|
47
54
|
bulkUpsert(df) {
|
48
55
|
return __awaiter(this, void 0, void 0, function* () {
|
49
56
|
yield this._bulkUpsert(df);
|
@@ -49,30 +49,30 @@ class TimeSeriesRepository extends base_1.BaseRepository {
|
|
49
49
|
}
|
50
50
|
});
|
51
51
|
}
|
52
|
-
list(
|
53
|
-
joinParameters
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
list() {
|
53
|
+
return __awaiter(this, arguments, void 0, function* ({ joinParameters = false, filter = {}, } = {
|
54
|
+
joinParameters: false,
|
55
|
+
filter: {},
|
56
|
+
}) {
|
57
57
|
return (yield this._list({
|
58
58
|
filter,
|
59
59
|
params: { joinParameters },
|
60
60
|
}));
|
61
61
|
});
|
62
62
|
}
|
63
|
-
tabulate(
|
64
|
-
joinParameters
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
tabulate() {
|
64
|
+
return __awaiter(this, arguments, void 0, function* ({ joinParameters = false, filter = {}, } = {
|
65
|
+
joinParameters: false,
|
66
|
+
filter: {},
|
67
|
+
}) {
|
68
68
|
return yield this._tabulate({
|
69
69
|
filter,
|
70
70
|
params: { joinParameters },
|
71
71
|
});
|
72
72
|
});
|
73
73
|
}
|
74
|
-
bulkUpsert(
|
75
|
-
return __awaiter(this,
|
74
|
+
bulkUpsert(df_1) {
|
75
|
+
return __awaiter(this, arguments, void 0, function* (df, createRelated = false) {
|
76
76
|
yield this._bulkUpsert(df, { create_related: createRelated });
|
77
77
|
});
|
78
78
|
}
|
@@ -17,16 +17,21 @@ class VariableRepository extends base_1.BaseRepository {
|
|
17
17
|
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/iamc/variables/');
|
19
19
|
}
|
20
|
-
list(
|
21
|
-
return __awaiter(this,
|
20
|
+
list() {
|
21
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
22
22
|
return yield this._list({ filter });
|
23
23
|
});
|
24
24
|
}
|
25
|
-
tabulate(
|
26
|
-
return __awaiter(this,
|
25
|
+
tabulate() {
|
26
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
27
27
|
return yield this._tabulate({ filter });
|
28
28
|
});
|
29
29
|
}
|
30
|
+
count() {
|
31
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
32
|
+
return yield this._count({ filter });
|
33
|
+
});
|
34
|
+
}
|
30
35
|
create(name) {
|
31
36
|
return __awaiter(this, void 0, void 0, function* () {
|
32
37
|
return yield this._post({ name });
|
package/dist/cjs/data/meta.js
CHANGED
@@ -19,16 +19,21 @@ var MetaIndicatorType;
|
|
19
19
|
MetaIndicatorType["BOOL"] = "BOOL";
|
20
20
|
})(MetaIndicatorType || (MetaIndicatorType = {}));
|
21
21
|
class MetaIndicatorRepository extends base_1.BaseRepository {
|
22
|
-
list(
|
23
|
-
return __awaiter(this,
|
22
|
+
list() {
|
23
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
24
24
|
return yield this._list(filter);
|
25
25
|
});
|
26
26
|
}
|
27
|
-
tabulate(
|
28
|
-
return __awaiter(this,
|
27
|
+
tabulate() {
|
28
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}, joinRunIndex) {
|
29
29
|
return yield this._tabulate({ filter, params: { joinRunIndex } });
|
30
30
|
});
|
31
31
|
}
|
32
|
+
count() {
|
33
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
34
|
+
return yield this._count({ filter });
|
35
|
+
});
|
36
|
+
}
|
32
37
|
create(run__id, key, value) {
|
33
38
|
return __awaiter(this, void 0, void 0, function* () {
|
34
39
|
const res = yield this._post({
|
package/dist/cjs/data/model.js
CHANGED
@@ -17,16 +17,21 @@ class ModelRepository extends base_1.BaseRepository {
|
|
17
17
|
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/models/');
|
19
19
|
}
|
20
|
-
list(
|
21
|
-
return __awaiter(this,
|
20
|
+
list() {
|
21
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
22
22
|
return yield this._list({ filter });
|
23
23
|
});
|
24
24
|
}
|
25
|
-
tabulate(
|
26
|
-
return __awaiter(this,
|
25
|
+
tabulate() {
|
26
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
27
27
|
return yield this._tabulate({ filter });
|
28
28
|
});
|
29
29
|
}
|
30
|
+
count() {
|
31
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
32
|
+
return yield this._count({ filter });
|
33
|
+
});
|
34
|
+
}
|
30
35
|
create(name) {
|
31
36
|
return __awaiter(this, void 0, void 0, function* () {
|
32
37
|
const res = yield this._post({ name });
|
package/dist/cjs/data/region.js
CHANGED
@@ -17,17 +17,22 @@ class RegionRepository extends base_1.BaseRepository {
|
|
17
17
|
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/regions/');
|
19
19
|
}
|
20
|
-
list(
|
21
|
-
return __awaiter(this,
|
20
|
+
list() {
|
21
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
22
22
|
const Regions = yield this._list({ filter });
|
23
23
|
return Regions;
|
24
24
|
});
|
25
25
|
}
|
26
|
-
tabulate(
|
27
|
-
return __awaiter(this,
|
26
|
+
tabulate() {
|
27
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
28
28
|
return yield this._tabulate({ filter });
|
29
29
|
});
|
30
30
|
}
|
31
|
+
count() {
|
32
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
33
|
+
return yield this._count({ filter });
|
34
|
+
});
|
35
|
+
}
|
31
36
|
create(name, hierarchy) {
|
32
37
|
return __awaiter(this, void 0, void 0, function* () {
|
33
38
|
const res = yield this._post({
|
package/dist/cjs/data/run.js
CHANGED
@@ -13,16 +13,21 @@ 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
|
-
list(
|
17
|
-
return __awaiter(this,
|
16
|
+
list() {
|
17
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
18
18
|
return yield this._list({ filter });
|
19
19
|
});
|
20
20
|
}
|
21
|
-
tabulate(
|
22
|
-
return __awaiter(this,
|
21
|
+
tabulate() {
|
22
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
23
23
|
return yield this._tabulate({ filter });
|
24
24
|
});
|
25
25
|
}
|
26
|
+
count() {
|
27
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
28
|
+
return yield this._count({ filter });
|
29
|
+
});
|
30
|
+
}
|
26
31
|
create(modelName, scenarioName) {
|
27
32
|
return __awaiter(this, void 0, void 0, function* () {
|
28
33
|
const res = yield this._post({
|
@@ -17,16 +17,21 @@ class ScenarioRepository extends base_1.BaseRepository {
|
|
17
17
|
super(client);
|
18
18
|
this.docs = new docs_1.DocsRepository(client, 'docs/scenarios/');
|
19
19
|
}
|
20
|
-
list(
|
21
|
-
return __awaiter(this,
|
20
|
+
list() {
|
21
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
22
22
|
return (yield this._list({ filter }));
|
23
23
|
});
|
24
24
|
}
|
25
|
-
tabulate(
|
26
|
-
return __awaiter(this,
|
25
|
+
tabulate() {
|
26
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
27
27
|
return yield this._tabulate({ filter });
|
28
28
|
});
|
29
29
|
}
|
30
|
+
count() {
|
31
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
32
|
+
return yield this._count({ filter });
|
33
|
+
});
|
34
|
+
}
|
30
35
|
create(name) {
|
31
36
|
return __awaiter(this, void 0, void 0, function* () {
|
32
37
|
return (yield this._post({ name }));
|