@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/backend.js
CHANGED
@@ -70,23 +70,26 @@ class Backend {
|
|
70
70
|
client.interceptors.response.use((value) => {
|
71
71
|
return value;
|
72
72
|
}, (err) => __awaiter(this, void 0, void 0, function* () {
|
73
|
-
|
73
|
+
const originalRequest = err.config;
|
74
|
+
if (!originalRequest._retry &&
|
75
|
+
err.response &&
|
74
76
|
((err.response.status === 401 &&
|
75
77
|
err.response.data.error_name === 'invalid_token') ||
|
76
78
|
(err.response.status === 403 &&
|
77
79
|
err.response.data.error_name === 'forbidden' &&
|
78
80
|
auth.accessToken === null))) {
|
81
|
+
originalRequest._retry = true;
|
79
82
|
return yield auth
|
80
83
|
.refreshOrObtainAccessToken()
|
81
84
|
.then(() => {
|
82
85
|
return client.request(err.config);
|
83
86
|
})
|
84
|
-
.catch(() => {
|
85
|
-
|
87
|
+
.catch((error) => {
|
88
|
+
return Promise.reject(error);
|
86
89
|
});
|
87
90
|
}
|
88
91
|
else {
|
89
|
-
|
92
|
+
return Promise.reject(err);
|
90
93
|
}
|
91
94
|
}));
|
92
95
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InvalidCredentials = exports.BadFilterArguments = exports.InvalidRunMeta = exports.NoDefaultRunVersion = exports.SchemaError = exports.OperationNotSupported = exports.DeletionPrevented = exports.NotUnique = exports.NotFound = exports.Forbidden = exports.InvalidToken = exports.MissingToken = exports.PlatformNotUnique = exports.PlatformNotFound = exports.UnknownApiError = exports.ManagerApiError = exports.ImproperlyConfigured = exports.BadRequest = exports.InconsistentIamcType = exports.ProgrammingError = exports.IxmpError =
|
3
|
+
exports.InvalidCredentials = exports.BadFilterArguments = exports.InvalidRunMeta = exports.NoDefaultRunVersion = exports.SchemaError = exports.OperationNotSupported = exports.DeletionPrevented = exports.NotUnique = exports.NotFound = exports.Forbidden = exports.InvalidToken = exports.MissingToken = exports.PlatformNotUnique = exports.PlatformNotFound = exports.UnknownApiError = exports.ManagerApiError = exports.ImproperlyConfigured = exports.BadRequest = exports.InconsistentIamcType = exports.ProgrammingError = exports.IxmpError = void 0;
|
4
|
+
exports.createError = createError;
|
4
5
|
class ProgrammingError extends Error {
|
5
6
|
}
|
6
7
|
exports.ProgrammingError = ProgrammingError;
|
@@ -210,7 +211,6 @@ function createError(options) {
|
|
210
211
|
return new ImproperlyConfigured(Object.assign({ message: 'Could not find remote exception in registry. Are you sure client and server ixmp versions are compatible?' }, options));
|
211
212
|
}
|
212
213
|
}
|
213
|
-
exports.createError = createError;
|
214
214
|
// Register all error classes
|
215
215
|
registerError(InconsistentIamcType);
|
216
216
|
registerError(BadRequest);
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.PlatformIamcData = exports.RunIamcData = void 0;
|
24
24
|
const dataframe_1 = require("../../dataframe");
|
25
25
|
const base_1 = require("../base");
|
26
|
+
const datapoint_1 = require("../../data/iamc/datapoint");
|
26
27
|
const utils_1 = require("../utils");
|
27
28
|
const variable_1 = require("./variable");
|
28
29
|
/**
|
@@ -70,18 +71,12 @@ class RunIamcData extends base_1.BaseFacade {
|
|
70
71
|
yield this.backend.iamc.datapoints.bulkDelete(df);
|
71
72
|
});
|
72
73
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
*/
|
80
|
-
tabulate(_a = {
|
81
|
-
wide: false,
|
82
|
-
}) {
|
83
|
-
var { wide = false } = _a, filter = __rest(_a, ["wide"]);
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
74
|
+
tabulate() {
|
75
|
+
return __awaiter(this, arguments, void 0, function* (_a = {
|
76
|
+
wide: false,
|
77
|
+
splitByType: false,
|
78
|
+
}) {
|
79
|
+
var { wide = false, splitByType = false } = _a, filter = __rest(_a, ["wide", "splitByType"]);
|
85
80
|
if (filter !== undefined && filter !== null) {
|
86
81
|
// these filters do not make sense when applied from a Run
|
87
82
|
const illegalFilter = Object.keys(filter).filter((key) => {
|
@@ -91,7 +86,9 @@ class RunIamcData extends base_1.BaseFacade {
|
|
91
86
|
throw new Error(`Illegal filter for 'iamc.tabulate()': ${illegalFilter}`);
|
92
87
|
}
|
93
88
|
}
|
94
|
-
|
89
|
+
const df = yield this.repository.tabulate(Object.assign(Object.assign({}, filter), { run: { id: this.run.id, defaultOnly: false }, joinRuns: false, wide,
|
90
|
+
splitByType }));
|
91
|
+
return df;
|
95
92
|
});
|
96
93
|
}
|
97
94
|
contractParameters(df) {
|
@@ -135,19 +132,9 @@ class PlatformIamcData extends base_1.BaseFacade {
|
|
135
132
|
super(backend);
|
136
133
|
this.variables = new variable_1.VariableRepository(this.backend);
|
137
134
|
}
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
* @param joinRuns Optional. Whether to join runs or not, defaults to true.
|
142
|
-
* @param wide Optional. Whether to return the data in IAMC wide format or not, defaults to false.
|
143
|
-
* @returns A Promise that resolves to a DataFrame containing the tabulated data.
|
144
|
-
*/
|
145
|
-
tabulate(_a = {
|
146
|
-
joinRuns: true,
|
147
|
-
wide: false,
|
148
|
-
}) {
|
149
|
-
var { joinRuns = true, wide = false } = _a, filter = __rest(_a, ["joinRuns", "wide"]);
|
150
|
-
return __awaiter(this, void 0, void 0, function* () {
|
135
|
+
tabulate() {
|
136
|
+
return __awaiter(this, arguments, void 0, function* (_a = { joinRuns: true, wide: false, splitByType: false }) {
|
137
|
+
var { joinRuns = true, wide = false, splitByType = false } = _a, filter = __rest(_a, ["joinRuns", "wide", "splitByType"]);
|
151
138
|
if (filter === undefined) {
|
152
139
|
filter = {};
|
153
140
|
}
|
@@ -156,19 +143,54 @@ class PlatformIamcData extends base_1.BaseFacade {
|
|
156
143
|
filter['run'] = { defaultOnly: true };
|
157
144
|
}
|
158
145
|
const joinParameters = true;
|
159
|
-
let df = yield this.backend.iamc.datapoints.tabulate({
|
146
|
+
let df = (yield this.backend.iamc.datapoints.tabulate({
|
160
147
|
joinRuns,
|
161
148
|
joinParameters,
|
162
149
|
filter,
|
163
|
-
});
|
164
|
-
|
165
|
-
|
166
|
-
|
150
|
+
}));
|
151
|
+
if (splitByType) {
|
152
|
+
const splitDfs = (0, utils_1.splitDataFrameByType)(df);
|
153
|
+
const typeMapping = {
|
154
|
+
annual: datapoint_1.DataPointType.ANNUAL,
|
155
|
+
categorical: datapoint_1.DataPointType.CATEGORICAL,
|
156
|
+
datetime: datapoint_1.DataPointType.DATETIME,
|
157
|
+
};
|
158
|
+
const presentTypes = [];
|
159
|
+
Object.entries(typeMapping).forEach(([key, type]) => {
|
160
|
+
const typedKey = key;
|
161
|
+
if (splitDfs[typedKey]) {
|
162
|
+
presentTypes.push(type);
|
163
|
+
if (wide) {
|
164
|
+
splitDfs[typedKey] = (0, utils_1.toIamcWide)(splitDfs[typedKey]);
|
165
|
+
}
|
166
|
+
splitDfs[typedKey] = (0, utils_1.standardizeIamcDf)(splitDfs[typedKey]);
|
167
|
+
}
|
168
|
+
});
|
169
|
+
return Object.assign({ presentTypes }, splitDfs);
|
167
170
|
}
|
168
|
-
|
169
|
-
|
171
|
+
else {
|
172
|
+
if (wide) {
|
173
|
+
df = (0, utils_1.toIamcWide)(df);
|
174
|
+
}
|
175
|
+
return (0, utils_1.standardizeIamcDf)(df);
|
176
|
+
}
|
177
|
+
});
|
178
|
+
}
|
179
|
+
/**
|
180
|
+
* Counts IAMC datapoints with optional filtering.
|
181
|
+
* @param filter Optional. Filter for counting IAMC datapoints.
|
182
|
+
* @returns A promise that resolves to the count of datapoints.
|
183
|
+
*/
|
184
|
+
count(filter) {
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
186
|
+
if (filter === undefined) {
|
187
|
+
filter = {};
|
188
|
+
}
|
189
|
+
// return only default runs unless a run-filter is provided
|
190
|
+
if (!Object.hasOwn(filter, 'run')) {
|
191
|
+
filter['run'] = { defaultOnly: true };
|
170
192
|
}
|
171
|
-
return
|
193
|
+
return this.backend.iamc.datapoints.count(filter);
|
172
194
|
});
|
173
195
|
}
|
174
196
|
}
|
@@ -136,5 +136,15 @@ class VariableRepository extends base_1.BaseFacade {
|
|
136
136
|
return this.backend.iamc.variables.tabulate(filter);
|
137
137
|
});
|
138
138
|
}
|
139
|
+
/**
|
140
|
+
* Counts Variables with optional filtering.
|
141
|
+
* @param filter Optional. Filter for counting Variables.
|
142
|
+
* @returns A Promise that resolves to the count of Variables.
|
143
|
+
*/
|
144
|
+
count(filter) {
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
146
|
+
return this.backend.iamc.variables.count(filter);
|
147
|
+
});
|
148
|
+
}
|
139
149
|
}
|
140
150
|
exports.VariableRepository = VariableRepository;
|
package/dist/cjs/core/meta.js
CHANGED
@@ -33,17 +33,27 @@ class MetaIndicatorRepository extends base_1.BaseFacade {
|
|
33
33
|
* @param joinRunIndex Optional. Whether to join the run index to the tabulated data, defaults to true.
|
34
34
|
* @returns A promise that resolves to a DataFrame containing the tabulated meta indicators.
|
35
35
|
*/
|
36
|
-
tabulate(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
tabulate() {
|
37
|
+
return __awaiter(this, arguments, void 0, function* (_a = {
|
38
|
+
joinRunIndex: true,
|
39
|
+
}) {
|
40
|
+
var { joinRunIndex = true } = _a, filter = __rest(_a, ["joinRunIndex"]);
|
41
41
|
if (filter === undefined) {
|
42
42
|
filter = {};
|
43
43
|
}
|
44
44
|
return yield this.backend.meta.tabulate(filter, joinRunIndex);
|
45
45
|
});
|
46
46
|
}
|
47
|
+
/**
|
48
|
+
* Counts meta indicators with optional filtering.
|
49
|
+
* @param filter Optional. Filter for counting meta indicators.
|
50
|
+
* @returns A promise that resolves to the count of meta indicators.
|
51
|
+
*/
|
52
|
+
count(filter) {
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
54
|
+
return this.backend.meta.count(filter || {});
|
55
|
+
});
|
56
|
+
}
|
47
57
|
}
|
48
58
|
exports.MetaIndicatorRepository = MetaIndicatorRepository;
|
49
59
|
/**
|
package/dist/cjs/core/model.js
CHANGED
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.ModelRepository = exports.Model = void 0;
|
13
13
|
const base_1 = require("./base");
|
14
|
+
const utils_1 = require("./utils");
|
14
15
|
/**
|
15
16
|
* Represents a model in the assessment modeling system.
|
16
17
|
*/
|
@@ -120,7 +121,7 @@ class ModelRepository extends base_1.BaseFacade {
|
|
120
121
|
*/
|
121
122
|
list(filter) {
|
122
123
|
return __awaiter(this, void 0, void 0, function* () {
|
123
|
-
const models = yield this.backend.models.list(filter);
|
124
|
+
const models = yield this.backend.models.list((0, utils_1.withIamcDefault)(filter));
|
124
125
|
return models.map((model) => {
|
125
126
|
return new Model(this.backend, model);
|
126
127
|
});
|
@@ -133,7 +134,17 @@ class ModelRepository extends base_1.BaseFacade {
|
|
133
134
|
*/
|
134
135
|
tabulate(filter) {
|
135
136
|
return __awaiter(this, void 0, void 0, function* () {
|
136
|
-
return this.backend.models.tabulate(filter);
|
137
|
+
return this.backend.models.tabulate((0, utils_1.withIamcDefault)(filter));
|
138
|
+
});
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* Counts models with optional filtering.
|
142
|
+
* @param filter Optional. Filter for counting models.
|
143
|
+
* @returns A promise that resolves to the count of models.
|
144
|
+
*/
|
145
|
+
count(filter) {
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
147
|
+
return this.backend.models.count((0, utils_1.withIamcDefault)(filter));
|
137
148
|
});
|
138
149
|
}
|
139
150
|
}
|
package/dist/cjs/core/region.js
CHANGED
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.RegionRepository = exports.Region = void 0;
|
13
13
|
const base_1 = require("./base");
|
14
|
+
const utils_1 = require("./utils");
|
14
15
|
/**
|
15
16
|
* Represents a unit in the system.
|
16
17
|
*/
|
@@ -152,7 +153,7 @@ class RegionRepository extends base_1.BaseFacade {
|
|
152
153
|
*/
|
153
154
|
list(filter) {
|
154
155
|
return __awaiter(this, void 0, void 0, function* () {
|
155
|
-
return this.backend.regions.list(filter).then((models) => {
|
156
|
+
return this.backend.regions.list((0, utils_1.withIamcDefault)(filter)).then((models) => {
|
156
157
|
return models.map((model) => new Region(this.backend, model));
|
157
158
|
});
|
158
159
|
});
|
@@ -164,7 +165,17 @@ class RegionRepository extends base_1.BaseFacade {
|
|
164
165
|
*/
|
165
166
|
tabulate(filter) {
|
166
167
|
return __awaiter(this, void 0, void 0, function* () {
|
167
|
-
return this.backend.regions.tabulate(filter);
|
168
|
+
return this.backend.regions.tabulate((0, utils_1.withIamcDefault)(filter));
|
169
|
+
});
|
170
|
+
}
|
171
|
+
/**
|
172
|
+
* Counts regions with optional filtering.
|
173
|
+
* @param filter Optional. Filter for counting regions.
|
174
|
+
* @returns A promise that resolves to the count of regions.
|
175
|
+
*/
|
176
|
+
count(filter) {
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
178
|
+
return this.backend.regions.count((0, utils_1.withIamcDefault)(filter));
|
168
179
|
});
|
169
180
|
}
|
170
181
|
}
|
package/dist/cjs/core/run.js
CHANGED
@@ -13,6 +13,7 @@ exports.RunRepository = exports.Run = void 0;
|
|
13
13
|
const base_1 = require("./base");
|
14
14
|
const data_1 = require("./iamc/data");
|
15
15
|
const meta_1 = require("./meta");
|
16
|
+
const utils_1 = require("./utils");
|
16
17
|
/**
|
17
18
|
* Represents a Modeling Run.
|
18
19
|
*/
|
@@ -150,12 +151,12 @@ class RunRepository extends base_1.BaseFacade {
|
|
150
151
|
* @param filter Optional. Filter for retriving runs.
|
151
152
|
* @returns A promise that resolves to an array of Run instances.
|
152
153
|
*/
|
153
|
-
list(
|
154
|
-
return __awaiter(this,
|
154
|
+
list() {
|
155
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
155
156
|
if (filter.defaultOnly === undefined) {
|
156
157
|
filter.defaultOnly = true;
|
157
158
|
}
|
158
|
-
const runs = yield this.backend.runs.list(filter);
|
159
|
+
const runs = yield this.backend.runs.list((0, utils_1.withIamcDefault)(filter));
|
159
160
|
const runPromises = runs.map((run) => __awaiter(this, void 0, void 0, function* () {
|
160
161
|
return new Run(this.backend, run);
|
161
162
|
}));
|
@@ -167,12 +168,12 @@ class RunRepository extends base_1.BaseFacade {
|
|
167
168
|
* @param filter Optional. Filter for tabulating runs.
|
168
169
|
* @returns A promise that resolves to a DataFrame containing the tabulated runs.
|
169
170
|
*/
|
170
|
-
tabulate(
|
171
|
-
return __awaiter(this,
|
171
|
+
tabulate() {
|
172
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
172
173
|
if (filter.defaultOnly === undefined) {
|
173
174
|
filter.defaultOnly = true;
|
174
175
|
}
|
175
|
-
const df = yield this.backend.runs.tabulate(filter);
|
176
|
+
const df = yield this.backend.runs.tabulate((0, utils_1.withIamcDefault)(filter));
|
176
177
|
const models = yield this.backend.models.list();
|
177
178
|
const scenarios = yield this.backend.scenarios.list();
|
178
179
|
const modelNames = df.columnValues('model__id').map((id) => {
|
@@ -189,5 +190,15 @@ class RunRepository extends base_1.BaseFacade {
|
|
189
190
|
});
|
190
191
|
});
|
191
192
|
}
|
193
|
+
/**
|
194
|
+
* Counts runs with optional filtering.
|
195
|
+
* @param filter Optional. Filter for counting runs.
|
196
|
+
* @returns A promise that resolves to the count of runs.
|
197
|
+
*/
|
198
|
+
count() {
|
199
|
+
return __awaiter(this, arguments, void 0, function* (filter = {}) {
|
200
|
+
return this.backend.runs.count((0, utils_1.withIamcDefault)(filter));
|
201
|
+
});
|
202
|
+
}
|
192
203
|
}
|
193
204
|
exports.RunRepository = RunRepository;
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.ScenarioRepository = exports.Scenario = void 0;
|
13
13
|
const base_1 = require("./base");
|
14
|
+
const utils_1 = require("./utils");
|
14
15
|
/**
|
15
16
|
* Represents a Modeling Scenario.
|
16
17
|
*/
|
@@ -127,7 +128,9 @@ class ScenarioRepository extends base_1.BaseFacade {
|
|
127
128
|
*/
|
128
129
|
list(filter) {
|
129
130
|
return __awaiter(this, void 0, void 0, function* () {
|
130
|
-
return this.backend.scenarios
|
131
|
+
return this.backend.scenarios
|
132
|
+
.list((0, utils_1.withIamcDefault)(filter))
|
133
|
+
.then((models) => {
|
131
134
|
return models.map((model) => new Scenario(this.backend, model));
|
132
135
|
});
|
133
136
|
});
|
@@ -139,7 +142,17 @@ class ScenarioRepository extends base_1.BaseFacade {
|
|
139
142
|
*/
|
140
143
|
tabulate(filter) {
|
141
144
|
return __awaiter(this, void 0, void 0, function* () {
|
142
|
-
return this.backend.scenarios.tabulate(filter);
|
145
|
+
return this.backend.scenarios.tabulate((0, utils_1.withIamcDefault)(filter));
|
146
|
+
});
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* Counts scenarios with optional filtering.
|
150
|
+
* @param filter Optional. Filter for counting scenarios.
|
151
|
+
* @returns A promise that resolves to the count of scenarios.
|
152
|
+
*/
|
153
|
+
count(filter) {
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
155
|
+
return this.backend.scenarios.count((0, utils_1.withIamcDefault)(filter));
|
143
156
|
});
|
144
157
|
}
|
145
158
|
}
|
package/dist/cjs/core/unit.js
CHANGED
@@ -167,7 +167,7 @@ class UnitRepository extends base_1.BaseFacade {
|
|
167
167
|
*/
|
168
168
|
list(filter) {
|
169
169
|
return __awaiter(this, void 0, void 0, function* () {
|
170
|
-
return this.backend.units.list(filter).then((models) => {
|
170
|
+
return this.backend.units.list((0, utils_1.withIamcDefault)(filter)).then((models) => {
|
171
171
|
return models.map((model) => new Unit(this.backend, model));
|
172
172
|
});
|
173
173
|
});
|
@@ -179,7 +179,17 @@ class UnitRepository extends base_1.BaseFacade {
|
|
179
179
|
*/
|
180
180
|
tabulate(filter) {
|
181
181
|
return __awaiter(this, void 0, void 0, function* () {
|
182
|
-
return this.backend.units.tabulate(filter);
|
182
|
+
return this.backend.units.tabulate((0, utils_1.withIamcDefault)(filter));
|
183
|
+
});
|
184
|
+
}
|
185
|
+
/**
|
186
|
+
* Counts units with optional filtering.
|
187
|
+
* @param filter Optional. Filter for counting units.
|
188
|
+
* @returns A promise that resolves to the count of units.
|
189
|
+
*/
|
190
|
+
count(filter) {
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
192
|
+
return this.backend.units.count((0, utils_1.withIamcDefault)(filter));
|
183
193
|
});
|
184
194
|
}
|
185
195
|
}
|