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.
Files changed (130) hide show
  1. package/.github/workflows/publish.yml +34 -0
  2. package/LICENSE.md +29 -0
  3. package/MANUAL.md +26 -0
  4. package/README.md +126 -0
  5. package/cli.js +2 -0
  6. package/dist/index.d.ts +64 -0
  7. package/dist/index.js +311 -0
  8. package/dist/model/Activity.d.ts +81 -0
  9. package/dist/model/Activity.js +30 -0
  10. package/dist/model/ActivityEvent.d.ts +51 -0
  11. package/dist/model/ActivityEvent.js +21 -0
  12. package/dist/model/ActivitySpec.d.ts +38 -0
  13. package/dist/model/ActivitySpec.js +12 -0
  14. package/dist/model/Credential.d.ts +21 -0
  15. package/dist/model/Credential.js +12 -0
  16. package/dist/model/DynamicAttachment.d.ts +34 -0
  17. package/dist/model/DynamicAttachment.js +12 -0
  18. package/dist/model/Participant.d.ts +30 -0
  19. package/dist/model/Participant.js +12 -0
  20. package/dist/model/Researcher.d.ts +27 -0
  21. package/dist/model/Researcher.js +12 -0
  22. package/dist/model/ResearcherSettings.d.ts +57 -0
  23. package/dist/model/ResearcherSettings.js +12 -0
  24. package/dist/model/Sensor.d.ts +22 -0
  25. package/dist/model/Sensor.js +12 -0
  26. package/dist/model/SensorEvent.d.ts +18 -0
  27. package/dist/model/SensorEvent.js +12 -0
  28. package/dist/model/SensorSpec.d.ts +13 -0
  29. package/dist/model/SensorSpec.js +12 -0
  30. package/dist/model/Study.d.ts +24 -0
  31. package/dist/model/Study.js +12 -0
  32. package/dist/model/Type.d.ts +56 -0
  33. package/dist/model/Type.js +30 -0
  34. package/dist/model/index.d.ts +12 -0
  35. package/dist/model/index.js +24 -0
  36. package/dist/service/API.service.d.ts +12 -0
  37. package/dist/service/API.service.js +82 -0
  38. package/dist/service/Activity.service.d.ts +101 -0
  39. package/dist/service/Activity.service.js +756 -0
  40. package/dist/service/ActivityEvent.service.d.ts +46 -0
  41. package/dist/service/ActivityEvent.service.js +303 -0
  42. package/dist/service/ActivitySpec.service.d.ts +31 -0
  43. package/dist/service/ActivitySpec.service.js +173 -0
  44. package/dist/service/Credential.service.d.ts +38 -0
  45. package/dist/service/Credential.service.js +319 -0
  46. package/dist/service/Demo.d.ts +14 -0
  47. package/dist/service/Demo.js +24 -0
  48. package/dist/service/Fetch.d.ts +30 -0
  49. package/dist/service/Fetch.js +245 -0
  50. package/dist/service/Participant.service.d.ts +42 -0
  51. package/dist/service/Participant.service.js +312 -0
  52. package/dist/service/Researcher.service.d.ts +34 -0
  53. package/dist/service/Researcher.service.js +252 -0
  54. package/dist/service/ResearcherSettings.service.d.ts +16 -0
  55. package/dist/service/ResearcherSettings.service.js +114 -0
  56. package/dist/service/Sensor.service.d.ts +47 -0
  57. package/dist/service/Sensor.service.js +372 -0
  58. package/dist/service/SensorEvent.service.d.ts +44 -0
  59. package/dist/service/SensorEvent.service.js +302 -0
  60. package/dist/service/SensorSpec.service.d.ts +31 -0
  61. package/dist/service/SensorSpec.service.js +171 -0
  62. package/dist/service/Study.service.d.ts +42 -0
  63. package/dist/service/Study.service.js +286 -0
  64. package/dist/service/Type.service.d.ts +48 -0
  65. package/dist/service/Type.service.js +352 -0
  66. package/dist/service/index.d.ts +13 -0
  67. package/dist/service/index.js +25 -0
  68. package/docs/APIApi.md +82 -0
  69. package/docs/AccessCitation.md +11 -0
  70. package/docs/Activity.md +13 -0
  71. package/docs/ActivityApi.md +356 -0
  72. package/docs/ActivityEvent.md +13 -0
  73. package/docs/ActivityEventApi.md +251 -0
  74. package/docs/ActivitySpec.md +14 -0
  75. package/docs/ActivitySpecApi.md +222 -0
  76. package/docs/Credential.md +12 -0
  77. package/docs/CredentialApi.md +175 -0
  78. package/docs/Document.md +9 -0
  79. package/docs/DurationInterval.md +11 -0
  80. package/docs/DurationIntervalLegacy.md +10 -0
  81. package/docs/DynamicAttachment.md +14 -0
  82. package/docs/Error.md +8 -0
  83. package/docs/Metadata.md +8 -0
  84. package/docs/Participant.md +14 -0
  85. package/docs/ParticipantApi.md +312 -0
  86. package/docs/Researcher.md +12 -0
  87. package/docs/ResearcherApi.md +223 -0
  88. package/docs/Sensor.md +12 -0
  89. package/docs/SensorApi.md +356 -0
  90. package/docs/SensorEvent.md +11 -0
  91. package/docs/SensorEventApi.md +250 -0
  92. package/docs/SensorSpec.md +10 -0
  93. package/docs/SensorSpecApi.md +222 -0
  94. package/docs/Study.md +11 -0
  95. package/docs/StudyApi.md +268 -0
  96. package/docs/TemporalSlice.md +13 -0
  97. package/docs/TypeApi.md +274 -0
  98. package/package.json +44 -0
  99. package/src/index.ts +256 -0
  100. package/src/model/Activity.ts +93 -0
  101. package/src/model/ActivityEvent.ts +63 -0
  102. package/src/model/ActivitySpec.ts +45 -0
  103. package/src/model/Credential.ts +26 -0
  104. package/src/model/DynamicAttachment.ts +42 -0
  105. package/src/model/Participant.ts +37 -0
  106. package/src/model/Researcher.ts +33 -0
  107. package/src/model/ResearcherSettings.ts +65 -0
  108. package/src/model/Sensor.ts +27 -0
  109. package/src/model/SensorEvent.ts +22 -0
  110. package/src/model/SensorSpec.ts +16 -0
  111. package/src/model/Study.ts +29 -0
  112. package/src/model/Type.ts +68 -0
  113. package/src/model/index.ts +12 -0
  114. package/src/service/API.service.ts +29 -0
  115. package/src/service/Activity.service.ts +625 -0
  116. package/src/service/ActivityEvent.service.ts +244 -0
  117. package/src/service/ActivitySpec.service.ts +98 -0
  118. package/src/service/Credential.service.ts +268 -0
  119. package/src/service/Demo.ts +21 -0
  120. package/src/service/Fetch.ts +187 -0
  121. package/src/service/Participant.service.ts +217 -0
  122. package/src/service/Researcher.service.ts +147 -0
  123. package/src/service/ResearcherSettings.service.ts +62 -0
  124. package/src/service/Sensor.service.ts +256 -0
  125. package/src/service/SensorEvent.service.ts +239 -0
  126. package/src/service/SensorSpec.service.ts +96 -0
  127. package/src/service/Study.service.ts +187 -0
  128. package/src/service/Type.service.ts +297 -0
  129. package/src/service/index.ts +13 -0
  130. package/tsconfig.json +29 -0
