@reventlessdev/reventless-core 3.0.0-alpha.341 → 3.0.0-alpha.342
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/CHANGELOG.md +16 -0
- package/package.json +7 -7
- package/src/Projection.res +32 -4
- package/src/Projection.res.mjs +51 -4
- package/src/ViewChange.res +1 -9
- package/src/ViewChange.res.mjs +2 -13
- package/src/admin/Platform_ComponentDefinitionsApi.res +29 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +47 -1
- package/src/admin/Platform_PluginStructuresApi.res +4 -3
- package/src/admin/Platform_PluginStructuresApi.res.mjs +5 -1
- package/src/components/Api/SuryToJsonSchema.res +7 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +18 -0
- package/src/components/Dcb/Dcb_Builder.res +59 -0
- package/src/components/Dcb/Dcb_Builder.res.mjs +48 -3
- package/src/components/DcbEventLog/DcbEventLog.res +2 -0
- package/src/components/DcbEventLog/DcbEventLog_Adapter.res +7 -0
- package/src/components/DcbEventLog/DcbEventLog_Builder.res +12 -3
- package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +5 -3
- package/src/components/DcbEventLog/DcbEventLog_Operations.res +3 -0
- package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +3 -1
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +2 -2
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +158 -107
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +178 -154
- package/src/components/StateChangeSlice/StateChangeSlice.res +3 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +6 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res.mjs +5 -4
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +369 -279
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +210 -166
- package/src/plugin/component/Plugin_Structure.res +45 -0
- package/src/plugin/component/Plugin_Structure.res.mjs +42 -1
- package/src/util/Logger.res +5 -5
- package/src/util/Logger.res.mjs +3 -3
- package/tests/admin/AdminApiSchemaDriftTest.res +23 -0
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +21 -1
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +1 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +1 -0
- package/tests/admin/Platform_PluginStructuresApiTest.res +1 -0
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +1 -0
- package/tests/api/QuantitySemanticTest.res +68 -0
- package/tests/api/QuantitySemanticTest.res.mjs +68 -0
- package/tests/commandgenerator/OwnerActingTest.res.mjs +1 -1
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +1 -1
- package/tests/dcb/DcbFenceCountReadTest.res +213 -0
- package/tests/dcb/DcbFenceCountReadTest.res.mjs +358 -0
- package/tests/dcb/DcbPiiSliceTest.res.mjs +1 -1
- package/tests/dcb/DcbReadsNothingTest.res.mjs +1 -1
- package/tests/dcb/DcbScopeInferenceTest.res +143 -2
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +192 -2
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +22 -22
- package/tests/dcb/DcbTagTest.res +68 -0
- package/tests/dcb/DcbTagTest.res.mjs +86 -10
- package/tests/dcb/DcbValidationTest.res.mjs +1 -1
- package/tests/logger/LoggerLazyTest.res.mjs +3 -3
- package/tests/plugin/PluginStructureAccessTest.res +1 -0
- package/tests/plugin/PluginStructureAccessTest.res.mjs +1 -1
- package/tests/plugin/PluginStructureTest.res +61 -0
- package/tests/plugin/PluginStructureTest.res.mjs +78 -32
- package/tests/plugin/StateChange/PsRateSession.res +37 -0
- package/tests/plugin/StateChange/PsRateSession.res.mjs +80 -0
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +10 -0
- package/tests/projection/ViewChangeTest.res +32 -0
- package/tests/projection/ViewChangeTest.res.mjs +57 -0
|
@@ -11,6 +11,7 @@ import * as Effect$1 from "effect/Effect";
|
|
|
11
11
|
import * as Stream$1 from "effect/Stream";
|
|
12
12
|
import * as Pii$Reventless from "@reventlessdev/reventless-spec/src/components/Pii.res.mjs";
|
|
13
13
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
14
|
+
import * as Duration from "effect/Duration";
|
|
14
15
|
import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components/Owner.res.mjs";
|
|
15
16
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
16
17
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
@@ -21,9 +22,11 @@ import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/U
|
|
|
21
22
|
import * as OwnerScope$Reventless from "@reventlessdev/reventless-spec/src/types/OwnerScope.res.mjs";
|
|
22
23
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
23
24
|
import * as Metrics$ReventlessCore from "../../util/Metrics.res.mjs";
|
|
25
|
+
import * as DcbFenceCount$Reventless from "@reventlessdev/reventless-spec/src/components/DcbFenceCount.res.mjs";
|
|
24
26
|
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
25
27
|
import * as CommandOutcome$Reventless from "@reventlessdev/reventless-spec/src/components/CommandOutcome.res.mjs";
|
|
26
28
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
29
|
+
import * as DcbScopeInference$Reventless from "@reventlessdev/reventless-spec/src/components/DcbScopeInference.res.mjs";
|
|
27
30
|
import * as CommandTopic_Helpers$ReventlessCore from "../CommandTopic/CommandTopic_Helpers.res.mjs";
|
|
28
31
|
|
|
29
32
|
function Make(Spec) {
|
|
@@ -149,11 +152,11 @@ function Make(Spec) {
|
|
|
149
152
|
};
|
|
150
153
|
let projectionCache = Lru$ReventlessCore.make(100, Lru$ReventlessCore.decodedStateTtlMs(), undefined);
|
|
151
154
|
let resetCache = () => Lru$ReventlessCore.clear(projectionCache);
|
|
152
|
-
let handleSingleCommand = (tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, partitionTag, dcbEventLog, command$p) => {
|
|
155
|
+
let handleSingleCommand = (tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, pairEventTypes, partitionTag, dcbEventLog, command$p) => {
|
|
153
156
|
let cmdJson = Message$ReventlessCore.commandJsonOfCommand$p(Id$Reventless.$$String.toString, Spec.commandSchema, command$p);
|
|
154
157
|
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, cmdJson.commandJson, EffectLogger$ReventlessCore.idsOf(undefined, undefined, cmdJson.meta), `handling command: ` + LogFormat$ReventlessCore.cmdDetailNoId(cmdJson)));
|
|
155
158
|
let asksForRepeat = Message$ReventlessCore.hasStableMsgId(command$p.meta);
|
|
156
|
-
let query = DcbTag$Reventless.buildQueryFromCommand(asksForRepeat ? queryEventTypesWithOwn : queryEventTypes, Spec.commandSchema, command$p.command, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys);
|
|
159
|
+
let query = DcbTag$Reventless.buildQueryFromCommand(asksForRepeat ? queryEventTypesWithOwn : queryEventTypes, Spec.commandSchema, command$p.command, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, pairEventTypes);
|
|
157
160
|
let queryDetail = query.map(qi => {
|
|
158
161
|
let ts = qi.eventTypes;
|
|
159
162
|
let types = ts !== undefined ? ts.map(LogFormat$ReventlessCore.bold).join("|") : "*";
|
|
@@ -241,18 +244,28 @@ function Make(Spec) {
|
|
|
241
244
|
contents: cacheGet()
|
|
242
245
|
};
|
|
243
246
|
Metrics$ReventlessCore.emitCount(Stdlib_Option.isSome(seed.contents) ? "DcbDecisionModelCacheHit" : "DcbDecisionModelCacheMiss", Spec.name, undefined);
|
|
247
|
+
let fenceClauses = DcbFenceCount$Reventless.clauses(query, crossPartitionTagKeys);
|
|
244
248
|
let attempt = retries => {
|
|
245
249
|
let match = seed.contents;
|
|
246
250
|
let match$1 = match !== undefined ? [
|
|
247
251
|
match[0],
|
|
248
252
|
match[1],
|
|
249
|
-
match[2]
|
|
253
|
+
match[2],
|
|
254
|
+
match[3]
|
|
250
255
|
] : [
|
|
251
256
|
Decision.initialState,
|
|
252
257
|
undefined,
|
|
253
|
-
[]
|
|
258
|
+
[],
|
|
259
|
+
{}
|
|
254
260
|
];
|
|
261
|
+
let baseOwners = match$1[2];
|
|
255
262
|
let afterPos = match$1[1];
|
|
263
|
+
let baseState = match$1[0];
|
|
264
|
+
let seen = Object.assign({}, match$1[3]);
|
|
265
|
+
let match$2 = dcbEventLog.readFences;
|
|
266
|
+
let fencesRead = fenceClauses.length !== 0 ? (
|
|
267
|
+
match$2 !== undefined ? Effect.tryPromise(e => `reading the fences failed: ` + String(e), () => match$2(fenceClauses.map(c => c.tag))) : Effect$1.succeed([])
|
|
268
|
+
) : Effect$1.succeed([]);
|
|
256
269
|
let cacheHit = Stdlib_Option.isSome(seed.contents);
|
|
257
270
|
let strongConsistency;
|
|
258
271
|
switch (Spec.readConsistency) {
|
|
@@ -266,16 +279,17 @@ function Make(Spec) {
|
|
|
266
279
|
strongConsistency = false;
|
|
267
280
|
break;
|
|
268
281
|
}
|
|
269
|
-
return Effect$1.flatMap(Effect$1.tap(Stream.runFold(Stream.mapEffect(DcbTag$Reventless.readsNothing(query) ? Stream$1.empty : dcbEventLog.readStream(query, afterPos, strongConsistency), openRaw), [
|
|
270
|
-
|
|
282
|
+
return Effect$1.flatMap(fencesRead, fences => Effect$1.flatMap(Effect$1.tap(Stream.runFold(Stream.mapEffect(DcbTag$Reventless.readsNothing(query) ? Stream$1.empty : dcbEventLog.readStream(query, afterPos, strongConsistency), openRaw), [
|
|
283
|
+
baseState,
|
|
271
284
|
afterPos,
|
|
272
285
|
[],
|
|
273
|
-
|
|
286
|
+
baseOwners,
|
|
274
287
|
false
|
|
275
288
|
], (param, raw) => {
|
|
276
289
|
let owners = param[3];
|
|
277
290
|
let reads = param[2];
|
|
278
291
|
let dm = param[0];
|
|
292
|
+
DcbFenceCount$Reventless.countRead(seen, fenceClauses, raw.eventType, raw.tags);
|
|
279
293
|
let repeated = param[4] || asksForRepeat && Primitive_object.equal(raw.meta.causationId, command$p.meta.msgId);
|
|
280
294
|
let data = Stdlib_Option.getOr(Stdlib_JSON.Decode.object(raw.data), {});
|
|
281
295
|
let event = decoder.decode(raw.eventType, data);
|
|
@@ -311,193 +325,223 @@ function Make(Spec) {
|
|
|
311
325
|
let owners = param[3];
|
|
312
326
|
let headPosition = param[1];
|
|
313
327
|
let state = param[0];
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
let rejected = match.rejected;
|
|
330
|
-
cachePut([
|
|
331
|
-
state,
|
|
332
|
-
headPosition,
|
|
333
|
-
owners
|
|
334
|
-
]);
|
|
335
|
-
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "AccessRefusal", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, rejected);
|
|
336
|
-
let line = `refused: ` + rejected.errorDetail + ` id=` + Stdlib_Option.getOr(entityId, "-");
|
|
337
|
-
return Effect$1.map(match.isDefect ? EffectLogger$ReventlessCore.logError(comp, undefined, ids, line) : EffectLogger$ReventlessCore.logWarn(comp, undefined, ids, line), () => ({
|
|
338
|
-
TAG: "Ok",
|
|
339
|
-
_0: "rejected"
|
|
328
|
+
let missing = DcbFenceCount$Reventless.shortfalls(fences, fenceClauses, seen);
|
|
329
|
+
if (missing.length !== 0) {
|
|
330
|
+
let detail = missing.map(m => m.tag.key + `=` + m.tag.value + ` ` + m.eventType + `: read ` + m.read.toString() + ` of ` + m.counted.toString()).join(", ");
|
|
331
|
+
if (retries > 0) {
|
|
332
|
+
seed.contents = undefined;
|
|
333
|
+
return Effect$1.flatMap(Effect$1.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, ids, `index behind its fence (retrying ` + ((3 - retries | 0) + 1 | 0).toString() + `/` + (3).toString() + `): ` + detail), () => Effect$1.sleep(Duration.millis(100 * ((3 - retries | 0) + 1 | 0) | 0))), () => attempt(retries - 1 | 0));
|
|
334
|
+
} else {
|
|
335
|
+
cacheInvalidate();
|
|
336
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "InfrastructureFailure", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
337
|
+
errorCode: CommandOutcome$Reventless.code("Conflict"),
|
|
338
|
+
errorDetail: `index behind its fence: ` + detail
|
|
339
|
+
});
|
|
340
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, ids, `index behind its fence, retries exhausted: ` + detail), () => ({
|
|
341
|
+
TAG: "Error",
|
|
342
|
+
_0: detail
|
|
340
343
|
}));
|
|
341
344
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
let
|
|
345
|
-
if (
|
|
346
|
-
cachePut([
|
|
347
|
-
state,
|
|
348
|
-
headPosition,
|
|
349
|
-
owners
|
|
350
|
-
]);
|
|
345
|
+
} else {
|
|
346
|
+
return Effect$1.flatMap(EffectLogger$ReventlessCore.logDebug(comp, undefined, ids, `deciding: id=` + Stdlib_Option.getOr(entityId, "-") + ` head=` + Stdlib_Option.getOr(headPosition, "-") + ` cmd=` + LogFormat$ReventlessCore.cmdName(cmdJson)), () => {
|
|
347
|
+
let match = ownershipRefusal(owners);
|
|
348
|
+
if (repeated) {
|
|
351
349
|
CommandTopic_Helpers$ReventlessCore.reportAccepted(Spec.name, cmdJson.meta.correlationId, cmdJson.meta.causationId, cmdJson.meta.msgId, entityId !== undefined ? ({
|
|
352
350
|
entityId: entityId,
|
|
353
351
|
eventCount: 0
|
|
354
352
|
}) : ({
|
|
355
353
|
eventCount: 0
|
|
356
354
|
}));
|
|
357
|
-
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, ids,
|
|
355
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, ids, `repeat dropped: ` + LogFormat$ReventlessCore.cmdName(cmdJson) + ` msgId=` + cmdJson.meta.msgId + ` already caused events in id=` + Stdlib_Option.getOr(entityId, "-")), () => ({
|
|
358
356
|
TAG: "Ok",
|
|
359
357
|
_0: "ok"
|
|
360
358
|
}));
|
|
361
359
|
}
|
|
362
|
-
|
|
363
|
-
let
|
|
364
|
-
let json = Util_Sury$Reventless.toJson(e, Spec.eventSchema);
|
|
365
|
-
let match = Message$ReventlessCore.splitMessage(json);
|
|
366
|
-
let eventType = match[0];
|
|
367
|
-
let baseTags = DcbTag$Reventless.extractTagsExpanded(Spec.eventSchema, e);
|
|
368
|
-
let keys = tagKeysByEventType[eventType];
|
|
369
|
-
let indexedTags = keys !== undefined ? baseTags.filter(t => keys.includes(t.key)) : baseTags;
|
|
370
|
-
let meta = Message$ReventlessCore.deriveMeta(parentMeta, undefined);
|
|
371
|
-
return {
|
|
372
|
-
eventType: eventType,
|
|
373
|
-
data: match[1],
|
|
374
|
-
tags: indexedTags,
|
|
375
|
-
meta: meta
|
|
376
|
-
};
|
|
377
|
-
});
|
|
378
|
-
return Effect$1.flatMap(Effect$1.promise(() => sealRawEvents(encoded)), sealResult => {
|
|
379
|
-
if (sealResult.TAG === "Ok") {
|
|
380
|
-
let rawEvents = sealResult._0;
|
|
381
|
-
let eventCount = rawEvents.length.toString();
|
|
382
|
-
let eventDetails = rawEvents.map(e => {
|
|
383
|
-
let dict = e.data;
|
|
384
|
-
if (typeof dict === "object" && dict !== null && !Array.isArray(dict)) {
|
|
385
|
-
return LogFormat$ReventlessCore.cmdLabelOfJson(Message$ReventlessCore.combineMessage(e.eventType, dict));
|
|
386
|
-
} else {
|
|
387
|
-
return LogFormat$ReventlessCore.bold(e.eventType);
|
|
388
|
-
}
|
|
389
|
-
}).join(", ");
|
|
390
|
-
let eventJsons = rawEvents.map(e => e.data);
|
|
391
|
-
let condition = {
|
|
392
|
-
query: query,
|
|
393
|
-
after: headPosition
|
|
394
|
-
};
|
|
395
|
-
return Effect$1.flatMap(Effect$1.flatMap(EffectLogger$ReventlessCore.logInfo(comp, eventJsons, ids, `produced ` + eventCount + ` event(s): [` + eventDetails + `]`), () => Effect$1.promise(() => {
|
|
396
|
-
if (DcbTag$Reventless.readsNothing(query)) {
|
|
397
|
-
return dcbEventLog.append(rawEvents, undefined);
|
|
398
|
-
} else {
|
|
399
|
-
return dcbEventLog.append(rawEvents, condition);
|
|
400
|
-
}
|
|
401
|
-
})), appendResult => {
|
|
402
|
-
if (appendResult.TAG === "Ok") {
|
|
403
|
-
cachePut([
|
|
404
|
-
state,
|
|
405
|
-
headPosition,
|
|
406
|
-
owners
|
|
407
|
-
]);
|
|
408
|
-
CommandTopic_Helpers$ReventlessCore.reportAccepted(Spec.name, cmdJson.meta.correlationId, cmdJson.meta.causationId, cmdJson.meta.msgId, entityId !== undefined ? ({
|
|
409
|
-
entityId: entityId,
|
|
410
|
-
eventCount: rawEvents.length
|
|
411
|
-
}) : ({
|
|
412
|
-
eventCount: rawEvents.length
|
|
413
|
-
}));
|
|
414
|
-
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, ids, `append: ` + eventCount + ` event(s)`), () => ({
|
|
415
|
-
TAG: "Ok",
|
|
416
|
-
_0: "ok"
|
|
417
|
-
}));
|
|
418
|
-
}
|
|
419
|
-
let err = appendResult._0;
|
|
420
|
-
let match;
|
|
421
|
-
match = typeof err !== "object" ? [
|
|
422
|
-
CommandOutcome$Reventless.code("Conflict"),
|
|
423
|
-
"conflict: condition check failed"
|
|
424
|
-
] : [
|
|
425
|
-
CommandOutcome$Reventless.code("AppendFailed"),
|
|
426
|
-
err._0
|
|
427
|
-
];
|
|
428
|
-
let errDetail = match[1];
|
|
429
|
-
let errorCode = match[0];
|
|
430
|
-
if (retries > 0) {
|
|
431
|
-
seed.contents = [
|
|
432
|
-
state,
|
|
433
|
-
headPosition,
|
|
434
|
-
owners
|
|
435
|
-
];
|
|
436
|
-
Metrics$ReventlessCore.emitCount("AppendRetry", Spec.name, undefined);
|
|
437
|
-
return Effect$1.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, ids, `append failed (retrying ` + ((3 - retries | 0) + 1 | 0).toString() + `/` + (3).toString() + `): ` + errDetail), () => attempt(retries - 1 | 0));
|
|
438
|
-
} else {
|
|
439
|
-
cacheInvalidate();
|
|
440
|
-
if (errorCode === CommandOutcome$Reventless.code("Conflict")) {
|
|
441
|
-
Metrics$ReventlessCore.emitCount("AppendConflict", Spec.name, undefined);
|
|
442
|
-
}
|
|
443
|
-
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "InfrastructureFailure", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
444
|
-
errorCode: errorCode,
|
|
445
|
-
errorDetail: errDetail
|
|
446
|
-
});
|
|
447
|
-
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, ids, `append failed, retries exhausted: ` + errDetail), () => ({
|
|
448
|
-
TAG: "Error",
|
|
449
|
-
_0: errDetail
|
|
450
|
-
}));
|
|
451
|
-
}
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
let detail = sealResult._0;
|
|
360
|
+
if (match !== undefined) {
|
|
361
|
+
let rejected = match.rejected;
|
|
455
362
|
cachePut([
|
|
456
363
|
state,
|
|
457
364
|
headPosition,
|
|
458
|
-
owners
|
|
365
|
+
owners,
|
|
366
|
+
seen
|
|
459
367
|
]);
|
|
460
|
-
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
TAG: "Error",
|
|
466
|
-
_0: detail
|
|
368
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "AccessRefusal", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, rejected);
|
|
369
|
+
let line = `refused: ` + rejected.errorDetail + ` id=` + Stdlib_Option.getOr(entityId, "-");
|
|
370
|
+
return Effect$1.map(match.isDefect ? EffectLogger$ReventlessCore.logError(comp, undefined, ids, line) : EffectLogger$ReventlessCore.logWarn(comp, undefined, ids, line), () => ({
|
|
371
|
+
TAG: "Ok",
|
|
372
|
+
_0: "rejected"
|
|
467
373
|
}));
|
|
374
|
+
}
|
|
375
|
+
let newEvents = Decision.decide(state, command$p.command);
|
|
376
|
+
if (newEvents.TAG === "Ok") {
|
|
377
|
+
let newEvents$1 = newEvents._0;
|
|
378
|
+
if (newEvents$1.length === 0) {
|
|
379
|
+
cachePut([
|
|
380
|
+
state,
|
|
381
|
+
headPosition,
|
|
382
|
+
owners,
|
|
383
|
+
seen
|
|
384
|
+
]);
|
|
385
|
+
CommandTopic_Helpers$ReventlessCore.reportAccepted(Spec.name, cmdJson.meta.correlationId, cmdJson.meta.causationId, cmdJson.meta.msgId, entityId !== undefined ? ({
|
|
386
|
+
entityId: entityId,
|
|
387
|
+
eventCount: 0
|
|
388
|
+
}) : ({
|
|
389
|
+
eventCount: 0
|
|
390
|
+
}));
|
|
391
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, ids, "no events produced"), () => ({
|
|
392
|
+
TAG: "Ok",
|
|
393
|
+
_0: "ok"
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
let encoded = newEvents$1.map(e => {
|
|
397
|
+
let parentMeta = command$p.meta;
|
|
398
|
+
let json = Util_Sury$Reventless.toJson(e, Spec.eventSchema);
|
|
399
|
+
let match = Message$ReventlessCore.splitMessage(json);
|
|
400
|
+
let eventType = match[0];
|
|
401
|
+
let baseTags = DcbTag$Reventless.extractTagsExpanded(Spec.eventSchema, e);
|
|
402
|
+
let keys = tagKeysByEventType[eventType];
|
|
403
|
+
let indexedTags = keys !== undefined ? baseTags.filter(t => keys.includes(t.key)) : baseTags;
|
|
404
|
+
let meta = Message$ReventlessCore.deriveMeta(parentMeta, undefined);
|
|
405
|
+
return {
|
|
406
|
+
eventType: eventType,
|
|
407
|
+
data: match[1],
|
|
408
|
+
tags: indexedTags,
|
|
409
|
+
meta: meta
|
|
410
|
+
};
|
|
411
|
+
});
|
|
412
|
+
return Effect$1.flatMap(Effect$1.promise(() => sealRawEvents(encoded)), sealResult => {
|
|
413
|
+
if (sealResult.TAG === "Ok") {
|
|
414
|
+
let rawEvents = sealResult._0;
|
|
415
|
+
let eventCount = rawEvents.length.toString();
|
|
416
|
+
let eventDetails = rawEvents.map(e => {
|
|
417
|
+
let dict = e.data;
|
|
418
|
+
if (typeof dict === "object" && dict !== null && !Array.isArray(dict)) {
|
|
419
|
+
return LogFormat$ReventlessCore.cmdLabelOfJson(Message$ReventlessCore.combineMessage(e.eventType, dict));
|
|
420
|
+
} else {
|
|
421
|
+
return LogFormat$ReventlessCore.bold(e.eventType);
|
|
422
|
+
}
|
|
423
|
+
}).join(", ");
|
|
424
|
+
let eventJsons = rawEvents.map(e => e.data);
|
|
425
|
+
let fenceCounts = DcbFenceCount$Reventless.readCounts(fences, fenceClauses, seen);
|
|
426
|
+
let condition_fenceCounts = Primitive_object.equal(fenceCounts, []) ? undefined : fenceCounts;
|
|
427
|
+
let condition = {
|
|
428
|
+
query: query,
|
|
429
|
+
after: headPosition,
|
|
430
|
+
fenceCounts: condition_fenceCounts
|
|
431
|
+
};
|
|
432
|
+
return Effect$1.flatMap(Effect$1.flatMap(EffectLogger$ReventlessCore.logInfo(comp, eventJsons, ids, `produced ` + eventCount + ` event(s): [` + eventDetails + `]`), () => Effect$1.promise(() => {
|
|
433
|
+
if (DcbTag$Reventless.readsNothing(query)) {
|
|
434
|
+
return dcbEventLog.append(rawEvents, undefined);
|
|
435
|
+
} else {
|
|
436
|
+
return dcbEventLog.append(rawEvents, condition);
|
|
437
|
+
}
|
|
438
|
+
})), appendResult => {
|
|
439
|
+
if (appendResult.TAG === "Ok") {
|
|
440
|
+
cachePut([
|
|
441
|
+
state,
|
|
442
|
+
headPosition,
|
|
443
|
+
owners,
|
|
444
|
+
seen
|
|
445
|
+
]);
|
|
446
|
+
CommandTopic_Helpers$ReventlessCore.reportAccepted(Spec.name, cmdJson.meta.correlationId, cmdJson.meta.causationId, cmdJson.meta.msgId, entityId !== undefined ? ({
|
|
447
|
+
entityId: entityId,
|
|
448
|
+
eventCount: rawEvents.length
|
|
449
|
+
}) : ({
|
|
450
|
+
eventCount: rawEvents.length
|
|
451
|
+
}));
|
|
452
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, ids, `append: ` + eventCount + ` event(s)`), () => ({
|
|
453
|
+
TAG: "Ok",
|
|
454
|
+
_0: "ok"
|
|
455
|
+
}));
|
|
456
|
+
}
|
|
457
|
+
let err = appendResult._0;
|
|
458
|
+
let match;
|
|
459
|
+
match = typeof err !== "object" ? [
|
|
460
|
+
CommandOutcome$Reventless.code("Conflict"),
|
|
461
|
+
"conflict: condition check failed"
|
|
462
|
+
] : [
|
|
463
|
+
CommandOutcome$Reventless.code("AppendFailed"),
|
|
464
|
+
err._0
|
|
465
|
+
];
|
|
466
|
+
let errDetail = match[1];
|
|
467
|
+
let errorCode = match[0];
|
|
468
|
+
if (retries > 0) {
|
|
469
|
+
seed.contents = [
|
|
470
|
+
state,
|
|
471
|
+
headPosition,
|
|
472
|
+
owners,
|
|
473
|
+
seen
|
|
474
|
+
];
|
|
475
|
+
Metrics$ReventlessCore.emitCount("AppendRetry", Spec.name, undefined);
|
|
476
|
+
return Effect$1.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, ids, `append failed (retrying ` + ((3 - retries | 0) + 1 | 0).toString() + `/` + (3).toString() + `): ` + errDetail), () => attempt(retries - 1 | 0));
|
|
477
|
+
} else {
|
|
478
|
+
cacheInvalidate();
|
|
479
|
+
if (errorCode === CommandOutcome$Reventless.code("Conflict")) {
|
|
480
|
+
Metrics$ReventlessCore.emitCount("AppendConflict", Spec.name, undefined);
|
|
481
|
+
}
|
|
482
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "InfrastructureFailure", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
483
|
+
errorCode: errorCode,
|
|
484
|
+
errorDetail: errDetail
|
|
485
|
+
});
|
|
486
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, ids, `append failed, retries exhausted: ` + errDetail), () => ({
|
|
487
|
+
TAG: "Error",
|
|
488
|
+
_0: errDetail
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
let detail = sealResult._0;
|
|
494
|
+
cachePut([
|
|
495
|
+
state,
|
|
496
|
+
headPosition,
|
|
497
|
+
owners,
|
|
498
|
+
seen
|
|
499
|
+
]);
|
|
500
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "InfrastructureFailure", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
501
|
+
errorCode: CommandOutcome$Reventless.code("AppendFailed"),
|
|
502
|
+
errorDetail: detail
|
|
503
|
+
});
|
|
504
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, ids, `append refused: ` + detail), () => ({
|
|
505
|
+
TAG: "Error",
|
|
506
|
+
_0: detail
|
|
507
|
+
}));
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
cachePut([
|
|
511
|
+
state,
|
|
512
|
+
headPosition,
|
|
513
|
+
owners,
|
|
514
|
+
seen
|
|
515
|
+
]);
|
|
516
|
+
let errorJson = Util_Sury$Reventless.toJson(newEvents._0, Spec.errorSchema);
|
|
517
|
+
let errorCode = Message$ReventlessCore.variantNameOfJson(errorJson);
|
|
518
|
+
let match$1 = Message$ReventlessCore.splitMessage(errorJson);
|
|
519
|
+
let payloadDict = match$1[1];
|
|
520
|
+
let errorDetail = Object.entries(payloadDict).length === 0 ? "" : JSON.stringify(payloadDict);
|
|
521
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "DomainRejection", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
522
|
+
errorCode: errorCode,
|
|
523
|
+
errorDetail: errorDetail
|
|
468
524
|
});
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
owners
|
|
474
|
-
]);
|
|
475
|
-
let errorJson = Util_Sury$Reventless.toJson(newEvents._0, Spec.errorSchema);
|
|
476
|
-
let errorCode = Message$ReventlessCore.variantNameOfJson(errorJson);
|
|
477
|
-
let match$1 = Message$ReventlessCore.splitMessage(errorJson);
|
|
478
|
-
let payloadDict = match$1[1];
|
|
479
|
-
let errorDetail = Object.entries(payloadDict).length === 0 ? "" : JSON.stringify(payloadDict);
|
|
480
|
-
CommandTopic_Helpers$ReventlessCore.reportRejected(Spec.name, "DomainRejection", cmdJson.meta.correlationId, cmdJson.meta.causationId, Stdlib_Option.isSome(cmdJson.meta.callerClaim), cmdJson.meta.msgId, {
|
|
481
|
-
errorCode: errorCode,
|
|
482
|
-
errorDetail: errorDetail
|
|
525
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, ids, `decide rejected: ` + errorCode + ` ` + errorDetail), () => ({
|
|
526
|
+
TAG: "Ok",
|
|
527
|
+
_0: "rejected"
|
|
528
|
+
}));
|
|
483
529
|
});
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
_0: "rejected"
|
|
487
|
-
}));
|
|
488
|
-
});
|
|
489
|
-
});
|
|
530
|
+
}
|
|
531
|
+
}));
|
|
490
532
|
};
|
|
491
533
|
return attempt(3);
|
|
492
534
|
};
|
|
493
|
-
let handleCommands = (tagKeysByEventTypeOpt, crossPartitionTagKeysOpt, partitionTag, dcbEventLog, stream) => {
|
|
535
|
+
let handleCommands = (tagKeysByEventTypeOpt, crossPartitionTagKeysOpt, crossPartitionPairsOpt, partitionTag, dcbEventLog, stream) => {
|
|
494
536
|
let tagKeysByEventType = tagKeysByEventTypeOpt !== undefined ? tagKeysByEventTypeOpt : ({});
|
|
495
537
|
let crossPartitionTagKeys = crossPartitionTagKeysOpt !== undefined ? crossPartitionTagKeysOpt : [];
|
|
538
|
+
let crossPartitionPairs = crossPartitionPairsOpt !== undefined ? crossPartitionPairsOpt : [];
|
|
496
539
|
let partitionTag$1 = partitionTag !== undefined ? partitionTag : Stdlib_Lazy.get(slicePartitionTag);
|
|
497
540
|
let payloadTagKeys = DcbTag$Reventless.commandPayloadTagKeys(scopeShape, partitionTag$1, crossPartitionTagKeys);
|
|
541
|
+
let pairEventTypes = DcbScopeInference$Reventless.pairEventTypes(crossPartitionPairs, Spec.name);
|
|
498
542
|
return Stream$1.runCollect(Stream.mapEffect(stream, param => {
|
|
499
543
|
let reference = param.reference;
|
|
500
|
-
return Effect$1.map(handleSingleCommand(tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, partitionTag$1, dcbEventLog, param.command), result => {
|
|
544
|
+
return Effect$1.map(handleSingleCommand(tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, pairEventTypes, partitionTag$1, dcbEventLog, param.command), result => {
|
|
501
545
|
if (result.TAG === "Ok") {
|
|
502
546
|
return {
|
|
503
547
|
TAG: "Ok",
|
|
@@ -1493,6 +1493,47 @@ let make = (
|
|
|
1493
1493
|
)
|
|
1494
1494
|
}
|
|
1495
1495
|
|
|
1496
|
+
// The quantities the fields measure or price, each once. A field names only the
|
|
1497
|
+
// quantity and the unit, so a reader converting between units finds the factors
|
|
1498
|
+
// here. Walked into records and lists: a line item's energy is a field too.
|
|
1499
|
+
let quantities = {
|
|
1500
|
+
// Bounded, so a recursive type ends; a quantity six records deep is not one.
|
|
1501
|
+
let rec collect = (schema: S.t<unknown>, ~depth): array<Reventless.Quantity.def> =>
|
|
1502
|
+
switch Reventless.Quantity.defOf(schema) {
|
|
1503
|
+
| Some(q) => [q]
|
|
1504
|
+
| None if depth >= 6 => []
|
|
1505
|
+
| None =>
|
|
1506
|
+
let inner = collect(_, ~depth=depth + 1)
|
|
1507
|
+
switch schema->Reventless.Semantic.unwrapOptional->Option.getOr(schema) {
|
|
1508
|
+
| Object({properties}) => properties->Dict.valuesToArray->Array.flatMap(inner)
|
|
1509
|
+
| Array({additionalItems: Schema(item)}) => inner(item)
|
|
1510
|
+
| AnyOf({anyOf}) => anyOf->Array.flatMap(inner)
|
|
1511
|
+
| _ => []
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
let found =
|
|
1515
|
+
storeDeclarationSites
|
|
1516
|
+
->Array.flatMap(((_, schema)) => collect(schema, ~depth=0))
|
|
1517
|
+
->Array.reduce([], (acc, q) =>
|
|
1518
|
+
acc->Array.some(seen => seen == q) ? acc : acc->Array.concat([q])
|
|
1519
|
+
)
|
|
1520
|
+
->Array.toSorted((a, b) => String.compare(a.name, b.name))
|
|
1521
|
+
// Two fields disagreeing on what a quantity is would make one of them read
|
|
1522
|
+
// wrong; a factor is what a stored number means.
|
|
1523
|
+
switch Reventless.Quantity.conflicts(found) {
|
|
1524
|
+
| [] => found
|
|
1525
|
+
| pairs =>
|
|
1526
|
+
JsError.throwWithMessage(
|
|
1527
|
+
`${name}: ` ++
|
|
1528
|
+
pairs
|
|
1529
|
+
->Array.map(((a, _)) => `two fields declare the quantity "${a.name}" with different units`)
|
|
1530
|
+
->Array.join(
|
|
1531
|
+
"; ",
|
|
1532
|
+
) ++ `. A quantity is declared once and every field uses that declaration.`,
|
|
1533
|
+
)
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1496
1537
|
// Capabilities a slice declares its `translate` reaches for. Sorted and
|
|
1497
1538
|
// deduplicated for the same reason the store declarations are: the manifest is
|
|
1498
1539
|
// committed, so it must not churn on a re-build. Translation slices are the ones
|
|
@@ -2385,5 +2426,9 @@ let make = (
|
|
|
2385
2426
|
}),
|
|
2386
2427
|
)
|
|
2387
2428
|
},
|
|
2429
|
+
quantities: ?switch quantities {
|
|
2430
|
+
| [] => None
|
|
2431
|
+
| found => Some(found)
|
|
2432
|
+
},
|
|
2388
2433
|
}
|
|
2389
2434
|
}
|
|
@@ -13,6 +13,7 @@ import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js
|
|
|
13
13
|
import * as Trait$Reventless from "@reventlessdev/reventless-spec/src/types/Trait.res.mjs";
|
|
14
14
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
15
15
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
16
|
+
import * as Quantity$Reventless from "@reventlessdev/reventless-spec/src/semantic/Quantity.res.mjs";
|
|
16
17
|
import * as Schedule$Reventless from "@reventlessdev/reventless-spec/src/types/Schedule.res.mjs";
|
|
17
18
|
import * as Semantic$Reventless from "@reventlessdev/reventless-spec/src/semantic/Semantic.res.mjs";
|
|
18
19
|
import * as Admission$Reventless from "@reventlessdev/reventless-spec/src/types/Admission.res.mjs";
|
|
@@ -1080,6 +1081,45 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1080
1081
|
if (found.length !== 0) {
|
|
1081
1082
|
Stdlib_JsError.throwWithMessage(name + `: two declared object stores look like one store misspelled.\n` + found.map(Capability_Inference$ReventlessCore.collisionMessage).join("\n"));
|
|
1082
1083
|
}
|
|
1084
|
+
let collect = (schema, depth) => {
|
|
1085
|
+
let q = Quantity$Reventless.defOf(schema);
|
|
1086
|
+
if (q !== undefined) {
|
|
1087
|
+
return [q];
|
|
1088
|
+
}
|
|
1089
|
+
if (depth >= 6) {
|
|
1090
|
+
return [];
|
|
1091
|
+
}
|
|
1092
|
+
let inner = __x => collect(__x, depth + 1 | 0);
|
|
1093
|
+
let match = Stdlib_Option.getOr(Semantic$Reventless.unwrapOptional(schema), schema);
|
|
1094
|
+
switch (match.type) {
|
|
1095
|
+
case "array" :
|
|
1096
|
+
let item = match.additionalItems;
|
|
1097
|
+
if (item === "strip" || item === "strict") {
|
|
1098
|
+
if (item === "strip") {
|
|
1099
|
+
return [];
|
|
1100
|
+
} else {
|
|
1101
|
+
return [];
|
|
1102
|
+
}
|
|
1103
|
+
} else {
|
|
1104
|
+
return inner(item);
|
|
1105
|
+
}
|
|
1106
|
+
case "object" :
|
|
1107
|
+
return Object.values(match.properties).flatMap(inner);
|
|
1108
|
+
case "anyOf" :
|
|
1109
|
+
return match.anyOf.flatMap(inner);
|
|
1110
|
+
default:
|
|
1111
|
+
return [];
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
let found$1 = Stdlib_Array.reduce(storeDeclarationSites.flatMap(param => collect(param[1], 0)), [], (acc, q) => {
|
|
1115
|
+
if (acc.some(seen => Primitive_object.equal(seen, q))) {
|
|
1116
|
+
return acc;
|
|
1117
|
+
} else {
|
|
1118
|
+
return acc.concat([q]);
|
|
1119
|
+
}
|
|
1120
|
+
}).toSorted((a, b) => Primitive_string.compare(a.name, b.name));
|
|
1121
|
+
let pairs = Quantity$Reventless.conflicts(found$1);
|
|
1122
|
+
let quantities = pairs.length !== 0 ? Stdlib_JsError.throwWithMessage(name + `: ` + pairs.map(param => `two fields declare the quantity "` + param[0].name + `" with different units`).join("; ") + `. A quantity is declared once and every field uses that declaration.`) : found$1;
|
|
1083
1123
|
let declarationsOf = (component, needs) => needs.map(need => ({
|
|
1084
1124
|
capability: CapabilityNeed$Reventless.toString(need),
|
|
1085
1125
|
component: component
|
|
@@ -1642,7 +1682,8 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1642
1682
|
admissionDoors: admissionDoors.length !== 0 ? admissionDoors.map(param => ({
|
|
1643
1683
|
component: param[0],
|
|
1644
1684
|
part: Admission$Reventless.doorName(param[1])
|
|
1645
|
-
})) : undefined
|
|
1685
|
+
})) : undefined,
|
|
1686
|
+
quantities: quantities.length !== 0 ? quantities : undefined
|
|
1646
1687
|
};
|
|
1647
1688
|
}
|
|
1648
1689
|
|
package/src/util/Logger.res
CHANGED
|
@@ -40,8 +40,8 @@ type t = {
|
|
|
40
40
|
// Lazy debug: the message thunk runs only when debug output is actually
|
|
41
41
|
// enabled. On a hot path (e.g. per-projection-action logging) this avoids
|
|
42
42
|
// building — and serializing state into — a string that is then dropped at
|
|
43
|
-
// the default Info level.
|
|
44
|
-
debugLazy: (~comp: string=?, unit => string) => unit,
|
|
43
|
+
// the default Info level. `ids` become top-level fields, as annotations do.
|
|
44
|
+
debugLazy: (~comp: string=?, ~ids: dict<string>=?, unit => string) => unit,
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** A log line's level. Its text is the upper-case word a JSON line, the platform
|
|
@@ -282,9 +282,9 @@ let makeLoggerWith = (shouldLog: (level, option<string>) => bool): t => {
|
|
|
282
282
|
info: (~comp=?, ~data=?, msg) => log(Info, ~comp?, ~data?, msg),
|
|
283
283
|
warn: (~comp=?, ~data=?, msg) => log(Warn, ~comp?, ~data?, msg),
|
|
284
284
|
error: (~comp=?, ~data=?, msg) => log(Error, ~comp?, ~data?, msg),
|
|
285
|
-
debugLazy: (~comp=?, makeMsg) =>
|
|
285
|
+
debugLazy: (~comp=?, ~ids=?, makeMsg) =>
|
|
286
286
|
if shouldLog(Debug, comp) {
|
|
287
|
-
emit(~level=Debug, ~comp?, makeMsg())
|
|
287
|
+
emit(~level=Debug, ~comp?, ~annotations=?ids, makeMsg())
|
|
288
288
|
},
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -299,7 +299,7 @@ let silent: t = {
|
|
|
299
299
|
info: (~comp as _=?, ~data as _=?, _) => (),
|
|
300
300
|
warn: (~comp as _=?, ~data as _=?, _) => (),
|
|
301
301
|
error: (~comp as _=?, ~data as _=?, _) => (),
|
|
302
|
-
debugLazy: (~comp as _=?, _) => (),
|
|
302
|
+
debugLazy: (~comp as _=?, ~ids as _=?, _) => (),
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
// Active minimum level: explicit LOG_LEVEL wins, else the platform default.
|
package/src/util/Logger.res.mjs
CHANGED
|
@@ -244,9 +244,9 @@ function makeLoggerWith(shouldLog) {
|
|
|
244
244
|
info: (comp, data, msg) => log("INFO", comp, data, msg),
|
|
245
245
|
warn: (comp, data, msg) => log("WARN", comp, data, msg),
|
|
246
246
|
error: (comp, data, msg) => log("ERROR", comp, data, msg),
|
|
247
|
-
debugLazy: (comp, makeMsg) => {
|
|
247
|
+
debugLazy: (comp, ids, makeMsg) => {
|
|
248
248
|
if (shouldLog("DEBUG", comp)) {
|
|
249
|
-
return emit("DEBUG", comp, undefined, undefined,
|
|
249
|
+
return emit("DEBUG", comp, undefined, undefined, ids, makeMsg());
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
};
|
|
@@ -273,7 +273,7 @@ function silent_error(param, param$1, param$2) {
|
|
|
273
273
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
function silent_debugLazy(param, param$1) {
|
|
276
|
+
function silent_debugLazy(param, param$1, param$2) {
|
|
277
277
|
|
|
278
278
|
}
|
|
279
279
|
|