kaabalah 5.5.1 → 6.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.
Files changed (66) hide show
  1. package/README.md +72 -0
  2. package/dist/astrology/index.d.mts +16 -1
  3. package/dist/astrology/index.d.ts +16 -1
  4. package/dist/astrology/index.js +55 -51
  5. package/dist/astrology/index.mjs +1 -1
  6. package/dist/{chunk-BJUCABP4.js → chunk-3HYK4Q4B.js} +123 -10
  7. package/dist/chunk-3HYK4Q4B.js.map +1 -0
  8. package/dist/{chunk-27IU6FA2.mjs → chunk-3SFBJHP2.mjs} +3 -3
  9. package/dist/{chunk-27IU6FA2.mjs.map → chunk-3SFBJHP2.mjs.map} +1 -1
  10. package/dist/chunk-4NMXTZX4.mjs +525 -0
  11. package/dist/chunk-4NMXTZX4.mjs.map +1 -0
  12. package/dist/{chunk-T6Y4DLMA.mjs → chunk-5NCI7UPZ.mjs} +176 -11
  13. package/dist/chunk-5NCI7UPZ.mjs.map +1 -0
  14. package/dist/chunk-7IXAG4KW.mjs +2136 -0
  15. package/dist/chunk-7IXAG4KW.mjs.map +1 -0
  16. package/dist/{chunk-HGEWHDIX.js → chunk-DU5HI6CU.js} +176 -10
  17. package/dist/chunk-DU5HI6CU.js.map +1 -0
  18. package/dist/{chunk-PEAOQ7YH.js → chunk-EVQ432JA.js} +23 -23
  19. package/dist/{chunk-PEAOQ7YH.js.map → chunk-EVQ432JA.js.map} +1 -1
  20. package/dist/{chunk-PPSRTX52.mjs → chunk-IHQPXEB7.mjs} +123 -11
  21. package/dist/chunk-IHQPXEB7.mjs.map +1 -0
  22. package/dist/{chunk-W5UTGQI2.mjs → chunk-S6BFRUJQ.mjs} +3 -3
  23. package/dist/{chunk-W5UTGQI2.mjs.map → chunk-S6BFRUJQ.mjs.map} +1 -1
  24. package/dist/chunk-XB6PXEKO.js +529 -0
  25. package/dist/chunk-XB6PXEKO.js.map +1 -0
  26. package/dist/chunk-XNJ6UHWN.js +2150 -0
  27. package/dist/chunk-XNJ6UHWN.js.map +1 -0
  28. package/dist/{chunk-ZQ2ZZPOW.js → chunk-XTVGQXCL.js} +4 -4
  29. package/dist/{chunk-ZQ2ZZPOW.js.map → chunk-XTVGQXCL.js.map} +1 -1
  30. package/dist/cli.js +1817 -97
  31. package/dist/cli.js.map +1 -1
  32. package/dist/{registry-DOiHyH-r.d.mts → constants-DbFwuCjR.d.mts} +1 -177
  33. package/dist/{registry-DOiHyH-r.d.ts → constants-DbFwuCjR.d.ts} +1 -177
  34. package/dist/core/index.d.mts +66 -3
  35. package/dist/core/index.d.ts +66 -3
  36. package/dist/core/index.js +55 -39
  37. package/dist/core/index.mjs +2 -2
  38. package/dist/correspondence-model-D8c42J4c.d.mts +281 -0
  39. package/dist/correspondence-model-DhmBYoMf.d.ts +281 -0
  40. package/dist/gematria/index.d.mts +2 -1
  41. package/dist/gematria/index.d.ts +2 -1
  42. package/dist/gematria/index.js +5 -5
  43. package/dist/gematria/index.mjs +2 -2
  44. package/dist/index.d.mts +5 -4
  45. package/dist/index.d.ts +5 -4
  46. package/dist/index.js +179 -119
  47. package/dist/index.mjs +6 -6
  48. package/dist/numerology/index.js +18 -18
  49. package/dist/numerology/index.mjs +3 -3
  50. package/dist/tarot/index.d.mts +157 -2
  51. package/dist/tarot/index.d.ts +157 -2
  52. package/dist/tarot/index.js +46 -4
  53. package/dist/tarot/index.mjs +3 -1
  54. package/package.json +1 -1
  55. package/dist/chunk-3IPH7UTM.mjs +0 -878
  56. package/dist/chunk-3IPH7UTM.mjs.map +0 -1
  57. package/dist/chunk-AD7T42HJ.js +0 -4
  58. package/dist/chunk-AD7T42HJ.js.map +0 -1
  59. package/dist/chunk-BJUCABP4.js.map +0 -1
  60. package/dist/chunk-FYR5Z7M2.js +0 -882
  61. package/dist/chunk-FYR5Z7M2.js.map +0 -1
  62. package/dist/chunk-HGEWHDIX.js.map +0 -1
  63. package/dist/chunk-PPSRTX52.mjs.map +0 -1
  64. package/dist/chunk-RFSO3JRG.mjs +0 -3
  65. package/dist/chunk-RFSO3JRG.mjs.map +0 -1
  66. package/dist/chunk-T6Y4DLMA.mjs.map +0 -1
