lamp-core-lst 2025.11.1-3.basic
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/.github/workflows/publish.yml +34 -0
- package/LICENSE.md +29 -0
- package/MANUAL.md +26 -0
- package/README.md +126 -0
- package/cli.js +2 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +311 -0
- package/dist/model/Activity.d.ts +81 -0
- package/dist/model/Activity.js +30 -0
- package/dist/model/ActivityEvent.d.ts +51 -0
- package/dist/model/ActivityEvent.js +21 -0
- package/dist/model/ActivitySpec.d.ts +38 -0
- package/dist/model/ActivitySpec.js +12 -0
- package/dist/model/Credential.d.ts +21 -0
- package/dist/model/Credential.js +12 -0
- package/dist/model/DynamicAttachment.d.ts +34 -0
- package/dist/model/DynamicAttachment.js +12 -0
- package/dist/model/Participant.d.ts +30 -0
- package/dist/model/Participant.js +12 -0
- package/dist/model/Researcher.d.ts +27 -0
- package/dist/model/Researcher.js +12 -0
- package/dist/model/ResearcherSettings.d.ts +57 -0
- package/dist/model/ResearcherSettings.js +12 -0
- package/dist/model/Sensor.d.ts +22 -0
- package/dist/model/Sensor.js +12 -0
- package/dist/model/SensorEvent.d.ts +18 -0
- package/dist/model/SensorEvent.js +12 -0
- package/dist/model/SensorSpec.d.ts +13 -0
- package/dist/model/SensorSpec.js +12 -0
- package/dist/model/Study.d.ts +24 -0
- package/dist/model/Study.js +12 -0
- package/dist/model/Type.d.ts +56 -0
- package/dist/model/Type.js +30 -0
- package/dist/model/index.d.ts +12 -0
- package/dist/model/index.js +24 -0
- package/dist/service/API.service.d.ts +12 -0
- package/dist/service/API.service.js +82 -0
- package/dist/service/Activity.service.d.ts +101 -0
- package/dist/service/Activity.service.js +756 -0
- package/dist/service/ActivityEvent.service.d.ts +46 -0
- package/dist/service/ActivityEvent.service.js +303 -0
- package/dist/service/ActivitySpec.service.d.ts +31 -0
- package/dist/service/ActivitySpec.service.js +173 -0
- package/dist/service/Credential.service.d.ts +38 -0
- package/dist/service/Credential.service.js +319 -0
- package/dist/service/Demo.d.ts +14 -0
- package/dist/service/Demo.js +24 -0
- package/dist/service/Fetch.d.ts +30 -0
- package/dist/service/Fetch.js +245 -0
- package/dist/service/Participant.service.d.ts +42 -0
- package/dist/service/Participant.service.js +312 -0
- package/dist/service/Researcher.service.d.ts +34 -0
- package/dist/service/Researcher.service.js +252 -0
- package/dist/service/ResearcherSettings.service.d.ts +16 -0
- package/dist/service/ResearcherSettings.service.js +114 -0
- package/dist/service/Sensor.service.d.ts +47 -0
- package/dist/service/Sensor.service.js +372 -0
- package/dist/service/SensorEvent.service.d.ts +44 -0
- package/dist/service/SensorEvent.service.js +302 -0
- package/dist/service/SensorSpec.service.d.ts +31 -0
- package/dist/service/SensorSpec.service.js +171 -0
- package/dist/service/Study.service.d.ts +42 -0
- package/dist/service/Study.service.js +286 -0
- package/dist/service/Type.service.d.ts +48 -0
- package/dist/service/Type.service.js +352 -0
- package/dist/service/index.d.ts +13 -0
- package/dist/service/index.js +25 -0
- package/docs/APIApi.md +82 -0
- package/docs/AccessCitation.md +11 -0
- package/docs/Activity.md +13 -0
- package/docs/ActivityApi.md +356 -0
- package/docs/ActivityEvent.md +13 -0
- package/docs/ActivityEventApi.md +251 -0
- package/docs/ActivitySpec.md +14 -0
- package/docs/ActivitySpecApi.md +222 -0
- package/docs/Credential.md +12 -0
- package/docs/CredentialApi.md +175 -0
- package/docs/Document.md +9 -0
- package/docs/DurationInterval.md +11 -0
- package/docs/DurationIntervalLegacy.md +10 -0
- package/docs/DynamicAttachment.md +14 -0
- package/docs/Error.md +8 -0
- package/docs/Metadata.md +8 -0
- package/docs/Participant.md +14 -0
- package/docs/ParticipantApi.md +312 -0
- package/docs/Researcher.md +12 -0
- package/docs/ResearcherApi.md +223 -0
- package/docs/Sensor.md +12 -0
- package/docs/SensorApi.md +356 -0
- package/docs/SensorEvent.md +11 -0
- package/docs/SensorEventApi.md +250 -0
- package/docs/SensorSpec.md +10 -0
- package/docs/SensorSpecApi.md +222 -0
- package/docs/Study.md +11 -0
- package/docs/StudyApi.md +268 -0
- package/docs/TemporalSlice.md +13 -0
- package/docs/TypeApi.md +274 -0
- package/package.json +44 -0
- package/src/index.ts +256 -0
- package/src/model/Activity.ts +93 -0
- package/src/model/ActivityEvent.ts +63 -0
- package/src/model/ActivitySpec.ts +45 -0
- package/src/model/Credential.ts +26 -0
- package/src/model/DynamicAttachment.ts +42 -0
- package/src/model/Participant.ts +37 -0
- package/src/model/Researcher.ts +33 -0
- package/src/model/ResearcherSettings.ts +65 -0
- package/src/model/Sensor.ts +27 -0
- package/src/model/SensorEvent.ts +22 -0
- package/src/model/SensorSpec.ts +16 -0
- package/src/model/Study.ts +29 -0
- package/src/model/Type.ts +68 -0
- package/src/model/index.ts +12 -0
- package/src/service/API.service.ts +29 -0
- package/src/service/Activity.service.ts +625 -0
- package/src/service/ActivityEvent.service.ts +244 -0
- package/src/service/ActivitySpec.service.ts +98 -0
- package/src/service/Credential.service.ts +268 -0
- package/src/service/Demo.ts +21 -0
- package/src/service/Fetch.ts +187 -0
- package/src/service/Participant.service.ts +217 -0
- package/src/service/Researcher.service.ts +147 -0
- package/src/service/ResearcherSettings.service.ts +62 -0
- package/src/service/Sensor.service.ts +256 -0
- package/src/service/SensorEvent.service.ts +239 -0
- package/src/service/SensorSpec.service.ts +96 -0
- package/src/service/Study.service.ts +187 -0
- package/src/service/Type.service.ts +297 -0
- package/src/service/index.ts +13 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { Identifier } from "../model/Type";
|
|
3
|
+
import { Participant } from "../model/Participant";
|
|
4
|
+
export declare class ParticipantService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
* Get the set of all participants.
|
|
8
|
+
*/
|
|
9
|
+
all(transform?: string): Promise<Participant[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the set of all participants under a single researcher.
|
|
12
|
+
* @param researcherId
|
|
13
|
+
*/
|
|
14
|
+
allByResearcher(researcherId: Identifier, transform?: string): Promise<Participant[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the set of all participants in a single study.
|
|
17
|
+
* @param studyId
|
|
18
|
+
*/
|
|
19
|
+
allByStudy(studyId: Identifier, transform?: string): Promise<Participant[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new Participant for the given Study.
|
|
22
|
+
* @param studyId
|
|
23
|
+
* @param participant
|
|
24
|
+
*/
|
|
25
|
+
create(studyId: Identifier, participant: Participant): Promise<Identifier>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a participant AND all owned data or event streams.
|
|
28
|
+
* @param participantId
|
|
29
|
+
*/
|
|
30
|
+
delete(participantId: Identifier): Promise<Identifier>;
|
|
31
|
+
/**
|
|
32
|
+
* Update a Participant's settings.
|
|
33
|
+
* @param participantId
|
|
34
|
+
* @param participant
|
|
35
|
+
*/
|
|
36
|
+
update(participantId: Identifier, participant: Participant): Promise<Identifier>;
|
|
37
|
+
/**
|
|
38
|
+
* Get a single participant, by identifier.
|
|
39
|
+
* @param participantId
|
|
40
|
+
*/
|
|
41
|
+
view(participantId: Identifier, transform?: string): Promise<Participant>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.ParticipantService = void 0;
|
|
43
|
+
var Fetch_1 = require("./Fetch");
|
|
44
|
+
var Participant_1 = require("../model/Participant");
|
|
45
|
+
var Demo_1 = require("./Demo");
|
|
46
|
+
var jsonata_1 = __importDefault(require("jsonata"));
|
|
47
|
+
var ParticipantService = /** @class */ (function () {
|
|
48
|
+
function ParticipantService() {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the set of all participants.
|
|
52
|
+
*/
|
|
53
|
+
ParticipantService.prototype.all = function (transform) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var auth_1, credential, output;
|
|
57
|
+
return __generator(this, function (_c) {
|
|
58
|
+
switch (_c.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
61
|
+
auth_1 = (this.configuration.authorization || ":").split(":");
|
|
62
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_1[0] && x["secret_key"] === auth_1[1]; });
|
|
63
|
+
if (credential.length === 0)
|
|
64
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
65
|
+
output = (_a = Demo_1.Demo.Participant) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Participant_1.Participant(), x); });
|
|
66
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
67
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
68
|
+
}
|
|
69
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/participant", this.configuration)];
|
|
70
|
+
case 1: return [2 /*return*/, (_b = (_c.sent()).data) === null || _b === void 0 ? void 0 : _b.map(function (x) {
|
|
71
|
+
return Object.assign(new Participant_1.Participant(), x);
|
|
72
|
+
})];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Get the set of all participants under a single researcher.
|
|
79
|
+
* @param researcherId
|
|
80
|
+
*/
|
|
81
|
+
ParticipantService.prototype.allByResearcher = function (researcherId, transform) {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var auth_2, credential, output;
|
|
85
|
+
return __generator(this, function (_c) {
|
|
86
|
+
switch (_c.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
if (researcherId === null || researcherId === undefined)
|
|
89
|
+
throw new Error("Required parameter researcherId was null or undefined when calling participantAllByResearcher.");
|
|
90
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
91
|
+
auth_2 = (this.configuration.authorization || ":").split(":");
|
|
92
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_2[0] && x["secret_key"] === auth_2[1]; });
|
|
93
|
+
if (credential.length === 0)
|
|
94
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
95
|
+
if (researcherId === "me")
|
|
96
|
+
researcherId = credential.length > 0 ? credential[0]["origin"] : researcherId;
|
|
97
|
+
if (Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === researcherId; }).length > 0) {
|
|
98
|
+
output = (_a = Demo_1.Demo.Participant.filter(function (x) { var _a; return (_a = Demo_1.Demo.Study.filter(function (y) { return y["#parent"] === researcherId; })) === null || _a === void 0 ? void 0 : _a.map(function (y) { return y["id"]; }).includes(x["#parent"]); })) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Participant_1.Participant(), x); });
|
|
99
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
100
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/researcher/" + researcherId + "/participant", this.configuration)];
|
|
107
|
+
case 1: return [2 /*return*/, (_b = (_c.sent()).data) === null || _b === void 0 ? void 0 : _b.map(function (x) { return Object.assign(new Participant_1.Participant(), x); })];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Get the set of all participants in a single study.
|
|
114
|
+
* @param studyId
|
|
115
|
+
*/
|
|
116
|
+
ParticipantService.prototype.allByStudy = function (studyId, transform) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var auth_3, credential, output;
|
|
120
|
+
return __generator(this, function (_c) {
|
|
121
|
+
switch (_c.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
if (studyId === null || studyId === undefined)
|
|
124
|
+
throw new Error("Required parameter studyId was null or undefined when calling participantAllByStudy.");
|
|
125
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
126
|
+
auth_3 = (this.configuration.authorization || ":").split(":");
|
|
127
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_3[0] && x["secret_key"] === auth_3[1]; });
|
|
128
|
+
if (credential.length === 0)
|
|
129
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
130
|
+
if (studyId === "me")
|
|
131
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
132
|
+
if (Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).length > 0) {
|
|
133
|
+
output = (_a = Demo_1.Demo.Participant.filter(function (x) { return x["#parent"] === studyId; })) === null || _a === void 0 ? void 0 : _a.map(function (x) {
|
|
134
|
+
return Object.assign(new Participant_1.Participant(), x);
|
|
135
|
+
});
|
|
136
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
137
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/study/" + studyId + "/participant", this.configuration)];
|
|
144
|
+
case 1: return [2 /*return*/, (_b = (_c.sent()).data) === null || _b === void 0 ? void 0 : _b.map(function (x) {
|
|
145
|
+
return Object.assign(new Participant_1.Participant(), x);
|
|
146
|
+
})];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Create a new Participant for the given Study.
|
|
153
|
+
* @param studyId
|
|
154
|
+
* @param participant
|
|
155
|
+
*/
|
|
156
|
+
ParticipantService.prototype.create = function (studyId, participant) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
+
var auth_4, credential, data;
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0:
|
|
162
|
+
if (studyId === null || studyId === undefined)
|
|
163
|
+
throw new Error("Required parameter studyId was null or undefined when calling participantCreate.");
|
|
164
|
+
if (participant === null || participant === undefined)
|
|
165
|
+
throw new Error("Required parameter participant was null or undefined when calling participantCreate.");
|
|
166
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
167
|
+
auth_4 = (this.configuration.authorization || ":").split(":");
|
|
168
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_4[0] && x["secret_key"] === auth_4[1]; });
|
|
169
|
+
if (credential.length === 0)
|
|
170
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
171
|
+
if (studyId === "me")
|
|
172
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
173
|
+
if (Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).length > 0) {
|
|
174
|
+
data = {
|
|
175
|
+
"#type": "Participant",
|
|
176
|
+
"#parent": studyId,
|
|
177
|
+
id: "U" +
|
|
178
|
+
Math.random()
|
|
179
|
+
.toString()
|
|
180
|
+
.substring(2, 11),
|
|
181
|
+
language: "en",
|
|
182
|
+
theme: "#359FFE",
|
|
183
|
+
emergency_contact: null,
|
|
184
|
+
helpline: null
|
|
185
|
+
};
|
|
186
|
+
Demo_1.Demo.Participant.push(data);
|
|
187
|
+
return [2 /*return*/, Promise.resolve({ data: data["id"] })];
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/study/" + studyId + "/participant", participant, this.configuration)];
|
|
194
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Delete a participant AND all owned data or event streams.
|
|
201
|
+
* @param participantId
|
|
202
|
+
*/
|
|
203
|
+
ParticipantService.prototype.delete = function (participantId) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
205
|
+
var auth_5, credential, idx;
|
|
206
|
+
return __generator(this, function (_a) {
|
|
207
|
+
switch (_a.label) {
|
|
208
|
+
case 0:
|
|
209
|
+
if (participantId === null || participantId === undefined)
|
|
210
|
+
throw new Error("Required parameter participantId was null or undefined when calling participantDelete.");
|
|
211
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
212
|
+
auth_5 = (this.configuration.authorization || ":").split(":");
|
|
213
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_5[0] && x["secret_key"] === auth_5[1]; });
|
|
214
|
+
if (credential.length === 0)
|
|
215
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
216
|
+
if (participantId === "me")
|
|
217
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
218
|
+
idx = Demo_1.Demo.Participant.findIndex(function (x) { return x["id"] === participantId; });
|
|
219
|
+
if (idx >= 0) {
|
|
220
|
+
Demo_1.Demo.Participant.splice(idx, 1);
|
|
221
|
+
Demo_1.Demo.ActivityEvent = Demo_1.Demo.ActivityEvent.filter(function (x) { return x["#parent"] !== participantId; });
|
|
222
|
+
Demo_1.Demo.SensorEvent = Demo_1.Demo.SensorEvent.filter(function (x) { return x["#parent"] !== participantId; });
|
|
223
|
+
Demo_1.Demo.Credential = Demo_1.Demo.Credential.filter(function (x) { return x["#parent"] !== participantId; });
|
|
224
|
+
Demo_1.Demo.Tags = Demo_1.Demo.Tags.filter(function (x) { return x["#parent"] !== participantId && x["target"] !== participantId; });
|
|
225
|
+
return [2 /*return*/, Promise.resolve({})];
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return [4 /*yield*/, Fetch_1.Fetch.delete("/participant/" + participantId, this.configuration)];
|
|
232
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Update a Participant's settings.
|
|
239
|
+
* @param participantId
|
|
240
|
+
* @param participant
|
|
241
|
+
*/
|
|
242
|
+
ParticipantService.prototype.update = function (participantId, participant) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
244
|
+
var auth_6, credential;
|
|
245
|
+
return __generator(this, function (_a) {
|
|
246
|
+
switch (_a.label) {
|
|
247
|
+
case 0:
|
|
248
|
+
if (participantId === null || participantId === undefined)
|
|
249
|
+
throw new Error("Required parameter participantId was null or undefined when calling participantUpdate.");
|
|
250
|
+
if (participant === null || participant === undefined)
|
|
251
|
+
throw new Error("Required parameter participant was null or undefined when calling participantUpdate.");
|
|
252
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
253
|
+
auth_6 = (this.configuration.authorization || ":").split(":");
|
|
254
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_6[0] && x["secret_key"] === auth_6[1]; });
|
|
255
|
+
if (credential.length === 0)
|
|
256
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
257
|
+
if (participantId === "me")
|
|
258
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
259
|
+
if (Demo_1.Demo.Participant.filter(function (x) { return x["id"] === participantId; }).length > 0) {
|
|
260
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return [4 /*yield*/, Fetch_1.Fetch.put("/participant/" + participantId, participant, this.configuration)];
|
|
267
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Get a single participant, by identifier.
|
|
274
|
+
* @param participantId
|
|
275
|
+
*/
|
|
276
|
+
ParticipantService.prototype.view = function (participantId, transform) {
|
|
277
|
+
var _a, _b;
|
|
278
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
279
|
+
var auth_7, credential, data, output;
|
|
280
|
+
return __generator(this, function (_c) {
|
|
281
|
+
switch (_c.label) {
|
|
282
|
+
case 0:
|
|
283
|
+
if (participantId === null || participantId === undefined)
|
|
284
|
+
throw new Error("Required parameter participantId was null or undefined when calling participantView.");
|
|
285
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
286
|
+
auth_7 = (this.configuration.authorization || ":").split(":");
|
|
287
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_7[0] && x["secret_key"] === auth_7[1]; });
|
|
288
|
+
if (credential.length === 0)
|
|
289
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
290
|
+
if (participantId === "me")
|
|
291
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
292
|
+
data = (_a = Demo_1.Demo.Participant.filter(function (x) { return x["id"] === participantId; })) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Participant_1.Participant(), x); });
|
|
293
|
+
if (data.length > 0) {
|
|
294
|
+
output = data[0];
|
|
295
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
296
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/participant/" + participantId, this.configuration)];
|
|
303
|
+
case 1: return [2 /*return*/, (_b = (_c.sent()).data) === null || _b === void 0 ? void 0 : _b.map(function (x) {
|
|
304
|
+
return Object.assign(new Participant_1.Participant(), x);
|
|
305
|
+
})[0]];
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
return ParticipantService;
|
|
311
|
+
}());
|
|
312
|
+
exports.ParticipantService = ParticipantService;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { Identifier } from "../model/Type";
|
|
3
|
+
import { Researcher } from "../model/Researcher";
|
|
4
|
+
export declare class ResearcherService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
* Get the set of all researchers.
|
|
8
|
+
*/
|
|
9
|
+
all(transform?: string): Promise<Researcher[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new Researcher.
|
|
12
|
+
* @param researcher
|
|
13
|
+
*/
|
|
14
|
+
create(researcher: Researcher): Promise<Identifier>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete a researcher.
|
|
17
|
+
* @param researcherId
|
|
18
|
+
*/
|
|
19
|
+
delete(researcherId: Identifier): Promise<Identifier>;
|
|
20
|
+
/**
|
|
21
|
+
* Update a Researcher's settings.
|
|
22
|
+
* @param researcherId
|
|
23
|
+
* @param body
|
|
24
|
+
*/
|
|
25
|
+
update(researcherId: Identifier, researcher: Researcher): Promise<Identifier>;
|
|
26
|
+
/**
|
|
27
|
+
* Get a single researcher, by identifier.
|
|
28
|
+
* @param researcherId
|
|
29
|
+
*/
|
|
30
|
+
view(researcherId: Identifier, transform?: string): Promise<Researcher>;
|
|
31
|
+
usersList(id: string, filters: any): Promise<any>;
|
|
32
|
+
activitiesList(id: string, filters: any): Promise<any>;
|
|
33
|
+
sensorsList(id: string, filters: any): Promise<any>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.ResearcherService = void 0;
|
|
43
|
+
var Fetch_1 = require("./Fetch");
|
|
44
|
+
var Researcher_1 = require("../model/Researcher");
|
|
45
|
+
var Demo_1 = require("./Demo");
|
|
46
|
+
var jsonata_1 = __importDefault(require("jsonata"));
|
|
47
|
+
var ResearcherService = /** @class */ (function () {
|
|
48
|
+
function ResearcherService() {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the set of all researchers.
|
|
52
|
+
*/
|
|
53
|
+
ResearcherService.prototype.all = function (transform) {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var auth_1, credential, output;
|
|
57
|
+
return __generator(this, function (_d) {
|
|
58
|
+
switch (_d.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
61
|
+
auth_1 = (this.configuration.authorization || ":").split(":");
|
|
62
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_1[0] && x["secret_key"] === auth_1[1]; });
|
|
63
|
+
if (credential.length === 0)
|
|
64
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
65
|
+
output = (_a = Demo_1.Demo.Researcher) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Researcher_1.Researcher(), x); });
|
|
66
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
67
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
68
|
+
}
|
|
69
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/researcher", this.configuration)];
|
|
70
|
+
case 1: return [2 /*return*/, (_c = (_b = (_d.sent())) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map(function (x) {
|
|
71
|
+
return Object.assign(new Researcher_1.Researcher(), x);
|
|
72
|
+
})];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Create a new Researcher.
|
|
79
|
+
* @param researcher
|
|
80
|
+
*/
|
|
81
|
+
ResearcherService.prototype.create = function (researcher) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
if (researcher === null || researcher === undefined)
|
|
87
|
+
throw new Error("Required parameter researcher was null or undefined when calling researcherCreate.");
|
|
88
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
89
|
+
// DEMO
|
|
90
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
91
|
+
}
|
|
92
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/researcher", researcher, this.configuration)];
|
|
93
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Delete a researcher.
|
|
100
|
+
* @param researcherId
|
|
101
|
+
*/
|
|
102
|
+
ResearcherService.prototype.delete = function (researcherId) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (researcherId === null || researcherId === undefined)
|
|
108
|
+
throw new Error("Required parameter researcherId was null or undefined when calling researcherDelete.");
|
|
109
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
110
|
+
// DEMO
|
|
111
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
112
|
+
}
|
|
113
|
+
return [4 /*yield*/, Fetch_1.Fetch.delete("/researcher/" + researcherId, this.configuration)];
|
|
114
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Update a Researcher's settings.
|
|
121
|
+
* @param researcherId
|
|
122
|
+
* @param body
|
|
123
|
+
*/
|
|
124
|
+
ResearcherService.prototype.update = function (researcherId, researcher) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
if (researcherId === null || researcherId === undefined)
|
|
130
|
+
throw new Error("Required parameter researcherId was null or undefined when calling researcherUpdate.");
|
|
131
|
+
if (researcher === null || researcher === undefined)
|
|
132
|
+
throw new Error("Required parameter researcher was null or undefined when calling researcherUpdate.");
|
|
133
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
134
|
+
// DEMO
|
|
135
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
136
|
+
}
|
|
137
|
+
return [4 /*yield*/, Fetch_1.Fetch.put("/researcher/" + researcherId, researcher, this.configuration)];
|
|
138
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Get a single researcher, by identifier.
|
|
145
|
+
* @param researcherId
|
|
146
|
+
*/
|
|
147
|
+
ResearcherService.prototype.view = function (researcherId, transform) {
|
|
148
|
+
var _a, _b, _c;
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
var auth_2, credential, data, output;
|
|
151
|
+
return __generator(this, function (_d) {
|
|
152
|
+
switch (_d.label) {
|
|
153
|
+
case 0:
|
|
154
|
+
if (researcherId === null || researcherId === undefined)
|
|
155
|
+
throw new Error("Required parameter researcherId was null or undefined when calling researcherView.");
|
|
156
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
157
|
+
auth_2 = (this.configuration.authorization || ":").split(":");
|
|
158
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_2[0] && x["secret_key"] === auth_2[1]; });
|
|
159
|
+
if (credential.length === 0)
|
|
160
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
161
|
+
if (researcherId === "me")
|
|
162
|
+
researcherId = credential.length > 0 ? credential[0]["origin"] : researcherId;
|
|
163
|
+
data = (_a = Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === researcherId; })) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Researcher_1.Researcher(), x); });
|
|
164
|
+
if (data.length > 0) {
|
|
165
|
+
output = data[0];
|
|
166
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
167
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/researcher/" + researcherId, this.configuration)];
|
|
174
|
+
case 1: return [2 /*return*/, (_c = (_b = (_d.sent())) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map(function (x) {
|
|
175
|
+
return Object.assign(new Researcher_1.Researcher(), x);
|
|
176
|
+
})[0]];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
ResearcherService.prototype.usersList = function (id, filters) {
|
|
182
|
+
var _a;
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var auth_3, credential, output, result;
|
|
185
|
+
return __generator(this, function (_b) {
|
|
186
|
+
switch (_b.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
189
|
+
auth_3 = (this.configuration.authorization || ":").split(":");
|
|
190
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_3[0] && x["secret_key"] === auth_3[1]; });
|
|
191
|
+
if (credential.length === 0)
|
|
192
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
193
|
+
output = (_a = Demo_1.Demo.Researcher) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Researcher_1.Researcher(), x); });
|
|
194
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
195
|
+
}
|
|
196
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/researcher/" + id + "/users", filters, this.configuration)];
|
|
197
|
+
case 1:
|
|
198
|
+
result = _b.sent();
|
|
199
|
+
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.data];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
ResearcherService.prototype.activitiesList = function (id, filters) {
|
|
205
|
+
var _a;
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
var auth_4, credential, output, result;
|
|
208
|
+
return __generator(this, function (_b) {
|
|
209
|
+
switch (_b.label) {
|
|
210
|
+
case 0:
|
|
211
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
212
|
+
auth_4 = (this.configuration.authorization || ":").split(":");
|
|
213
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_4[0] && x["secret_key"] === auth_4[1]; });
|
|
214
|
+
if (credential.length === 0)
|
|
215
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
216
|
+
output = (_a = Demo_1.Demo.Researcher) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Researcher_1.Researcher(), x); });
|
|
217
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
218
|
+
}
|
|
219
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/researcher/activities/" + id, filters, this.configuration)];
|
|
220
|
+
case 1:
|
|
221
|
+
result = _b.sent();
|
|
222
|
+
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.data];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
ResearcherService.prototype.sensorsList = function (id, filters) {
|
|
228
|
+
var _a;
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
var auth_5, credential, output, result;
|
|
231
|
+
return __generator(this, function (_b) {
|
|
232
|
+
switch (_b.label) {
|
|
233
|
+
case 0:
|
|
234
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
235
|
+
auth_5 = (this.configuration.authorization || ":").split(":");
|
|
236
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_5[0] && x["secret_key"] === auth_5[1]; });
|
|
237
|
+
if (credential.length === 0)
|
|
238
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
239
|
+
output = (_a = Demo_1.Demo.Researcher) === null || _a === void 0 ? void 0 : _a.map(function (x) { return Object.assign(new Researcher_1.Researcher(), x); });
|
|
240
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
241
|
+
}
|
|
242
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/researcher/sensors/" + id, filters, this.configuration)];
|
|
243
|
+
case 1:
|
|
244
|
+
result = _b.sent();
|
|
245
|
+
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.data];
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
return ResearcherService;
|
|
251
|
+
}());
|
|
252
|
+
exports.ResearcherService = ResearcherService;
|