@shapeshift-labs/frontier-lang-compiler 0.2.72 → 0.2.73
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.
|
@@ -33,7 +33,10 @@ export function createSemanticLineageEvent(input = {}, options = {}) {
|
|
|
33
33
|
id: input.actorId ?? options.actorId,
|
|
34
34
|
role: input.actorRole ?? options.actorRole
|
|
35
35
|
});
|
|
36
|
-
const
|
|
36
|
+
const explicitCrdt = input.crdt ?? input.clock ?? input.operation;
|
|
37
|
+
const crdt = normalizeCrdtClock(explicitCrdt ?? (hasInlineCrdtClock(input) ? input : undefined), {
|
|
38
|
+
useIdAsOperationId: explicitCrdt !== undefined
|
|
39
|
+
});
|
|
37
40
|
const evidence = compactRecord({
|
|
38
41
|
pathMatch: input.evidence?.pathMatch ?? input.pathMatch,
|
|
39
42
|
signatureHashMatch: input.evidence?.signatureHashMatch ?? input.signatureHashMatch,
|
|
@@ -66,7 +69,7 @@ export function createSemanticLineageEvent(input = {}, options = {}) {
|
|
|
66
69
|
const hash = input.hash ?? hashSemanticValue(core);
|
|
67
70
|
return {
|
|
68
71
|
...core,
|
|
69
|
-
id: input.id ?? options.id ?? `semantic_lineage_${idFragment(firstString(from?.key, toAnchors[0]?.key, crdt
|
|
72
|
+
id: input.id ?? options.id ?? `semantic_lineage_${idFragment(firstString(from?.key, toAnchors[0]?.key, crdt?.operationId, hash))}`,
|
|
70
73
|
stableId: `semantic_lineage_${idFragment(hash)}`,
|
|
71
74
|
hash,
|
|
72
75
|
createdAt: input.createdAt ?? options.createdAt ?? Date.now()
|
|
@@ -135,9 +138,20 @@ export function semanticLineageIndex(events) {
|
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
function
|
|
141
|
+
function hasInlineCrdtClock(source) {
|
|
142
|
+
return source?.operationId !== undefined
|
|
143
|
+
|| source?.seq !== undefined
|
|
144
|
+
|| source?.deps !== undefined
|
|
145
|
+
|| source?.heads !== undefined
|
|
146
|
+
|| source?.stateVector !== undefined
|
|
147
|
+
|| source?.versionFrame !== undefined
|
|
148
|
+
|| source?.frame !== undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function normalizeCrdtClock(source, options = {}) {
|
|
152
|
+
if (!source) return undefined;
|
|
139
153
|
return nonEmptyRecord(compactRecord({
|
|
140
|
-
operationId: source.operationId ?? source.id,
|
|
154
|
+
operationId: source.operationId ?? (options.useIdAsOperationId ? source.id : undefined),
|
|
141
155
|
actor: source.actorId ?? source.actor,
|
|
142
156
|
seq: source.seq,
|
|
143
157
|
deps: uniqueStrings(source.deps),
|
package/package.json
CHANGED