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,286 @@
|
|
|
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.StudyService = void 0;
|
|
43
|
+
var Fetch_1 = require("./Fetch");
|
|
44
|
+
var Study_1 = require("../model/Study");
|
|
45
|
+
var Demo_1 = require("./Demo");
|
|
46
|
+
var jsonata_1 = __importDefault(require("jsonata"));
|
|
47
|
+
var StudyService = /** @class */ (function () {
|
|
48
|
+
function StudyService() {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the set of all studies.
|
|
52
|
+
*/
|
|
53
|
+
StudyService.prototype.all = function (transform) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var auth_1, credential, output;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
60
|
+
auth_1 = (this.configuration.authorization || ":").split(":");
|
|
61
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_1[0] && x["secret_key"] === auth_1[1]; });
|
|
62
|
+
if (credential.length === 0)
|
|
63
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
64
|
+
output = Demo_1.Demo.Study.map(function (x) { return Object.assign(new Study_1.Study(), x); });
|
|
65
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
66
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
67
|
+
}
|
|
68
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/study", this.configuration)];
|
|
69
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) { return Object.assign(new Study_1.Study(), x); })];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Get the set of studies for a single researcher.
|
|
76
|
+
* @param researcherId
|
|
77
|
+
*/
|
|
78
|
+
StudyService.prototype.allByResearcher = function (researcherId, transform) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
var auth_2, credential, output;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (researcherId === null || researcherId === undefined)
|
|
85
|
+
throw new Error("Required parameter researcherId was null or undefined when calling studyAllByResearcher.");
|
|
86
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
87
|
+
auth_2 = (this.configuration.authorization || ":").split(":");
|
|
88
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_2[0] && x["secret_key"] === auth_2[1]; });
|
|
89
|
+
if (credential.length === 0)
|
|
90
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
91
|
+
if (researcherId === "me")
|
|
92
|
+
researcherId = credential.length > 0 ? credential[0]["origin"] : researcherId;
|
|
93
|
+
if (Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === researcherId; }).length > 0) {
|
|
94
|
+
output = Demo_1.Demo.Study.filter(function (x) { return x["#parent"] === researcherId; }).map(function (x) { return Object.assign(new Study_1.Study(), x); });
|
|
95
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
96
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/researcher/" + researcherId + "/study", this.configuration)];
|
|
103
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) {
|
|
104
|
+
return Object.assign(new Study_1.Study(), x);
|
|
105
|
+
})];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Create a new Study for the given Researcher.
|
|
112
|
+
* @param researcherId
|
|
113
|
+
* @param study
|
|
114
|
+
*/
|
|
115
|
+
StudyService.prototype.create = function (researcherId, study) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var auth_3, credential;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
if (researcherId === null || researcherId === undefined)
|
|
122
|
+
throw new Error("Required parameter researcherId was null or undefined when calling studyCreate.");
|
|
123
|
+
if (study === null || study === undefined)
|
|
124
|
+
throw new Error("Required parameter study was null or undefined when calling studyCreate.");
|
|
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 (researcherId === "me")
|
|
131
|
+
researcherId = credential.length > 0 ? credential[0]["origin"] : researcherId;
|
|
132
|
+
if (Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === researcherId; }).length > 0) {
|
|
133
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/researcher/" + researcherId + "/study", study, this.configuration)];
|
|
140
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Delete a study.
|
|
147
|
+
* @param studyId
|
|
148
|
+
*/
|
|
149
|
+
StudyService.prototype.delete = function (studyId) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var auth_4, credential;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
if (studyId === null || studyId === undefined)
|
|
156
|
+
throw new Error("Required parameter studyId was null or undefined when calling studyDelete.");
|
|
157
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
158
|
+
auth_4 = (this.configuration.authorization || ":").split(":");
|
|
159
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_4[0] && x["secret_key"] === auth_4[1]; });
|
|
160
|
+
if (credential.length === 0)
|
|
161
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
162
|
+
if (studyId === "me")
|
|
163
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
164
|
+
if (Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).length > 0) {
|
|
165
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return [4 /*yield*/, Fetch_1.Fetch.delete("/study/" + studyId, this.configuration)];
|
|
172
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Update the study.
|
|
179
|
+
* @param studyId
|
|
180
|
+
* @param study
|
|
181
|
+
*/
|
|
182
|
+
StudyService.prototype.update = function (studyId, study) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var auth_5, credential;
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (studyId === null || studyId === undefined)
|
|
189
|
+
throw new Error("Required parameter studyId was null or undefined when calling studyUpdate.");
|
|
190
|
+
if (study === null || study === undefined)
|
|
191
|
+
throw new Error("Required parameter study was null or undefined when calling studyUpdate.");
|
|
192
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
193
|
+
auth_5 = (this.configuration.authorization || ":").split(":");
|
|
194
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_5[0] && x["secret_key"] === auth_5[1]; });
|
|
195
|
+
if (credential.length === 0)
|
|
196
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
197
|
+
if (studyId === "me")
|
|
198
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
199
|
+
if (Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).length > 0) {
|
|
200
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return [4 /*yield*/, Fetch_1.Fetch.put("/study/" + studyId, study, this.configuration)];
|
|
207
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Get a single study, by identifier.
|
|
214
|
+
* @param studyId
|
|
215
|
+
*/
|
|
216
|
+
StudyService.prototype.view = function (studyId, transform) {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
+
var auth_6, credential, data, output;
|
|
219
|
+
return __generator(this, function (_a) {
|
|
220
|
+
switch (_a.label) {
|
|
221
|
+
case 0:
|
|
222
|
+
if (studyId === null || studyId === undefined)
|
|
223
|
+
throw new Error("Required parameter studyId was null or undefined when calling studyView.");
|
|
224
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
225
|
+
auth_6 = (this.configuration.authorization || ":").split(":");
|
|
226
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_6[0] && x["secret_key"] === auth_6[1]; });
|
|
227
|
+
if (credential.length === 0)
|
|
228
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
229
|
+
if (studyId === "me")
|
|
230
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
231
|
+
data = Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).map(function (x) { return Object.assign(new Study_1.Study(), x); });
|
|
232
|
+
if (data.length > 0) {
|
|
233
|
+
output = data[0];
|
|
234
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
235
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/study/" + studyId, this.configuration)];
|
|
242
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) {
|
|
243
|
+
return Object.assign(new Study_1.Study(), x);
|
|
244
|
+
})[0]];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Get a single study, by identifier.
|
|
251
|
+
* @param studyId
|
|
252
|
+
*/
|
|
253
|
+
StudyService.prototype.lookup = function (studyId, mode, transform) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
var auth_7, credential, data, output;
|
|
256
|
+
return __generator(this, function (_a) {
|
|
257
|
+
switch (_a.label) {
|
|
258
|
+
case 0:
|
|
259
|
+
if (studyId === null || studyId === undefined)
|
|
260
|
+
throw new Error("Required parameter studyId was null or undefined when calling studyView.");
|
|
261
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
262
|
+
auth_7 = (this.configuration.authorization || ":").split(":");
|
|
263
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_7[0] && x["secret_key"] === auth_7[1]; });
|
|
264
|
+
if (credential.length === 0)
|
|
265
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
266
|
+
if (studyId === "me")
|
|
267
|
+
studyId = credential.length > 0 ? credential[0]["origin"] : studyId;
|
|
268
|
+
data = Demo_1.Demo.Study.filter(function (x) { return x["id"] === studyId; }).map(function (x) { return Object.assign(new Study_1.Study(), x); });
|
|
269
|
+
if (data.length > 0) {
|
|
270
|
+
output = data[0];
|
|
271
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
272
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/study/" + studyId + "/_lookup/participant/mode/" + mode, this.configuration)];
|
|
279
|
+
case 1: return [2 /*return*/, (_a.sent())];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
return StudyService;
|
|
285
|
+
}());
|
|
286
|
+
exports.StudyService = StudyService;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { Identifier } from "../model/Type";
|
|
3
|
+
import { DynamicAttachment } from "../model/DynamicAttachment";
|
|
4
|
+
export declare class TypeService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param typeId
|
|
9
|
+
* @param attachmentKey
|
|
10
|
+
*/
|
|
11
|
+
getAttachment(typeId: Identifier, attachmentKey: string): Promise<any[]>;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param typeId
|
|
15
|
+
* @param attachmentKey
|
|
16
|
+
* @param invokeAlways
|
|
17
|
+
* @param includeLogs
|
|
18
|
+
* @param ignoreOutput
|
|
19
|
+
*/
|
|
20
|
+
getDynamicAttachment(typeId: Identifier, attachmentKey: string, invokeAlways: boolean, includeLogs: boolean, ignoreOutput: boolean): Promise<DynamicAttachment[]>;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param typeId
|
|
24
|
+
*/
|
|
25
|
+
listAttachments(typeId: Identifier): Promise<any[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the parent type identifier of the data structure referenced by the identifier.
|
|
28
|
+
* @param typeId
|
|
29
|
+
*/
|
|
30
|
+
parent(typeId: Identifier, transform?: string): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param typeId
|
|
34
|
+
* @param target
|
|
35
|
+
* @param attachmentKey
|
|
36
|
+
* @param attachmentValue
|
|
37
|
+
*/
|
|
38
|
+
setAttachment(typeId: Identifier, target: string, attachmentKey: string, attachmentValue: any): Promise<Identifier>;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param invokeOnce
|
|
42
|
+
* @param typeId
|
|
43
|
+
* @param target
|
|
44
|
+
* @param attachmentKey
|
|
45
|
+
* @param attachmentValue
|
|
46
|
+
*/
|
|
47
|
+
setDynamicAttachment(invokeOnce: boolean, typeId: Identifier, target: string, attachmentKey: string, attachmentValue: DynamicAttachment): Promise<Identifier>;
|
|
48
|
+
}
|