@fjell/core 4.4.46 → 4.4.48

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/index.js CHANGED
@@ -179,11 +179,11 @@ var isItemKey = (key) => {
179
179
  };
180
180
  var isComKey = (key) => {
181
181
  logger2.trace("isComKey", { key });
182
- return key !== void 0 && (key.pk !== void 0 && key.kt !== void 0) && (key.loc !== void 0 && key.loc.length > 0);
182
+ return key !== void 0 && (key.pk !== void 0 && key.kt !== void 0) && (key.loc !== void 0 && Array.isArray(key.loc));
183
183
  };
184
184
  var isPriKey = (key) => {
185
185
  logger2.trace("isPriKey", { key });
186
- return key !== void 0 && (key.pk !== void 0 && key.kt !== void 0) && (key.loc === void 0 || key.loc.length === 0);
186
+ return key !== void 0 && (key.pk !== void 0 && key.kt !== void 0) && key.loc === void 0;
187
187
  };
188
188
  var isLocKey = (key) => {
189
189
  logger2.trace("isLocKey", { key });
@@ -284,7 +284,7 @@ var itemKeyToLocKeyArray = (ik) => {
284
284
  let lka = [];
285
285
  if (isComKey(ik)) {
286
286
  const ck = ik;
287
- lka = [...ck.loc, { kt: ck.kt, lk: ck.pk }];
287
+ lka = [...ck.loc];
288
288
  } else {
289
289
  const pk = ik;
290
290
  lka = [{ kt: pk.kt, lk: pk.pk }];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fjell/core",
3
3
  "description": "Core Item and Key Framework for Fjell",
4
- "version": "4.4.46",
4
+ "version": "4.4.48",
5
5
  "keywords": [
6
6
  "core",
7
7
  "fjell"
package/src/key/KUtils.ts CHANGED
@@ -192,13 +192,13 @@ export const isItemKey = (key: any): boolean => {
192
192
  export const isComKey = (key: any): boolean => {
193
193
  logger.trace('isComKey', { key });
194
194
  return key !== undefined &&
195
- (key.pk !== undefined && key.kt !== undefined) && (key.loc !== undefined && key.loc.length > 0);
195
+ (key.pk !== undefined && key.kt !== undefined) && (key.loc !== undefined && Array.isArray(key.loc));
196
196
  }
197
197
 
198
198
  export const isPriKey = (key: any): boolean => {
199
199
  logger.trace('isPriKey', { key });
200
200
  return key !== undefined &&
201
- (key.pk !== undefined && key.kt !== undefined) && (key.loc === undefined || key.loc.length === 0);
201
+ (key.pk !== undefined && key.kt !== undefined) && (key.loc === undefined);
202
202
  }
203
203
 
204
204
  export const isLocKey = (key: any): boolean => {
@@ -382,9 +382,10 @@ export const itemKeyToLocKeyArray =
382
382
  let lka: Array<LocKey<L1 | L2 | L3 | L4 | L5>> = [];
383
383
  if (isComKey(ik)) {
384
384
  const ck = ik as ComKey<S, L1, L2, L3, L4, L5>;
385
- // Location arrays should be ordered from parent to child (root to leaf)
386
- // So parent locations come first, then the current item
387
- lka = [...ck.loc, { kt: ck.kt, lk: ck.pk } as unknown as LocKey<L1 | L2 | L3 | L4 | L5>];
385
+ // For composite keys, return only the parent location keys (ck.loc)
386
+ // Location arrays are ordered child-to-parent per KTA hierarchy: ['child', 'parent', 'grandparent']
387
+ // This is used for aggregation queries where we want to find sibling items at the same location
388
+ lka = [...ck.loc];
388
389
  } else {
389
390
  const pk = ik as PriKey<S>;
390
391
  lka = [{ kt: pk.kt, lk: pk.pk } as unknown as LocKey<L1 | L2 | L3 | L4 | L5>];