@openhi/constructs 0.0.107 → 0.0.109
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/lib/chunk-2TPJ6HOF.mjs +289 -0
- package/lib/chunk-2TPJ6HOF.mjs.map +1 -0
- package/lib/{chunk-L6UAP4KP.mjs → chunk-7FUAMZOF.mjs} +3 -3
- package/lib/{chunk-36UPY7YQ.mjs → chunk-7Q2IJ2J5.mjs} +5 -5
- package/lib/{chunk-YU2HRNUP.mjs → chunk-AJ3G3THO.mjs} +2 -2
- package/lib/chunk-BB5MK4L3.mjs +96 -0
- package/lib/chunk-BB5MK4L3.mjs.map +1 -0
- package/lib/chunk-IS4VQRI4.mjs +1390 -0
- package/lib/chunk-IS4VQRI4.mjs.map +1 -0
- package/lib/{chunk-AO3E22CS.mjs → chunk-MULKGFIJ.mjs} +74 -4
- package/lib/chunk-MULKGFIJ.mjs.map +1 -0
- package/lib/{chunk-VYDIGFIX.mjs → chunk-QR5JVSCF.mjs} +11 -1
- package/lib/chunk-QR5JVSCF.mjs.map +1 -0
- package/lib/index.js +1043 -5
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +5 -5
- package/lib/pre-token-generation.handler.js +1360 -11
- package/lib/pre-token-generation.handler.js.map +1 -1
- package/lib/pre-token-generation.handler.mjs +102 -5
- package/lib/pre-token-generation.handler.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +1189 -15
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +4 -5
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +4374 -3691
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +2110 -2756
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.js +1173 -9
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +5 -5
- package/lib/seed-system-data.handler.js +10 -0
- package/lib/seed-system-data.handler.js.map +1 -1
- package/lib/seed-system-data.handler.mjs +2 -2
- package/package.json +1 -1
- package/lib/chunk-AO3E22CS.mjs.map +0 -1
- package/lib/chunk-CHPEQRXU.mjs +0 -45
- package/lib/chunk-CHPEQRXU.mjs.map +0 -1
- package/lib/chunk-JUNL76HF.mjs +0 -428
- package/lib/chunk-JUNL76HF.mjs.map +0 -1
- package/lib/chunk-VYDIGFIX.mjs.map +0 -1
- package/lib/chunk-YZZDUJHI.mjs +0 -37
- package/lib/chunk-YZZDUJHI.mjs.map +0 -1
- /package/lib/{chunk-L6UAP4KP.mjs.map → chunk-7FUAMZOF.mjs.map} +0 -0
- /package/lib/{chunk-36UPY7YQ.mjs.map → chunk-7Q2IJ2J5.mjs.map} +0 -0
- /package/lib/{chunk-YU2HRNUP.mjs.map → chunk-AJ3G3THO.mjs.map} +0 -0
|
@@ -0,0 +1,1390 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHARD_COUNT,
|
|
3
|
+
computeShard,
|
|
4
|
+
defaultTableName,
|
|
5
|
+
dynamoClient
|
|
6
|
+
} from "./chunk-QR5JVSCF.mjs";
|
|
7
|
+
|
|
8
|
+
// src/data/errors/domain-errors.ts
|
|
9
|
+
var DomainError = class extends Error {
|
|
10
|
+
constructor(message, code, options) {
|
|
11
|
+
super(message, options);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.details = options?.details;
|
|
15
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var NotFoundError = class extends DomainError {
|
|
19
|
+
constructor(message, options) {
|
|
20
|
+
super(message, "NOT_FOUND", options);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var ValidationError = class extends DomainError {
|
|
24
|
+
constructor(message, options) {
|
|
25
|
+
super(message, "VALIDATION", options);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var ConflictError = class extends DomainError {
|
|
29
|
+
constructor(message, options) {
|
|
30
|
+
super(message, "CONFLICT", options);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var ForbiddenError = class extends DomainError {
|
|
34
|
+
constructor(message, options) {
|
|
35
|
+
super(message, "FORBIDDEN", options);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function domainErrorToHttpStatus(err) {
|
|
39
|
+
if (err instanceof NotFoundError) return 404;
|
|
40
|
+
if (err instanceof ValidationError) return 400;
|
|
41
|
+
if (err instanceof ConflictError) return 409;
|
|
42
|
+
if (err instanceof ForbiddenError) return 403;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/data/dynamo/dynamo-data-service.ts
|
|
47
|
+
import { Service } from "electrodb";
|
|
48
|
+
|
|
49
|
+
// src/data/dynamo/entities/data-entity-common.ts
|
|
50
|
+
import { Entity } from "electrodb";
|
|
51
|
+
var dataEntityAttributes = {
|
|
52
|
+
/** Sort key. "CURRENT" for current version; version history in S3. */
|
|
53
|
+
sk: {
|
|
54
|
+
type: "string",
|
|
55
|
+
required: true,
|
|
56
|
+
default: "CURRENT"
|
|
57
|
+
},
|
|
58
|
+
tenantId: {
|
|
59
|
+
type: "string",
|
|
60
|
+
required: true
|
|
61
|
+
},
|
|
62
|
+
workspaceId: {
|
|
63
|
+
type: "string",
|
|
64
|
+
required: true
|
|
65
|
+
},
|
|
66
|
+
/** FHIR Resource.id; logical id in URL and PK. */
|
|
67
|
+
id: {
|
|
68
|
+
type: "string",
|
|
69
|
+
required: true
|
|
70
|
+
},
|
|
71
|
+
/** FHIR resource as JSON string. JSON.stringify(resource) on write; JSON.parse(item.resource) on read. */
|
|
72
|
+
resource: {
|
|
73
|
+
type: "string",
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Summary projection of the FHIR resource as a JSON string (uncompressed). Populated on every
|
|
78
|
+
* write via `extractSummary(resource)` so GSI projections can surface list/lookup data without
|
|
79
|
+
* reading the compressed `resource` blob. Kept uncompressed because the summary is small and
|
|
80
|
+
* must be fast to retrieve without encode/decode overhead.
|
|
81
|
+
*
|
|
82
|
+
* @see sites/www-docs/content/architecture/adr/2026-04-17-02-fhir-summary-projection-for-gsi-access-patterns.md
|
|
83
|
+
*/
|
|
84
|
+
summary: {
|
|
85
|
+
type: "string",
|
|
86
|
+
required: true
|
|
87
|
+
},
|
|
88
|
+
/** Version id (e.g. ULID). Tracks current version; S3 history key. */
|
|
89
|
+
vid: {
|
|
90
|
+
type: "string",
|
|
91
|
+
required: true
|
|
92
|
+
},
|
|
93
|
+
lastUpdated: {
|
|
94
|
+
type: "string",
|
|
95
|
+
required: true
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Shard index segment for the GSI1 partition key. Computed deterministically from `id`
|
|
99
|
+
* via `computeShard` so updates always land on the same shard. Stored as a string because
|
|
100
|
+
* it appears as a literal segment in the GSI1 PK template; the underlying value is 0..3.
|
|
101
|
+
* Not `required` because the value is derived via `watch`/`set`; ElectroDB's required-field
|
|
102
|
+
* check runs before watch propagation, so callers must not fail validation on a derived field.
|
|
103
|
+
*
|
|
104
|
+
* @see sites/www-docs/content/packages/@openhi/constructs/data/dynamo/single-table-design.md — GSI1 (sharded)
|
|
105
|
+
*/
|
|
106
|
+
gsi1Shard: {
|
|
107
|
+
type: "string",
|
|
108
|
+
watch: ["id"],
|
|
109
|
+
set: (_val, item) => {
|
|
110
|
+
if (typeof item?.id !== "string" || item.id.length === 0) {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
return String(computeShard(item.id));
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* GSI1 sort key. Written as the index's SK verbatim so list endpoints can
|
|
118
|
+
* use `BEGINS_WITH` for prefix queries (e.g. `?name=Sm` against Patient).
|
|
119
|
+
* Computed at write time via `extractSortKey(resource)` per DR-004:
|
|
120
|
+
* - Labeled types (LABEL_PATHS): `<normalizedLabel>#<id>`
|
|
121
|
+
* - Unlabeled types: `<ISO-8601 lastUpdated>#<id>`
|
|
122
|
+
* The factory deliberately does not derive this from `lastUpdated`/`id`
|
|
123
|
+
* — that would lock every type into the unlabeled fallback and defeat
|
|
124
|
+
* label-based BEGINS_WITH on labeled types.
|
|
125
|
+
*
|
|
126
|
+
* @see openhi-planning DR-004
|
|
127
|
+
*/
|
|
128
|
+
gsi1sk: {
|
|
129
|
+
type: "string",
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
deleted: {
|
|
133
|
+
type: "boolean",
|
|
134
|
+
required: false
|
|
135
|
+
},
|
|
136
|
+
bundleId: {
|
|
137
|
+
type: "string",
|
|
138
|
+
required: false
|
|
139
|
+
},
|
|
140
|
+
msgId: {
|
|
141
|
+
type: "string",
|
|
142
|
+
required: false
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
function createDataEntity(entity, resourceTypeLabel) {
|
|
146
|
+
return new Entity({
|
|
147
|
+
model: {
|
|
148
|
+
entity,
|
|
149
|
+
service: "data",
|
|
150
|
+
version: "01"
|
|
151
|
+
},
|
|
152
|
+
attributes: dataEntityAttributes,
|
|
153
|
+
indexes: {
|
|
154
|
+
/** Base table: PK, SK (data store key names). PK is built from tenantId, workspaceId, id. */
|
|
155
|
+
record: {
|
|
156
|
+
pk: {
|
|
157
|
+
field: "PK",
|
|
158
|
+
composite: ["tenantId", "workspaceId", "id"],
|
|
159
|
+
template: `TID#\${tenantId}#WID#\${workspaceId}#RT#${resourceTypeLabel}#ID#\${id}`
|
|
160
|
+
},
|
|
161
|
+
sk: {
|
|
162
|
+
field: "SK",
|
|
163
|
+
composite: ["sk"]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* GSI1 — Unified Sharded List: list all resources of this type in a workspace; reads fan
|
|
168
|
+
* out across the four shards and merge by SK. SK is the writer-supplied `gsi1sk` verbatim
|
|
169
|
+
* (per DR-004) so labeled types serve `BEGINS_WITH` prefix queries on the natural label.
|
|
170
|
+
* `casing: "none"` is required on the SK because the writer (`extractSortKey`) already
|
|
171
|
+
* applies DR-004 normalization — ElectroDB's default lowercasing would mangle the
|
|
172
|
+
* ISO-8601 unlabeled fallback (`T`/`Z` → `t`/`z`).
|
|
173
|
+
*/
|
|
174
|
+
gsi1: {
|
|
175
|
+
index: "GSI1",
|
|
176
|
+
pk: {
|
|
177
|
+
field: "GSI1PK",
|
|
178
|
+
composite: ["tenantId", "workspaceId", "gsi1Shard"],
|
|
179
|
+
template: `TID#\${tenantId}#WID#\${workspaceId}#RT#${resourceTypeLabel}#SHARD#\${gsi1Shard}`
|
|
180
|
+
},
|
|
181
|
+
sk: {
|
|
182
|
+
field: "GSI1SK",
|
|
183
|
+
casing: "none",
|
|
184
|
+
composite: ["gsi1sk"],
|
|
185
|
+
template: `\${gsi1sk}`
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/data/dynamo/entities/data/account-entity.ts
|
|
193
|
+
var AccountEntity = createDataEntity("account", "Account");
|
|
194
|
+
|
|
195
|
+
// src/data/dynamo/entities/data/activity-definition-entity.ts
|
|
196
|
+
var ActivityDefinitionEntity = createDataEntity(
|
|
197
|
+
"activitydefinition",
|
|
198
|
+
"ActivityDefinition"
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
// src/data/dynamo/entities/data/adverse-event-entity.ts
|
|
202
|
+
var AdverseEventEntity = createDataEntity(
|
|
203
|
+
"adverseevent",
|
|
204
|
+
"AdverseEvent"
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
// src/data/dynamo/entities/data/allergy-intolerance-entity.ts
|
|
208
|
+
var AllergyIntoleranceEntity = createDataEntity(
|
|
209
|
+
"allergyintolerance",
|
|
210
|
+
"AllergyIntolerance"
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
// src/data/dynamo/entities/data/appointment-entity.ts
|
|
214
|
+
var AppointmentEntity = createDataEntity("appointment", "Appointment");
|
|
215
|
+
|
|
216
|
+
// src/data/dynamo/entities/data/appointment-response-entity.ts
|
|
217
|
+
var AppointmentResponseEntity = createDataEntity(
|
|
218
|
+
"appointmentresponse",
|
|
219
|
+
"AppointmentResponse"
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
// src/data/dynamo/entities/data/audit-event-entity.ts
|
|
223
|
+
var AuditEventEntity = createDataEntity("auditevent", "AuditEvent");
|
|
224
|
+
|
|
225
|
+
// src/data/dynamo/entities/data/basic-entity.ts
|
|
226
|
+
var BasicEntity = createDataEntity("basic", "Basic");
|
|
227
|
+
|
|
228
|
+
// src/data/dynamo/entities/data/biologically-derived-product-entity.ts
|
|
229
|
+
var BiologicallyDerivedProductEntity = createDataEntity(
|
|
230
|
+
"biologicallyderivedproduct",
|
|
231
|
+
"BiologicallyDerivedProduct"
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
// src/data/dynamo/entities/data/body-structure-entity.ts
|
|
235
|
+
var BodyStructureEntity = createDataEntity(
|
|
236
|
+
"bodystructure",
|
|
237
|
+
"BodyStructure"
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
// src/data/dynamo/entities/data/capability-statement-entity.ts
|
|
241
|
+
var CapabilityStatementEntity = createDataEntity(
|
|
242
|
+
"capabilitystatement",
|
|
243
|
+
"CapabilityStatement"
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
// src/data/dynamo/entities/data/care-plan-entity.ts
|
|
247
|
+
var CarePlanEntity = createDataEntity("careplan", "CarePlan");
|
|
248
|
+
|
|
249
|
+
// src/data/dynamo/entities/data/care-team-entity.ts
|
|
250
|
+
var CareTeamEntity = createDataEntity("careteam", "CareTeam");
|
|
251
|
+
|
|
252
|
+
// src/data/dynamo/entities/data/catalog-entry-entity.ts
|
|
253
|
+
var CatalogEntryEntity = createDataEntity(
|
|
254
|
+
"catalogentry",
|
|
255
|
+
"CatalogEntry"
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
// src/data/dynamo/entities/data/charge-item-definition-entity.ts
|
|
259
|
+
var ChargeItemDefinitionEntity = createDataEntity(
|
|
260
|
+
"chargeitemdefinition",
|
|
261
|
+
"ChargeItemDefinition"
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
// src/data/dynamo/entities/data/charge-item-entity.ts
|
|
265
|
+
var ChargeItemEntity = createDataEntity("chargeitem", "ChargeItem");
|
|
266
|
+
|
|
267
|
+
// src/data/dynamo/entities/data/claim-entity.ts
|
|
268
|
+
var ClaimEntity = createDataEntity("claim", "Claim");
|
|
269
|
+
|
|
270
|
+
// src/data/dynamo/entities/data/claim-response-entity.ts
|
|
271
|
+
var ClaimResponseEntity = createDataEntity(
|
|
272
|
+
"claimresponse",
|
|
273
|
+
"ClaimResponse"
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
// src/data/dynamo/entities/data/clinical-impression-entity.ts
|
|
277
|
+
var ClinicalImpressionEntity = createDataEntity(
|
|
278
|
+
"clinicalimpression",
|
|
279
|
+
"ClinicalImpression"
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// src/data/dynamo/entities/data/code-system-entity.ts
|
|
283
|
+
var CodeSystemEntity = createDataEntity("codesystem", "CodeSystem");
|
|
284
|
+
|
|
285
|
+
// src/data/dynamo/entities/data/communication-entity.ts
|
|
286
|
+
var CommunicationEntity = createDataEntity(
|
|
287
|
+
"communication",
|
|
288
|
+
"Communication"
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
// src/data/dynamo/entities/data/communication-request-entity.ts
|
|
292
|
+
var CommunicationRequestEntity = createDataEntity(
|
|
293
|
+
"communicationrequest",
|
|
294
|
+
"CommunicationRequest"
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
// src/data/dynamo/entities/data/compartment-definition-entity.ts
|
|
298
|
+
var CompartmentDefinitionEntity = createDataEntity(
|
|
299
|
+
"compartmentdefinition",
|
|
300
|
+
"CompartmentDefinition"
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// src/data/dynamo/entities/data/composition-entity.ts
|
|
304
|
+
var CompositionEntity = createDataEntity("composition", "Composition");
|
|
305
|
+
|
|
306
|
+
// src/data/dynamo/entities/data/concept-map-entity.ts
|
|
307
|
+
var ConceptMapEntity = createDataEntity("conceptmap", "ConceptMap");
|
|
308
|
+
|
|
309
|
+
// src/data/dynamo/entities/data/condition-entity.ts
|
|
310
|
+
var ConditionEntity = createDataEntity("condition", "Condition");
|
|
311
|
+
|
|
312
|
+
// src/data/dynamo/entities/data/consent-entity.ts
|
|
313
|
+
var ConsentEntity = createDataEntity("consent", "Consent");
|
|
314
|
+
|
|
315
|
+
// src/data/dynamo/entities/data/contract-entity.ts
|
|
316
|
+
var ContractEntity = createDataEntity("contract", "Contract");
|
|
317
|
+
|
|
318
|
+
// src/data/dynamo/entities/data/coverage-eligibility-request-entity.ts
|
|
319
|
+
var CoverageEligibilityRequestEntity = createDataEntity(
|
|
320
|
+
"coverageeligibilityrequest",
|
|
321
|
+
"CoverageEligibilityRequest"
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
// src/data/dynamo/entities/data/coverage-eligibility-response-entity.ts
|
|
325
|
+
var CoverageEligibilityResponseEntity = createDataEntity(
|
|
326
|
+
"coverageeligibilityresponse",
|
|
327
|
+
"CoverageEligibilityResponse"
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
// src/data/dynamo/entities/data/coverage-entity.ts
|
|
331
|
+
var CoverageEntity = createDataEntity("coverage", "Coverage");
|
|
332
|
+
|
|
333
|
+
// src/data/dynamo/entities/data/detected-issue-entity.ts
|
|
334
|
+
var DetectedIssueEntity = createDataEntity(
|
|
335
|
+
"detectedissue",
|
|
336
|
+
"DetectedIssue"
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// src/data/dynamo/entities/data/device-definition-entity.ts
|
|
340
|
+
var DeviceDefinitionEntity = createDataEntity(
|
|
341
|
+
"devicedefinition",
|
|
342
|
+
"DeviceDefinition"
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
// src/data/dynamo/entities/data/device-entity.ts
|
|
346
|
+
var DeviceEntity = createDataEntity("device", "Device");
|
|
347
|
+
|
|
348
|
+
// src/data/dynamo/entities/data/device-metric-entity.ts
|
|
349
|
+
var DeviceMetricEntity = createDataEntity(
|
|
350
|
+
"devicemetric",
|
|
351
|
+
"DeviceMetric"
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
// src/data/dynamo/entities/data/device-request-entity.ts
|
|
355
|
+
var DeviceRequestEntity = createDataEntity(
|
|
356
|
+
"devicerequest",
|
|
357
|
+
"DeviceRequest"
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
// src/data/dynamo/entities/data/device-use-statement-entity.ts
|
|
361
|
+
var DeviceUseStatementEntity = createDataEntity(
|
|
362
|
+
"deviceusestatement",
|
|
363
|
+
"DeviceUseStatement"
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
// src/data/dynamo/entities/data/diagnostic-report-entity.ts
|
|
367
|
+
var DiagnosticReportEntity = createDataEntity(
|
|
368
|
+
"diagnosticreport",
|
|
369
|
+
"DiagnosticReport"
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
// src/data/dynamo/entities/data/document-manifest-entity.ts
|
|
373
|
+
var DocumentManifestEntity = createDataEntity(
|
|
374
|
+
"documentmanifest",
|
|
375
|
+
"DocumentManifest"
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
// src/data/dynamo/entities/data/document-reference-entity.ts
|
|
379
|
+
var DocumentReferenceEntity = createDataEntity(
|
|
380
|
+
"documentreference",
|
|
381
|
+
"DocumentReference"
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
// src/data/dynamo/entities/data/effect-evidence-synthesis-entity.ts
|
|
385
|
+
var EffectEvidenceSynthesisEntity = createDataEntity(
|
|
386
|
+
"effectevidencesynthesis",
|
|
387
|
+
"EffectEvidenceSynthesis"
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
// src/data/dynamo/entities/data/encounter-entity.ts
|
|
391
|
+
var EncounterEntity = createDataEntity("encounter", "Encounter");
|
|
392
|
+
|
|
393
|
+
// src/data/dynamo/entities/data/endpoint-entity.ts
|
|
394
|
+
var EndpointEntity = createDataEntity("endpoint", "Endpoint");
|
|
395
|
+
|
|
396
|
+
// src/data/dynamo/entities/data/enrollment-request-entity.ts
|
|
397
|
+
var EnrollmentRequestEntity = createDataEntity(
|
|
398
|
+
"enrollmentrequest",
|
|
399
|
+
"EnrollmentRequest"
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
// src/data/dynamo/entities/data/enrollment-response-entity.ts
|
|
403
|
+
var EnrollmentResponseEntity = createDataEntity(
|
|
404
|
+
"enrollmentresponse",
|
|
405
|
+
"EnrollmentResponse"
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
// src/data/dynamo/entities/data/episode-of-care-entity.ts
|
|
409
|
+
var EpisodeOfCareEntity = createDataEntity(
|
|
410
|
+
"episodeofcare",
|
|
411
|
+
"EpisodeOfCare"
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
// src/data/dynamo/entities/data/event-definition-entity.ts
|
|
415
|
+
var EventDefinitionEntity = createDataEntity(
|
|
416
|
+
"eventdefinition",
|
|
417
|
+
"EventDefinition"
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
// src/data/dynamo/entities/data/evidence-entity.ts
|
|
421
|
+
var EvidenceEntity = createDataEntity("evidence", "Evidence");
|
|
422
|
+
|
|
423
|
+
// src/data/dynamo/entities/data/evidence-variable-entity.ts
|
|
424
|
+
var EvidenceVariableEntity = createDataEntity(
|
|
425
|
+
"evidencevariable",
|
|
426
|
+
"EvidenceVariable"
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
// src/data/dynamo/entities/data/example-scenario-entity.ts
|
|
430
|
+
var ExampleScenarioEntity = createDataEntity(
|
|
431
|
+
"examplescenario",
|
|
432
|
+
"ExampleScenario"
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
// src/data/dynamo/entities/data/explanation-of-benefit-entity.ts
|
|
436
|
+
var ExplanationOfBenefitEntity = createDataEntity(
|
|
437
|
+
"explanationofbenefit",
|
|
438
|
+
"ExplanationOfBenefit"
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
// src/data/dynamo/entities/data/family-member-history-entity.ts
|
|
442
|
+
var FamilyMemberHistoryEntity = createDataEntity(
|
|
443
|
+
"familymemberhistory",
|
|
444
|
+
"FamilyMemberHistory"
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
// src/data/dynamo/entities/data/flag-entity.ts
|
|
448
|
+
var FlagEntity = createDataEntity("flag", "Flag");
|
|
449
|
+
|
|
450
|
+
// src/data/dynamo/entities/data/goal-entity.ts
|
|
451
|
+
var GoalEntity = createDataEntity("goal", "Goal");
|
|
452
|
+
|
|
453
|
+
// src/data/dynamo/entities/data/graph-definition-entity.ts
|
|
454
|
+
var GraphDefinitionEntity = createDataEntity(
|
|
455
|
+
"graphdefinition",
|
|
456
|
+
"GraphDefinition"
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
// src/data/dynamo/entities/data/group-entity.ts
|
|
460
|
+
var GroupEntity = createDataEntity("group", "Group");
|
|
461
|
+
|
|
462
|
+
// src/data/dynamo/entities/data/guidance-response-entity.ts
|
|
463
|
+
var GuidanceResponseEntity = createDataEntity(
|
|
464
|
+
"guidanceresponse",
|
|
465
|
+
"GuidanceResponse"
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
// src/data/dynamo/entities/data/healthcare-service-entity.ts
|
|
469
|
+
var HealthcareServiceEntity = createDataEntity(
|
|
470
|
+
"healthcareservice",
|
|
471
|
+
"HealthcareService"
|
|
472
|
+
);
|
|
473
|
+
|
|
474
|
+
// src/data/dynamo/entities/data/imaging-study-entity.ts
|
|
475
|
+
var ImagingStudyEntity = createDataEntity(
|
|
476
|
+
"imagingstudy",
|
|
477
|
+
"ImagingStudy"
|
|
478
|
+
);
|
|
479
|
+
|
|
480
|
+
// src/data/dynamo/entities/data/immunization-entity.ts
|
|
481
|
+
var ImmunizationEntity = createDataEntity(
|
|
482
|
+
"immunization",
|
|
483
|
+
"Immunization"
|
|
484
|
+
);
|
|
485
|
+
|
|
486
|
+
// src/data/dynamo/entities/data/immunization-evaluation-entity.ts
|
|
487
|
+
var ImmunizationEvaluationEntity = createDataEntity(
|
|
488
|
+
"immunizationevaluation",
|
|
489
|
+
"ImmunizationEvaluation"
|
|
490
|
+
);
|
|
491
|
+
|
|
492
|
+
// src/data/dynamo/entities/data/immunization-recommendation-entity.ts
|
|
493
|
+
var ImmunizationRecommendationEntity = createDataEntity(
|
|
494
|
+
"immunizationrecommendation",
|
|
495
|
+
"ImmunizationRecommendation"
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
// src/data/dynamo/entities/data/implementation-guide-entity.ts
|
|
499
|
+
var ImplementationGuideEntity = createDataEntity(
|
|
500
|
+
"implementationguide",
|
|
501
|
+
"ImplementationGuide"
|
|
502
|
+
);
|
|
503
|
+
|
|
504
|
+
// src/data/dynamo/entities/data/insurance-plan-entity.ts
|
|
505
|
+
var InsurancePlanEntity = createDataEntity(
|
|
506
|
+
"insuranceplan",
|
|
507
|
+
"InsurancePlan"
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
// src/data/dynamo/entities/data/invoice-entity.ts
|
|
511
|
+
var InvoiceEntity = createDataEntity("invoice", "Invoice");
|
|
512
|
+
|
|
513
|
+
// src/data/dynamo/entities/data/library-entity.ts
|
|
514
|
+
var LibraryEntity = createDataEntity("library", "Library");
|
|
515
|
+
|
|
516
|
+
// src/data/dynamo/entities/data/linkage-entity.ts
|
|
517
|
+
var LinkageEntity = createDataEntity("linkage", "Linkage");
|
|
518
|
+
|
|
519
|
+
// src/data/dynamo/entities/data/list-entity.ts
|
|
520
|
+
var ListEntity = createDataEntity("list", "List");
|
|
521
|
+
|
|
522
|
+
// src/data/dynamo/entities/data/location-entity.ts
|
|
523
|
+
var LocationEntity = createDataEntity("location", "Location");
|
|
524
|
+
|
|
525
|
+
// src/data/dynamo/entities/data/measure-entity.ts
|
|
526
|
+
var MeasureEntity = createDataEntity("measure", "Measure");
|
|
527
|
+
|
|
528
|
+
// src/data/dynamo/entities/data/measure-report-entity.ts
|
|
529
|
+
var MeasureReportEntity = createDataEntity(
|
|
530
|
+
"measurereport",
|
|
531
|
+
"MeasureReport"
|
|
532
|
+
);
|
|
533
|
+
|
|
534
|
+
// src/data/dynamo/entities/data/media-entity.ts
|
|
535
|
+
var MediaEntity = createDataEntity("media", "Media");
|
|
536
|
+
|
|
537
|
+
// src/data/dynamo/entities/data/medication-administration-entity.ts
|
|
538
|
+
var MedicationAdministrationEntity = createDataEntity(
|
|
539
|
+
"medicationadministration",
|
|
540
|
+
"MedicationAdministration"
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
// src/data/dynamo/entities/data/medication-dispense-entity.ts
|
|
544
|
+
var MedicationDispenseEntity = createDataEntity(
|
|
545
|
+
"medicationdispense",
|
|
546
|
+
"MedicationDispense"
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
// src/data/dynamo/entities/data/medication-entity.ts
|
|
550
|
+
var MedicationEntity = createDataEntity("medication", "Medication");
|
|
551
|
+
|
|
552
|
+
// src/data/dynamo/entities/data/medication-knowledge-entity.ts
|
|
553
|
+
var MedicationKnowledgeEntity = createDataEntity(
|
|
554
|
+
"medicationknowledge",
|
|
555
|
+
"MedicationKnowledge"
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
// src/data/dynamo/entities/data/medication-request-entity.ts
|
|
559
|
+
var MedicationRequestEntity = createDataEntity(
|
|
560
|
+
"medicationrequest",
|
|
561
|
+
"MedicationRequest"
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
// src/data/dynamo/entities/data/medication-statement-entity.ts
|
|
565
|
+
var MedicationStatementEntity = createDataEntity(
|
|
566
|
+
"medicationstatement",
|
|
567
|
+
"MedicationStatement"
|
|
568
|
+
);
|
|
569
|
+
|
|
570
|
+
// src/data/dynamo/entities/data/medicinal-product-authorization-entity.ts
|
|
571
|
+
var MedicinalProductAuthorizationEntity = createDataEntity(
|
|
572
|
+
"medicinalproductauthorization",
|
|
573
|
+
"MedicinalProductAuthorization"
|
|
574
|
+
);
|
|
575
|
+
|
|
576
|
+
// src/data/dynamo/entities/data/medicinal-product-contraindication-entity.ts
|
|
577
|
+
var MedicinalProductContraindicationEntity = createDataEntity(
|
|
578
|
+
"medicinalproductcontraindication",
|
|
579
|
+
"MedicinalProductContraindication"
|
|
580
|
+
);
|
|
581
|
+
|
|
582
|
+
// src/data/dynamo/entities/data/medicinal-product-entity.ts
|
|
583
|
+
var MedicinalProductEntity = createDataEntity(
|
|
584
|
+
"medicinalproduct",
|
|
585
|
+
"MedicinalProduct"
|
|
586
|
+
);
|
|
587
|
+
|
|
588
|
+
// src/data/dynamo/entities/data/medicinal-product-indication-entity.ts
|
|
589
|
+
var MedicinalProductIndicationEntity = createDataEntity(
|
|
590
|
+
"medicinalproductindication",
|
|
591
|
+
"MedicinalProductIndication"
|
|
592
|
+
);
|
|
593
|
+
|
|
594
|
+
// src/data/dynamo/entities/data/medicinal-product-ingredient-entity.ts
|
|
595
|
+
var MedicinalProductIngredientEntity = createDataEntity(
|
|
596
|
+
"medicinalproductingredient",
|
|
597
|
+
"MedicinalProductIngredient"
|
|
598
|
+
);
|
|
599
|
+
|
|
600
|
+
// src/data/dynamo/entities/data/medicinal-product-interaction-entity.ts
|
|
601
|
+
var MedicinalProductInteractionEntity = createDataEntity(
|
|
602
|
+
"medicinalproductinteraction",
|
|
603
|
+
"MedicinalProductInteraction"
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
// src/data/dynamo/entities/data/medicinal-product-manufactured-entity.ts
|
|
607
|
+
var MedicinalProductManufacturedEntity = createDataEntity(
|
|
608
|
+
"medicinalproductmanufactured",
|
|
609
|
+
"MedicinalProductManufactured"
|
|
610
|
+
);
|
|
611
|
+
|
|
612
|
+
// src/data/dynamo/entities/data/medicinal-product-packaged-entity.ts
|
|
613
|
+
var MedicinalProductPackagedEntity = createDataEntity(
|
|
614
|
+
"medicinalproductpackaged",
|
|
615
|
+
"MedicinalProductPackaged"
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
// src/data/dynamo/entities/data/medicinal-product-pharmaceutical-entity.ts
|
|
619
|
+
var MedicinalProductPharmaceuticalEntity = createDataEntity(
|
|
620
|
+
"medicinalproductpharmaceutical",
|
|
621
|
+
"MedicinalProductPharmaceutical"
|
|
622
|
+
);
|
|
623
|
+
|
|
624
|
+
// src/data/dynamo/entities/data/medicinal-product-undesirable-effect-entity.ts
|
|
625
|
+
var MedicinalProductUndesirableEffectEntity = createDataEntity(
|
|
626
|
+
"medicinalproductundesirableeffect",
|
|
627
|
+
"MedicinalProductUndesirableEffect"
|
|
628
|
+
);
|
|
629
|
+
|
|
630
|
+
// src/data/dynamo/entities/data/message-definition-entity.ts
|
|
631
|
+
var MessageDefinitionEntity = createDataEntity(
|
|
632
|
+
"messagedefinition",
|
|
633
|
+
"MessageDefinition"
|
|
634
|
+
);
|
|
635
|
+
|
|
636
|
+
// src/data/dynamo/entities/data/message-header-entity.ts
|
|
637
|
+
var MessageHeaderEntity = createDataEntity(
|
|
638
|
+
"messageheader",
|
|
639
|
+
"MessageHeader"
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
// src/data/dynamo/entities/data/molecular-sequence-entity.ts
|
|
643
|
+
var MolecularSequenceEntity = createDataEntity(
|
|
644
|
+
"molecularsequence",
|
|
645
|
+
"MolecularSequence"
|
|
646
|
+
);
|
|
647
|
+
|
|
648
|
+
// src/data/dynamo/entities/data/naming-system-entity.ts
|
|
649
|
+
var NamingSystemEntity = createDataEntity(
|
|
650
|
+
"namingsystem",
|
|
651
|
+
"NamingSystem"
|
|
652
|
+
);
|
|
653
|
+
|
|
654
|
+
// src/data/dynamo/entities/data/nutrition-order-entity.ts
|
|
655
|
+
var NutritionOrderEntity = createDataEntity(
|
|
656
|
+
"nutritionorder",
|
|
657
|
+
"NutritionOrder"
|
|
658
|
+
);
|
|
659
|
+
|
|
660
|
+
// src/data/dynamo/entities/data/observation-definition-entity.ts
|
|
661
|
+
var ObservationDefinitionEntity = createDataEntity(
|
|
662
|
+
"observationdefinition",
|
|
663
|
+
"ObservationDefinition"
|
|
664
|
+
);
|
|
665
|
+
|
|
666
|
+
// src/data/dynamo/entities/data/observation-entity.ts
|
|
667
|
+
var ObservationEntity = createDataEntity("observation", "Observation");
|
|
668
|
+
|
|
669
|
+
// src/data/dynamo/entities/data/operation-definition-entity.ts
|
|
670
|
+
var OperationDefinitionEntity = createDataEntity(
|
|
671
|
+
"operationdefinition",
|
|
672
|
+
"OperationDefinition"
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
// src/data/dynamo/entities/data/organization-affiliation-entity.ts
|
|
676
|
+
var OrganizationAffiliationEntity = createDataEntity(
|
|
677
|
+
"organizationaffiliation",
|
|
678
|
+
"OrganizationAffiliation"
|
|
679
|
+
);
|
|
680
|
+
|
|
681
|
+
// src/data/dynamo/entities/data/organization-entity.ts
|
|
682
|
+
var OrganizationEntity = createDataEntity(
|
|
683
|
+
"organization",
|
|
684
|
+
"Organization"
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
// src/data/dynamo/entities/data/patient-entity.ts
|
|
688
|
+
var PatientEntity = createDataEntity("patient", "Patient");
|
|
689
|
+
|
|
690
|
+
// src/data/dynamo/entities/data/payment-notice-entity.ts
|
|
691
|
+
var PaymentNoticeEntity = createDataEntity(
|
|
692
|
+
"paymentnotice",
|
|
693
|
+
"PaymentNotice"
|
|
694
|
+
);
|
|
695
|
+
|
|
696
|
+
// src/data/dynamo/entities/data/payment-reconciliation-entity.ts
|
|
697
|
+
var PaymentReconciliationEntity = createDataEntity(
|
|
698
|
+
"paymentreconciliation",
|
|
699
|
+
"PaymentReconciliation"
|
|
700
|
+
);
|
|
701
|
+
|
|
702
|
+
// src/data/dynamo/entities/data/person-entity.ts
|
|
703
|
+
var PersonEntity = createDataEntity("person", "Person");
|
|
704
|
+
|
|
705
|
+
// src/data/dynamo/entities/data/plan-definition-entity.ts
|
|
706
|
+
var PlanDefinitionEntity = createDataEntity(
|
|
707
|
+
"plandefinition",
|
|
708
|
+
"PlanDefinition"
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
// src/data/dynamo/entities/data/practitioner-entity.ts
|
|
712
|
+
var PractitionerEntity = createDataEntity(
|
|
713
|
+
"practitioner",
|
|
714
|
+
"Practitioner"
|
|
715
|
+
);
|
|
716
|
+
|
|
717
|
+
// src/data/dynamo/entities/data/practitioner-role-entity.ts
|
|
718
|
+
var PractitionerRoleEntity = createDataEntity(
|
|
719
|
+
"practitionerrole",
|
|
720
|
+
"PractitionerRole"
|
|
721
|
+
);
|
|
722
|
+
|
|
723
|
+
// src/data/dynamo/entities/data/procedure-entity.ts
|
|
724
|
+
var ProcedureEntity = createDataEntity("procedure", "Procedure");
|
|
725
|
+
|
|
726
|
+
// src/data/dynamo/entities/data/provenance-entity.ts
|
|
727
|
+
var ProvenanceEntity = createDataEntity("provenance", "Provenance");
|
|
728
|
+
|
|
729
|
+
// src/data/dynamo/entities/data/questionnaire-entity.ts
|
|
730
|
+
var QuestionnaireEntity = createDataEntity(
|
|
731
|
+
"questionnaire",
|
|
732
|
+
"Questionnaire"
|
|
733
|
+
);
|
|
734
|
+
|
|
735
|
+
// src/data/dynamo/entities/data/questionnaire-response-entity.ts
|
|
736
|
+
var QuestionnaireResponseEntity = createDataEntity(
|
|
737
|
+
"questionnaireresponse",
|
|
738
|
+
"QuestionnaireResponse"
|
|
739
|
+
);
|
|
740
|
+
|
|
741
|
+
// src/data/dynamo/entities/data/related-person-entity.ts
|
|
742
|
+
var RelatedPersonEntity = createDataEntity(
|
|
743
|
+
"relatedperson",
|
|
744
|
+
"RelatedPerson"
|
|
745
|
+
);
|
|
746
|
+
|
|
747
|
+
// src/data/dynamo/entities/data/request-group-entity.ts
|
|
748
|
+
var RequestGroupEntity = createDataEntity(
|
|
749
|
+
"requestgroup",
|
|
750
|
+
"RequestGroup"
|
|
751
|
+
);
|
|
752
|
+
|
|
753
|
+
// src/data/dynamo/entities/data/research-definition-entity.ts
|
|
754
|
+
var ResearchDefinitionEntity = createDataEntity(
|
|
755
|
+
"researchdefinition",
|
|
756
|
+
"ResearchDefinition"
|
|
757
|
+
);
|
|
758
|
+
|
|
759
|
+
// src/data/dynamo/entities/data/research-element-definition-entity.ts
|
|
760
|
+
var ResearchElementDefinitionEntity = createDataEntity(
|
|
761
|
+
"researchelementdefinition",
|
|
762
|
+
"ResearchElementDefinition"
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
// src/data/dynamo/entities/data/research-study-entity.ts
|
|
766
|
+
var ResearchStudyEntity = createDataEntity(
|
|
767
|
+
"researchstudy",
|
|
768
|
+
"ResearchStudy"
|
|
769
|
+
);
|
|
770
|
+
|
|
771
|
+
// src/data/dynamo/entities/data/research-subject-entity.ts
|
|
772
|
+
var ResearchSubjectEntity = createDataEntity(
|
|
773
|
+
"researchsubject",
|
|
774
|
+
"ResearchSubject"
|
|
775
|
+
);
|
|
776
|
+
|
|
777
|
+
// src/data/dynamo/entities/data/risk-assessment-entity.ts
|
|
778
|
+
var RiskAssessmentEntity = createDataEntity(
|
|
779
|
+
"riskassessment",
|
|
780
|
+
"RiskAssessment"
|
|
781
|
+
);
|
|
782
|
+
|
|
783
|
+
// src/data/dynamo/entities/data/risk-evidence-synthesis-entity.ts
|
|
784
|
+
var RiskEvidenceSynthesisEntity = createDataEntity(
|
|
785
|
+
"riskevidencesynthesis",
|
|
786
|
+
"RiskEvidenceSynthesis"
|
|
787
|
+
);
|
|
788
|
+
|
|
789
|
+
// src/data/dynamo/entities/data/schedule-entity.ts
|
|
790
|
+
var ScheduleEntity = createDataEntity("schedule", "Schedule");
|
|
791
|
+
|
|
792
|
+
// src/data/dynamo/entities/data/search-parameter-entity.ts
|
|
793
|
+
var SearchParameterEntity = createDataEntity(
|
|
794
|
+
"searchparameter",
|
|
795
|
+
"SearchParameter"
|
|
796
|
+
);
|
|
797
|
+
|
|
798
|
+
// src/data/dynamo/entities/data/service-request-entity.ts
|
|
799
|
+
var ServiceRequestEntity = createDataEntity(
|
|
800
|
+
"servicerequest",
|
|
801
|
+
"ServiceRequest"
|
|
802
|
+
);
|
|
803
|
+
|
|
804
|
+
// src/data/dynamo/entities/data/slot-entity.ts
|
|
805
|
+
var SlotEntity = createDataEntity("slot", "Slot");
|
|
806
|
+
|
|
807
|
+
// src/data/dynamo/entities/data/specimen-definition-entity.ts
|
|
808
|
+
var SpecimenDefinitionEntity = createDataEntity(
|
|
809
|
+
"specimendefinition",
|
|
810
|
+
"SpecimenDefinition"
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
// src/data/dynamo/entities/data/specimen-entity.ts
|
|
814
|
+
var SpecimenEntity = createDataEntity("specimen", "Specimen");
|
|
815
|
+
|
|
816
|
+
// src/data/dynamo/entities/data/structure-definition-entity.ts
|
|
817
|
+
var StructureDefinitionEntity = createDataEntity(
|
|
818
|
+
"structuredefinition",
|
|
819
|
+
"StructureDefinition"
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
// src/data/dynamo/entities/data/structure-map-entity.ts
|
|
823
|
+
var StructureMapEntity = createDataEntity(
|
|
824
|
+
"structuremap",
|
|
825
|
+
"StructureMap"
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
// src/data/dynamo/entities/data/subscription-entity.ts
|
|
829
|
+
var SubscriptionEntity = createDataEntity(
|
|
830
|
+
"subscription",
|
|
831
|
+
"Subscription"
|
|
832
|
+
);
|
|
833
|
+
|
|
834
|
+
// src/data/dynamo/entities/data/substance-entity.ts
|
|
835
|
+
var SubstanceEntity = createDataEntity("substance", "Substance");
|
|
836
|
+
|
|
837
|
+
// src/data/dynamo/entities/data/substance-nucleic-acid-entity.ts
|
|
838
|
+
var SubstanceNucleicAcidEntity = createDataEntity(
|
|
839
|
+
"substancenucleicacid",
|
|
840
|
+
"SubstanceNucleicAcid"
|
|
841
|
+
);
|
|
842
|
+
|
|
843
|
+
// src/data/dynamo/entities/data/substance-polymer-entity.ts
|
|
844
|
+
var SubstancePolymerEntity = createDataEntity(
|
|
845
|
+
"substancepolymer",
|
|
846
|
+
"SubstancePolymer"
|
|
847
|
+
);
|
|
848
|
+
|
|
849
|
+
// src/data/dynamo/entities/data/substance-protein-entity.ts
|
|
850
|
+
var SubstanceProteinEntity = createDataEntity(
|
|
851
|
+
"substanceprotein",
|
|
852
|
+
"SubstanceProtein"
|
|
853
|
+
);
|
|
854
|
+
|
|
855
|
+
// src/data/dynamo/entities/data/substance-reference-information-entity.ts
|
|
856
|
+
var SubstanceReferenceInformationEntity = createDataEntity(
|
|
857
|
+
"substancereferenceinformation",
|
|
858
|
+
"SubstanceReferenceInformation"
|
|
859
|
+
);
|
|
860
|
+
|
|
861
|
+
// src/data/dynamo/entities/data/substance-source-material-entity.ts
|
|
862
|
+
var SubstanceSourceMaterialEntity = createDataEntity(
|
|
863
|
+
"substancesourcematerial",
|
|
864
|
+
"SubstanceSourceMaterial"
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
// src/data/dynamo/entities/data/substance-specification-entity.ts
|
|
868
|
+
var SubstanceSpecificationEntity = createDataEntity(
|
|
869
|
+
"substancespecification",
|
|
870
|
+
"SubstanceSpecification"
|
|
871
|
+
);
|
|
872
|
+
|
|
873
|
+
// src/data/dynamo/entities/data/supply-delivery-entity.ts
|
|
874
|
+
var SupplyDeliveryEntity = createDataEntity(
|
|
875
|
+
"supplydelivery",
|
|
876
|
+
"SupplyDelivery"
|
|
877
|
+
);
|
|
878
|
+
|
|
879
|
+
// src/data/dynamo/entities/data/supply-request-entity.ts
|
|
880
|
+
var SupplyRequestEntity = createDataEntity(
|
|
881
|
+
"supplyrequest",
|
|
882
|
+
"SupplyRequest"
|
|
883
|
+
);
|
|
884
|
+
|
|
885
|
+
// src/data/dynamo/entities/data/task-entity.ts
|
|
886
|
+
var TaskEntity = createDataEntity("task", "Task");
|
|
887
|
+
|
|
888
|
+
// src/data/dynamo/entities/data/terminology-capabilities-entity.ts
|
|
889
|
+
var TerminologyCapabilitiesEntity = createDataEntity(
|
|
890
|
+
"terminologycapabilities",
|
|
891
|
+
"TerminologyCapabilities"
|
|
892
|
+
);
|
|
893
|
+
|
|
894
|
+
// src/data/dynamo/entities/data/test-report-entity.ts
|
|
895
|
+
var TestReportEntity = createDataEntity("testreport", "TestReport");
|
|
896
|
+
|
|
897
|
+
// src/data/dynamo/entities/data/test-script-entity.ts
|
|
898
|
+
var TestScriptEntity = createDataEntity("testscript", "TestScript");
|
|
899
|
+
|
|
900
|
+
// src/data/dynamo/entities/data/value-set-entity.ts
|
|
901
|
+
var ValueSetEntity = createDataEntity("valueset", "ValueSet");
|
|
902
|
+
|
|
903
|
+
// src/data/dynamo/entities/data/verification-result-entity.ts
|
|
904
|
+
var VerificationResultEntity = createDataEntity(
|
|
905
|
+
"verificationresult",
|
|
906
|
+
"VerificationResult"
|
|
907
|
+
);
|
|
908
|
+
|
|
909
|
+
// src/data/dynamo/entities/data/vision-prescription-entity.ts
|
|
910
|
+
var VisionPrescriptionEntity = createDataEntity(
|
|
911
|
+
"visionprescription",
|
|
912
|
+
"VisionPrescription"
|
|
913
|
+
);
|
|
914
|
+
|
|
915
|
+
// src/data/dynamo/dynamo-data-service.ts
|
|
916
|
+
var dataPlaneEntities = {
|
|
917
|
+
account: AccountEntity,
|
|
918
|
+
activitydefinition: ActivityDefinitionEntity,
|
|
919
|
+
adverseevent: AdverseEventEntity,
|
|
920
|
+
allergyintolerance: AllergyIntoleranceEntity,
|
|
921
|
+
appointment: AppointmentEntity,
|
|
922
|
+
appointmentresponse: AppointmentResponseEntity,
|
|
923
|
+
auditevent: AuditEventEntity,
|
|
924
|
+
basic: BasicEntity,
|
|
925
|
+
biologicallyderivedproduct: BiologicallyDerivedProductEntity,
|
|
926
|
+
bodystructure: BodyStructureEntity,
|
|
927
|
+
capabilitystatement: CapabilityStatementEntity,
|
|
928
|
+
careplan: CarePlanEntity,
|
|
929
|
+
careteam: CareTeamEntity,
|
|
930
|
+
catalogentry: CatalogEntryEntity,
|
|
931
|
+
codesystem: CodeSystemEntity,
|
|
932
|
+
chargeitem: ChargeItemEntity,
|
|
933
|
+
chargeitemdefinition: ChargeItemDefinitionEntity,
|
|
934
|
+
claim: ClaimEntity,
|
|
935
|
+
claimresponse: ClaimResponseEntity,
|
|
936
|
+
clinicalimpression: ClinicalImpressionEntity,
|
|
937
|
+
communication: CommunicationEntity,
|
|
938
|
+
communicationrequest: CommunicationRequestEntity,
|
|
939
|
+
compartmentdefinition: CompartmentDefinitionEntity,
|
|
940
|
+
composition: CompositionEntity,
|
|
941
|
+
conceptmap: ConceptMapEntity,
|
|
942
|
+
condition: ConditionEntity,
|
|
943
|
+
consent: ConsentEntity,
|
|
944
|
+
contract: ContractEntity,
|
|
945
|
+
coverage: CoverageEntity,
|
|
946
|
+
coverageeligibilityrequest: CoverageEligibilityRequestEntity,
|
|
947
|
+
coverageeligibilityresponse: CoverageEligibilityResponseEntity,
|
|
948
|
+
detectedissue: DetectedIssueEntity,
|
|
949
|
+
device: DeviceEntity,
|
|
950
|
+
devicedefinition: DeviceDefinitionEntity,
|
|
951
|
+
devicemetric: DeviceMetricEntity,
|
|
952
|
+
devicerequest: DeviceRequestEntity,
|
|
953
|
+
deviceusestatement: DeviceUseStatementEntity,
|
|
954
|
+
diagnosticreport: DiagnosticReportEntity,
|
|
955
|
+
documentmanifest: DocumentManifestEntity,
|
|
956
|
+
documentreference: DocumentReferenceEntity,
|
|
957
|
+
effectevidencesynthesis: EffectEvidenceSynthesisEntity,
|
|
958
|
+
encounter: EncounterEntity,
|
|
959
|
+
examplescenario: ExampleScenarioEntity,
|
|
960
|
+
endpoint: EndpointEntity,
|
|
961
|
+
enrollmentrequest: EnrollmentRequestEntity,
|
|
962
|
+
enrollmentresponse: EnrollmentResponseEntity,
|
|
963
|
+
episodeofcare: EpisodeOfCareEntity,
|
|
964
|
+
eventdefinition: EventDefinitionEntity,
|
|
965
|
+
evidence: EvidenceEntity,
|
|
966
|
+
evidencevariable: EvidenceVariableEntity,
|
|
967
|
+
explanationofbenefit: ExplanationOfBenefitEntity,
|
|
968
|
+
familymemberhistory: FamilyMemberHistoryEntity,
|
|
969
|
+
flag: FlagEntity,
|
|
970
|
+
goal: GoalEntity,
|
|
971
|
+
graphdefinition: GraphDefinitionEntity,
|
|
972
|
+
group: GroupEntity,
|
|
973
|
+
guidanceresponse: GuidanceResponseEntity,
|
|
974
|
+
healthcareservice: HealthcareServiceEntity,
|
|
975
|
+
immunization: ImmunizationEntity,
|
|
976
|
+
immunizationevaluation: ImmunizationEvaluationEntity,
|
|
977
|
+
immunizationrecommendation: ImmunizationRecommendationEntity,
|
|
978
|
+
imagingstudy: ImagingStudyEntity,
|
|
979
|
+
implementationguide: ImplementationGuideEntity,
|
|
980
|
+
insuranceplan: InsurancePlanEntity,
|
|
981
|
+
invoice: InvoiceEntity,
|
|
982
|
+
library: LibraryEntity,
|
|
983
|
+
linkage: LinkageEntity,
|
|
984
|
+
list: ListEntity,
|
|
985
|
+
location: LocationEntity,
|
|
986
|
+
medication: MedicationEntity,
|
|
987
|
+
medicationadministration: MedicationAdministrationEntity,
|
|
988
|
+
medicationdispense: MedicationDispenseEntity,
|
|
989
|
+
medicationknowledge: MedicationKnowledgeEntity,
|
|
990
|
+
medicationrequest: MedicationRequestEntity,
|
|
991
|
+
medicationstatement: MedicationStatementEntity,
|
|
992
|
+
medicinalproduct: MedicinalProductEntity,
|
|
993
|
+
medicinalproductauthorization: MedicinalProductAuthorizationEntity,
|
|
994
|
+
medicinalproductcontraindication: MedicinalProductContraindicationEntity,
|
|
995
|
+
medicinalproductingredient: MedicinalProductIngredientEntity,
|
|
996
|
+
medicinalproductindication: MedicinalProductIndicationEntity,
|
|
997
|
+
medicinalproductinteraction: MedicinalProductInteractionEntity,
|
|
998
|
+
medicinalproductmanufactured: MedicinalProductManufacturedEntity,
|
|
999
|
+
medicinalproductpackaged: MedicinalProductPackagedEntity,
|
|
1000
|
+
medicinalproductpharmaceutical: MedicinalProductPharmaceuticalEntity,
|
|
1001
|
+
medicinalproductundesirableeffect: MedicinalProductUndesirableEffectEntity,
|
|
1002
|
+
media: MediaEntity,
|
|
1003
|
+
measure: MeasureEntity,
|
|
1004
|
+
measurereport: MeasureReportEntity,
|
|
1005
|
+
messagedefinition: MessageDefinitionEntity,
|
|
1006
|
+
messageheader: MessageHeaderEntity,
|
|
1007
|
+
molecularsequence: MolecularSequenceEntity,
|
|
1008
|
+
namingsystem: NamingSystemEntity,
|
|
1009
|
+
nutritionorder: NutritionOrderEntity,
|
|
1010
|
+
observation: ObservationEntity,
|
|
1011
|
+
observationdefinition: ObservationDefinitionEntity,
|
|
1012
|
+
operationdefinition: OperationDefinitionEntity,
|
|
1013
|
+
organization: OrganizationEntity,
|
|
1014
|
+
organizationaffiliation: OrganizationAffiliationEntity,
|
|
1015
|
+
patient: PatientEntity,
|
|
1016
|
+
paymentnotice: PaymentNoticeEntity,
|
|
1017
|
+
paymentreconciliation: PaymentReconciliationEntity,
|
|
1018
|
+
person: PersonEntity,
|
|
1019
|
+
plandefinition: PlanDefinitionEntity,
|
|
1020
|
+
practitioner: PractitionerEntity,
|
|
1021
|
+
practitionerrole: PractitionerRoleEntity,
|
|
1022
|
+
procedure: ProcedureEntity,
|
|
1023
|
+
provenance: ProvenanceEntity,
|
|
1024
|
+
questionnaire: QuestionnaireEntity,
|
|
1025
|
+
questionnaireresponse: QuestionnaireResponseEntity,
|
|
1026
|
+
requestgroup: RequestGroupEntity,
|
|
1027
|
+
relatedperson: RelatedPersonEntity,
|
|
1028
|
+
researchdefinition: ResearchDefinitionEntity,
|
|
1029
|
+
researchelementdefinition: ResearchElementDefinitionEntity,
|
|
1030
|
+
researchstudy: ResearchStudyEntity,
|
|
1031
|
+
researchsubject: ResearchSubjectEntity,
|
|
1032
|
+
riskassessment: RiskAssessmentEntity,
|
|
1033
|
+
riskevidencesynthesis: RiskEvidenceSynthesisEntity,
|
|
1034
|
+
schedule: ScheduleEntity,
|
|
1035
|
+
searchparameter: SearchParameterEntity,
|
|
1036
|
+
servicerequest: ServiceRequestEntity,
|
|
1037
|
+
specimen: SpecimenEntity,
|
|
1038
|
+
specimendefinition: SpecimenDefinitionEntity,
|
|
1039
|
+
structuredefinition: StructureDefinitionEntity,
|
|
1040
|
+
structuremap: StructureMapEntity,
|
|
1041
|
+
substance: SubstanceEntity,
|
|
1042
|
+
substancenucleicacid: SubstanceNucleicAcidEntity,
|
|
1043
|
+
substancepolymer: SubstancePolymerEntity,
|
|
1044
|
+
substanceprotein: SubstanceProteinEntity,
|
|
1045
|
+
substancereferenceinformation: SubstanceReferenceInformationEntity,
|
|
1046
|
+
substancespecification: SubstanceSpecificationEntity,
|
|
1047
|
+
substancesourcematerial: SubstanceSourceMaterialEntity,
|
|
1048
|
+
subscription: SubscriptionEntity,
|
|
1049
|
+
terminologycapabilities: TerminologyCapabilitiesEntity,
|
|
1050
|
+
testreport: TestReportEntity,
|
|
1051
|
+
testscript: TestScriptEntity,
|
|
1052
|
+
valueset: ValueSetEntity,
|
|
1053
|
+
supplydelivery: SupplyDeliveryEntity,
|
|
1054
|
+
supplyrequest: SupplyRequestEntity,
|
|
1055
|
+
slot: SlotEntity,
|
|
1056
|
+
task: TaskEntity,
|
|
1057
|
+
visionprescription: VisionPrescriptionEntity,
|
|
1058
|
+
verificationresult: VerificationResultEntity
|
|
1059
|
+
};
|
|
1060
|
+
var dataPlaneService = new Service(dataPlaneEntities, {
|
|
1061
|
+
table: defaultTableName,
|
|
1062
|
+
client: dynamoClient
|
|
1063
|
+
});
|
|
1064
|
+
var DynamoDataService = {
|
|
1065
|
+
entities: dataPlaneService.entities
|
|
1066
|
+
};
|
|
1067
|
+
function getDynamoDataService(tableName) {
|
|
1068
|
+
const resolved = tableName ?? defaultTableName;
|
|
1069
|
+
const service = new Service(dataPlaneEntities, {
|
|
1070
|
+
table: resolved,
|
|
1071
|
+
client: dynamoClient
|
|
1072
|
+
});
|
|
1073
|
+
return {
|
|
1074
|
+
entities: service.entities
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// src/data/operations/data-operations-common.ts
|
|
1079
|
+
import { extractSortKey, extractSummary } from "@openhi/types";
|
|
1080
|
+
|
|
1081
|
+
// src/lib/compression.ts
|
|
1082
|
+
import { gzipSync, gunzipSync } from "zlib";
|
|
1083
|
+
var ENVELOPE_VERSION = 1;
|
|
1084
|
+
var COMPRESSION_ALGOS = {
|
|
1085
|
+
NONE: "none",
|
|
1086
|
+
GZIP: "gzip",
|
|
1087
|
+
BROTLI: "brotli",
|
|
1088
|
+
DEFLATE: "deflate"
|
|
1089
|
+
};
|
|
1090
|
+
function isEnvelope(obj) {
|
|
1091
|
+
return typeof obj === "object" && obj !== null && "v" in obj && "algo" in obj && "payload" in obj && typeof obj.payload === "string";
|
|
1092
|
+
}
|
|
1093
|
+
function compressResource(jsonString, options) {
|
|
1094
|
+
const algo = options?.algo ?? COMPRESSION_ALGOS.GZIP;
|
|
1095
|
+
if (algo === COMPRESSION_ALGOS.NONE) {
|
|
1096
|
+
const envelope2 = {
|
|
1097
|
+
v: ENVELOPE_VERSION,
|
|
1098
|
+
algo: COMPRESSION_ALGOS.NONE,
|
|
1099
|
+
payload: jsonString
|
|
1100
|
+
};
|
|
1101
|
+
return JSON.stringify(envelope2);
|
|
1102
|
+
}
|
|
1103
|
+
const buf = Buffer.from(jsonString, "utf-8");
|
|
1104
|
+
const payload = gzipSync(buf).toString("base64");
|
|
1105
|
+
const envelope = {
|
|
1106
|
+
v: ENVELOPE_VERSION,
|
|
1107
|
+
algo: COMPRESSION_ALGOS.GZIP,
|
|
1108
|
+
payload
|
|
1109
|
+
};
|
|
1110
|
+
return JSON.stringify(envelope);
|
|
1111
|
+
}
|
|
1112
|
+
function decompressResource(compressedOrRaw) {
|
|
1113
|
+
try {
|
|
1114
|
+
const parsed = JSON.parse(compressedOrRaw);
|
|
1115
|
+
if (isEnvelope(parsed)) {
|
|
1116
|
+
if (parsed.algo === COMPRESSION_ALGOS.GZIP) {
|
|
1117
|
+
const buf = Buffer.from(parsed.payload, "base64");
|
|
1118
|
+
return gunzipSync(buf).toString("utf-8");
|
|
1119
|
+
}
|
|
1120
|
+
if (parsed.algo === COMPRESSION_ALGOS.NONE) {
|
|
1121
|
+
return parsed.payload;
|
|
1122
|
+
}
|
|
1123
|
+
return parsed.payload;
|
|
1124
|
+
}
|
|
1125
|
+
} catch {
|
|
1126
|
+
}
|
|
1127
|
+
try {
|
|
1128
|
+
const buf = Buffer.from(compressedOrRaw, "base64");
|
|
1129
|
+
if (buf.length >= 2 && buf[0] === 31 && buf[1] === 139) {
|
|
1130
|
+
return gunzipSync(buf).toString("utf-8");
|
|
1131
|
+
}
|
|
1132
|
+
} catch {
|
|
1133
|
+
}
|
|
1134
|
+
return compressedOrRaw;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// src/data/audit-meta.ts
|
|
1138
|
+
var OPENHI_EXT = "http://openhi.org/fhir/StructureDefinition";
|
|
1139
|
+
function mergeAuditIntoMeta(meta, audit) {
|
|
1140
|
+
const existing = meta ?? {};
|
|
1141
|
+
const ext = [
|
|
1142
|
+
...Array.isArray(existing.extension) ? existing.extension : []
|
|
1143
|
+
];
|
|
1144
|
+
const byUrl = new Map(ext.map((e) => [e.url, e]));
|
|
1145
|
+
function set(url, value, type) {
|
|
1146
|
+
if (value == null) return;
|
|
1147
|
+
byUrl.set(url, { url, [type]: value });
|
|
1148
|
+
}
|
|
1149
|
+
set(`${OPENHI_EXT}/created-date`, audit.createdDate, "valueDateTime");
|
|
1150
|
+
set(`${OPENHI_EXT}/created-by-id`, audit.createdById, "valueString");
|
|
1151
|
+
set(`${OPENHI_EXT}/created-by-name`, audit.createdByName, "valueString");
|
|
1152
|
+
set(`${OPENHI_EXT}/modified-date`, audit.modifiedDate, "valueDateTime");
|
|
1153
|
+
set(`${OPENHI_EXT}/modified-by-id`, audit.modifiedById, "valueString");
|
|
1154
|
+
set(`${OPENHI_EXT}/modified-by-name`, audit.modifiedByName, "valueString");
|
|
1155
|
+
set(`${OPENHI_EXT}/deleted-date`, audit.deletedDate, "valueDateTime");
|
|
1156
|
+
set(`${OPENHI_EXT}/deleted-by-id`, audit.deletedById, "valueString");
|
|
1157
|
+
set(`${OPENHI_EXT}/deleted-by-name`, audit.deletedByName, "valueString");
|
|
1158
|
+
return { ...existing, extension: Array.from(byUrl.values()) };
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// src/data/operations/data-operations-common.ts
|
|
1162
|
+
var DATA_ENTITY_SK = "CURRENT";
|
|
1163
|
+
async function getDataEntityById(entity, tenantId, workspaceId, id, resourceLabel) {
|
|
1164
|
+
const result = await entity.get({
|
|
1165
|
+
tenantId,
|
|
1166
|
+
workspaceId,
|
|
1167
|
+
id,
|
|
1168
|
+
sk: DATA_ENTITY_SK
|
|
1169
|
+
}).go();
|
|
1170
|
+
if (!result.data) {
|
|
1171
|
+
throw new NotFoundError(`${resourceLabel} ${id} not found`, {
|
|
1172
|
+
details: { id }
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
const parsed = JSON.parse(decompressResource(result.data.resource));
|
|
1176
|
+
return {
|
|
1177
|
+
id: result.data.id,
|
|
1178
|
+
resource: { ...parsed, id: result.data.id }
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
async function deleteDataEntityById(entity, tenantId, workspaceId, id) {
|
|
1182
|
+
await entity.delete({
|
|
1183
|
+
tenantId,
|
|
1184
|
+
workspaceId,
|
|
1185
|
+
id,
|
|
1186
|
+
sk: DATA_ENTITY_SK
|
|
1187
|
+
}).go();
|
|
1188
|
+
}
|
|
1189
|
+
var BATCH_GET_MAX_ATTEMPTS = 3;
|
|
1190
|
+
var BATCH_GET_BASE_BACKOFF_MS = 50;
|
|
1191
|
+
async function batchGetWithRetry(entity, keys) {
|
|
1192
|
+
if (keys.length === 0) return [];
|
|
1193
|
+
const collected = [];
|
|
1194
|
+
let pending = keys;
|
|
1195
|
+
let attempt = 0;
|
|
1196
|
+
while (pending.length > 0) {
|
|
1197
|
+
if (attempt > 0) {
|
|
1198
|
+
await new Promise(
|
|
1199
|
+
(resolve) => setTimeout(resolve, BATCH_GET_BASE_BACKOFF_MS * 2 ** (attempt - 1))
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
attempt++;
|
|
1203
|
+
const result = await entity.get(pending).go();
|
|
1204
|
+
collected.push(...result.data);
|
|
1205
|
+
const unprocessed = result.unprocessed ?? [];
|
|
1206
|
+
if (unprocessed.length === 0) break;
|
|
1207
|
+
if (attempt >= BATCH_GET_MAX_ATTEMPTS) {
|
|
1208
|
+
throw new Error(
|
|
1209
|
+
`BatchGet exhausted retries: ${unprocessed.length} key(s) still unprocessed after ${BATCH_GET_MAX_ATTEMPTS} attempt(s)`
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
pending = unprocessed;
|
|
1213
|
+
}
|
|
1214
|
+
return collected;
|
|
1215
|
+
}
|
|
1216
|
+
async function dispatchListMode(mode, shardResults, hooks) {
|
|
1217
|
+
if (mode === "count") {
|
|
1218
|
+
let total = 0;
|
|
1219
|
+
for (const shardResult of shardResults) {
|
|
1220
|
+
total += (shardResult.data ?? []).length;
|
|
1221
|
+
}
|
|
1222
|
+
return { entries: [], total };
|
|
1223
|
+
}
|
|
1224
|
+
if (mode === "summary") {
|
|
1225
|
+
const entries2 = [];
|
|
1226
|
+
for (const shardResult of shardResults) {
|
|
1227
|
+
for (const item of shardResult.data ?? []) {
|
|
1228
|
+
if (typeof item.summary !== "string") continue;
|
|
1229
|
+
let parsed;
|
|
1230
|
+
try {
|
|
1231
|
+
parsed = JSON.parse(item.summary);
|
|
1232
|
+
} catch {
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
entries2.push(hooks.buildSummaryEntry(item.id, parsed));
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return { entries: entries2, total: entries2.length };
|
|
1239
|
+
}
|
|
1240
|
+
const orderedIds = [];
|
|
1241
|
+
for (const shardResult of shardResults) {
|
|
1242
|
+
for (const item of shardResult.data ?? []) {
|
|
1243
|
+
orderedIds.push(item.id);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
if (orderedIds.length === 0) return { entries: [], total: 0 };
|
|
1247
|
+
const items = await hooks.hydrate(orderedIds);
|
|
1248
|
+
const byId = new Map(items.map((item) => [hooks.getId(item), item]));
|
|
1249
|
+
const entries = [];
|
|
1250
|
+
for (const id of orderedIds) {
|
|
1251
|
+
const item = byId.get(id);
|
|
1252
|
+
if (!item) continue;
|
|
1253
|
+
entries.push(hooks.buildEntry(id, item));
|
|
1254
|
+
}
|
|
1255
|
+
return { entries, total: entries.length };
|
|
1256
|
+
}
|
|
1257
|
+
async function listDataEntitiesByWorkspace(entity, tenantId, workspaceId, mode = "full") {
|
|
1258
|
+
const shardResults = await Promise.all(
|
|
1259
|
+
Array.from(
|
|
1260
|
+
{ length: SHARD_COUNT },
|
|
1261
|
+
(_, shard) => entity.query.gsi1({ tenantId, workspaceId, gsi1Shard: String(shard) }).go()
|
|
1262
|
+
)
|
|
1263
|
+
);
|
|
1264
|
+
return dispatchListMode(
|
|
1265
|
+
mode,
|
|
1266
|
+
shardResults,
|
|
1267
|
+
{
|
|
1268
|
+
hydrate: (orderedIds) => batchGetWithRetry(
|
|
1269
|
+
entity,
|
|
1270
|
+
orderedIds.map((id) => ({
|
|
1271
|
+
tenantId,
|
|
1272
|
+
workspaceId,
|
|
1273
|
+
id,
|
|
1274
|
+
sk: DATA_ENTITY_SK
|
|
1275
|
+
}))
|
|
1276
|
+
),
|
|
1277
|
+
getId: (item) => item.id,
|
|
1278
|
+
buildEntry: (id, item) => {
|
|
1279
|
+
const parsed = JSON.parse(decompressResource(item.resource));
|
|
1280
|
+
return { id, resource: { ...parsed, id } };
|
|
1281
|
+
},
|
|
1282
|
+
buildSummaryEntry: (id, parsed) => ({
|
|
1283
|
+
id,
|
|
1284
|
+
resource: { ...parsed, id }
|
|
1285
|
+
})
|
|
1286
|
+
}
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
async function createDataEntityRecord(entity, tenantId, workspaceId, id, resourceWithAudit, fallbackDate) {
|
|
1290
|
+
const lastUpdated = resourceWithAudit.meta?.lastUpdated ?? fallbackDate ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1291
|
+
const vid = lastUpdated.replace(/[-:T.Z]/g, "").slice(0, 12) || Date.now().toString(36);
|
|
1292
|
+
const resourceLike = resourceWithAudit;
|
|
1293
|
+
const summary = JSON.stringify(extractSummary(resourceLike));
|
|
1294
|
+
const gsi1sk = extractSortKey(resourceLike);
|
|
1295
|
+
await entity.put({
|
|
1296
|
+
sk: DATA_ENTITY_SK,
|
|
1297
|
+
tenantId,
|
|
1298
|
+
workspaceId,
|
|
1299
|
+
id,
|
|
1300
|
+
resource: compressResource(JSON.stringify(resourceWithAudit)),
|
|
1301
|
+
summary,
|
|
1302
|
+
vid,
|
|
1303
|
+
lastUpdated,
|
|
1304
|
+
gsi1sk
|
|
1305
|
+
}).go();
|
|
1306
|
+
return {
|
|
1307
|
+
id,
|
|
1308
|
+
resource: resourceWithAudit
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function buildUpdatedResourceWithAudit(body, id, date, actorId, actorName, existingResourceStr, resourceType) {
|
|
1312
|
+
const existingMeta = JSON.parse(existingResourceStr).meta;
|
|
1313
|
+
const bodyWithMeta = body;
|
|
1314
|
+
const resourceWithVersion = {
|
|
1315
|
+
...body,
|
|
1316
|
+
resourceType,
|
|
1317
|
+
id,
|
|
1318
|
+
meta: {
|
|
1319
|
+
...bodyWithMeta.meta ?? {},
|
|
1320
|
+
lastUpdated: date,
|
|
1321
|
+
versionId: "2"
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
const resourceWithAudit = {
|
|
1325
|
+
...resourceWithVersion,
|
|
1326
|
+
meta: mergeAuditIntoMeta(resourceWithVersion.meta ?? existingMeta, {
|
|
1327
|
+
modifiedDate: date,
|
|
1328
|
+
modifiedById: actorId,
|
|
1329
|
+
modifiedByName: actorName
|
|
1330
|
+
})
|
|
1331
|
+
};
|
|
1332
|
+
return {
|
|
1333
|
+
resource: resourceWithAudit,
|
|
1334
|
+
lastUpdated: date
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
async function updateDataEntityById(entity, tenantId, workspaceId, id, resourceLabel, context, buildPatched) {
|
|
1338
|
+
const existing = await entity.get({
|
|
1339
|
+
tenantId,
|
|
1340
|
+
workspaceId,
|
|
1341
|
+
id,
|
|
1342
|
+
sk: DATA_ENTITY_SK
|
|
1343
|
+
}).go();
|
|
1344
|
+
if (!existing.data) {
|
|
1345
|
+
throw new NotFoundError(`${resourceLabel} ${id} not found`, {
|
|
1346
|
+
details: { id }
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
const existingStr = decompressResource(existing.data.resource);
|
|
1350
|
+
const { resource, lastUpdated } = buildPatched(existingStr);
|
|
1351
|
+
const resourceLike = resource;
|
|
1352
|
+
const summary = JSON.stringify(extractSummary(resourceLike));
|
|
1353
|
+
const gsi1sk = extractSortKey(resourceLike);
|
|
1354
|
+
await entity.patch({
|
|
1355
|
+
tenantId,
|
|
1356
|
+
workspaceId,
|
|
1357
|
+
id,
|
|
1358
|
+
sk: DATA_ENTITY_SK
|
|
1359
|
+
}).set({
|
|
1360
|
+
resource: compressResource(JSON.stringify(resource)),
|
|
1361
|
+
summary,
|
|
1362
|
+
lastUpdated,
|
|
1363
|
+
gsi1sk
|
|
1364
|
+
}).go();
|
|
1365
|
+
return {
|
|
1366
|
+
id,
|
|
1367
|
+
resource
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
export {
|
|
1372
|
+
NotFoundError,
|
|
1373
|
+
ValidationError,
|
|
1374
|
+
ForbiddenError,
|
|
1375
|
+
domainErrorToHttpStatus,
|
|
1376
|
+
getDynamoDataService,
|
|
1377
|
+
compressResource,
|
|
1378
|
+
decompressResource,
|
|
1379
|
+
mergeAuditIntoMeta,
|
|
1380
|
+
DATA_ENTITY_SK,
|
|
1381
|
+
getDataEntityById,
|
|
1382
|
+
deleteDataEntityById,
|
|
1383
|
+
batchGetWithRetry,
|
|
1384
|
+
dispatchListMode,
|
|
1385
|
+
listDataEntitiesByWorkspace,
|
|
1386
|
+
createDataEntityRecord,
|
|
1387
|
+
buildUpdatedResourceWithAudit,
|
|
1388
|
+
updateDataEntityById
|
|
1389
|
+
};
|
|
1390
|
+
//# sourceMappingURL=chunk-IS4VQRI4.mjs.map
|