@@ -0,0 +1,352 @@
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.TypeService = void 0;
43
+ var Fetch_1 = require("./Fetch");
44
+ var Demo_1 = require("./Demo");
45
+ var jsonata_1 = __importDefault(require("jsonata"));
46
+ var TypeService = /** @class */ (function () {
47
+ function TypeService() {
48
+ }
49
+ /**
50
+ *
51
+ * @param typeId
52
+ * @param attachmentKey
53
+ */
54
+ TypeService.prototype.getAttachment = function (typeId, attachmentKey) {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var auth_1, credential, exists_1, ancestors_1, tagSelf_1, tagParent_1, data;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ if (attachmentKey === null || attachmentKey === undefined)
61
+ throw new Error("Required parameter attachmentKey was null or undefined when calling typeGetAttachment.");
62
+ if (this.configuration.base === "https://demo.lamp.digital") {
63
+ auth_1 = (this.configuration.authorization || ":").split(":");
64
+ credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_1[0] && x["secret_key"] === auth_1[1]; });
65
+ if (credential.length === 0)
66
+ return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
67
+ if (typeId === "me")
68
+ typeId = credential.length > 0 ? credential[0]["origin"] : typeId;
69
+ exists_1 = [].concat(Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Study.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Participant.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Activity.filter(function (x) { return x["id"] === typeId; }) // ???
70
+ );
71
+ if (exists_1.length > 0) {
72
+ ancestors_1 = function (obj) {
73
+ return obj["#type"] === "Researcher"
74
+ ? []
75
+ : obj["#type"] === "Study"
76
+ ? [obj["#parent"]]
77
+ : obj["#type"] === "Participant"
78
+ ? [obj["#parent"], Demo_1.Demo.Study.filter(function (x) { return x["id"] === obj["#parent"]; }).map(function (x) { return x["#parent"]; })[0]]
79
+ : obj["#type"] === "Activity"
80
+ ? [obj["#parent"], Demo_1.Demo.Study.filter(function (x) { return x["id"] === obj["#parent"]; }).map(function (x) { return x["#parent"]; })[0]]
81
+ : [];
82
+ };
83
+ tagSelf_1 = function (tag) { return [typeId].includes(tag["#parent"]) && [typeId, "me"].includes(tag["target"]); } // implicit & explicit
84
+ ;
85
+ tagParent_1 = function (tag) {
86
+ return ancestors_1(exists_1[0]).includes(tag["#parent"]) && [typeId, exists_1[0]["#type"]].includes(tag["target"]);
87
+ } // implicit & explicit
88
+ ;
89
+ data = Demo_1.Demo.Tags.filter(function (x) { return (tagSelf_1(x) || tagParent_1(x)) && x["key"] === attachmentKey; });
90
+ return [2 /*return*/, Promise.resolve(data.length > 0 ? { data: data[0]["value"] } : { error: "404.not-found" })];
91
+ }
92
+ else {
93
+ return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
94
+ }
95
+ }
96
+ return [4 /*yield*/, Fetch_1.Fetch.get("/type/" + typeId + "/attachment/" + attachmentKey, this.configuration)];
97
+ case 1: return [2 /*return*/, _a.sent()];
98
+ }
99
+ });
100
+ });
101
+ };
102
+ /**
103
+ *
104
+ * @param typeId
105
+ * @param attachmentKey
106
+ * @param invokeAlways
107
+ * @param includeLogs
108
+ * @param ignoreOutput
109
+ */
110
+ TypeService.prototype.getDynamicAttachment = function (typeId, attachmentKey, invokeAlways, includeLogs, ignoreOutput) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var queryParameters;
113
+ return __generator(this, function (_a) {
114
+ switch (_a.label) {
115
+ case 0:
116
+ if (attachmentKey === null || attachmentKey === undefined)
117
+ throw new Error("Required parameter attachmentKey was null or undefined when calling typeGetDynamicAttachment.");
118
+ if (invokeAlways === null || invokeAlways === undefined)
119
+ throw new Error("Required parameter invokeAlways was null or undefined when calling typeGetDynamicAttachment.");
120
+ if (includeLogs === null || includeLogs === undefined)
121
+ throw new Error("Required parameter includeLogs was null or undefined when calling typeGetDynamicAttachment.");
122
+ if (ignoreOutput === null || ignoreOutput === undefined)
123
+ throw new Error("Required parameter ignoreOutput was null or undefined when calling typeGetDynamicAttachment.");
124
+ queryParameters = new URLSearchParams();
125
+ if (invokeAlways !== undefined && invokeAlways !== null)
126
+ queryParameters.set("invoke_always", invokeAlways);
127
+ if (includeLogs !== undefined && includeLogs !== null)
128
+ queryParameters.set("include_logs", includeLogs);
129
+ if (ignoreOutput !== undefined && ignoreOutput !== null)
130
+ queryParameters.set("ignore_output", ignoreOutput);
131
+ if (this.configuration.base === "https://demo.lamp.digital") {
132
+ // DEMO
133
+ return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
134
+ }
135
+ return [4 /*yield*/, Fetch_1.Fetch.get("/type/" + typeId + "/attachment/dynamic/" + attachmentKey + "?" + queryParameters.toString(), this.configuration)];
136
+ case 1: return [2 /*return*/, _a.sent()];
137
+ }
138
+ });
139
+ });
140
+ };
141
+ /**
142
+ *
143
+ * @param typeId
144
+ */
145
+ TypeService.prototype.listAttachments = function (typeId) {
146
+ return __awaiter(this, void 0, void 0, function () {
147
+ var auth_2, credential, exists_2, ancestors_2, tagSelf_2, tagParent_2;
148
+ return __generator(this, function (_a) {
149
+ switch (_a.label) {
150
+ case 0:
151
+ if (this.configuration.base === "https://demo.lamp.digital") {
152
+ auth_2 = (this.configuration.authorization || ":").split(":");
153
+ credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_2[0] && x["secret_key"] === auth_2[1]; });
154
+ if (credential.length === 0)
155
+ return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
156
+ if (typeId === "me")
157
+ typeId = credential.length > 0 ? credential[0]["origin"] : typeId;
158
+ exists_2 = [].concat(Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Study.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Participant.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Activity.filter(function (x) { return x["id"] === typeId; }) // ???
159
+ );
160
+ if (exists_2.length > 0) {
161
+ ancestors_2 = function (obj) {
162
+ return obj["#type"] === "Researcher"
163
+ ? []
164
+ : obj["#type"] === "Study"
165
+ ? [obj["#parent"]]
166
+ : obj["#type"] === "Participant"
167
+ ? [obj["#parent"], Demo_1.Demo.Study.filter(function (x) { return x["id"] === obj["#parent"]; }).map(function (x) { return x["#parent"]; })[0]]
168
+ : obj["#type"] === "Activity"
169
+ ? [obj["#parent"], Demo_1.Demo.Study.filter(function (x) { return x["id"] === obj["#parent"]; }).map(function (x) { return x["#parent"]; })[0]]
170
+ : [];
171
+ };
172
+ tagSelf_2 = function (tag) { return [typeId].includes(tag["#parent"]) && [typeId, "me"].includes(tag["target"]); } // implicit & explicit
173
+ ;
174
+ tagParent_2 = function (tag) {
175
+ return ancestors_2(exists_2[0]).includes(tag["#parent"]) && [typeId, exists_2[0]["#type"]].includes(tag["target"]);
176
+ } // implicit & explicit
177
+ ;
178
+ return [2 /*return*/, Promise.resolve({ data: Demo_1.Demo.Tags.filter(function (x) { return tagSelf_2(x) || tagParent_2(x); }).map(function (x) { return x.key; }) })];
179
+ }
180
+ else {
181
+ return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
182
+ }
183
+ }
184
+ return [4 /*yield*/, Fetch_1.Fetch.get("/type/" + typeId + "/attachment", this.configuration)];
185
+ case 1: return [2 /*return*/, _a.sent()];
186
+ }
187
+ });
188
+ });
189
+ };
190
+ /**
191
+ * Get the parent type identifier of the data structure referenced by the identifier.
192
+ * @param typeId
193
+ */
194
+ TypeService.prototype.parent = function (typeId, transform) {
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ var auth_3, credential, possible_1, output, output, output, output;
197
+ return __generator(this, function (_a) {
198
+ switch (_a.label) {
199
+ case 0:
200
+ if (this.configuration.base === "https://demo.lamp.digital") {
201
+ auth_3 = (this.configuration.authorization || ":").split(":");
202
+ credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_3[0] && x["secret_key"] === auth_3[1]; });
203
+ if (credential.length === 0)
204
+ return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
205
+ if (typeId === "me")
206
+ typeId = credential.length > 0 ? credential[0]["origin"] : typeId;
207
+ possible_1 = [];
208
+ possible_1 = Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === typeId; });
209
+ if (possible_1.length > 0) {
210
+ output = { data: {} };
211
+ output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
212
+ return [2 /*return*/, Promise.resolve(output)];
213
+ }
214
+ possible_1 = Demo_1.Demo.Study.filter(function (x) { return x["id"] === typeId; });
215
+ if (possible_1.length > 0) {
216
+ output = { data: { Researcher: possible_1[0]["#parent"] } };
217
+ output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
218
+ return [2 /*return*/, Promise.resolve(output)];
219
+ }
220
+ possible_1 = Demo_1.Demo.Participant.filter(function (x) { return x["id"] === typeId; });
221
+ if (possible_1.length > 0) {
222
+ output = {
223
+ data: {
224
+ Researcher: Demo_1.Demo.Study.filter(function (x) { return x["id"] === possible_1[0]["#parent"]; })[0],
225
+ Study: possible_1[0]["#parent"]
226
+ }
227
+ };
228
+ output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
229
+ return [2 /*return*/, Promise.resolve(output)];
230
+ }
231
+ possible_1 = Demo_1.Demo.Activity.filter(function (x) { return x["id"] === typeId; });
232
+ if (possible_1.length > 0) {
233
+ output = {
234
+ data: {
235
+ Researcher: Demo_1.Demo.Study.filter(function (x) { return x["id"] === possible_1[0]["#parent"]; })[0],
236
+ Study: possible_1[0]["#parent"]
237
+ }
238
+ };
239
+ output = typeof transform === "string" ? jsonata_1.default(transform).evaluate(output) : output;
240
+ return [2 /*return*/, Promise.resolve(output)];
241
+ }
242
+ return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
243
+ }
244
+ return [4 /*yield*/, Fetch_1.Fetch.get("/type/" + typeId + "/parent", this.configuration)];
245
+ case 1: return [2 /*return*/, _a.sent()];
246
+ }
247
+ });
248
+ });
249
+ };
250
+ /**
251
+ *
252
+ * @param typeId
253
+ * @param target
254
+ * @param attachmentKey
255
+ * @param attachmentValue
256
+ */
257
+ TypeService.prototype.setAttachment = function (typeId, target, attachmentKey, attachmentValue) {
258
+ return __awaiter(this, void 0, void 0, function () {
259
+ var auth_4, credential, exists, idx;
260
+ return __generator(this, function (_a) {
261
+ switch (_a.label) {
262
+ case 0:
263
+ if (target === null || target === undefined)
264
+ throw new Error("Required parameter target was null or undefined when calling typeSetAttachment.");
265
+ if (attachmentKey === null || attachmentKey === undefined)
266
+ throw new Error("Required parameter attachmentKey was null or undefined when calling typeSetAttachment.");
267
+ if (attachmentValue === undefined)
268
+ throw new Error("Required parameter attachmentValue was null or undefined when calling typeSetAttachment.");
269
+ if (this.configuration.base === "https://demo.lamp.digital") {
270
+ auth_4 = (this.configuration.authorization || ":").split(":");
271
+ credential = Demo_1.Demo.Credential.filter(function (x) { return x["access_key"] === auth_4[0] && x["secret_key"] === auth_4[1]; });
272
+ if (credential.length === 0)
273
+ return [2 /*return*/, Promise.resolve({ error: "403.invalid-credentials" })];
274
+ if (typeId === "me")
275
+ typeId = credential.length > 0 ? credential[0]["origin"] : typeId;
276
+ exists = [].concat(Demo_1.Demo.Researcher.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Study.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Participant.filter(function (x) { return x["id"] === typeId; }), Demo_1.Demo.Activity.filter(function (x) { return x["id"] === typeId; }) // ???
277
+ );
278
+ if (exists.length > 0) {
279
+ // FIXME: Sibling Tags? (Participant, Activity, Sensor)
280
+ if (attachmentValue === null) {
281
+ // DELETE
282
+ Demo_1.Demo.Tags = Demo_1.Demo.Tags.filter(function (x) { return !(x["#parent"] === typeId && x["target"] === target && x["key"] === attachmentKey); });
283
+ }
284
+ else {
285
+ idx = Demo_1.Demo.Tags.findIndex(function (x) { return x["#parent"] === typeId && x["target"] === target && x["key"] === attachmentKey; });
286
+ if (idx >= 0) {
287
+ // UPDATE
288
+ console.dir("update");
289
+ Demo_1.Demo.Tags[idx]["value"] = attachmentValue;
290
+ }
291
+ else {
292
+ // INSERT
293
+ console.dir("insert");
294
+ Demo_1.Demo.Tags.push({
295
+ "#type": "Tag",
296
+ "#parent": typeId,
297
+ target: target,
298
+ key: attachmentKey,
299
+ value: attachmentValue
300
+ });
301
+ }
302
+ }
303
+ return [2 /*return*/, Promise.resolve({})];
304
+ }
305
+ else {
306
+ return [2 /*return*/, Promise.resolve({ error: "404.not-found" })];
307
+ }
308
+ }
309
+ return [4 /*yield*/, Fetch_1.Fetch.put("/type/" + typeId + "/attachment/" + attachmentKey + "/" + target, attachmentValue, this.configuration)];
310
+ case 1: return [2 /*return*/, _a.sent()];
311
+ }
312
+ });
313
+ });
314
+ };
315
+ /**
316
+ *
317
+ * @param invokeOnce
318
+ * @param typeId
319
+ * @param target
320
+ * @param attachmentKey
321
+ * @param attachmentValue
322
+ */
323
+ TypeService.prototype.setDynamicAttachment = function (invokeOnce, typeId, target, attachmentKey, attachmentValue) {
324
+ return __awaiter(this, void 0, void 0, function () {
325
+ var queryParameters;
326
+ return __generator(this, function (_a) {
327
+ switch (_a.label) {
328
+ case 0:
329
+ if (invokeOnce === null || invokeOnce === undefined)
330
+ throw new Error("Required parameter invokeOnce was null or undefined when calling typeSetDynamicAttachment.");
331
+ if (target === null || target === undefined)
332
+ throw new Error("Required parameter target was null or undefined when calling typeSetDynamicAttachment.");
333
+ if (attachmentKey === null || attachmentKey === undefined)
334
+ throw new Error("Required parameter attachmentKey was null or undefined when calling typeSetDynamicAttachment.");
335
+ if (attachmentValue === null || attachmentValue === undefined)
336
+ throw new Error("Required parameter attachmentValue was null or undefined when calling typeSetDynamicAttachment.");
337
+ queryParameters = new URLSearchParams();
338
+ if (invokeOnce !== undefined && invokeOnce !== null)
339
+ queryParameters.set("invoke_once", invokeOnce);
340
+ if (this.configuration.base === "https://demo.lamp.digital") {
341
+ // DEMO
342
+ return [2 /*return*/, Promise.resolve({ error: "500.demo-restriction" })];
343
+ }
344
+ return [4 /*yield*/, Fetch_1.Fetch.put("/type/" + typeId + "/attachment/dynamic/" + attachmentKey + "/" + target + "?" + queryParameters.toString(), attachmentValue, this.configuration)];
345
+ case 1: return [2 /*return*/, _a.sent()];
346
+ }
347
+ });
348
+ });
349
+ };
350
+ return TypeService;
351
+ }());
352
+ exports.TypeService = TypeService;
@@ -0,0 +1,13 @@
1
+ export * from "./Activity.service";
2
+ export * from "./ActivityEvent.service";
3
+ export * from "./ActivitySpec.service";
4
+ export * from "./Credential.service";
5
+ export * from "./Participant.service";
6
+ export * from "./Researcher.service";
7
+ export * from "./ResearcherSettings.service";
8
+ export * from "./Sensor.service";
9
+ export * from "./SensorEvent.service";
10
+ export * from "./SensorSpec.service";
11
+ export * from "./Study.service";
12
+ export * from "./Type.service";
13
+ export * from "./API.service";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Activity.service"), exports);
14
+ __exportStar(require("./ActivityEvent.service"), exports);
15
+ __exportStar(require("./ActivitySpec.service"), exports);
16
+ __exportStar(require("./Credential.service"), exports);
17
+ __exportStar(require("./Participant.service"), exports);
18
+ __exportStar(require("./Researcher.service"), exports);
19
+ __exportStar(require("./ResearcherSettings.service"), exports);
20
+ __exportStar(require("./Sensor.service"), exports);
21
+ __exportStar(require("./SensorEvent.service"), exports);
22
+ __exportStar(require("./SensorSpec.service"), exports);
23
+ __exportStar(require("./Study.service"), exports);
24
+ __exportStar(require("./Type.service"), exports);
25
+ __exportStar(require("./API.service"), exports);
package/docs/APIApi.md ADDED
@@ -0,0 +1,82 @@
1
+ # LAMP.API
2
+
3
+ Method | HTTP request | Description
4
+ ------------- | ------------- | -------------
5
+ [**query**](APIApi.md#query) | **POST** / | Query the LAMP Database.
6
+ [**schema**](APIApi.md#schema) | **GET** / | View the API schema document.
7
+
8
+
9
+ # **query**
10
+ > object query(body)
11
+
12
+ Query the LAMP Database.
13
+
14
+ Query the LAMP Database using a transformation document. All GET operations in this API schema document are available by replacing the period with an underscore (i.e. `.Participant_view(...)` instead of `Participant.view(...)`). The `origin`, `from`, and `to` parameters of EventStream functions are preserved but the `transform` parameter is not.
15
+
16
+ ### Example
17
+ ```javascript
18
+ import LAMP from 'lamp-core'
19
+
20
+ // Query the LAMP Database.
21
+ const result = LAMP.API.query(`jsonata_query_example`)
22
+ console.dir(result)
23
+ ```
24
+
25
+ ### Parameters
26
+
27
+ Name | Type | Description | Notes
28
+ ------------- | ------------- | ------------- | -------------
29
+ **body** | **string**| |
30
+
31
+ ### Return type
32
+
33
+ **object**
34
+
35
+ ### HTTP request headers
36
+
37
+ - **Content-Type**: text/plain, application/json
38
+ - **Accept**: `application/json`
39
+
40
+ ### HTTP response details
41
+ | Status code | Description | Response headers |
42
+ |-------------|-------------|------------------|
43
+ | **200** | 200 Success | - |
44
+ | **0** | 400 Bad Request | - |
45
+
46
+ # **schema**
47
+ > object schema()
48
+
49
+ View the API schema document.
50
+
51
+ View this API schema document from a live server instance.
52
+
53
+ ### Example
54
+ ```javascript
55
+ import LAMP from 'lamp-core'
56
+
57
+ // View the API schema document.
58
+ const result = LAMP.API.schema()
59
+ console.dir(result)
60
+ ```
61
+
62
+ ### Parameters
63
+ This endpoint does not need any parameter.
64
+
65
+ ### Return type
66
+
67
+ **object**
68
+
69
+ ### Authorization
70
+
71
+ No authorization required
72
+
73
+ ### HTTP request headers
74
+
75
+ - **Content-Type**: `application/json`
76
+ - **Accept**: `application/json`
77
+
78
+ ### HTTP response details
79
+ | Status code | Description | Response headers |
80
+ |-------------|-------------|------------------|
81
+ | **200** | 200 Success | - |
82
+
@@ -0,0 +1,11 @@
1
+ # LAMP.AccessCitation
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **in** | **string** | | [optional]
7
+ **at** | **string** | | [optional]
8
+ **on** | **number** | The UNIX Epoch date-time representation: number of milliseconds since 1/1/1970 12:00 AM. | [optional]
9
+ **by** | **string** | | [optional]
10
+
11
+
@@ -0,0 +1,13 @@
1
+ # LAMP.Activity
2
+
3
+ An activity that may be performed by a participant in a study.
4
+ ## Properties
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **id** | **string** | A globally unique reference for objects. | [optional]
8
+ **spec** | **string** | A globally unique reference for objects. | [optional]
9
+ **name** | **string** | The name of the activity. | [optional]
10
+ **schedule** | [**DurationIntervalLegacy**](DurationIntervalLegacy.md) | | [optional]
11
+ **settings** | [**object**](.md) | The configuration settings for the activity. | [optional]
12
+
13
+