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,46 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { Identifier } from "../model/Type";
|
|
3
|
+
import { ActivityEvent } from "../model/ActivityEvent";
|
|
4
|
+
export declare class ActivityEventService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
* Get the set of all activity events produced by a given participant, by identifier.
|
|
8
|
+
* @param participantId
|
|
9
|
+
* @param origin
|
|
10
|
+
* @param from
|
|
11
|
+
* @param to
|
|
12
|
+
* @param limit
|
|
13
|
+
* @param ignoreBinary
|
|
14
|
+
*/
|
|
15
|
+
allByParticipant(participantId: Identifier, origin?: string, from?: number, to?: number, limit?: number, ignoreBinary?: boolean, transform?: string): Promise<ActivityEvent[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the set of all activity events produced by participants of any study conducted by a researcher, by researcher identifier.
|
|
18
|
+
* @param researcherId
|
|
19
|
+
* @param origin
|
|
20
|
+
* @param from
|
|
21
|
+
* @param to
|
|
22
|
+
*/
|
|
23
|
+
allByResearcher(researcherId: Identifier, origin?: string, from?: number, to?: number, limit?: number, transform?: string): Promise<ActivityEvent[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Get the set of all activity events produced by participants of a single study, by study identifier.
|
|
26
|
+
* @param studyId
|
|
27
|
+
* @param origin
|
|
28
|
+
* @param from
|
|
29
|
+
* @param to
|
|
30
|
+
*/
|
|
31
|
+
allByStudy(studyId: Identifier, origin?: string, from?: number, to?: number, limit?: number, transform?: string): Promise<ActivityEvent[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new ActivityEvent for the given Participant.
|
|
34
|
+
* @param participantId
|
|
35
|
+
* @param activityEvent
|
|
36
|
+
*/
|
|
37
|
+
create(participantId: Identifier, activityEvent: ActivityEvent): Promise<Identifier>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete a ActivityEvent.
|
|
40
|
+
* @param participantId
|
|
41
|
+
* @param origin
|
|
42
|
+
* @param from
|
|
43
|
+
* @param to
|
|
44
|
+
*/
|
|
45
|
+
delete(participantId: Identifier, origin?: string, from?: number, to?: number): Promise<Identifier>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.ActivityEventService = void 0;
|
|
54
|
+
var Fetch_1 = require("./Fetch");
|
|
55
|
+
var ActivityEvent_1 = require("../model/ActivityEvent");
|
|
56
|
+
var Demo_1 = require("./Demo");
|
|
57
|
+
var jsonata_1 = __importDefault(require("jsonata"));
|
|
58
|
+
var ActivityEventService = /** @class */ (function () {
|
|
59
|
+
function ActivityEventService() {
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the set of all activity events produced by a given participant, by identifier.
|
|
63
|
+
* @param participantId
|
|
64
|
+
* @param origin
|
|
65
|
+
* @param from
|
|
66
|
+
* @param to
|
|
67
|
+
* @param limit
|
|
68
|
+
* @param ignoreBinary
|
|
69
|
+
*/
|
|
70
|
+
ActivityEventService.prototype.allByParticipant = function (participantId, origin, from, to, limit, ignoreBinary, transform) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var queryParameters, auth_1, credential, output;
|
|
74
|
+
return __generator(this, function (_c) {
|
|
75
|
+
switch (_c.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (participantId === null || participantId === undefined)
|
|
78
|
+
throw new Error("Required parameter participantId was null or undefined when calling activityEventAllByParticipant.");
|
|
79
|
+
queryParameters = new URLSearchParams();
|
|
80
|
+
if (origin !== undefined && origin !== null)
|
|
81
|
+
queryParameters.set("origin", origin);
|
|
82
|
+
if (from !== undefined && from !== null)
|
|
83
|
+
queryParameters.set("from", from);
|
|
84
|
+
if (to !== undefined && to !== null)
|
|
85
|
+
queryParameters.set("to", to);
|
|
86
|
+
if (limit !== undefined && limit !== null)
|
|
87
|
+
queryParameters.set("limit", limit);
|
|
88
|
+
queryParameters.set("ignore_binary", (_a = ignoreBinary) !== null && _a !== void 0 ? _a : false);
|
|
89
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
90
|
+
auth_1 = (this.configuration.authorization || ":").split(":");
|
|
91
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_1[0] && x["secret_key"] === auth_1[1]; });
|
|
92
|
+
if (credential.length === 0)
|
|
93
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
94
|
+
if (participantId === "me")
|
|
95
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
96
|
+
if (Demo_1.Demo.Participant.filter(function (x) { return x["id"] === participantId; }).length > 0) {
|
|
97
|
+
output = Demo_1.Demo.ActivityEvent.filter(function (x) { return x["#parent"] === participantId && (!!origin ? x["activity"] === origin : true); }).map(function (x) { return Object.assign(new ActivityEvent_1.ActivityEvent(), x); });
|
|
98
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
99
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/participant/" + participantId + "/activity_event?" + queryParameters.toString(), this.configuration)];
|
|
106
|
+
case 1: return [2 /*return*/, (_b = (_c.sent()).data) === null || _b === void 0 ? void 0 : _b.map(function (x) { return Object.assign(new ActivityEvent_1.ActivityEvent(), x); })];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Get the set of all activity events produced by participants of any study conducted by a researcher, by researcher identifier.
|
|
113
|
+
* @param researcherId
|
|
114
|
+
* @param origin
|
|
115
|
+
* @param from
|
|
116
|
+
* @param to
|
|
117
|
+
*/
|
|
118
|
+
ActivityEventService.prototype.allByResearcher = function (researcherId, origin, from, to, limit, transform) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
+
var queryParameters, auth_2, credential, participants, fn_1, output;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
if (researcherId === null || researcherId === undefined)
|
|
125
|
+
throw new Error("Required parameter researcherId was null or undefined when calling activityEventAllByResearcher.");
|
|
126
|
+
queryParameters = new URLSearchParams();
|
|
127
|
+
if (origin !== undefined && origin !== null)
|
|
128
|
+
queryParameters.set("origin", origin);
|
|
129
|
+
if (from !== undefined && from !== null)
|
|
130
|
+
queryParameters.set("from", from);
|
|
131
|
+
if (to !== undefined && to !== null)
|
|
132
|
+
queryParameters.set("to", to);
|
|
133
|
+
if (limit !== undefined && limit !== null)
|
|
134
|
+
queryParameters.set("limit", limit);
|
|
135
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
136
|
+
auth_2 = (this.configuration.authorization || ":").split(":");
|
|
137
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_2[0] && x["secret_key"] === auth_2[1]; });
|
|
138
|
+
if (credential.length === 0)
|
|
139
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
140
|
+
if (researcherId === "me")
|
|
141
|
+
researcherId = credential.length > 0 ? credential[0]["origin"] : researcherId;
|
|
142
|
+
if (Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === researcherId; }).length > 0) {
|
|
143
|
+
participants = Demo_1.Demo.Study.filter(function (x) { return x["#parent"] === researcherId; })
|
|
144
|
+
.map(function (x) { return Demo_1.Demo.Participant.filter(function (y) { return y["#parent"] === x["id"]; }); })
|
|
145
|
+
.flat(1);
|
|
146
|
+
fn_1 = function (id) {
|
|
147
|
+
return Demo_1.Demo.ActivityEvent.filter(function (x) { return x["#parent"] === id && (!!origin ? x["activity"] === origin : true); }).map(function (x) {
|
|
148
|
+
return Object.assign(new ActivityEvent_1.ActivityEvent(), x);
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
output = participants.reduce(function (all, participant) {
|
|
152
|
+
var _a;
|
|
153
|
+
return (__assign(__assign({}, all), (_a = {}, _a[participant["id"]] = fn_1(participant["id"]), _a)));
|
|
154
|
+
}, {});
|
|
155
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
156
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/researcher/" + researcherId + "/activity_event?" + queryParameters.toString(), this.configuration)];
|
|
163
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) { return Object.assign(new ActivityEvent_1.ActivityEvent(), x); })];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Get the set of all activity events produced by participants of a single study, by study identifier.
|
|
170
|
+
* @param studyId
|
|
171
|
+
* @param origin
|
|
172
|
+
* @param from
|
|
173
|
+
* @param to
|
|
174
|
+
*/
|
|
175
|
+
ActivityEventService.prototype.allByStudy = function (studyId, origin, from, to, limit, transform) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
+
var queryParameters, auth_3, credential, participants, fn_2, output;
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
switch (_a.label) {
|
|
180
|
+
case 0:
|
|
181
|
+
if (studyId === null || studyId === undefined)
|
|
182
|
+
throw new Error("Required parameter studyId was null or undefined when calling activityEventAllByStudy.");
|
|
183
|
+
queryParameters = new URLSearchParams();
|
|
184
|
+
if (origin !== undefined && origin !== null)
|
|
185
|
+
queryParameters.set("origin", origin);
|
|
186
|
+
if (from !== undefined && from !== null)
|
|
187
|
+
queryParameters.set("from", from);
|
|
188
|
+
if (to !== undefined && to !== null)
|
|
189
|
+
queryParameters.set("to", to);
|
|
190
|
+
if (limit !== undefined && limit !== null)
|
|
191
|
+
queryParameters.set("limit", limit);
|
|
192
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
193
|
+
auth_3 = (this.configuration.authorization || ":").split(":");
|
|
194
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_3[0] && x["secret_key"] === auth_3[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
|
+
participants = Demo_1.Demo.Participant.filter(function (x) { return x["#parent"] === studyId; });
|
|
201
|
+
fn_2 = function (id) {
|
|
202
|
+
return Demo_1.Demo.ActivityEvent.filter(function (x) { return x["#parent"] === id && (!!origin ? x["activity"] === origin : true); }).map(function (x) {
|
|
203
|
+
return Object.assign(new ActivityEvent_1.ActivityEvent(), x);
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
output = participants.reduce(function (all, participant) {
|
|
207
|
+
var _a;
|
|
208
|
+
return (__assign(__assign({}, all), (_a = {}, _a[participant["id"]] = fn_2(participant["id"]), _a)));
|
|
209
|
+
}, {});
|
|
210
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
211
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/study/" + studyId + "/activity_event?" + queryParameters.toString(), this.configuration)];
|
|
218
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) { return Object.assign(new ActivityEvent_1.ActivityEvent(), x); })];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Create a new ActivityEvent for the given Participant.
|
|
225
|
+
* @param participantId
|
|
226
|
+
* @param activityEvent
|
|
227
|
+
*/
|
|
228
|
+
ActivityEventService.prototype.create = function (participantId, activityEvent) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
var auth_4, credential;
|
|
231
|
+
return __generator(this, function (_a) {
|
|
232
|
+
switch (_a.label) {
|
|
233
|
+
case 0:
|
|
234
|
+
if (participantId === null || participantId === undefined)
|
|
235
|
+
throw new Error("Required parameter participantId was null or undefined when calling activityEventCreate.");
|
|
236
|
+
if (activityEvent === null || activityEvent === undefined)
|
|
237
|
+
throw new Error("Required parameter activityEvent was null or undefined when calling activityEventCreate.");
|
|
238
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
239
|
+
auth_4 = (this.configuration.authorization || ":").split(":");
|
|
240
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_4[0] && x["secret_key"] === auth_4[1]; });
|
|
241
|
+
if (credential.length === 0)
|
|
242
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
243
|
+
if (participantId === "me")
|
|
244
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
245
|
+
if (Demo_1.Demo.Participant.filter(function (x) { return x["id"] === participantId; }).length > 0) {
|
|
246
|
+
Demo_1.Demo.ActivityEvent.push(__assign({ "#type": "ActivityEvent", "#parent": participantId }, activityEvent));
|
|
247
|
+
return [2 /*return*/, Promise.resolve({})];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/participant/" + participantId + "/activity_event", activityEvent, this.configuration)];
|
|
254
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Delete a ActivityEvent.
|
|
261
|
+
* @param participantId
|
|
262
|
+
* @param origin
|
|
263
|
+
* @param from
|
|
264
|
+
* @param to
|
|
265
|
+
*/
|
|
266
|
+
ActivityEventService.prototype.delete = function (participantId, origin, from, to) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
|
+
var queryParameters, auth_5, credential;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
if (participantId === null || participantId === undefined)
|
|
273
|
+
throw new Error("Required parameter participantId was null or undefined when calling activityEventDelete.");
|
|
274
|
+
queryParameters = new URLSearchParams();
|
|
275
|
+
if (origin !== undefined && origin !== null)
|
|
276
|
+
queryParameters.set("origin", origin);
|
|
277
|
+
if (from !== undefined && from !== null)
|
|
278
|
+
queryParameters.set("from", from);
|
|
279
|
+
if (to !== undefined && to !== null)
|
|
280
|
+
queryParameters.set("to", to);
|
|
281
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
282
|
+
auth_5 = (this.configuration.authorization || ":").split(":");
|
|
283
|
+
credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_5[0] && x["secret_key"] === auth_5[1]; });
|
|
284
|
+
if (credential.length === 0)
|
|
285
|
+
return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
|
|
286
|
+
if (participantId === "me")
|
|
287
|
+
participantId = credential.length > 0 ? credential[0]["origin"] : participantId;
|
|
288
|
+
if (Demo_1.Demo.Participant.filter(function (x) { return x["id"] === participantId; }).length > 0) {
|
|
289
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return [4 /*yield*/, Fetch_1.Fetch.delete("/participant/" + participantId + "/activity_event?" + queryParameters.toString(), this.configuration)];
|
|
296
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
return ActivityEventService;
|
|
302
|
+
}());
|
|
303
|
+
exports.ActivityEventService = ActivityEventService;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { ActivitySpec } from "../model/ActivitySpec";
|
|
3
|
+
import { Identifier } from "../model/Type";
|
|
4
|
+
export declare class ActivitySpecService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
* Get all ActivitySpecs registered.
|
|
8
|
+
*/
|
|
9
|
+
all(transform?: string): Promise<ActivitySpec[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new ActivitySpec.
|
|
12
|
+
* @param activitySpec
|
|
13
|
+
*/
|
|
14
|
+
create(activitySpec: ActivitySpec): Promise<Identifier>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete an ActivitySpec.
|
|
17
|
+
* @param activitySpecName
|
|
18
|
+
*/
|
|
19
|
+
delete(activitySpecName: Identifier): Promise<Identifier>;
|
|
20
|
+
/**
|
|
21
|
+
* Update an ActivitySpec.
|
|
22
|
+
* @param activitySpecName
|
|
23
|
+
* @param activitySpec
|
|
24
|
+
*/
|
|
25
|
+
update(activitySpecName: Identifier, activitySpec: ActivitySpec): Promise<Identifier>;
|
|
26
|
+
/**
|
|
27
|
+
* View an ActivitySpec.
|
|
28
|
+
* @param activitySpecName
|
|
29
|
+
*/
|
|
30
|
+
view(activitySpecName: string, transform?: string): Promise<ActivitySpec>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
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.ActivitySpecService = void 0;
|
|
43
|
+
var Fetch_1 = require("./Fetch");
|
|
44
|
+
var ActivitySpec_1 = require("../model/ActivitySpec");
|
|
45
|
+
var Demo_1 = require("./Demo");
|
|
46
|
+
var jsonata_1 = __importDefault(require("jsonata"));
|
|
47
|
+
var ActivitySpecService = /** @class */ (function () {
|
|
48
|
+
function ActivitySpecService() {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get all ActivitySpecs registered.
|
|
52
|
+
*/
|
|
53
|
+
ActivitySpecService.prototype.all = function (transform) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var output;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
60
|
+
output = Demo_1.Demo.ActivitySpec.map(function (x) { return Object.assign(new ActivitySpec_1.ActivitySpec(), x); });
|
|
61
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
62
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
63
|
+
}
|
|
64
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/activity_spec", this.configuration)];
|
|
65
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) {
|
|
66
|
+
return Object.assign(new ActivitySpec_1.ActivitySpec(), x);
|
|
67
|
+
})];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Create a new ActivitySpec.
|
|
74
|
+
* @param activitySpec
|
|
75
|
+
*/
|
|
76
|
+
ActivitySpecService.prototype.create = function (activitySpec) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
if (activitySpec === null || activitySpec === undefined)
|
|
82
|
+
throw new Error("Required parameter activitySpec was null or undefined when calling activitySpecCreate.");
|
|
83
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
84
|
+
// DEMO
|
|
85
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
86
|
+
}
|
|
87
|
+
return [4 /*yield*/, Fetch_1.Fetch.post("/activity_spec", activitySpec, this.configuration)];
|
|
88
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Delete an ActivitySpec.
|
|
95
|
+
* @param activitySpecName
|
|
96
|
+
*/
|
|
97
|
+
ActivitySpecService.prototype.delete = function (activitySpecName) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
if (activitySpecName === null || activitySpecName === undefined)
|
|
103
|
+
throw new Error("Required parameter activitySpecName was null or undefined when calling activitySpecDelete.");
|
|
104
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
105
|
+
// DEMO
|
|
106
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
107
|
+
}
|
|
108
|
+
return [4 /*yield*/, Fetch_1.Fetch.delete("/activity_spec/" + activitySpecName, this.configuration)];
|
|
109
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Update an ActivitySpec.
|
|
116
|
+
* @param activitySpecName
|
|
117
|
+
* @param activitySpec
|
|
118
|
+
*/
|
|
119
|
+
ActivitySpecService.prototype.update = function (activitySpecName, activitySpec) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
if (activitySpecName === null || activitySpecName === undefined)
|
|
125
|
+
throw new Error("Required parameter activitySpecName was null or undefined when calling activitySpecUpdate.");
|
|
126
|
+
if (activitySpec === null || activitySpec === undefined)
|
|
127
|
+
throw new Error("Required parameter activitySpec was null or undefined when calling activitySpecUpdate.");
|
|
128
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
129
|
+
// DEMO
|
|
130
|
+
return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
|
|
131
|
+
}
|
|
132
|
+
return [4 /*yield*/, Fetch_1.Fetch.put("/activity_spec/" + activitySpecName, activitySpec, this.configuration)];
|
|
133
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* View an ActivitySpec.
|
|
140
|
+
* @param activitySpecName
|
|
141
|
+
*/
|
|
142
|
+
ActivitySpecService.prototype.view = function (activitySpecName, transform) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var data, output;
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
if (activitySpecName === null || activitySpecName === undefined)
|
|
149
|
+
throw new Error("Required parameter activitySpecName was null or undefined when calling activitySpecView.");
|
|
150
|
+
if (this.configuration.base === "https://demo.lamp.digital") {
|
|
151
|
+
data = Demo_1.Demo.ActivitySpec.filter(function (x) { return x["name"] === activitySpecName; }).map(function (x) {
|
|
152
|
+
return Object.assign(new ActivitySpec_1.ActivitySpec(), x);
|
|
153
|
+
});
|
|
154
|
+
if (data.length > 0) {
|
|
155
|
+
output = data[0];
|
|
156
|
+
output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
|
|
157
|
+
return [2 /*return*/, Promise.resolve(output)];
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [4 /*yield*/, Fetch_1.Fetch.get("/activity_spec/" + activitySpecName, this.configuration)];
|
|
164
|
+
case 1: return [2 /*return*/, (_a.sent()).data.map(function (x) {
|
|
165
|
+
return Object.assign(new ActivitySpec_1.ActivitySpec(), x);
|
|
166
|
+
})[0]];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
return ActivitySpecService;
|
|
172
|
+
}());
|
|
173
|
+
exports.ActivitySpecService = ActivitySpecService;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Configuration } from "./Fetch";
|
|
2
|
+
import { Identifier } from "../model/Type";
|
|
3
|
+
import { Credential } from "../model/Credential";
|
|
4
|
+
export declare class CredentialService {
|
|
5
|
+
configuration?: Configuration;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param typeId
|
|
9
|
+
* @param secretKey
|
|
10
|
+
*/
|
|
11
|
+
create(typeId: Identifier, accessKey: string, secretKey: string, description?: string): Promise<Credential>;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param typeId
|
|
15
|
+
* @param accessKey
|
|
16
|
+
*/
|
|
17
|
+
delete(typeId: Identifier, accessKey: string): Promise<Identifier>;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param typeId
|
|
21
|
+
*/
|
|
22
|
+
list(typeId: Identifier, transform?: string): Promise<Credential[]>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param typeId
|
|
26
|
+
* @param accessKey
|
|
27
|
+
* @param secretKey
|
|
28
|
+
*/
|
|
29
|
+
update(typeId: Identifier, accessKey: string, secretKey: string, description?: string): Promise<Identifier>;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param accessKey
|
|
33
|
+
* @param secretKey
|
|
34
|
+
*/
|
|
35
|
+
login(accessKey: string, secretKey: string): Promise<any>;
|
|
36
|
+
renewToken(refreshToken: string, base: string): Promise<any>;
|
|
37
|
+
logout(token: string): Promise<any>;
|
|
38
|
+
}
|