@ifc-lite/mutations 1.26.1 → 2.0.0
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/README.md +42 -1
- package/dist/base-qset-lookup.d.ts +14 -0
- package/dist/base-qset-lookup.d.ts.map +1 -0
- package/dist/base-qset-lookup.js +14 -0
- package/dist/base-qset-lookup.js.map +1 -0
- package/dist/bulk-query-engine.d.ts +4 -1
- package/dist/bulk-query-engine.d.ts.map +1 -1
- package/dist/bulk-query-engine.js +6 -1
- package/dist/bulk-query-engine.js.map +1 -1
- package/dist/csv-connector.d.ts +11 -7
- package/dist/csv-connector.d.ts.map +1 -1
- package/dist/csv-connector.js +23 -33
- package/dist/csv-connector.js.map +1 -1
- package/dist/csv-parse-value.d.ts +16 -0
- package/dist/csv-parse-value.d.ts.map +1 -0
- package/dist/csv-parse-value.js +65 -0
- package/dist/csv-parse-value.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mutable-property-view.d.ts.map +1 -1
- package/dist/mutable-property-view.js +93 -118
- package/dist/mutable-property-view.js.map +1 -1
- package/dist/mutation-guard.d.ts +32 -0
- package/dist/mutation-guard.d.ts.map +1 -0
- package/dist/mutation-guard.js +40 -0
- package/dist/mutation-guard.js.map +1 -0
- package/dist/nonfinite-json.d.ts +8 -0
- package/dist/nonfinite-json.d.ts.map +1 -0
- package/dist/nonfinite-json.js +57 -0
- package/dist/nonfinite-json.js.map +1 -0
- package/dist/same-name-set-claims.d.ts +54 -0
- package/dist/same-name-set-claims.d.ts.map +1 -0
- package/dist/same-name-set-claims.js +74 -0
- package/dist/same-name-set-claims.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Optional local-edit guard for the "always-local" write engines
|
|
6
|
+
* (`BulkQueryEngine`, `CsvConnector`).
|
|
7
|
+
*
|
|
8
|
+
* These two classes are constructed directly by viewer components
|
|
9
|
+
* (`BulkPropertyEditor.tsx`, `DataConnector.tsx`) and write straight to a
|
|
10
|
+
* `MutablePropertyView`, bypassing the Zustand store's `setProperty` /
|
|
11
|
+
* `setEntityType` actions — and, with them, `canCollabEdit()`. Unlike
|
|
12
|
+
* `MutablePropertyView` and `StoreEditor` themselves (see the module doc on
|
|
13
|
+
* `MutablePropertyView`), neither engine is ever reached by inbound CRDT
|
|
14
|
+
* replay, `useZoneWriteBack`, or any `mirror*` helper: both are always
|
|
15
|
+
* constructed fresh, per dialog-open, from a local user action, and never
|
|
16
|
+
* shared with — or passed into — the collab plumbing. That makes them safe
|
|
17
|
+
* to gate at construction: there is no legitimate caller this guard could
|
|
18
|
+
* wrongly block.
|
|
19
|
+
*
|
|
20
|
+
* A caller passes a `canEdit` predicate at construction; the engine consults
|
|
21
|
+
* it once before mutating and throws `MutationGuardError` (rather than
|
|
22
|
+
* silently dropping the write) if it returns false. Passing no predicate
|
|
23
|
+
* preserves today's behaviour exactly — this is opt-in, not a new default,
|
|
24
|
+
* so it does not change any other consumer of these classes (CLI, SDK,
|
|
25
|
+
* sandbox bridge, existing tests).
|
|
26
|
+
*/
|
|
27
|
+
/** Thrown by a guarded engine when `canEdit()` returns false. */
|
|
28
|
+
export class MutationGuardError extends Error {
|
|
29
|
+
constructor(message = 'Mutation blocked: editing is disabled for the current role') {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'MutationGuardError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Throws `MutationGuardError` if `guard` is present and returns false. */
|
|
35
|
+
export function checkMutationGuard(guard) {
|
|
36
|
+
if (guard && !guard()) {
|
|
37
|
+
throw new MutationGuardError();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=mutation-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-guard.js","sourceRoot":"","sources":["../src/mutation-guard.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iEAAiE;AACjE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAO,GAAG,4DAA4D;QAChF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAKD,2EAA2E;AAC3E,MAAM,UAAU,kBAAkB,CAAC,KAAuC;IACxE,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** `JSON.stringify` replacer for `MutablePropertyView.exportMutations()`. */
|
|
2
|
+
export declare function encodeNonFiniteNumbers(key: string, value: unknown): unknown;
|
|
3
|
+
/**
|
|
4
|
+
* `JSON.parse` reviver for `MutablePropertyView.importMutations()`; inverse
|
|
5
|
+
* of {@link encodeNonFiniteNumbers}.
|
|
6
|
+
*/
|
|
7
|
+
export declare function decodeNonFiniteNumbers(key: string, value: unknown): unknown;
|
|
8
|
+
//# sourceMappingURL=nonfinite-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonfinite-json.d.ts","sourceRoot":"","sources":["../src/nonfinite-json.ts"],"names":[],"mappings":"AAoCA,6EAA6E;AAC7E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAU3E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAY3E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* `JSON.stringify`/`JSON.parse` replacer+reviver pair that preserves a
|
|
6
|
+
* non-finite number (`NaN`/`Infinity`/`-Infinity`) inside a `Mutation`'s
|
|
7
|
+
* `newValue`/`oldValue`, or a `value` inside a whole-set `newValue` array
|
|
8
|
+
* (`createPropertySet`/`createQuantitySet`'s per-member payload).
|
|
9
|
+
*
|
|
10
|
+
* JSON has no non-finite numeric literal (RFC 8259); `JSON.stringify` silently
|
|
11
|
+
* maps `NaN`/`Infinity`/`-Infinity` to `null`, indistinguishable from the value
|
|
12
|
+
* being absent. `MutablePropertyView.applyMutations`' quantity replay then
|
|
13
|
+
* does `Number(mutation.newValue)`, and `Number(null)` is `0` — so an
|
|
14
|
+
* out-of-range quantity (e.g. a computed volume that overflowed, or a CSV
|
|
15
|
+
* cell parsed to `NaN`) silently became `0` across `exportMutations()` →
|
|
16
|
+
* `importMutations()`, even though direct application (no serialization in
|
|
17
|
+
* between) preserves it exactly. Mirrors the sibling fix for the JSON/JSON-LD
|
|
18
|
+
* export path (`finite_json_number` in `rust/export/src/json.rs`, #3596) and
|
|
19
|
+
* the query aggregation guard (#3611) — this repo's recurring non-finite-value
|
|
20
|
+
* shape.
|
|
21
|
+
*/
|
|
22
|
+
const NON_FINITE_NUMBER_KEYS = new Set(['newValue', 'oldValue', 'value']);
|
|
23
|
+
function isNonFiniteNumberMarker(value) {
|
|
24
|
+
return (typeof value === 'object' &&
|
|
25
|
+
value !== null &&
|
|
26
|
+
typeof value.__nonFiniteNumber === 'string');
|
|
27
|
+
}
|
|
28
|
+
/** `JSON.stringify` replacer for `MutablePropertyView.exportMutations()`. */
|
|
29
|
+
export function encodeNonFiniteNumbers(key, value) {
|
|
30
|
+
if (NON_FINITE_NUMBER_KEYS.has(key) && typeof value === 'number' && !Number.isFinite(value)) {
|
|
31
|
+
const token = Number.isNaN(value)
|
|
32
|
+
? 'NaN'
|
|
33
|
+
: value > 0
|
|
34
|
+
? 'Infinity'
|
|
35
|
+
: '-Infinity';
|
|
36
|
+
return { __nonFiniteNumber: token };
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `JSON.parse` reviver for `MutablePropertyView.importMutations()`; inverse
|
|
42
|
+
* of {@link encodeNonFiniteNumbers}.
|
|
43
|
+
*/
|
|
44
|
+
export function decodeNonFiniteNumbers(key, value) {
|
|
45
|
+
if (NON_FINITE_NUMBER_KEYS.has(key) && isNonFiniteNumberMarker(value)) {
|
|
46
|
+
switch (value.__nonFiniteNumber) {
|
|
47
|
+
case 'NaN':
|
|
48
|
+
return NaN;
|
|
49
|
+
case 'Infinity':
|
|
50
|
+
return Infinity;
|
|
51
|
+
case '-Infinity':
|
|
52
|
+
return -Infinity;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=nonfinite-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonfinite-json.js","sourceRoot":"","sources":["../src/nonfinite-json.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAM1E,SAAS,uBAAuB,CAAC,KAAc;IAC7C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAAyC,CAAC,iBAAiB,KAAK,QAAQ,CACjF,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,KAAc;IAChE,IAAI,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5F,MAAM,KAAK,GAA+C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC3E,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,KAAK,GAAG,CAAC;gBACT,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,WAAW,CAAC;QAClB,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAkC,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,KAAc;IAChE,IAAI,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,QAAQ,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAChC,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC;YACb,KAAK,UAAU;gBACb,OAAO,QAAQ,CAAC;YAClB,KAAK,WAAW;gBACd,OAAO,CAAC,QAAQ,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `getForEntity`/`getQuantitiesForEntity`'s shared helper for entities that
|
|
3
|
+
* carry two (or more) base property/quantity sets sharing a name (a type
|
|
4
|
+
* pset and an occurrence pset, say). A mutation key
|
|
5
|
+
* (`${entityId}:${setName}:${memberName}`) has no identity past the set
|
|
6
|
+
* NAME, so it can't tell apart which instance a SET/DELETE on an existing
|
|
7
|
+
* member, or a brand-new member, was meant for. Both must still land on
|
|
8
|
+
* exactly ONE instance: the FIRST one (in base-set order) whose own base
|
|
9
|
+
* members already carry that name -- matching the "first match across the
|
|
10
|
+
* sequence wins" read semantics `findPropertyInSets`/
|
|
11
|
+
* `PropertyTable.getProperty` already use for same-named reads (#3468). A
|
|
12
|
+
* member that exists on NO instance yet (a genuinely new property/quantity)
|
|
13
|
+
* is claimed by the first instance of that set name, same as a brand-new
|
|
14
|
+
* set would be.
|
|
15
|
+
*
|
|
16
|
+
* One implementation, parameterised over the set/member shapes, backs both
|
|
17
|
+
* the property and quantity paths -- they are one mechanism (a name-only
|
|
18
|
+
* mutation key over possibly-repeated set names) and must agree; a
|
|
19
|
+
* property-only or quantity-only copy would drift the same way the pset and
|
|
20
|
+
* qset paths themselves drifted before this file existed.
|
|
21
|
+
*/
|
|
22
|
+
export interface SetClaims<S> {
|
|
23
|
+
/** `${setName}:${memberName}` -> the base set instance that owns edits to it. */
|
|
24
|
+
readonly claimingInstanceForMember: Map<string, S>;
|
|
25
|
+
/** `setName` -> the first base set instance carrying that name. */
|
|
26
|
+
readonly firstInstanceOfSetName: Map<string, S>;
|
|
27
|
+
}
|
|
28
|
+
export declare function computeSetClaims<S extends {
|
|
29
|
+
name: string;
|
|
30
|
+
}>(sets: readonly S[], membersOf: (set: S) => readonly {
|
|
31
|
+
name: string;
|
|
32
|
+
}[]): SetClaims<S>;
|
|
33
|
+
/**
|
|
34
|
+
* The mutated member list for ONE base set instance: its own members with
|
|
35
|
+
* SET/DELETE applied only where this instance is the claiming one for that
|
|
36
|
+
* name, plus any genuinely-new member this instance claims as the first
|
|
37
|
+
* instance of its set name.
|
|
38
|
+
*
|
|
39
|
+
* @param memberKey builds the mutation-map key, e.g. `propertyKey`/`quantityKey`.
|
|
40
|
+
* @param applySet builds the output row for an own member a SET mutation targets.
|
|
41
|
+
* @param passthrough builds the output row for an own member with no mutation
|
|
42
|
+
* applied here (either unmutated, or mutated on a sibling instance instead).
|
|
43
|
+
* @param buildNew builds the output row for a brand-new member this instance claims.
|
|
44
|
+
*/
|
|
45
|
+
export declare function mutatedMembersForInstance<S extends {
|
|
46
|
+
name: string;
|
|
47
|
+
}, M extends {
|
|
48
|
+
name: string;
|
|
49
|
+
}, Mut extends {
|
|
50
|
+
operation: 'SET' | 'DELETE';
|
|
51
|
+
}, Out extends {
|
|
52
|
+
name: string;
|
|
53
|
+
}>(entityId: number, set: S, members: readonly M[], claims: SetClaims<S>, mutations: ReadonlyMap<string, Mut>, entityMemberKeys: ReadonlySet<string> | undefined, memberKey: (entityId: number, setName: string, memberName: string) => string, applySet: (member: M, mutation: Mut) => Out, passthrough: (member: M) => Out, buildNew: (name: string, mutation: Mut) => Out): Out[];
|
|
54
|
+
//# sourceMappingURL=same-name-set-claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"same-name-set-claims.d.ts","sourceRoot":"","sources":["../src/same-name-set-claims.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,mEAAmE;IACnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CACjD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACzD,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GACjD,SAAS,CAAC,CAAC,CAAC,CAed;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAC1B,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAC1B,GAAG,SAAS;IAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAA;CAAE,EAC3C,GAAG,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAE5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EACjD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,EAC5E,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,GAAG,EAC3C,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,GAAG,EAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,GAAG,GAC7C,GAAG,EAAE,CAwCP"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
export function computeSetClaims(sets, membersOf) {
|
|
5
|
+
const claimingInstanceForMember = new Map();
|
|
6
|
+
const firstInstanceOfSetName = new Map();
|
|
7
|
+
for (const set of sets) {
|
|
8
|
+
if (!firstInstanceOfSetName.has(set.name)) {
|
|
9
|
+
firstInstanceOfSetName.set(set.name, set);
|
|
10
|
+
}
|
|
11
|
+
for (const member of membersOf(set)) {
|
|
12
|
+
const claimKey = `${set.name}:${member.name}`;
|
|
13
|
+
if (!claimingInstanceForMember.has(claimKey)) {
|
|
14
|
+
claimingInstanceForMember.set(claimKey, set);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return { claimingInstanceForMember, firstInstanceOfSetName };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The mutated member list for ONE base set instance: its own members with
|
|
22
|
+
* SET/DELETE applied only where this instance is the claiming one for that
|
|
23
|
+
* name, plus any genuinely-new member this instance claims as the first
|
|
24
|
+
* instance of its set name.
|
|
25
|
+
*
|
|
26
|
+
* @param memberKey builds the mutation-map key, e.g. `propertyKey`/`quantityKey`.
|
|
27
|
+
* @param applySet builds the output row for an own member a SET mutation targets.
|
|
28
|
+
* @param passthrough builds the output row for an own member with no mutation
|
|
29
|
+
* applied here (either unmutated, or mutated on a sibling instance instead).
|
|
30
|
+
* @param buildNew builds the output row for a brand-new member this instance claims.
|
|
31
|
+
*/
|
|
32
|
+
export function mutatedMembersForInstance(entityId, set, members, claims, mutations, entityMemberKeys, memberKey, applySet, passthrough, buildNew) {
|
|
33
|
+
const { claimingInstanceForMember, firstInstanceOfSetName } = claims;
|
|
34
|
+
const mutatedMembers = [];
|
|
35
|
+
for (const member of members) {
|
|
36
|
+
const isClaimingInstance = claimingInstanceForMember.get(`${set.name}:${member.name}`) === set;
|
|
37
|
+
if (!isClaimingInstance) {
|
|
38
|
+
mutatedMembers.push(passthrough(member));
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const key = memberKey(entityId, set.name, member.name);
|
|
42
|
+
const mutation = mutations.get(key);
|
|
43
|
+
if (mutation) {
|
|
44
|
+
if (mutation.operation === 'DELETE')
|
|
45
|
+
continue;
|
|
46
|
+
mutatedMembers.push(applySet(member, mutation));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
mutatedMembers.push(passthrough(member));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// New members (never present on any same-named base instance) land on
|
|
53
|
+
// the first instance of this set name only, and only when no OTHER
|
|
54
|
+
// same-named instance already owns that name in its own base members
|
|
55
|
+
// (that member isn't new at all, just claimed by the sibling above).
|
|
56
|
+
if (firstInstanceOfSetName.get(set.name) === set && entityMemberKeys) {
|
|
57
|
+
const setPrefix = `${entityId}:${set.name}:`;
|
|
58
|
+
for (const key of entityMemberKeys) {
|
|
59
|
+
if (!key.startsWith(setPrefix))
|
|
60
|
+
continue;
|
|
61
|
+
const mutation = mutations.get(key);
|
|
62
|
+
if (!mutation || mutation.operation !== 'SET')
|
|
63
|
+
continue;
|
|
64
|
+
const memberName = key.slice(setPrefix.length);
|
|
65
|
+
if (claimingInstanceForMember.has(`${set.name}:${memberName}`))
|
|
66
|
+
continue; // owned by a sibling instance's own member
|
|
67
|
+
if (!mutatedMembers.some(m => m.name === memberName)) {
|
|
68
|
+
mutatedMembers.push(buildNew(memberName, mutation));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return mutatedMembers;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=same-name-set-claims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"same-name-set-claims.js","sourceRoot":"","sources":["../src/same-name-set-claims.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/mutations",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Mutation tracking and property editing for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@noble/hashes": "^2.
|
|
17
|
-
"@ifc-lite/data": "^
|
|
16
|
+
"@noble/hashes": "^2.4.0",
|
|
17
|
+
"@ifc-lite/data": "^4.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "^6.0.3",
|
|
21
|
-
"vitest": "^4.1.
|
|
21
|
+
"vitest": "^4.1.11"
|
|
22
22
|
},
|
|
23
23
|
"license": "MPL-2.0",
|
|
24
24
|
"author": "Louis True",
|