@openhi/constructs 0.0.108 → 0.0.110
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-EST32BJ2.mjs → chunk-7FUAMZOF.mjs} +2 -2
- package/lib/{chunk-L3QHWDHB.mjs → chunk-7Q2IJ2J5.mjs} +4 -4
- package/lib/{chunk-ZGOHB4RA.mjs → chunk-BB5MK4L3.mjs} +2 -2
- package/lib/{chunk-LKG3I536.mjs → chunk-IS4VQRI4.mjs} +8 -1
- package/lib/chunk-IS4VQRI4.mjs.map +1 -0
- package/lib/{chunk-WWGJZNXJ.mjs → chunk-MULKGFIJ.mjs} +2 -2
- package/lib/index.mjs +4 -4
- package/lib/pre-token-generation.handler.js +17 -14
- package/lib/pre-token-generation.handler.js.map +1 -1
- package/lib/pre-token-generation.handler.mjs +3 -4
- package/lib/pre-token-generation.handler.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +17 -14
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +3 -4
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +1504 -1156
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +1341 -1153
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +4 -4
- package/package.json +3 -3
- package/lib/chunk-6J7NQ6A4.mjs +0 -45
- package/lib/chunk-6J7NQ6A4.mjs.map +0 -1
- package/lib/chunk-GT7SFZLP.mjs +0 -126
- package/lib/chunk-GT7SFZLP.mjs.map +0 -1
- package/lib/chunk-LKG3I536.mjs.map +0 -1
- /package/lib/{chunk-EST32BJ2.mjs.map → chunk-7FUAMZOF.mjs.map} +0 -0
- /package/lib/{chunk-L3QHWDHB.mjs.map → chunk-7Q2IJ2J5.mjs.map} +0 -0
- /package/lib/{chunk-ZGOHB4RA.mjs.map → chunk-BB5MK4L3.mjs.map} +0 -0
- /package/lib/{chunk-WWGJZNXJ.mjs.map → chunk-MULKGFIJ.mjs.map} +0 -0
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
productionCognitoProvisioner,
|
|
6
6
|
runSeedDemoData,
|
|
7
7
|
seedDemoGraph
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-7Q2IJ2J5.mjs";
|
|
9
|
+
import "./chunk-7FUAMZOF.mjs";
|
|
10
10
|
import "./chunk-SYBADQXI.mjs";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-MULKGFIJ.mjs";
|
|
12
|
+
import "./chunk-IS4VQRI4.mjs";
|
|
13
13
|
import "./chunk-QR5JVSCF.mjs";
|
|
14
14
|
import "./chunk-LZOMFHX3.mjs";
|
|
15
15
|
export {
|
package/package.json
CHANGED
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"type-fest": "^4",
|
|
57
57
|
"ulid": "^3.0.2",
|
|
58
58
|
"@openhi/types": "0.0.0",
|
|
59
|
-
"@openhi/
|
|
60
|
-
"@openhi/
|
|
59
|
+
"@openhi/workflows": "0.0.0",
|
|
60
|
+
"@openhi/config": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devEngines": {
|
|
63
63
|
"packageManager": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"version": "0.0.
|
|
74
|
+
"version": "0.0.110",
|
|
75
75
|
"types": "lib/index.d.ts",
|
|
76
76
|
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"pnpm exec projen\".",
|
|
77
77
|
"scripts": {
|
package/lib/chunk-6J7NQ6A4.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDynamoControlService
|
|
3
|
-
} from "./chunk-QR5JVSCF.mjs";
|
|
4
|
-
|
|
5
|
-
// src/data/operations/control/user/user-find-by-sub-operation.ts
|
|
6
|
-
async function findUserBySubOperation(params) {
|
|
7
|
-
const { cognitoSub, tableName } = params;
|
|
8
|
-
const service = getDynamoControlService(tableName);
|
|
9
|
-
const result = await service.entities.user.query.gsi2({ cognitoSub }).go({ limit: 1 });
|
|
10
|
-
const item = result.data?.[0];
|
|
11
|
-
if (!item) {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
id: item.id,
|
|
16
|
-
cognitoSub: item.cognitoSub,
|
|
17
|
-
resource: item.resource,
|
|
18
|
-
vid: item.vid
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// src/data/operations/control/user/user-resource-helpers.ts
|
|
23
|
-
function parseUserResource(resource) {
|
|
24
|
-
try {
|
|
25
|
-
return JSON.parse(resource);
|
|
26
|
-
} catch {
|
|
27
|
-
return void 0;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/data/operations/fhir-reference.ts
|
|
32
|
-
function idFromReference(reference, prefix) {
|
|
33
|
-
if (!reference || !reference.startsWith(prefix)) {
|
|
34
|
-
return void 0;
|
|
35
|
-
}
|
|
36
|
-
const id = reference.slice(prefix.length);
|
|
37
|
-
return id.length > 0 ? id : void 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
findUserBySubOperation,
|
|
42
|
-
parseUserResource,
|
|
43
|
-
idFromReference
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=chunk-6J7NQ6A4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/operations/control/user/user-find-by-sub-operation.ts","../src/data/operations/control/user/user-resource-helpers.ts","../src/data/operations/fhir-reference.ts"],"sourcesContent":["import { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { OpenHiContext } from \"../../../openhi-context\";\n\nexport interface FindUserBySubParams {\n context: OpenHiContext;\n cognitoSub: string;\n tableName?: string;\n}\n\nexport interface FindUserBySubResult {\n id: string;\n cognitoSub?: string;\n resource: string;\n vid: string;\n}\n\n/**\n * Look up a User by Cognito sub via GSI2, projecting the row to a stable\n * result shape. Returns `undefined` when no row matches.\n */\nexport async function findUserBySubOperation(\n params: FindUserBySubParams,\n): Promise<FindUserBySubResult | undefined> {\n const { cognitoSub, tableName } = params;\n const service = getDynamoControlService(tableName);\n\n const result = await service.entities.user.query\n .gsi2({ cognitoSub })\n .go({ limit: 1 });\n const item = result.data?.[0];\n if (!item) {\n return undefined;\n }\n return {\n id: item.id,\n cognitoSub: item.cognitoSub,\n resource: item.resource,\n vid: item.vid,\n };\n}\n","import type { User } from \"@openhi/types\";\n\n/**\n * Helpers for working with persisted OpenHI User resources. Co-located with\n * the User operations because both the Cognito triggers and the onboarding\n * workflow consume these alongside `findUserBySubOperation`.\n */\n\n// Defensive parse — JSON.parse may yield any shape, so every field is optional.\nexport type UserResource = Partial<User>;\n\n/**\n * Existing User resources are stored as JSON strings in the data store; parse\n * defensively so a malformed payload returns `undefined` rather than throwing.\n */\nexport function parseUserResource(resource: string): UserResource | undefined {\n try {\n return JSON.parse(resource) as UserResource;\n } catch {\n return undefined;\n }\n}\n","/**\n * Pure helpers for working with FHIR Reference fields. Shared across data-plane\n * and control-plane operations and the handlers that wrap them.\n */\n\n/**\n * Extract the id portion from a FHIR-style reference such as `Patient/<id>` or\n * `Tenant/<id>`. Returns `undefined` if the reference is missing, does not\n * match the prefix, or has an empty id after the prefix.\n */\nexport function idFromReference(\n reference: string | undefined,\n prefix: string,\n): string | undefined {\n if (!reference || !reference.startsWith(prefix)) {\n return undefined;\n }\n const id = reference.slice(prefix.length);\n return id.length > 0 ? id : undefined;\n}\n"],"mappings":";;;;;AAoBA,eAAsB,uBACpB,QAC0C;AAC1C,QAAM,EAAE,YAAY,UAAU,IAAI;AAClC,QAAM,UAAU,wBAAwB,SAAS;AAEjD,QAAM,SAAS,MAAM,QAAQ,SAAS,KAAK,MACxC,KAAK,EAAE,WAAW,CAAC,EACnB,GAAG,EAAE,OAAO,EAAE,CAAC;AAClB,QAAM,OAAO,OAAO,OAAO,CAAC;AAC5B,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,YAAY,KAAK;AAAA,IACjB,UAAU,KAAK;AAAA,IACf,KAAK,KAAK;AAAA,EACZ;AACF;;;ACxBO,SAAS,kBAAkB,UAA4C;AAC5E,MAAI;AACF,WAAO,KAAK,MAAM,QAAQ;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ACXO,SAAS,gBACd,WACA,QACoB;AACpB,MAAI,CAAC,aAAa,CAAC,UAAU,WAAW,MAAM,GAAG;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,KAAK,UAAU,MAAM,OAAO,MAAM;AACxC,SAAO,GAAG,SAAS,IAAI,KAAK;AAC9B;","names":[]}
|
package/lib/chunk-GT7SFZLP.mjs
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NotFoundError,
|
|
3
|
-
batchGetWithRetry,
|
|
4
|
-
dispatchListMode
|
|
5
|
-
} from "./chunk-LKG3I536.mjs";
|
|
6
|
-
import {
|
|
7
|
-
SHARD_COUNT,
|
|
8
|
-
getDynamoControlService
|
|
9
|
-
} from "./chunk-QR5JVSCF.mjs";
|
|
10
|
-
|
|
11
|
-
// src/data/operations/control/user/user-create-operation.ts
|
|
12
|
-
import { extractSummary } from "@openhi/types";
|
|
13
|
-
async function createUserOperation(params) {
|
|
14
|
-
const { context, body, tableName } = params;
|
|
15
|
-
const service = getDynamoControlService(tableName);
|
|
16
|
-
const id = body.id ?? `user-${Date.now()}`;
|
|
17
|
-
const parsedResource = typeof body.resource === "string" ? JSON.parse(body.resource) : body.resource ?? {};
|
|
18
|
-
const lastUpdated = context.date ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
19
|
-
const vid = `1`;
|
|
20
|
-
const resource = { resourceType: "User", id, ...parsedResource };
|
|
21
|
-
const summary = JSON.stringify(extractSummary(resource));
|
|
22
|
-
await service.entities.user.put({
|
|
23
|
-
id,
|
|
24
|
-
resource: JSON.stringify(resource),
|
|
25
|
-
summary,
|
|
26
|
-
vid,
|
|
27
|
-
lastUpdated
|
|
28
|
-
}).go();
|
|
29
|
-
return {
|
|
30
|
-
id,
|
|
31
|
-
resource,
|
|
32
|
-
meta: { lastUpdated, versionId: vid }
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// src/data/operations/control/user/user-delete-operation.ts
|
|
37
|
-
async function deleteUserOperation(params) {
|
|
38
|
-
const { id, tableName } = params;
|
|
39
|
-
const service = getDynamoControlService(tableName);
|
|
40
|
-
await service.entities.user.delete({ id, sk: "CURRENT" }).go();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// src/data/operations/control/user/user-get-by-id-operation.ts
|
|
44
|
-
async function getUserByIdOperation(params) {
|
|
45
|
-
const { id, tableName } = params;
|
|
46
|
-
const service = getDynamoControlService(tableName);
|
|
47
|
-
const response = await service.entities.user.get({ id, sk: "CURRENT" }).go();
|
|
48
|
-
const item = response.data;
|
|
49
|
-
if (!item) {
|
|
50
|
-
throw new NotFoundError(`User not found: ${id}`);
|
|
51
|
-
}
|
|
52
|
-
const parsedResource = JSON.parse(item.resource);
|
|
53
|
-
return {
|
|
54
|
-
id,
|
|
55
|
-
resource: { resourceType: "User", id, ...parsedResource }
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/data/operations/control/user/user-list-operation.ts
|
|
60
|
-
var SK = "CURRENT";
|
|
61
|
-
async function listUsersOperation(params) {
|
|
62
|
-
const { tableName, mode = "full" } = params;
|
|
63
|
-
const service = getDynamoControlService(tableName);
|
|
64
|
-
const shardResults = await Promise.all(
|
|
65
|
-
Array.from(
|
|
66
|
-
{ length: SHARD_COUNT },
|
|
67
|
-
(_, shard) => service.entities.user.query.gsi1({ gsi1Shard: String(shard) }).go()
|
|
68
|
-
)
|
|
69
|
-
);
|
|
70
|
-
return dispatchListMode(mode, shardResults, {
|
|
71
|
-
hydrate: (orderedIds) => batchGetWithRetry(
|
|
72
|
-
service.entities.user,
|
|
73
|
-
orderedIds.map((id) => ({ id, sk: SK }))
|
|
74
|
-
),
|
|
75
|
-
getId: (item) => item.id,
|
|
76
|
-
buildEntry: (id, item) => ({
|
|
77
|
-
id,
|
|
78
|
-
resource: {
|
|
79
|
-
resourceType: "User",
|
|
80
|
-
id,
|
|
81
|
-
...JSON.parse(item.resource)
|
|
82
|
-
}
|
|
83
|
-
}),
|
|
84
|
-
buildSummaryEntry: (id, parsed) => ({
|
|
85
|
-
id,
|
|
86
|
-
resource: { resourceType: "User", id, ...parsed }
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// src/data/operations/control/user/user-update-operation.ts
|
|
92
|
-
import { extractSummary as extractSummary2 } from "@openhi/types";
|
|
93
|
-
async function updateUserOperation(params) {
|
|
94
|
-
const { context, id, body, tableName } = params;
|
|
95
|
-
const service = getDynamoControlService(tableName);
|
|
96
|
-
const existing = await service.entities.user.get({ id, sk: "CURRENT" }).go();
|
|
97
|
-
if (!existing.data) {
|
|
98
|
-
throw new NotFoundError(`User not found: ${id}`);
|
|
99
|
-
}
|
|
100
|
-
const parsedResource = typeof body.resource === "string" ? JSON.parse(body.resource) : body.resource ?? {};
|
|
101
|
-
const lastUpdated = context.date ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
102
|
-
const vid = `${Date.now()}`;
|
|
103
|
-
const resource = { resourceType: "User", id, ...parsedResource };
|
|
104
|
-
const summary = JSON.stringify(extractSummary2(resource));
|
|
105
|
-
await service.entities.user.put({
|
|
106
|
-
id,
|
|
107
|
-
resource: JSON.stringify(resource),
|
|
108
|
-
summary,
|
|
109
|
-
vid,
|
|
110
|
-
lastUpdated
|
|
111
|
-
}).go();
|
|
112
|
-
return {
|
|
113
|
-
id,
|
|
114
|
-
resource,
|
|
115
|
-
meta: { lastUpdated, versionId: vid }
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export {
|
|
120
|
-
createUserOperation,
|
|
121
|
-
deleteUserOperation,
|
|
122
|
-
getUserByIdOperation,
|
|
123
|
-
listUsersOperation,
|
|
124
|
-
updateUserOperation
|
|
125
|
-
};
|
|
126
|
-
//# sourceMappingURL=chunk-GT7SFZLP.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/operations/control/user/user-create-operation.ts","../src/data/operations/control/user/user-delete-operation.ts","../src/data/operations/control/user/user-get-by-id-operation.ts","../src/data/operations/control/user/user-list-operation.ts","../src/data/operations/control/user/user-update-operation.ts"],"sourcesContent":["import { extractSummary, type FhirResourceLike } from \"@openhi/types\";\nimport { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { OpenHiContext } from \"../../../openhi-context\";\n\nexport interface UserCreateParams {\n context: OpenHiContext;\n body: { id?: string; resource?: Record<string, unknown> | string };\n tableName?: string;\n}\n\nexport interface UserCreateResult {\n id: string;\n resource: { resourceType: string; id: string; [key: string]: unknown };\n meta: { lastUpdated: string; versionId: string };\n}\n\nexport async function createUserOperation(\n params: UserCreateParams,\n): Promise<UserCreateResult> {\n const { context, body, tableName } = params;\n const service = getDynamoControlService(tableName);\n\n const id = body.id ?? `user-${Date.now()}`;\n const parsedResource =\n typeof body.resource === \"string\"\n ? (JSON.parse(body.resource) as Record<string, unknown>)\n : (body.resource ?? {});\n\n const lastUpdated = context.date ?? new Date().toISOString();\n const vid = `1`;\n\n const resource = { resourceType: \"User\", id, ...parsedResource };\n const summary = JSON.stringify(extractSummary(resource as FhirResourceLike));\n\n await service.entities.user\n .put({\n id,\n resource: JSON.stringify(resource),\n summary,\n vid,\n lastUpdated,\n })\n .go();\n\n return {\n id,\n resource,\n meta: { lastUpdated, versionId: vid },\n };\n}\n","import { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { OpenHiContext } from \"../../../openhi-context\";\n\nexport interface UserDeleteParams {\n context: OpenHiContext;\n id: string;\n tableName?: string;\n}\n\nexport async function deleteUserOperation(\n params: UserDeleteParams,\n): Promise<void> {\n const { id, tableName } = params;\n const service = getDynamoControlService(tableName);\n\n await service.entities.user.delete({ id, sk: \"CURRENT\" }).go();\n}\n","import { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { NotFoundError } from \"../../../errors\";\nimport { OpenHiContext } from \"../../../openhi-context\";\n\nexport interface UserGetByIdParams {\n context: OpenHiContext;\n id: string;\n tableName?: string;\n}\n\nexport interface UserGetByIdResult {\n id: string;\n resource: { resourceType: string; id: string; [key: string]: unknown };\n}\n\nexport async function getUserByIdOperation(\n params: UserGetByIdParams,\n): Promise<UserGetByIdResult> {\n const { id, tableName } = params;\n const service = getDynamoControlService(tableName);\n\n const response = await service.entities.user.get({ id, sk: \"CURRENT\" }).go();\n\n const item = response.data;\n if (!item) {\n throw new NotFoundError(`User not found: ${id}`);\n }\n\n const parsedResource = JSON.parse(item.resource) as Record<string, unknown>;\n\n return {\n id,\n resource: { resourceType: \"User\", id, ...parsedResource },\n };\n}\n","import { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { SHARD_COUNT } from \"../../../dynamo/shard\";\nimport { OpenHiContext } from \"../../../openhi-context\";\nimport {\n batchGetWithRetry,\n dispatchListMode,\n type ListOperationMode,\n} from \"../../data-operations-common\";\n\nconst SK = \"CURRENT\";\n\nexport interface UserListParams {\n context: OpenHiContext;\n tableName?: string;\n /** #853: defaults to `\"full\"`. `\"summary\"` skips BatchGet, `\"count\"` returns total only. */\n mode?: ListOperationMode;\n}\n\nexport interface UserListResult {\n entries: Array<{\n id: string;\n resource: { resourceType: string; id: string; [key: string]: unknown };\n }>;\n total: number;\n}\n\n/**\n * Lists Users via GSI1 (sharded). `mode` (default `\"full\"`) selects between BatchGet hydration,\n * summary-only (parse `summary` JSON projected on GSI1), or count-only (skip both). See\n * `dispatchListMode` in data-operations-common for the canonical mode contract.\n */\nexport async function listUsersOperation(\n params: UserListParams,\n): Promise<UserListResult> {\n const { tableName, mode = \"full\" } = params;\n const service = getDynamoControlService(tableName);\n\n const shardResults = await Promise.all(\n Array.from({ length: SHARD_COUNT }, (_, shard) =>\n service.entities.user.query.gsi1({ gsi1Shard: String(shard) }).go(),\n ),\n );\n\n return dispatchListMode<\n { id: string; resource: string },\n UserListResult[\"entries\"][number]\n >(mode, shardResults, {\n hydrate: (orderedIds) =>\n batchGetWithRetry(\n service.entities.user,\n orderedIds.map((id) => ({ id, sk: SK })),\n ) as Promise<Array<{ id: string; resource: string }>>,\n getId: (item) => item.id,\n buildEntry: (id, item) => ({\n id,\n resource: {\n resourceType: \"User\",\n id,\n ...(JSON.parse(item.resource) as Record<string, unknown>),\n },\n }),\n buildSummaryEntry: (id, parsed) => ({\n id,\n resource: { resourceType: \"User\", id, ...parsed },\n }),\n });\n}\n","import { extractSummary, type FhirResourceLike } from \"@openhi/types\";\nimport { getDynamoControlService } from \"../../../dynamo/dynamo-control-service\";\nimport { NotFoundError } from \"../../../errors\";\nimport { OpenHiContext } from \"../../../openhi-context\";\n\nexport interface UserUpdateParams {\n context: OpenHiContext;\n id: string;\n body: { resource?: Record<string, unknown> | string };\n tableName?: string;\n}\n\nexport interface UserUpdateResult {\n id: string;\n resource: { resourceType: string; id: string; [key: string]: unknown };\n meta: { lastUpdated: string; versionId: string };\n}\n\nexport async function updateUserOperation(\n params: UserUpdateParams,\n): Promise<UserUpdateResult> {\n const { context, id, body, tableName } = params;\n const service = getDynamoControlService(tableName);\n\n const existing = await service.entities.user.get({ id, sk: \"CURRENT\" }).go();\n if (!existing.data) {\n throw new NotFoundError(`User not found: ${id}`);\n }\n\n const parsedResource =\n typeof body.resource === \"string\"\n ? (JSON.parse(body.resource) as Record<string, unknown>)\n : (body.resource ?? {});\n\n const lastUpdated = context.date ?? new Date().toISOString();\n const vid = `${Date.now()}`;\n\n const resource = { resourceType: \"User\", id, ...parsedResource };\n const summary = JSON.stringify(extractSummary(resource as FhirResourceLike));\n\n await service.entities.user\n .put({\n id,\n resource: JSON.stringify(resource),\n summary,\n vid,\n lastUpdated,\n })\n .go();\n\n return {\n id,\n resource,\n meta: { lastUpdated, versionId: vid },\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,sBAA6C;AAgBtD,eAAsB,oBACpB,QAC2B;AAC3B,QAAM,EAAE,SAAS,MAAM,UAAU,IAAI;AACrC,QAAM,UAAU,wBAAwB,SAAS;AAEjD,QAAM,KAAK,KAAK,MAAM,QAAQ,KAAK,IAAI,CAAC;AACxC,QAAM,iBACJ,OAAO,KAAK,aAAa,WACpB,KAAK,MAAM,KAAK,QAAQ,IACxB,KAAK,YAAY,CAAC;AAEzB,QAAM,cAAc,QAAQ,SAAQ,oBAAI,KAAK,GAAE,YAAY;AAC3D,QAAM,MAAM;AAEZ,QAAM,WAAW,EAAE,cAAc,QAAQ,IAAI,GAAG,eAAe;AAC/D,QAAM,UAAU,KAAK,UAAU,eAAe,QAA4B,CAAC;AAE3E,QAAM,QAAQ,SAAS,KACpB,IAAI;AAAA,IACH;AAAA,IACA,UAAU,KAAK,UAAU,QAAQ;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACA,GAAG;AAEN,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAM,EAAE,aAAa,WAAW,IAAI;AAAA,EACtC;AACF;;;ACxCA,eAAsB,oBACpB,QACe;AACf,QAAM,EAAE,IAAI,UAAU,IAAI;AAC1B,QAAM,UAAU,wBAAwB,SAAS;AAEjD,QAAM,QAAQ,SAAS,KAAK,OAAO,EAAE,IAAI,IAA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