@@ -2107,6 +2107,11 @@ var COLORS_DATA = {
2107
2107
  }
2108
2108
  };
2109
2109
 
2110
+ // src/core/correspondence-model.ts
2111
+ function makeCorrespondenceId(left, right) {
2112
+ return [left, right].sort().join("<->");
2113
+ }
2114
+
2110
2115
  // src/core/types.ts
2111
2116
  var KaabalahTypes = /* @__PURE__ */ ((KaabalahTypes2) => {
2112
2117
  KaabalahTypes2["SPHERE"] = "sphere";
@@ -6493,7 +6498,13 @@ var ModuleManager = class {
6493
6498
  if (!loadedSystem) {
6494
6499
  throw new Error(`System ${systemKey} not found`);
6495
6500
  }
6496
- loadedSystem.LOADERS.base(this.t);
6501
+ this.t.runWithMutationSource(
6502
+ {
6503
+ kind: "system",
6504
+ system: systemKey
6505
+ },
6506
+ () => loadedSystem.LOADERS.base(this.t)
6507
+ );
6497
6508
  this.activeSystem = systemKey;
6498
6509
  this.loadedParts.clear();
6499
6510
  this.loadedParts.add("base");
@@ -6513,13 +6524,28 @@ var ModuleManager = class {
6513
6524
  if (this.loadedParts.has(partKey)) {
6514
6525
  return;
6515
6526
  }
6516
- system.LOADERS[partKey](this.t);
6527
+ this.t.runWithMutationSource(
6528
+ {
6529
+ kind: "part",
6530
+ system: this.activeSystem,
6531
+ part: partKey
6532
+ },
6533
+ () => system.LOADERS[partKey](this.t)
6534
+ );
6517
6535
  this.loadedParts.add(partKey);
6518
6536
  const possiblePartBridges = system.BRIDGES.filter(
6519
6537
  (b) => b.needs.includes(partKey) && !this.bridgedParts.has(b.id) && b.needs.every((n) => this.loadedParts.has(n))
6520
6538
  );
6521
6539
  for (const bridge of possiblePartBridges) {
6522
- bridge.run(this.t);
6540
+ this.t.runWithMutationSource(
6541
+ {
6542
+ kind: "bridge",
6543
+ system: this.activeSystem,
6544
+ bridgeId: bridge.id,
6545
+ parts: [...bridge.needs]
6546
+ },
6547
+ () => bridge.run(this.t)
6548
+ );
6523
6549
  this.bridgedParts.add(bridge.id);
6524
6550
  }
6525
6551
  }
@@ -6556,7 +6582,15 @@ var ModuleManager = class {
6556
6582
  throw new Error(`Bridge ${bridgeKey} not found`);
6557
6583
  }
6558
6584
  if (!this.bridgedParts.has(bridge.id) && bridge.needs.every((n) => this.loadedParts.has(n))) {
6559
- bridge.run(this.t);
6585
+ this.t.runWithMutationSource(
6586
+ {
6587
+ kind: "bridge",
6588
+ system: this.activeSystem,
6589
+ bridgeId: bridge.id,
6590
+ parts: [...bridge.needs]
6591
+ },
6592
+ () => bridge.run(this.t)
6593
+ );
6560
6594
  this.bridgedParts.add(bridge.id);
6561
6595
  }
6562
6596
  }
@@ -6592,12 +6626,60 @@ var ModuleManager = class {
6592
6626
  };
6593
6627
 
6594
6628
  // src/core/tree-of-life.ts
6629
+ function mergeCorrespondenceMetadata(current, next) {
6630
+ if (!current) {
6631
+ return next ? { ...next } : void 0;
6632
+ }
6633
+ if (!next) {
6634
+ return { ...current };
6635
+ }
6636
+ return {
6637
+ ...current,
6638
+ ...next,
6639
+ tags: [.../* @__PURE__ */ new Set([...current.tags ?? [], ...next.tags ?? []])],
6640
+ attributes: {
6641
+ ...current.attributes ?? {},
6642
+ ...next.attributes ?? {}
6643
+ }
6644
+ };
6645
+ }
6646
+ function mergeCorrespondenceSources(current, next) {
6647
+ const seen = /* @__PURE__ */ new Set();
6648
+ const merged = [];
6649
+ for (const source of [...current, next]) {
6650
+ const key = JSON.stringify(source);
6651
+ if (seen.has(key)) {
6652
+ continue;
6653
+ }
6654
+ seen.add(key);
6655
+ merged.push({
6656
+ ...source,
6657
+ ...source.kind === "bridge" ? { parts: [...source.parts] } : {}
6658
+ });
6659
+ }
6660
+ return merged;
6661
+ }
6595
6662
  var TreeOfLife = class {
6596
6663
  constructor() {
6597
6664
  this.nodes = /* @__PURE__ */ new Map();
6598
6665
  this.adjacent = /* @__PURE__ */ new Map();
6666
+ this.edges = /* @__PURE__ */ new Map();
6667
+ this.mutationSources = [{ kind: "manual" }];
6599
6668
  this.modules = new ModuleManager(this);
6600
6669
  }
6670
+ getCurrentMutationSource() {
6671
+ return this.mutationSources[this.mutationSources.length - 1] ?? {
6672
+ kind: "manual"
6673
+ };
6674
+ }
6675
+ runWithMutationSource(source, fn) {
6676
+ this.mutationSources.push(source);
6677
+ try {
6678
+ return fn();
6679
+ } finally {
6680
+ this.mutationSources.pop();
6681
+ }
6682
+ }
6601
6683
  /**
6602
6684
  * Loads the tree of life system to be used
6603
6685
  * @param systemKey - the key of the system to load
@@ -6659,28 +6741,57 @@ var TreeOfLife = class {
6659
6741
  getNodes() {
6660
6742
  return [...this.nodes.values()];
6661
6743
  }
6744
+ getEdge(left, right) {
6745
+ return this.edges.get(makeCorrespondenceId(left, right));
6746
+ }
6747
+ getEdges(nodeId) {
6748
+ if (!nodeId) {
6749
+ return [...this.edges.values()];
6750
+ }
6751
+ return [...this.adjacent.get(nodeId) ?? []].map((relatedNodeId) => this.getEdge(nodeId, relatedNodeId)).filter((edge) => Boolean(edge));
6752
+ }
6662
6753
  /**
6663
6754
  * Links two nodes bi-directionally
6664
6755
  * @param firstNode - the id of the first node
6665
6756
  * @param secondNode - the id of the second node
6666
6757
  */
6667
- link(firstNode, secondNode) {
6758
+ link(firstNode, secondNode, options = {}) {
6668
6759
  if (!this.nodes.has(firstNode) || !this.nodes.has(secondNode)) {
6669
6760
  throw new Error("unknown node id");
6670
6761
  }
6671
6762
  if (firstNode === secondNode) {
6672
6763
  return;
6673
6764
  }
6674
- if (this.adjacent.has(firstNode) && this.adjacent.get(firstNode)?.has(secondNode)) {
6675
- return;
6676
- }
6765
+ const edgeId = makeCorrespondenceId(firstNode, secondNode);
6766
+ const source = options.source ?? this.getCurrentMutationSource();
6767
+ const existingEdge = this.edges.get(edgeId);
6677
6768
  const put = (leftNode, rightNode) => {
6678
6769
  const set = this.adjacent.get(leftNode) ?? /* @__PURE__ */ new Set();
6679
6770
  set.add(rightNode);
6680
6771
  this.adjacent.set(leftNode, set);
6681
6772
  };
6773
+ if (existingEdge) {
6774
+ this.edges.set(edgeId, {
6775
+ ...existingEdge,
6776
+ metadata: mergeCorrespondenceMetadata(
6777
+ existingEdge.metadata,
6778
+ options.metadata
6779
+ ),
6780
+ sources: mergeCorrespondenceSources(existingEdge.sources, source)
6781
+ });
6782
+ put(firstNode, secondNode);
6783
+ put(secondNode, firstNode);
6784
+ return;
6785
+ }
6682
6786
  put(firstNode, secondNode);
6683
6787
  put(secondNode, firstNode);
6788
+ this.edges.set(edgeId, {
6789
+ id: edgeId,
6790
+ left: firstNode,
6791
+ right: secondNode,
6792
+ metadata: mergeCorrespondenceMetadata(void 0, options.metadata),
6793
+ sources: mergeCorrespondenceSources([], source)
6794
+ });
6684
6795
  }
6685
6796
  /**
6686
6797
  * Gets the current node and all its direct relations, or, when filtered by node type, only the direct relations of that type.
@@ -6765,6 +6876,7 @@ var TreeOfLife = class {
6765
6876
  const neighbors = this.adjacent.get(id2);
6766
6877
  if (neighbors) {
6767
6878
  for (const neighbor of neighbors) {
6879
+ this.edges.delete(makeCorrespondenceId(id2, neighbor));
6768
6880
  const set = this.adjacent.get(neighbor);
6769
6881
  if (!set) {
6770
6882
  continue;
@@ -6943,6 +7055,6 @@ function createTree(opts = {
6943
7055
  return tree;
6944
7056
  }
6945
7057
 
6946
- export { BaseNode, COLORS, COLORS_DATA, FOUR_WORLDS, FOUR_WORLDS_DATA, HEBREW_LETTERS, HEBREW_LETTERS_DATA, KaabalahTypes, LATIN_LETTERS, LATIN_LETTERS_DATA, LURIANIC_PATHS, LetterTypes, MELKITZEDEKI_PATHS, MODALITIES, MUSICAL_NOTES, MUSICAL_NOTES_DATA, MiscTypes, NumerologyTypes, PLANETS, SPHERES, SPHERES_DATA, SYSTEM, SYSTEMS, TAROT_ARKANNUS, TAROT_ARKANNUS_DATA, TAROT_DECKS, TAROT_SUITS, TantraTypes, TarotTypes, TreeOfLife, WESTERN_ASPECTS, WESTERN_ELEMENTS, WESTERN_HOUSES, WESTERN_ZODIAC_SIGNS, WesternAstrologyTypes, createTree, id, parseId };
6947
- //# sourceMappingURL=chunk-PPSRTX52.mjs.map
6948
- //# sourceMappingURL=chunk-PPSRTX52.mjs.map
7058
+ export { BaseNode, COLORS, COLORS_DATA, FOUR_WORLDS, FOUR_WORLDS_DATA, HEBREW_LETTERS, HEBREW_LETTERS_DATA, KaabalahTypes, LATIN_LETTERS, LATIN_LETTERS_DATA, LURIANIC_PATHS, LetterTypes, MELKITZEDEKI_PATHS, MODALITIES, MUSICAL_NOTES, MUSICAL_NOTES_DATA, MiscTypes, NumerologyTypes, PLANETS, SPHERES, SPHERES_DATA, SYSTEM, SYSTEMS, TAROT_ARKANNUS, TAROT_ARKANNUS_DATA, TAROT_DECKS, TAROT_SUITS, TantraTypes, TarotTypes, TreeOfLife, WESTERN_ASPECTS, WESTERN_ELEMENTS, WESTERN_HOUSES, WESTERN_ZODIAC_SIGNS, WesternAstrologyTypes, createTree, id, makeCorrespondenceId, parseId };
7059
+ //# sourceMappingURL=chunk-IHQPXEB7.mjs.map
7060
+ //# sourceMappingURL=chunk-IHQPXEB7.mjs.map