@openhi/constructs 0.0.105 → 0.0.106
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-AGF3RAAZ.mjs +20 -0
- package/lib/chunk-AGF3RAAZ.mjs.map +1 -0
- package/lib/{chunk-BXEG7IOZ.mjs → chunk-AO3E22CS.mjs} +2 -2
- package/lib/{chunk-WNUH2WDZ.mjs → chunk-CHPEQRXU.mjs} +2 -2
- package/lib/chunk-JUNL76HF.mjs +428 -0
- package/lib/chunk-JUNL76HF.mjs.map +1 -0
- package/lib/chunk-L6UAP4KP.mjs +27 -0
- package/lib/chunk-L6UAP4KP.mjs.map +1 -0
- package/lib/{chunk-3QS3WKRC.mjs → chunk-LZOMFHX3.mjs} +9 -2
- package/lib/chunk-QMIOLLAS.mjs +531 -0
- package/lib/chunk-QMIOLLAS.mjs.map +1 -0
- package/lib/chunk-SYBADQXI.mjs +607 -0
- package/lib/chunk-SYBADQXI.mjs.map +1 -0
- package/lib/chunk-VXX4I3EF.mjs +19 -0
- package/lib/chunk-VXX4I3EF.mjs.map +1 -0
- package/lib/{chunk-36YCDLLA.mjs → chunk-VYDIGFIX.mjs} +75 -481
- package/lib/chunk-VYDIGFIX.mjs.map +1 -0
- package/lib/chunk-YU2HRNUP.mjs +33 -0
- package/lib/chunk-YU2HRNUP.mjs.map +1 -0
- package/lib/chunk-YZZDUJHI.mjs +37 -0
- package/lib/chunk-YZZDUJHI.mjs.map +1 -0
- package/lib/cors-options-lambda.handler.mjs +1 -1
- package/lib/data-store-postgres-replication.handler.mjs +1 -1
- package/lib/events-BfrkMoBD.d.mts +44 -0
- package/lib/events-BfrkMoBD.d.ts +44 -0
- package/lib/events-DGep6C7w.d.mts +207 -0
- package/lib/events-DGep6C7w.d.ts +207 -0
- package/lib/firehose-archive-transform.handler.mjs +1 -1
- package/lib/index.d.mts +417 -9
- package/lib/index.d.ts +663 -10
- package/lib/index.js +2400 -111
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +781 -104
- package/lib/index.mjs.map +1 -1
- package/lib/openhi-context-CaBH8SFo.d.mts +39 -0
- package/lib/openhi-context-CaBH8SFo.d.ts +39 -0
- package/lib/platform-deploy-bridge.handler.d.mts +14 -0
- package/lib/platform-deploy-bridge.handler.d.ts +14 -0
- package/lib/platform-deploy-bridge.handler.js +762 -0
- package/lib/platform-deploy-bridge.handler.js.map +1 -0
- package/lib/platform-deploy-bridge.handler.mjs +134 -0
- package/lib/platform-deploy-bridge.handler.mjs.map +1 -0
- package/lib/post-authentication.handler.mjs +1 -1
- package/lib/post-confirmation.handler.mjs +1 -1
- package/lib/pre-token-generation.handler.js +76 -31
- package/lib/pre-token-generation.handler.js.map +1 -1
- package/lib/pre-token-generation.handler.mjs +5 -3
- package/lib/pre-token-generation.handler.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +86 -41
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +6 -4
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +114 -59
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +40 -61
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.d.mts +107 -0
- package/lib/seed-demo-data.handler.d.ts +107 -0
- package/lib/seed-demo-data.handler.js +2037 -0
- package/lib/seed-demo-data.handler.js.map +1 -0
- package/lib/seed-demo-data.handler.mjs +23 -0
- package/lib/seed-demo-data.handler.mjs.map +1 -0
- package/lib/seed-system-data.handler.d.mts +64 -0
- package/lib/seed-system-data.handler.d.ts +64 -0
- package/lib/seed-system-data.handler.js +1631 -0
- package/lib/seed-system-data.handler.js.map +1 -0
- package/lib/seed-system-data.handler.mjs +135 -0
- package/lib/seed-system-data.handler.mjs.map +1 -0
- package/package.json +4 -2
- package/lib/chunk-36YCDLLA.mjs.map +0 -1
- /package/lib/{chunk-BXEG7IOZ.mjs.map → chunk-AO3E22CS.mjs.map} +0 -0
- /package/lib/{chunk-WNUH2WDZ.mjs.map → chunk-CHPEQRXU.mjs.map} +0 -0
- /package/lib/{chunk-3QS3WKRC.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1,35 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRoleOperation
|
|
3
|
+
} from "./chunk-YU2HRNUP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getRoleByIdOperation
|
|
6
|
+
} from "./chunk-L6UAP4KP.mjs";
|
|
1
7
|
import {
|
|
2
8
|
createMembershipOperation,
|
|
3
9
|
createRoleAssignmentOperation,
|
|
4
10
|
createTenantOperation,
|
|
5
11
|
createWorkspaceOperation
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AO3E22CS.mjs";
|
|
7
13
|
import {
|
|
8
|
-
NotFoundError,
|
|
9
|
-
SHARD_COUNT,
|
|
10
14
|
batchGetWithRetry,
|
|
11
15
|
buildUpdatedResourceWithAudit,
|
|
12
16
|
compressResource,
|
|
13
|
-
computeShard,
|
|
14
17
|
createDataEntityRecord,
|
|
15
18
|
createUserOperation,
|
|
16
19
|
decompressResource,
|
|
17
|
-
defaultTableName,
|
|
18
20
|
deleteDataEntityById,
|
|
19
21
|
deleteUserOperation,
|
|
20
22
|
dispatchListMode,
|
|
21
|
-
domainErrorToHttpStatus,
|
|
22
|
-
dynamoClient,
|
|
23
23
|
getDataEntityById,
|
|
24
|
-
getDynamoControlService,
|
|
25
24
|
getUserByIdOperation,
|
|
26
25
|
listDataEntitiesByWorkspace,
|
|
27
26
|
listUsersOperation,
|
|
28
27
|
mergeAuditIntoMeta,
|
|
29
28
|
updateDataEntityById,
|
|
30
29
|
updateUserOperation
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import
|
|
30
|
+
} from "./chunk-JUNL76HF.mjs";
|
|
31
|
+
import {
|
|
32
|
+
NotFoundError,
|
|
33
|
+
domainErrorToHttpStatus
|
|
34
|
+
} from "./chunk-YZZDUJHI.mjs";
|
|
35
|
+
import {
|
|
36
|
+
SHARD_COUNT,
|
|
37
|
+
computeShard,
|
|
38
|
+
defaultTableName,
|
|
39
|
+
dynamoClient,
|
|
40
|
+
getDynamoControlService
|
|
41
|
+
} from "./chunk-VYDIGFIX.mjs";
|
|
42
|
+
import "./chunk-LZOMFHX3.mjs";
|
|
33
43
|
|
|
34
44
|
// src/data/lambda/rest-api-lambda.handler.ts
|
|
35
45
|
import serverlessExpress from "@codegenie/serverless-express";
|
|
@@ -1226,31 +1236,6 @@ router2.delete("/:id", deleteMembershipRoute);
|
|
|
1226
1236
|
// src/data/rest-api/routes/control/role/role.ts
|
|
1227
1237
|
import express3 from "express";
|
|
1228
1238
|
|
|
1229
|
-
// src/data/operations/control/role/role-create-operation.ts
|
|
1230
|
-
import { extractSummary as extractSummary2 } from "@openhi/types";
|
|
1231
|
-
async function createRoleOperation(params) {
|
|
1232
|
-
const { context, body, tableName } = params;
|
|
1233
|
-
const service = getDynamoControlService(tableName);
|
|
1234
|
-
const id = body.id ?? `role-${Date.now()}`;
|
|
1235
|
-
const parsedResource = typeof body.resource === "string" ? JSON.parse(body.resource) : body.resource ?? {};
|
|
1236
|
-
const lastUpdated = context.date ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1237
|
-
const vid = `1`;
|
|
1238
|
-
const resource = { resourceType: "Role", id, ...parsedResource };
|
|
1239
|
-
const summary = JSON.stringify(extractSummary2(resource));
|
|
1240
|
-
await service.entities.role.put({
|
|
1241
|
-
id,
|
|
1242
|
-
resource: JSON.stringify(resource),
|
|
1243
|
-
summary,
|
|
1244
|
-
vid,
|
|
1245
|
-
lastUpdated
|
|
1246
|
-
}).go();
|
|
1247
|
-
return {
|
|
1248
|
-
id,
|
|
1249
|
-
resource,
|
|
1250
|
-
meta: { lastUpdated, versionId: vid }
|
|
1251
|
-
};
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
1239
|
// src/data/rest-api/routes/control/role/role-create-route.ts
|
|
1255
1240
|
async function createRoleRoute(req, res) {
|
|
1256
1241
|
const bodyResult = requireJsonBody(req, res);
|
|
@@ -1303,22 +1288,6 @@ async function deleteRoleRoute(req, res) {
|
|
|
1303
1288
|
}
|
|
1304
1289
|
}
|
|
1305
1290
|
|
|
1306
|
-
// src/data/operations/control/role/role-get-by-id-operation.ts
|
|
1307
|
-
async function getRoleByIdOperation(params) {
|
|
1308
|
-
const { id, tableName } = params;
|
|
1309
|
-
const service = getDynamoControlService(tableName);
|
|
1310
|
-
const response = await service.entities.role.get({ id, sk: "CURRENT" }).go();
|
|
1311
|
-
const item = response.data;
|
|
1312
|
-
if (!item) {
|
|
1313
|
-
throw new NotFoundError(`Role not found: ${id}`);
|
|
1314
|
-
}
|
|
1315
|
-
const parsedResource = JSON.parse(item.resource);
|
|
1316
|
-
return {
|
|
1317
|
-
id,
|
|
1318
|
-
resource: { resourceType: "Role", id, ...parsedResource }
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
1291
|
// src/data/rest-api/routes/control/role/role-get-by-id-route.ts
|
|
1323
1292
|
async function getRoleByIdRoute(req, res) {
|
|
1324
1293
|
const id = String(req.params.id);
|
|
@@ -1394,7 +1363,7 @@ async function listRolesRoute(req, res) {
|
|
|
1394
1363
|
}
|
|
1395
1364
|
|
|
1396
1365
|
// src/data/operations/control/role/role-update-operation.ts
|
|
1397
|
-
import { extractSummary as
|
|
1366
|
+
import { extractSummary as extractSummary2 } from "@openhi/types";
|
|
1398
1367
|
async function updateRoleOperation(params) {
|
|
1399
1368
|
const { context, id, body, tableName } = params;
|
|
1400
1369
|
const service = getDynamoControlService(tableName);
|
|
@@ -1406,7 +1375,7 @@ async function updateRoleOperation(params) {
|
|
|
1406
1375
|
const lastUpdated = context.date ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1407
1376
|
const vid = `${Date.now()}`;
|
|
1408
1377
|
const resource = { resourceType: "Role", id, ...parsedResource };
|
|
1409
|
-
const summary = JSON.stringify(
|
|
1378
|
+
const summary = JSON.stringify(extractSummary2(resource));
|
|
1410
1379
|
await service.entities.role.put({
|
|
1411
1380
|
id,
|
|
1412
1381
|
resource: JSON.stringify(resource),
|
|
@@ -1616,7 +1585,7 @@ async function listRoleAssignmentsRoute(req, res) {
|
|
|
1616
1585
|
}
|
|
1617
1586
|
|
|
1618
1587
|
// src/data/operations/control/roleassignment/roleassignment-update-operation.ts
|
|
1619
|
-
import { extractSummary as
|
|
1588
|
+
import { extractSummary as extractSummary3 } from "@openhi/types";
|
|
1620
1589
|
async function updateRoleAssignmentOperation(params) {
|
|
1621
1590
|
const { context, id, body, tableName } = params;
|
|
1622
1591
|
const service = getDynamoControlService(tableName);
|
|
@@ -1628,7 +1597,7 @@ async function updateRoleAssignmentOperation(params) {
|
|
|
1628
1597
|
const lastUpdated = context.date ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1629
1598
|
const vid = `${Date.now()}`;
|
|
1630
1599
|
const resource = { resourceType: "RoleAssignment", id, ...parsedResource };
|
|
1631
|
-
const summary = JSON.stringify(
|
|
1600
|
+
const summary = JSON.stringify(extractSummary3(resource));
|
|
1632
1601
|
await service.entities.roleAssignment.put({
|
|
1633
1602
|
tenantId: context.tenantId,
|
|
1634
1603
|
id,
|
|
@@ -1841,7 +1810,7 @@ async function listTenantsRoute(req, res) {
|
|
|
1841
1810
|
}
|
|
1842
1811
|
|
|
1843
1812
|
// src/data/operations/control/tenant/tenant-update-operation.ts
|
|
1844
|
-
import { extractSummary as
|
|
1813
|
+
import { extractSummary as extractSummary4 } from "@openhi/types";
|
|
1845
1814
|
async function updateTenantOperation(params) {
|
|
1846
1815
|
const { context, id, body, tableName } = params;
|
|
1847
1816
|
const service = getDynamoControlService(tableName);
|
|
@@ -1859,7 +1828,7 @@ async function updateTenantOperation(params) {
|
|
|
1859
1828
|
resourceType: "Tenant",
|
|
1860
1829
|
id
|
|
1861
1830
|
};
|
|
1862
|
-
const summary = JSON.stringify(
|
|
1831
|
+
const summary = JSON.stringify(extractSummary4(updated));
|
|
1863
1832
|
await service.entities.tenant.patch({ tenantId: id, sk: "CURRENT" }).set({ resource: JSON.stringify(updated), summary, vid, lastUpdated }).go();
|
|
1864
1833
|
return { id, resource: updated, meta: { lastUpdated, versionId: vid } };
|
|
1865
1834
|
}
|
|
@@ -2202,7 +2171,7 @@ async function listWorkspacesRoute(req, res) {
|
|
|
2202
2171
|
}
|
|
2203
2172
|
|
|
2204
2173
|
// src/data/operations/control/workspace/workspace-update-operation.ts
|
|
2205
|
-
import { extractSummary as
|
|
2174
|
+
import { extractSummary as extractSummary5 } from "@openhi/types";
|
|
2206
2175
|
async function updateWorkspaceOperation(params) {
|
|
2207
2176
|
const { context, id, body, tableName } = params;
|
|
2208
2177
|
const { tenantId } = context;
|
|
@@ -2221,7 +2190,7 @@ async function updateWorkspaceOperation(params) {
|
|
|
2221
2190
|
resourceType: "Workspace",
|
|
2222
2191
|
id
|
|
2223
2192
|
};
|
|
2224
|
-
const summary = JSON.stringify(
|
|
2193
|
+
const summary = JSON.stringify(extractSummary5(updated));
|
|
2225
2194
|
await service.entities.workspace.patch({ tenantId, id, sk: "CURRENT" }).set({ resource: JSON.stringify(updated), summary, vid, lastUpdated }).go();
|
|
2226
2195
|
return { id, resource: updated, meta: { lastUpdated, versionId: vid } };
|
|
2227
2196
|
}
|
|
@@ -4322,8 +4291,12 @@ var DataApiPostgresQueryRunner = class {
|
|
|
4322
4291
|
resourceArn: this.clusterArn,
|
|
4323
4292
|
secretArn: this.secretArn,
|
|
4324
4293
|
database: this.database,
|
|
4325
|
-
|
|
4326
|
-
|
|
4294
|
+
// NOTE: the Data API `schema` field is intentionally NOT set —
|
|
4295
|
+
// Aurora Serverless v2's Data API rejects it with
|
|
4296
|
+
// `ValidationException: The schema parameter isn't supported.`
|
|
4297
|
+
// Instead, the SQL is rewritten to schema-qualify the `resources`
|
|
4298
|
+
// table inline before being sent. See {@link qualifyResourcesTable}.
|
|
4299
|
+
sql: qualifyResourcesTable(sql, this.schema),
|
|
4327
4300
|
parameters: params.map(toSqlParameter),
|
|
4328
4301
|
// Results as named columns so we can map them back to JS objects.
|
|
4329
4302
|
includeResultMetadata: true,
|
|
@@ -4339,6 +4312,12 @@ var DataApiPostgresQueryRunner = class {
|
|
|
4339
4312
|
return JSON.parse(out.formattedRecords);
|
|
4340
4313
|
}
|
|
4341
4314
|
};
|
|
4315
|
+
function qualifyResourcesTable(sql, schema) {
|
|
4316
|
+
return sql.replace(
|
|
4317
|
+
/(\b(?:FROM|JOIN)\s+)resources\b/gi,
|
|
4318
|
+
`$1"${schema}".resources`
|
|
4319
|
+
);
|
|
4320
|
+
}
|
|
4342
4321
|
function toSqlParameter(param) {
|
|
4343
4322
|
if (param.value === null) {
|
|
4344
4323
|
return { name: param.name, value: { isNull: true } };
|