monorise 1.1.0-dev.0 → 1.1.0-dev.10
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/dist/base/index.d.ts +79 -1
- package/dist/base/index.js +51 -1
- package/dist/base/index.js.map +1 -1
- package/dist/cli/cli.js +2 -2
- package/dist/core/index.d.ts +12 -56
- package/dist/core/index.js +249 -59
- package/dist/core/index.js.map +1 -1
- package/dist/react/actions/core.action.d.ts.map +1 -1
- package/dist/react/{chunk-EQ3PKQ2S.js → chunk-BIXAYYE4.js} +35 -5
- package/dist/react/{chunk-EQ3PKQ2S.js.map → chunk-BIXAYYE4.js.map} +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +251 -10389
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/entity.d.ts +1 -1
- package/dist/react/lib/entity.d.ts.map +1 -1
- package/dist/react/websocket-7MZ3ENOC.js +9 -0
- package/dist/sst/components/monorise-core.d.ts +2 -0
- package/dist/sst/components/monorise-core.d.ts.map +1 -1
- package/dist/sst/components/single-table.d.ts +6 -0
- package/dist/sst/components/single-table.d.ts.map +1 -1
- package/dist/sst/index.js +8 -7
- package/dist/sst/index.js.map +1 -1
- package/package.json +9 -2
- package/dist/react/chunk-4D22OCZG.js +0 -65
- package/dist/react/chunk-4D22OCZG.js.map +0 -1
- package/dist/react/chunk-4N3P4ONH.js +0 -588
- package/dist/react/chunk-4N3P4ONH.js.map +0 -1
- package/dist/react/chunk-4Y4KWGJD.js +0 -182
- package/dist/react/chunk-4Y4KWGJD.js.map +0 -1
- package/dist/react/chunk-757E5UYA.js +0 -893
- package/dist/react/chunk-757E5UYA.js.map +0 -1
- package/dist/react/chunk-A5TI2FW3.js +0 -13
- package/dist/react/chunk-A5TI2FW3.js.map +0 -1
- package/dist/react/chunk-B3XDGUFO.js +0 -489
- package/dist/react/chunk-B3XDGUFO.js.map +0 -1
- package/dist/react/chunk-BPBCUO2Z.js +0 -248
- package/dist/react/chunk-BPBCUO2Z.js.map +0 -1
- package/dist/react/chunk-CQBOIXWK.js +0 -142
- package/dist/react/chunk-DRH2BB7I.js +0 -383
- package/dist/react/chunk-DRH2BB7I.js.map +0 -1
- package/dist/react/chunk-H64MMAL7.js +0 -245
- package/dist/react/chunk-H64MMAL7.js.map +0 -1
- package/dist/react/chunk-KJX5LOMN.js +0 -43
- package/dist/react/chunk-KJX5LOMN.js.map +0 -1
- package/dist/react/chunk-MO35V2Y7.js +0 -172
- package/dist/react/chunk-MO35V2Y7.js.map +0 -1
- package/dist/react/chunk-UC3E72G7.js +0 -73
- package/dist/react/chunk-UC3E72G7.js.map +0 -1
- package/dist/react/chunk-UHMKB3OR.js +0 -5568
- package/dist/react/chunk-UHMKB3OR.js.map +0 -1
- package/dist/react/chunk-UQPQBWEQ.js +0 -54
- package/dist/react/chunk-UQPQBWEQ.js.map +0 -1
- package/dist/react/chunk-XCDCVRJR.js +0 -43
- package/dist/react/chunk-XCDCVRJR.js.map +0 -1
- package/dist/react/chunk-XOYAZDIH.js +0 -47
- package/dist/react/chunk-XOYAZDIH.js.map +0 -1
- package/dist/react/chunk-YNFQEPO5.js +0 -29
- package/dist/react/chunk-YNFQEPO5.js.map +0 -1
- package/dist/react/dist-es-35AO47NO.js +0 -90
- package/dist/react/dist-es-35AO47NO.js.map +0 -1
- package/dist/react/dist-es-5GDBXNKQ.js +0 -333
- package/dist/react/dist-es-5GDBXNKQ.js.map +0 -1
- package/dist/react/dist-es-B3JDGWY6.js +0 -71
- package/dist/react/dist-es-B3JDGWY6.js.map +0 -1
- package/dist/react/dist-es-IWIE5JLA.js +0 -169
- package/dist/react/dist-es-IWIE5JLA.js.map +0 -1
- package/dist/react/dist-es-NRIS3TYJ.js +0 -494
- package/dist/react/dist-es-NRIS3TYJ.js.map +0 -1
- package/dist/react/dist-es-VCXAEYYN.js +0 -22
- package/dist/react/dist-es-VCXAEYYN.js.map +0 -1
- package/dist/react/dist-es-VU33JFTZ.js +0 -379
- package/dist/react/dist-es-VU33JFTZ.js.map +0 -1
- package/dist/react/event-streams-OSOTOTTP.js +0 -277
- package/dist/react/event-streams-OSOTOTTP.js.map +0 -1
- package/dist/react/loadSso-ME7MKAM3.js +0 -556
- package/dist/react/loadSso-ME7MKAM3.js.map +0 -1
- package/dist/react/service.config-ZJEZ6EKA-FC2TR3GH.js +0 -14
- package/dist/react/service.config-ZJEZ6EKA-FC2TR3GH.js.map +0 -1
- package/dist/react/signin-LOXYIE5I.js +0 -653
- package/dist/react/signin-LOXYIE5I.js.map +0 -1
- package/dist/react/sso-oidc-X63KRRLO.js +0 -786
- package/dist/react/sso-oidc-X63KRRLO.js.map +0 -1
- package/dist/react/sts-OXBEY7HY.js +0 -3948
- package/dist/react/sts-OXBEY7HY.js.map +0 -1
- package/dist/react/websocket-QHA7SQXG.js +0 -10
- package/dist/react/websocket-QHA7SQXG.js.map +0 -1
- /package/dist/react/{chunk-CQBOIXWK.js.map → websocket-7MZ3ENOC.js.map} +0 -0
package/dist/core/index.js
CHANGED
|
@@ -1075,7 +1075,14 @@ var MutualRepository = class extends Repository {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
getMutual(byEntityType, byEntityId, entityType, entityId, opts) {
|
|
1077
1077
|
return __async(this, null, function* () {
|
|
1078
|
-
var _a, _b;
|
|
1078
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1079
|
+
console.log("[MONORISE_DEBUG] getMutual start:", {
|
|
1080
|
+
byEntityType,
|
|
1081
|
+
byEntityId,
|
|
1082
|
+
entityType,
|
|
1083
|
+
entityId,
|
|
1084
|
+
opts
|
|
1085
|
+
});
|
|
1079
1086
|
const mutual = new Mutual(
|
|
1080
1087
|
byEntityType,
|
|
1081
1088
|
byEntityId,
|
|
@@ -1085,6 +1092,11 @@ var MutualRepository = class extends Repository {
|
|
|
1085
1092
|
{},
|
|
1086
1093
|
{}
|
|
1087
1094
|
);
|
|
1095
|
+
console.log("[MONORISE_DEBUG] getMutual querying:", {
|
|
1096
|
+
byFullEntityId: mutual.byFullEntityId,
|
|
1097
|
+
fullEntityId: mutual.fullEntityId,
|
|
1098
|
+
tableName: this.TABLE_NAME
|
|
1099
|
+
});
|
|
1088
1100
|
const resp = yield this.dynamodbClient.query({
|
|
1089
1101
|
TableName: this.TABLE_NAME,
|
|
1090
1102
|
KeyConditionExpression: "#PK = :PK and begins_with(#SK, :SK)",
|
|
@@ -1101,9 +1113,14 @@ var MutualRepository = class extends Repository {
|
|
|
1101
1113
|
},
|
|
1102
1114
|
Limit: 1
|
|
1103
1115
|
});
|
|
1116
|
+
console.log("[MONORISE_DEBUG] getMutual query result:", {
|
|
1117
|
+
hasItems: !!((_a = resp.Items) == null ? void 0 : _a.length),
|
|
1118
|
+
itemCount: (_c = (_b = resp.Items) == null ? void 0 : _b.length) != null ? _c : 0,
|
|
1119
|
+
hasLastEvaluatedKey: !!resp.LastEvaluatedKey
|
|
1120
|
+
});
|
|
1104
1121
|
let mutualMetadata = null;
|
|
1105
1122
|
if (opts == null ? void 0 : opts.isFromMetadata) {
|
|
1106
|
-
const tempMutual = Mutual.fromItem((
|
|
1123
|
+
const tempMutual = Mutual.fromItem((_d = resp.Items) == null ? void 0 : _d[0]);
|
|
1107
1124
|
const respMetadataMutual = yield this.dynamodbClient.getItem({
|
|
1108
1125
|
TableName: this.TABLE_NAME,
|
|
1109
1126
|
Key: tempMutual.mainKeys(),
|
|
@@ -1111,12 +1128,28 @@ var MutualRepository = class extends Repository {
|
|
|
1111
1128
|
});
|
|
1112
1129
|
mutualMetadata = Mutual.fromItem(respMetadataMutual.Item);
|
|
1113
1130
|
}
|
|
1114
|
-
|
|
1131
|
+
console.log("[MONORISE_DEBUG] getMutual fromItem:", {
|
|
1132
|
+
hasMutualMetadata: !!mutualMetadata,
|
|
1133
|
+
hasFirstItem: !!((_e = resp.Items) == null ? void 0 : _e[0])
|
|
1134
|
+
});
|
|
1135
|
+
const result = mutualMetadata || Mutual.fromItem((_f = resp.Items) == null ? void 0 : _f[0]);
|
|
1136
|
+
console.log("[MONORISE_DEBUG] getMutual complete:", {
|
|
1137
|
+
mutualId: result.mutualId,
|
|
1138
|
+
byEntityType: result.byEntityType,
|
|
1139
|
+
entityType: result.entityType
|
|
1140
|
+
});
|
|
1141
|
+
return result;
|
|
1115
1142
|
});
|
|
1116
1143
|
}
|
|
1117
1144
|
checkMutualExist(byEntityType, byEntityId, entityType, entityId) {
|
|
1118
1145
|
return __async(this, null, function* () {
|
|
1119
|
-
var _a;
|
|
1146
|
+
var _a, _b;
|
|
1147
|
+
console.log("[MONORISE_DEBUG] checkMutualExist:", {
|
|
1148
|
+
byEntityType,
|
|
1149
|
+
byEntityId,
|
|
1150
|
+
entityType,
|
|
1151
|
+
entityId
|
|
1152
|
+
});
|
|
1120
1153
|
const mutual = new Mutual(
|
|
1121
1154
|
byEntityType,
|
|
1122
1155
|
byEntityId,
|
|
@@ -1131,7 +1164,11 @@ var MutualRepository = class extends Repository {
|
|
|
1131
1164
|
Key: mutual.subKeys(),
|
|
1132
1165
|
ProjectionExpression: "PK, SK, expiresAt"
|
|
1133
1166
|
});
|
|
1134
|
-
|
|
1167
|
+
console.log("[MONORISE_DEBUG] checkMutualExist result:", {
|
|
1168
|
+
hasItem: !!resp.Item,
|
|
1169
|
+
hasExpiresAt: !!((_a = resp.Item) == null ? void 0 : _a.expiresAt)
|
|
1170
|
+
});
|
|
1171
|
+
if (resp.Item && !((_b = resp.Item) == null ? void 0 : _b.expiresAt)) {
|
|
1135
1172
|
throw new StandardError(
|
|
1136
1173
|
StandardErrorCode.MUTUAL_EXISTS,
|
|
1137
1174
|
"Entities are already linked"
|
|
@@ -1141,6 +1178,14 @@ var MutualRepository = class extends Repository {
|
|
|
1141
1178
|
});
|
|
1142
1179
|
}
|
|
1143
1180
|
createMutualTransactItems(mutual, opts) {
|
|
1181
|
+
console.log("[MONORISE_DEBUG] createMutualTransactItems:", {
|
|
1182
|
+
mutualId: mutual.mutualId,
|
|
1183
|
+
byEntityType: mutual.byEntityType,
|
|
1184
|
+
byEntityId: mutual.byEntityId,
|
|
1185
|
+
entityType: mutual.entityType,
|
|
1186
|
+
entityId: mutual.entityId,
|
|
1187
|
+
hasOpts: !!opts
|
|
1188
|
+
});
|
|
1144
1189
|
const TransactItems = [
|
|
1145
1190
|
{
|
|
1146
1191
|
Put: {
|
|
@@ -1215,10 +1260,19 @@ var MutualRepository = class extends Repository {
|
|
|
1215
1260
|
}
|
|
1216
1261
|
updateMutual(byEntityType, byEntityId, entityType, entityId, toUpdate, opts) {
|
|
1217
1262
|
return __async(this, null, function* () {
|
|
1218
|
-
var _a;
|
|
1263
|
+
var _a, _b;
|
|
1264
|
+
console.log("[MONORISE_DEBUG] updateMutual repository start:", {
|
|
1265
|
+
byEntityType,
|
|
1266
|
+
byEntityId,
|
|
1267
|
+
entityType,
|
|
1268
|
+
entityId,
|
|
1269
|
+
toUpdateKeys: Object.keys(toUpdate),
|
|
1270
|
+
opts
|
|
1271
|
+
});
|
|
1219
1272
|
const returnUpdatedValue = (_a = opts == null ? void 0 : opts.returnUpdatedValue) != null ? _a : false;
|
|
1220
1273
|
const errorContext = {};
|
|
1221
1274
|
try {
|
|
1275
|
+
console.log("[MONORISE_DEBUG] updateMutual fetching mutual...");
|
|
1222
1276
|
const mutual = yield this.getMutual(
|
|
1223
1277
|
byEntityType,
|
|
1224
1278
|
byEntityId,
|
|
@@ -1226,6 +1280,12 @@ var MutualRepository = class extends Repository {
|
|
|
1226
1280
|
entityId,
|
|
1227
1281
|
{ ProjectionExpression: PROJECTION_EXPRESSION.NO_DATA }
|
|
1228
1282
|
);
|
|
1283
|
+
console.log("[MONORISE_DEBUG] updateMutual mutual found:", {
|
|
1284
|
+
mutualId: mutual.mutualId,
|
|
1285
|
+
mainPk: mutual.mainPk,
|
|
1286
|
+
byFullEntityId: mutual.byFullEntityId,
|
|
1287
|
+
fullEntityId: mutual.fullEntityId
|
|
1288
|
+
});
|
|
1229
1289
|
const currentDatetime = (/* @__PURE__ */ new Date()).toISOString();
|
|
1230
1290
|
const toUpdateExpressions = this.toUpdate(
|
|
1231
1291
|
__spreadValues({
|
|
@@ -1233,6 +1293,11 @@ var MutualRepository = class extends Repository {
|
|
|
1233
1293
|
}, toUpdate),
|
|
1234
1294
|
{ maxLevel: opts == null ? void 0 : opts.maxObjectUpdateLevel }
|
|
1235
1295
|
);
|
|
1296
|
+
console.log("[MONORISE_DEBUG] updateMutual update expression:", {
|
|
1297
|
+
UpdateExpression: toUpdateExpressions.UpdateExpression,
|
|
1298
|
+
ExpressionAttributeNames: toUpdateExpressions.ExpressionAttributeNames,
|
|
1299
|
+
hasExpressionAttributeValues: !!toUpdateExpressions.ExpressionAttributeValues
|
|
1300
|
+
});
|
|
1236
1301
|
const updateExpression = {
|
|
1237
1302
|
ConditionExpression: (opts == null ? void 0 : opts.ConditionExpression) || "attribute_exists(PK)",
|
|
1238
1303
|
UpdateExpression: toUpdateExpressions.UpdateExpression,
|
|
@@ -1266,18 +1331,33 @@ var MutualRepository = class extends Repository {
|
|
|
1266
1331
|
}
|
|
1267
1332
|
];
|
|
1268
1333
|
errorContext.TransactItems = TransactItems;
|
|
1334
|
+
console.log("[MONORISE_DEBUG] updateMutual transact items prepared:", {
|
|
1335
|
+
itemCount: TransactItems.length,
|
|
1336
|
+
tableName: this.TABLE_NAME
|
|
1337
|
+
});
|
|
1338
|
+
console.log("[MONORISE_DEBUG] updateMutual executing transaction...");
|
|
1269
1339
|
yield this.ddbUtils.executeTransactWrite({ TransactItems });
|
|
1340
|
+
console.log("[MONORISE_DEBUG] updateMutual transaction succeeded");
|
|
1270
1341
|
if (!returnUpdatedValue) {
|
|
1342
|
+
console.log("[MONORISE_DEBUG] updateMutual returning (no value)");
|
|
1271
1343
|
return;
|
|
1272
1344
|
}
|
|
1345
|
+
console.log("[MONORISE_DEBUG] updateMutual fetching updated mutual...");
|
|
1273
1346
|
const updatedMutual = yield this.getMutual(
|
|
1274
1347
|
byEntityType,
|
|
1275
1348
|
byEntityId,
|
|
1276
1349
|
entityType,
|
|
1277
1350
|
entityId
|
|
1278
1351
|
);
|
|
1352
|
+
console.log("[MONORISE_DEBUG] updateMutual repository complete");
|
|
1279
1353
|
return updatedMutual;
|
|
1280
1354
|
} catch (err) {
|
|
1355
|
+
console.error("[MONORISE_DEBUG] updateMutual repository error:", {
|
|
1356
|
+
errorName: (_b = err == null ? void 0 : err.constructor) == null ? void 0 : _b.name,
|
|
1357
|
+
errorMessage: err == null ? void 0 : err.message,
|
|
1358
|
+
errorCode: err == null ? void 0 : err.code,
|
|
1359
|
+
isStandardError: err instanceof StandardError
|
|
1360
|
+
});
|
|
1281
1361
|
if (err instanceof StandardError && err.code === StandardErrorCode.CONDITIONAL_CHECK_FAILED) {
|
|
1282
1362
|
throw new StandardError(
|
|
1283
1363
|
StandardErrorCode.MUTUAL_NOT_FOUND,
|
|
@@ -2215,6 +2295,7 @@ var getDependencies = () => {
|
|
|
2215
2295
|
// middlewares/general-error-handler.ts
|
|
2216
2296
|
var factory2 = createFactory2();
|
|
2217
2297
|
var generalErrorHandler = (dependencies = getDependencies()) => factory2.createMiddleware((c) => __async(null, null, function* () {
|
|
2298
|
+
var _a, _b, _c, _d;
|
|
2218
2299
|
if (c.error) {
|
|
2219
2300
|
const { nanoid: nanoid2, publishErrorEvent: publishErrorEvent2 } = dependencies;
|
|
2220
2301
|
const errorId = nanoid2();
|
|
@@ -2227,12 +2308,21 @@ var generalErrorHandler = (dependencies = getDependencies()) => factory2.createM
|
|
|
2227
2308
|
body,
|
|
2228
2309
|
error: c.error
|
|
2229
2310
|
});
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2311
|
+
const error = c.error;
|
|
2312
|
+
console.warn("[MONORISE_DEBUG] INTERNAL_SERVER_EXCEPTION:", {
|
|
2313
|
+
errorId,
|
|
2314
|
+
method: c.req.method,
|
|
2315
|
+
path: c.req.path,
|
|
2316
|
+
errorName: error == null ? void 0 : error.name,
|
|
2317
|
+
errorMessage: error == null ? void 0 : error.message,
|
|
2318
|
+
errorCode: error == null ? void 0 : error.code,
|
|
2319
|
+
errorStack: error == null ? void 0 : error.stack,
|
|
2320
|
+
errorConstructor: (_a = error == null ? void 0 : error.constructor) == null ? void 0 : _a.name,
|
|
2321
|
+
hasLastError: !!(error == null ? void 0 : error.lastError),
|
|
2322
|
+
lastErrorName: (_c = (_b = error == null ? void 0 : error.lastError) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name,
|
|
2323
|
+
lastErrorMessage: (_d = error == null ? void 0 : error.lastError) == null ? void 0 : _d.message,
|
|
2324
|
+
context: error == null ? void 0 : error.context
|
|
2325
|
+
});
|
|
2236
2326
|
c.status(500);
|
|
2237
2327
|
c.json({
|
|
2238
2328
|
code: "INTERNAL_SERVER_EXCEPTION",
|
|
@@ -2315,7 +2405,7 @@ var handler2 = (container) => (ev) => __async(null, null, function* () {
|
|
|
2315
2405
|
const { entityRepository, mutualRepository, publishEvent: publishEvent2 } = container;
|
|
2316
2406
|
yield Promise.allSettled(
|
|
2317
2407
|
ev.Records.map((record) => __async(null, null, function* () {
|
|
2318
|
-
var _a, _b, _c, _d;
|
|
2408
|
+
var _a, _b, _c, _d, _e;
|
|
2319
2409
|
const errorContext = {};
|
|
2320
2410
|
const body = parseSQSBusEvent(record.body);
|
|
2321
2411
|
const { detail } = body;
|
|
@@ -2338,6 +2428,7 @@ var handler2 = (container) => (ev) => __async(null, null, function* () {
|
|
|
2338
2428
|
);
|
|
2339
2429
|
}
|
|
2340
2430
|
const mutualDataProcessor = (_d = config.mutualDataProcessor) != null ? _d : (() => ({}));
|
|
2431
|
+
const mutualDataSchema = (_e = config.mutual) == null ? void 0 : _e.mutualDataSchema;
|
|
2341
2432
|
yield mutualRepository.createMutualLock({
|
|
2342
2433
|
byEntityType,
|
|
2343
2434
|
byEntityId,
|
|
@@ -2373,6 +2464,20 @@ var handler2 = (container) => (ev) => __async(null, null, function* () {
|
|
|
2373
2464
|
addedEntityIds,
|
|
2374
2465
|
(id) => __async(null, null, function* () {
|
|
2375
2466
|
const entity = yield entityRepository.getEntity(entityType, id);
|
|
2467
|
+
const processedMutualData = mutualDataProcessor(
|
|
2468
|
+
mutualIds,
|
|
2469
|
+
new Mutual(
|
|
2470
|
+
byEntityType,
|
|
2471
|
+
byEntityId,
|
|
2472
|
+
byEntity.data,
|
|
2473
|
+
entityType,
|
|
2474
|
+
id,
|
|
2475
|
+
entity.data,
|
|
2476
|
+
{}
|
|
2477
|
+
),
|
|
2478
|
+
customContext
|
|
2479
|
+
);
|
|
2480
|
+
const parsedMutualData = mutualDataSchema ? mutualDataSchema.parse(processedMutualData) : processedMutualData;
|
|
2376
2481
|
yield mutualRepository.createMutual(
|
|
2377
2482
|
byEntityType,
|
|
2378
2483
|
byEntityId,
|
|
@@ -2380,19 +2485,7 @@ var handler2 = (container) => (ev) => __async(null, null, function* () {
|
|
|
2380
2485
|
entityType,
|
|
2381
2486
|
id,
|
|
2382
2487
|
entity.data,
|
|
2383
|
-
|
|
2384
|
-
mutualIds,
|
|
2385
|
-
new Mutual(
|
|
2386
|
-
byEntityType,
|
|
2387
|
-
byEntityId,
|
|
2388
|
-
byEntity.data,
|
|
2389
|
-
entityType,
|
|
2390
|
-
id,
|
|
2391
|
-
entity.data,
|
|
2392
|
-
{}
|
|
2393
|
-
),
|
|
2394
|
-
customContext
|
|
2395
|
-
),
|
|
2488
|
+
parsedMutualData,
|
|
2396
2489
|
{
|
|
2397
2490
|
ConditionExpression: "attribute_not_exists(#mutualUpdatedAt) OR #mutualUpdatedAt < :publishedAt",
|
|
2398
2491
|
ExpressionAttributeNames: {
|
|
@@ -2429,25 +2522,27 @@ var handler2 = (container) => (ev) => __async(null, null, function* () {
|
|
|
2429
2522
|
const updateEntities = yield processEntities(
|
|
2430
2523
|
toUpdateEntityIds,
|
|
2431
2524
|
(id) => __async(null, null, function* () {
|
|
2525
|
+
const processedMutualData = mutualDataProcessor(
|
|
2526
|
+
mutualIds,
|
|
2527
|
+
new Mutual(
|
|
2528
|
+
byEntityType,
|
|
2529
|
+
byEntityId,
|
|
2530
|
+
byEntity.data,
|
|
2531
|
+
entityType,
|
|
2532
|
+
id,
|
|
2533
|
+
{},
|
|
2534
|
+
{}
|
|
2535
|
+
),
|
|
2536
|
+
customContext
|
|
2537
|
+
);
|
|
2538
|
+
const parsedMutualData = mutualDataSchema ? mutualDataSchema.parse(processedMutualData) : processedMutualData;
|
|
2432
2539
|
yield mutualRepository.updateMutual(
|
|
2433
2540
|
byEntityType,
|
|
2434
2541
|
byEntityId,
|
|
2435
2542
|
entityType,
|
|
2436
2543
|
id,
|
|
2437
2544
|
{
|
|
2438
|
-
mutualData:
|
|
2439
|
-
mutualIds,
|
|
2440
|
-
new Mutual(
|
|
2441
|
-
byEntityType,
|
|
2442
|
-
byEntityId,
|
|
2443
|
-
byEntity.data,
|
|
2444
|
-
entityType,
|
|
2445
|
-
id,
|
|
2446
|
-
{},
|
|
2447
|
-
{}
|
|
2448
|
-
),
|
|
2449
|
-
customContext
|
|
2450
|
-
),
|
|
2545
|
+
mutualData: parsedMutualData,
|
|
2451
2546
|
mutualUpdatedAt: publishedAt
|
|
2452
2547
|
},
|
|
2453
2548
|
{
|
|
@@ -7925,6 +8020,7 @@ var CreateMutualController = class {
|
|
|
7925
8020
|
constructor(mutualService) {
|
|
7926
8021
|
this.mutualService = mutualService;
|
|
7927
8022
|
this.controller = createMiddleware11((c) => __async(this, null, function* () {
|
|
8023
|
+
var _a;
|
|
7928
8024
|
const accountId = c.req.header("account-id");
|
|
7929
8025
|
const { byEntityType, byEntityId, entityType, entityId } = c.req.param();
|
|
7930
8026
|
const asEntity = c.req.query("asEntity");
|
|
@@ -7943,7 +8039,7 @@ var CreateMutualController = class {
|
|
|
7943
8039
|
});
|
|
7944
8040
|
return c.json(mutual);
|
|
7945
8041
|
} catch (err) {
|
|
7946
|
-
if (err
|
|
8042
|
+
if (((_a = err == null ? void 0 : err.constructor) == null ? void 0 : _a.name) === "ZodError") {
|
|
7947
8043
|
c.status(httpStatus11.BAD_REQUEST);
|
|
7948
8044
|
return c.json({
|
|
7949
8045
|
code: "API_VALIDATION_ERROR",
|
|
@@ -7951,15 +8047,15 @@ var CreateMutualController = class {
|
|
|
7951
8047
|
details: err.flatten()
|
|
7952
8048
|
});
|
|
7953
8049
|
}
|
|
7954
|
-
if (err instanceof StandardError
|
|
7955
|
-
c.status(httpStatus11.BAD_REQUEST);
|
|
7956
|
-
return c.json(__spreadValues({}, err.toJSON()));
|
|
7957
|
-
}
|
|
7958
|
-
if (err instanceof StandardError && err.code === StandardErrorCode.ENTITY_IS_UNDEFINED) {
|
|
8050
|
+
if (err instanceof StandardError) {
|
|
7959
8051
|
c.status(httpStatus11.BAD_REQUEST);
|
|
7960
8052
|
return c.json(__spreadValues({}, err.toJSON()));
|
|
7961
8053
|
}
|
|
7962
|
-
|
|
8054
|
+
c.status(httpStatus11.INTERNAL_SERVER_ERROR);
|
|
8055
|
+
return c.json({
|
|
8056
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
8057
|
+
message: (err == null ? void 0 : err.message) || "An unexpected error occurred"
|
|
8058
|
+
});
|
|
7963
8059
|
}
|
|
7964
8060
|
}));
|
|
7965
8061
|
}
|
|
@@ -8093,6 +8189,7 @@ var UpdateMutualController = class {
|
|
|
8093
8189
|
constructor(mutualService) {
|
|
8094
8190
|
this.mutualService = mutualService;
|
|
8095
8191
|
this.controller = createMiddleware15((c) => __async(this, null, function* () {
|
|
8192
|
+
var _a;
|
|
8096
8193
|
const accountId = c.req.header("account-id");
|
|
8097
8194
|
const { byEntityType, byEntityId, entityType, entityId } = c.req.param();
|
|
8098
8195
|
const body = yield c.req.json();
|
|
@@ -8110,7 +8207,7 @@ var UpdateMutualController = class {
|
|
|
8110
8207
|
});
|
|
8111
8208
|
return c.json(mutual);
|
|
8112
8209
|
} catch (err) {
|
|
8113
|
-
if (err
|
|
8210
|
+
if (((_a = err == null ? void 0 : err.constructor) == null ? void 0 : _a.name) === "ZodError") {
|
|
8114
8211
|
c.status(httpStatus14.BAD_REQUEST);
|
|
8115
8212
|
return c.json({
|
|
8116
8213
|
code: "API_VALIDATION_ERROR",
|
|
@@ -8118,11 +8215,15 @@ var UpdateMutualController = class {
|
|
|
8118
8215
|
details: err.flatten()
|
|
8119
8216
|
});
|
|
8120
8217
|
}
|
|
8121
|
-
if (err instanceof StandardError
|
|
8218
|
+
if (err instanceof StandardError) {
|
|
8122
8219
|
c.status(httpStatus14.BAD_REQUEST);
|
|
8123
8220
|
return c.json(__spreadValues({}, err.toJSON()));
|
|
8124
8221
|
}
|
|
8125
|
-
|
|
8222
|
+
c.status(httpStatus14.INTERNAL_SERVER_ERROR);
|
|
8223
|
+
return c.json({
|
|
8224
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
8225
|
+
message: (err == null ? void 0 : err.message) || "An unexpected error occurred"
|
|
8226
|
+
});
|
|
8126
8227
|
}
|
|
8127
8228
|
}));
|
|
8128
8229
|
}
|
|
@@ -8510,7 +8611,8 @@ var EntityService = class {
|
|
|
8510
8611
|
// services/mutual.service.ts
|
|
8511
8612
|
import { ulid as ulid4 } from "ulid";
|
|
8512
8613
|
var MutualService = class {
|
|
8513
|
-
constructor(entityRepository, mutualRepository, publishEvent2, ddbUtils, entityServiceLifeCycle) {
|
|
8614
|
+
constructor(EntityConfig, entityRepository, mutualRepository, publishEvent2, ddbUtils, entityServiceLifeCycle) {
|
|
8615
|
+
this.EntityConfig = EntityConfig;
|
|
8514
8616
|
this.entityRepository = entityRepository;
|
|
8515
8617
|
this.mutualRepository = mutualRepository;
|
|
8516
8618
|
this.publishEvent = publishEvent2;
|
|
@@ -8525,6 +8627,7 @@ var MutualService = class {
|
|
|
8525
8627
|
accountId,
|
|
8526
8628
|
options = {}
|
|
8527
8629
|
}) {
|
|
8630
|
+
var _a;
|
|
8528
8631
|
const {
|
|
8529
8632
|
ensureEntityStrongConsistentWrite = false,
|
|
8530
8633
|
asEntity,
|
|
@@ -8545,20 +8648,37 @@ var MutualService = class {
|
|
|
8545
8648
|
options
|
|
8546
8649
|
}
|
|
8547
8650
|
};
|
|
8548
|
-
|
|
8651
|
+
console.log("[MONORISE_DEBUG] createMutual service start:", {
|
|
8652
|
+
byEntityType,
|
|
8653
|
+
byEntityId,
|
|
8654
|
+
entityType,
|
|
8655
|
+
entityId,
|
|
8656
|
+
mutualPayload,
|
|
8657
|
+
options
|
|
8658
|
+
});
|
|
8659
|
+
const schema = (_a = this.getMutualDataSchema(byEntityType, entityType)) != null ? _a : external_exports.record(external_exports.string(), external_exports.any());
|
|
8660
|
+
console.log("[MONORISE_DEBUG] createMutual schema resolved");
|
|
8549
8661
|
const parsedMutualPayload = schema.parse(mutualPayload);
|
|
8662
|
+
console.log("[MONORISE_DEBUG] createMutual payload parsed:", parsedMutualPayload);
|
|
8663
|
+
console.log("[MONORISE_DEBUG] createMutual fetching entities...");
|
|
8550
8664
|
const [{ data: byEntityData }, { data: entityData }] = yield Promise.all([
|
|
8551
8665
|
this.entityRepository.getEntity(byEntityType, byEntityId),
|
|
8552
8666
|
this.entityRepository.getEntity(entityType, entityId)
|
|
8553
8667
|
]);
|
|
8668
|
+
console.log("[MONORISE_DEBUG] createMutual entities fetched:", {
|
|
8669
|
+
hasByEntityData: !!byEntityData,
|
|
8670
|
+
hasEntityData: !!entityData
|
|
8671
|
+
});
|
|
8554
8672
|
errorContext.byEntityData = byEntityData;
|
|
8555
8673
|
errorContext.entityData = entityData;
|
|
8674
|
+
console.log("[MONORISE_DEBUG] createMutual checking mutual exist...");
|
|
8556
8675
|
yield this.mutualRepository.checkMutualExist(
|
|
8557
8676
|
byEntityType,
|
|
8558
8677
|
byEntityId,
|
|
8559
8678
|
entityType,
|
|
8560
8679
|
entityId
|
|
8561
8680
|
);
|
|
8681
|
+
console.log("[MONORISE_DEBUG] createMutual mutual does not exist (ok)");
|
|
8562
8682
|
const currentDatetime = createAndUpdateDatetime || /* @__PURE__ */ new Date();
|
|
8563
8683
|
const mutual = new Mutual(
|
|
8564
8684
|
byEntityType,
|
|
@@ -8573,6 +8693,9 @@ var MutualService = class {
|
|
|
8573
8693
|
currentDatetime,
|
|
8574
8694
|
currentDatetime
|
|
8575
8695
|
);
|
|
8696
|
+
console.log("[MONORISE_DEBUG] createMutual mutual object created:", {
|
|
8697
|
+
mutualId: mutual.mutualId
|
|
8698
|
+
});
|
|
8576
8699
|
const mutualTransactions = skipMutualCreation ? [] : this.mutualRepository.createMutualTransactItems(mutual, {
|
|
8577
8700
|
ConditionExpression,
|
|
8578
8701
|
ExpressionAttributeNames,
|
|
@@ -8596,9 +8719,13 @@ var MutualService = class {
|
|
|
8596
8719
|
}
|
|
8597
8720
|
const createTransactItems = [...mutualTransactions, ...entityTransactions];
|
|
8598
8721
|
errorContext.createTransactItems = createTransactItems;
|
|
8722
|
+
console.log("[MONORISE_DEBUG] createMutual executing transaction:", {
|
|
8723
|
+
transactItemCount: createTransactItems.length
|
|
8724
|
+
});
|
|
8599
8725
|
yield this.ddbUtils.executeTransactWrite({
|
|
8600
8726
|
TransactItems: createTransactItems
|
|
8601
8727
|
});
|
|
8728
|
+
console.log("[MONORISE_DEBUG] createMutual transaction succeeded");
|
|
8602
8729
|
if (asEntity && entity && ensureEntityStrongConsistentWrite) {
|
|
8603
8730
|
yield this.entityServiceLifeCycle.afterCreateEntityHook(
|
|
8604
8731
|
entity,
|
|
@@ -8637,6 +8764,7 @@ var MutualService = class {
|
|
|
8637
8764
|
})
|
|
8638
8765
|
];
|
|
8639
8766
|
yield Promise.all(eventPromises);
|
|
8767
|
+
console.log("[MONORISE_DEBUG] createMutual service complete");
|
|
8640
8768
|
return { mutual, eventPayload };
|
|
8641
8769
|
});
|
|
8642
8770
|
this.updateMutual = (_0) => __async(this, [_0], function* ({
|
|
@@ -8648,8 +8776,20 @@ var MutualService = class {
|
|
|
8648
8776
|
accountId,
|
|
8649
8777
|
options
|
|
8650
8778
|
}) {
|
|
8651
|
-
|
|
8779
|
+
var _a;
|
|
8780
|
+
console.log("[MONORISE_DEBUG] updateMutual service start:", {
|
|
8781
|
+
byEntityType,
|
|
8782
|
+
byEntityId,
|
|
8783
|
+
entityType,
|
|
8784
|
+
entityId,
|
|
8785
|
+
mutualPayload,
|
|
8786
|
+
options
|
|
8787
|
+
});
|
|
8788
|
+
const schema = (_a = this.getMutualDataSchema(byEntityType, entityType)) != null ? _a : external_exports.record(external_exports.string(), external_exports.any());
|
|
8789
|
+
console.log("[MONORISE_DEBUG] updateMutual schema resolved");
|
|
8652
8790
|
const parsedMutualPayload = schema.parse(mutualPayload);
|
|
8791
|
+
console.log("[MONORISE_DEBUG] updateMutual payload parsed:", parsedMutualPayload);
|
|
8792
|
+
console.log("[MONORISE_DEBUG] updateMutual calling repository...");
|
|
8653
8793
|
const mutual = yield this.mutualRepository.updateMutual(
|
|
8654
8794
|
byEntityType,
|
|
8655
8795
|
byEntityId,
|
|
@@ -8658,6 +8798,10 @@ var MutualService = class {
|
|
|
8658
8798
|
{ mutualData: parsedMutualPayload },
|
|
8659
8799
|
options
|
|
8660
8800
|
);
|
|
8801
|
+
console.log("[MONORISE_DEBUG] updateMutual repository result:", {
|
|
8802
|
+
hasMutual: !!mutual,
|
|
8803
|
+
mutualId: mutual == null ? void 0 : mutual.mutualId
|
|
8804
|
+
});
|
|
8661
8805
|
yield this.publishEvent({
|
|
8662
8806
|
event: EVENT.CORE.MUTUAL_UPDATED(byEntityType, entityType),
|
|
8663
8807
|
payload: {
|
|
@@ -8669,6 +8813,7 @@ var MutualService = class {
|
|
|
8669
8813
|
updatedByAccountId: accountId
|
|
8670
8814
|
}
|
|
8671
8815
|
});
|
|
8816
|
+
console.log("[MONORISE_DEBUG] updateMutual service complete");
|
|
8672
8817
|
return mutual;
|
|
8673
8818
|
});
|
|
8674
8819
|
this.deleteMutual = (_0) => __async(this, [_0], function* ({
|
|
@@ -8697,6 +8842,22 @@ var MutualService = class {
|
|
|
8697
8842
|
return mutual;
|
|
8698
8843
|
});
|
|
8699
8844
|
}
|
|
8845
|
+
getMutualDataSchema(byEntityType, entityType) {
|
|
8846
|
+
var _a, _b, _c;
|
|
8847
|
+
for (const [from, to] of [
|
|
8848
|
+
[byEntityType, entityType],
|
|
8849
|
+
[entityType, byEntityType]
|
|
8850
|
+
]) {
|
|
8851
|
+
const mutualFields = (_b = (_a = this.EntityConfig[from]) == null ? void 0 : _a.mutual) == null ? void 0 : _b.mutualFields;
|
|
8852
|
+
if (!mutualFields) continue;
|
|
8853
|
+
for (const config of Object.values(mutualFields)) {
|
|
8854
|
+
if (config.entityType === to && ((_c = config.mutual) == null ? void 0 : _c.mutualDataSchema)) {
|
|
8855
|
+
return config.mutual.mutualDataSchema;
|
|
8856
|
+
}
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8859
|
+
return void 0;
|
|
8860
|
+
}
|
|
8700
8861
|
};
|
|
8701
8862
|
|
|
8702
8863
|
// controllers/tag/list-tags.controller.ts
|
|
@@ -9395,6 +9556,7 @@ var DependencyContainer = class {
|
|
|
9395
9556
|
get mutualService() {
|
|
9396
9557
|
return this.createCachedInstance(
|
|
9397
9558
|
MutualService,
|
|
9559
|
+
this.config.EntityConfig,
|
|
9398
9560
|
this.entityRepository,
|
|
9399
9561
|
this.mutualRepository,
|
|
9400
9562
|
this.publishEvent,
|
|
@@ -9522,19 +9684,47 @@ var DependencyContainer = class {
|
|
|
9522
9684
|
}
|
|
9523
9685
|
};
|
|
9524
9686
|
|
|
9525
|
-
//
|
|
9687
|
+
// ../base/dist/index.js
|
|
9688
|
+
var __defProp = Object.defineProperty;
|
|
9689
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9690
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9691
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9692
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9693
|
+
var __spreadValues2 = (a, b) => {
|
|
9694
|
+
for (var prop in b || (b = {}))
|
|
9695
|
+
if (__hasOwnProp.call(b, prop))
|
|
9696
|
+
__defNormalProp(a, prop, b[prop]);
|
|
9697
|
+
if (__getOwnPropSymbols)
|
|
9698
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
9699
|
+
if (__propIsEnum.call(b, prop))
|
|
9700
|
+
__defNormalProp(a, prop, b[prop]);
|
|
9701
|
+
}
|
|
9702
|
+
return a;
|
|
9703
|
+
};
|
|
9704
|
+
var __objRest2 = (source, exclude) => {
|
|
9705
|
+
var target = {};
|
|
9706
|
+
for (var prop in source)
|
|
9707
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
9708
|
+
target[prop] = source[prop];
|
|
9709
|
+
if (source != null && __getOwnPropSymbols)
|
|
9710
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
9711
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
9712
|
+
target[prop] = source[prop];
|
|
9713
|
+
}
|
|
9714
|
+
return target;
|
|
9715
|
+
};
|
|
9526
9716
|
var transactional = {
|
|
9527
9717
|
createEntity: (entityType, payload) => {
|
|
9528
|
-
const _a = payload, { entityId } = _a, rest =
|
|
9529
|
-
return
|
|
9718
|
+
const _a = payload, { entityId } = _a, rest = __objRest2(_a, ["entityId"]);
|
|
9719
|
+
return __spreadValues2({
|
|
9530
9720
|
operation: "createEntity",
|
|
9531
9721
|
entityType,
|
|
9532
9722
|
payload: rest
|
|
9533
9723
|
}, entityId && { entityId });
|
|
9534
9724
|
},
|
|
9535
9725
|
updateEntity: (entityType, entityId, payload) => {
|
|
9536
|
-
const _a = payload, { $condition } = _a, rest =
|
|
9537
|
-
return
|
|
9726
|
+
const _a = payload, { $condition } = _a, rest = __objRest2(_a, ["$condition"]);
|
|
9727
|
+
return __spreadValues2({
|
|
9538
9728
|
operation: "updateEntity",
|
|
9539
9729
|
entityType,
|
|
9540
9730
|
entityId,
|
|
@@ -9542,8 +9732,8 @@ var transactional = {
|
|
|
9542
9732
|
}, $condition && { condition: $condition });
|
|
9543
9733
|
},
|
|
9544
9734
|
adjustEntity: (entityType, entityId, adjustments) => {
|
|
9545
|
-
const _a = adjustments, { $condition } = _a, rest =
|
|
9546
|
-
return
|
|
9735
|
+
const _a = adjustments, { $condition } = _a, rest = __objRest2(_a, ["$condition"]);
|
|
9736
|
+
return __spreadValues2({
|
|
9547
9737
|
operation: "adjustEntity",
|
|
9548
9738
|
entityType,
|
|
9549
9739
|
entityId,
|