kaabalah 5.5.1 → 5.6.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 +25 -0
- package/dist/{chunk-BJUCABP4.js → chunk-3HYK4Q4B.js} +123 -10
- package/dist/chunk-3HYK4Q4B.js.map +1 -0
- package/dist/{chunk-27IU6FA2.mjs → chunk-3SFBJHP2.mjs} +3 -3
- package/dist/{chunk-27IU6FA2.mjs.map → chunk-3SFBJHP2.mjs.map} +1 -1
- package/dist/chunk-4NMXTZX4.mjs +525 -0
- package/dist/chunk-4NMXTZX4.mjs.map +1 -0
- package/dist/{chunk-PEAOQ7YH.js → chunk-EVQ432JA.js} +23 -23
- package/dist/{chunk-PEAOQ7YH.js.map → chunk-EVQ432JA.js.map} +1 -1
- package/dist/{chunk-PPSRTX52.mjs → chunk-IHQPXEB7.mjs} +123 -11
- package/dist/chunk-IHQPXEB7.mjs.map +1 -0
- package/dist/{chunk-3IPH7UTM.mjs → chunk-OGWTKRJK.js} +196 -3
- package/dist/chunk-OGWTKRJK.js.map +1 -0
- package/dist/{chunk-W5UTGQI2.mjs → chunk-S6BFRUJQ.mjs} +3 -3
- package/dist/{chunk-W5UTGQI2.mjs.map → chunk-S6BFRUJQ.mjs.map} +1 -1
- package/dist/{chunk-FYR5Z7M2.js → chunk-U3JFWP24.mjs} +185 -6
- package/dist/chunk-U3JFWP24.mjs.map +1 -0
- package/dist/chunk-XB6PXEKO.js +529 -0
- package/dist/chunk-XB6PXEKO.js.map +1 -0
- package/dist/{chunk-ZQ2ZZPOW.js → chunk-XTVGQXCL.js} +4 -4
- package/dist/{chunk-ZQ2ZZPOW.js.map → chunk-XTVGQXCL.js.map} +1 -1
- package/dist/cli.js +881 -46
- package/dist/cli.js.map +1 -1
- package/dist/{registry-DOiHyH-r.d.mts → constants-DbFwuCjR.d.mts} +1 -177
- package/dist/{registry-DOiHyH-r.d.ts → constants-DbFwuCjR.d.ts} +1 -177
- package/dist/core/index.d.mts +66 -3
- package/dist/core/index.d.ts +66 -3
- package/dist/core/index.js +55 -39
- package/dist/core/index.mjs +2 -2
- package/dist/correspondence-model-D8c42J4c.d.mts +281 -0
- package/dist/correspondence-model-DhmBYoMf.d.ts +281 -0
- package/dist/gematria/index.d.mts +2 -1
- package/dist/gematria/index.d.ts +2 -1
- package/dist/gematria/index.js +5 -5
- package/dist/gematria/index.mjs +2 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +109 -69
- package/dist/index.mjs +5 -5
- package/dist/numerology/index.js +18 -18
- package/dist/numerology/index.mjs +3 -3
- package/dist/tarot/index.d.mts +64 -2
- package/dist/tarot/index.d.ts +64 -2
- package/dist/tarot/index.js +30 -4
- package/dist/tarot/index.mjs +3 -1
- package/package.json +1 -1
- package/dist/chunk-3IPH7UTM.mjs.map +0 -1
- package/dist/chunk-AD7T42HJ.js +0 -4
- package/dist/chunk-AD7T42HJ.js.map +0 -1
- package/dist/chunk-BJUCABP4.js.map +0 -1
- package/dist/chunk-FYR5Z7M2.js.map +0 -1
- package/dist/chunk-PPSRTX52.mjs.map +0 -1
- package/dist/chunk-RFSO3JRG.mjs +0 -3
- package/dist/chunk-RFSO3JRG.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -72,6 +72,31 @@ const gematriaValue = calculateGematria('kaabalah');
|
|
|
72
72
|
const spread = getRandomSpread(3, true);
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
### Canonical Tarot Image Resolution
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { id, KaabalahTypes } from "kaabalah/core";
|
|
79
|
+
import {
|
|
80
|
+
getTarotArchetype,
|
|
81
|
+
getTarotRepresentation,
|
|
82
|
+
resolveTarotImageUrl
|
|
83
|
+
} from "kaabalah/tarot";
|
|
84
|
+
|
|
85
|
+
const archetype = getTarotArchetype({
|
|
86
|
+
pathId: id(KaabalahTypes.PATH, 2)
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const riderWaite = getTarotRepresentation({ pathSlug: "beth" }, "rider-waite");
|
|
90
|
+
const papusImageUrl = resolveTarotImageUrl(
|
|
91
|
+
{ tarotCardFilename: "02_the_high_priestess" },
|
|
92
|
+
"papus_pt"
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
// Persist the canonical archetype ID (for example `path:2`), not the image URL.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The tarot resolver currently supports major-card archetypes only. Use `path:<1-22>` as the canonical persisted key, and treat path slugs, major-card filenames, and major-card numbers as lookup aliases.
|
|
99
|
+
|
|
75
100
|
## CLI
|
|
76
101
|
|
|
77
102
|
Kaabalah includes a command-line interface for quick calculations without writing code.
|
|
@@ -2109,6 +2109,11 @@ var COLORS_DATA = {
|
|
|
2109
2109
|
}
|
|
2110
2110
|
};
|
|
2111
2111
|
|
|
2112
|
+
// src/core/correspondence-model.ts
|
|
2113
|
+
function makeCorrespondenceId(left, right) {
|
|
2114
|
+
return [left, right].sort().join("<->");
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2112
2117
|
// src/core/types.ts
|
|
2113
2118
|
var KaabalahTypes = /* @__PURE__ */ ((KaabalahTypes2) => {
|
|
2114
2119
|
KaabalahTypes2["SPHERE"] = "sphere";
|
|
@@ -6495,7 +6500,13 @@ var ModuleManager = class {
|
|
|
6495
6500
|
if (!loadedSystem) {
|
|
6496
6501
|
throw new Error(`System ${systemKey} not found`);
|
|
6497
6502
|
}
|
|
6498
|
-
|
|
6503
|
+
this.t.runWithMutationSource(
|
|
6504
|
+
{
|
|
6505
|
+
kind: "system",
|
|
6506
|
+
system: systemKey
|
|
6507
|
+
},
|
|
6508
|
+
() => loadedSystem.LOADERS.base(this.t)
|
|
6509
|
+
);
|
|
6499
6510
|
this.activeSystem = systemKey;
|
|
6500
6511
|
this.loadedParts.clear();
|
|
6501
6512
|
this.loadedParts.add("base");
|
|
@@ -6515,13 +6526,28 @@ var ModuleManager = class {
|
|
|
6515
6526
|
if (this.loadedParts.has(partKey)) {
|
|
6516
6527
|
return;
|
|
6517
6528
|
}
|
|
6518
|
-
|
|
6529
|
+
this.t.runWithMutationSource(
|
|
6530
|
+
{
|
|
6531
|
+
kind: "part",
|
|
6532
|
+
system: this.activeSystem,
|
|
6533
|
+
part: partKey
|
|
6534
|
+
},
|
|
6535
|
+
() => system.LOADERS[partKey](this.t)
|
|
6536
|
+
);
|
|
6519
6537
|
this.loadedParts.add(partKey);
|
|
6520
6538
|
const possiblePartBridges = system.BRIDGES.filter(
|
|
6521
6539
|
(b) => b.needs.includes(partKey) && !this.bridgedParts.has(b.id) && b.needs.every((n) => this.loadedParts.has(n))
|
|
6522
6540
|
);
|
|
6523
6541
|
for (const bridge of possiblePartBridges) {
|
|
6524
|
-
|
|
6542
|
+
this.t.runWithMutationSource(
|
|
6543
|
+
{
|
|
6544
|
+
kind: "bridge",
|
|
6545
|
+
system: this.activeSystem,
|
|
6546
|
+
bridgeId: bridge.id,
|
|
6547
|
+
parts: [...bridge.needs]
|
|
6548
|
+
},
|
|
6549
|
+
() => bridge.run(this.t)
|
|
6550
|
+
);
|
|
6525
6551
|
this.bridgedParts.add(bridge.id);
|
|
6526
6552
|
}
|
|
6527
6553
|
}
|
|
@@ -6558,7 +6584,15 @@ var ModuleManager = class {
|
|
|
6558
6584
|
throw new Error(`Bridge ${bridgeKey} not found`);
|
|
6559
6585
|
}
|
|
6560
6586
|
if (!this.bridgedParts.has(bridge.id) && bridge.needs.every((n) => this.loadedParts.has(n))) {
|
|
6561
|
-
|
|
6587
|
+
this.t.runWithMutationSource(
|
|
6588
|
+
{
|
|
6589
|
+
kind: "bridge",
|
|
6590
|
+
system: this.activeSystem,
|
|
6591
|
+
bridgeId: bridge.id,
|
|
6592
|
+
parts: [...bridge.needs]
|
|
6593
|
+
},
|
|
6594
|
+
() => bridge.run(this.t)
|
|
6595
|
+
);
|
|
6562
6596
|
this.bridgedParts.add(bridge.id);
|
|
6563
6597
|
}
|
|
6564
6598
|
}
|
|
@@ -6594,12 +6628,60 @@ var ModuleManager = class {
|
|
|
6594
6628
|
};
|
|
6595
6629
|
|
|
6596
6630
|
// src/core/tree-of-life.ts
|
|
6631
|
+
function mergeCorrespondenceMetadata(current, next) {
|
|
6632
|
+
if (!current) {
|
|
6633
|
+
return next ? { ...next } : void 0;
|
|
6634
|
+
}
|
|
6635
|
+
if (!next) {
|
|
6636
|
+
return { ...current };
|
|
6637
|
+
}
|
|
6638
|
+
return {
|
|
6639
|
+
...current,
|
|
6640
|
+
...next,
|
|
6641
|
+
tags: [.../* @__PURE__ */ new Set([...current.tags ?? [], ...next.tags ?? []])],
|
|
6642
|
+
attributes: {
|
|
6643
|
+
...current.attributes ?? {},
|
|
6644
|
+
...next.attributes ?? {}
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
}
|
|
6648
|
+
function mergeCorrespondenceSources(current, next) {
|
|
6649
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6650
|
+
const merged = [];
|
|
6651
|
+
for (const source of [...current, next]) {
|
|
6652
|
+
const key = JSON.stringify(source);
|
|
6653
|
+
if (seen.has(key)) {
|
|
6654
|
+
continue;
|
|
6655
|
+
}
|
|
6656
|
+
seen.add(key);
|
|
6657
|
+
merged.push({
|
|
6658
|
+
...source,
|
|
6659
|
+
...source.kind === "bridge" ? { parts: [...source.parts] } : {}
|
|
6660
|
+
});
|
|
6661
|
+
}
|
|
6662
|
+
return merged;
|
|
6663
|
+
}
|
|
6597
6664
|
var TreeOfLife = class {
|
|
6598
6665
|
constructor() {
|
|
6599
6666
|
this.nodes = /* @__PURE__ */ new Map();
|
|
6600
6667
|
this.adjacent = /* @__PURE__ */ new Map();
|
|
6668
|
+
this.edges = /* @__PURE__ */ new Map();
|
|
6669
|
+
this.mutationSources = [{ kind: "manual" }];
|
|
6601
6670
|
this.modules = new ModuleManager(this);
|
|
6602
6671
|
}
|
|
6672
|
+
getCurrentMutationSource() {
|
|
6673
|
+
return this.mutationSources[this.mutationSources.length - 1] ?? {
|
|
6674
|
+
kind: "manual"
|
|
6675
|
+
};
|
|
6676
|
+
}
|
|
6677
|
+
runWithMutationSource(source, fn) {
|
|
6678
|
+
this.mutationSources.push(source);
|
|
6679
|
+
try {
|
|
6680
|
+
return fn();
|
|
6681
|
+
} finally {
|
|
6682
|
+
this.mutationSources.pop();
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6603
6685
|
/**
|
|
6604
6686
|
* Loads the tree of life system to be used
|
|
6605
6687
|
* @param systemKey - the key of the system to load
|
|
@@ -6661,28 +6743,57 @@ var TreeOfLife = class {
|
|
|
6661
6743
|
getNodes() {
|
|
6662
6744
|
return [...this.nodes.values()];
|
|
6663
6745
|
}
|
|
6746
|
+
getEdge(left, right) {
|
|
6747
|
+
return this.edges.get(makeCorrespondenceId(left, right));
|
|
6748
|
+
}
|
|
6749
|
+
getEdges(nodeId) {
|
|
6750
|
+
if (!nodeId) {
|
|
6751
|
+
return [...this.edges.values()];
|
|
6752
|
+
}
|
|
6753
|
+
return [...this.adjacent.get(nodeId) ?? []].map((relatedNodeId) => this.getEdge(nodeId, relatedNodeId)).filter((edge) => Boolean(edge));
|
|
6754
|
+
}
|
|
6664
6755
|
/**
|
|
6665
6756
|
* Links two nodes bi-directionally
|
|
6666
6757
|
* @param firstNode - the id of the first node
|
|
6667
6758
|
* @param secondNode - the id of the second node
|
|
6668
6759
|
*/
|
|
6669
|
-
link(firstNode, secondNode) {
|
|
6760
|
+
link(firstNode, secondNode, options = {}) {
|
|
6670
6761
|
if (!this.nodes.has(firstNode) || !this.nodes.has(secondNode)) {
|
|
6671
6762
|
throw new Error("unknown node id");
|
|
6672
6763
|
}
|
|
6673
6764
|
if (firstNode === secondNode) {
|
|
6674
6765
|
return;
|
|
6675
6766
|
}
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6767
|
+
const edgeId = makeCorrespondenceId(firstNode, secondNode);
|
|
6768
|
+
const source = options.source ?? this.getCurrentMutationSource();
|
|
6769
|
+
const existingEdge = this.edges.get(edgeId);
|
|
6679
6770
|
const put = (leftNode, rightNode) => {
|
|
6680
6771
|
const set = this.adjacent.get(leftNode) ?? /* @__PURE__ */ new Set();
|
|
6681
6772
|
set.add(rightNode);
|
|
6682
6773
|
this.adjacent.set(leftNode, set);
|
|
6683
6774
|
};
|
|
6775
|
+
if (existingEdge) {
|
|
6776
|
+
this.edges.set(edgeId, {
|
|
6777
|
+
...existingEdge,
|
|
6778
|
+
metadata: mergeCorrespondenceMetadata(
|
|
6779
|
+
existingEdge.metadata,
|
|
6780
|
+
options.metadata
|
|
6781
|
+
),
|
|
6782
|
+
sources: mergeCorrespondenceSources(existingEdge.sources, source)
|
|
6783
|
+
});
|
|
6784
|
+
put(firstNode, secondNode);
|
|
6785
|
+
put(secondNode, firstNode);
|
|
6786
|
+
return;
|
|
6787
|
+
}
|
|
6684
6788
|
put(firstNode, secondNode);
|
|
6685
6789
|
put(secondNode, firstNode);
|
|
6790
|
+
this.edges.set(edgeId, {
|
|
6791
|
+
id: edgeId,
|
|
6792
|
+
left: firstNode,
|
|
6793
|
+
right: secondNode,
|
|
6794
|
+
metadata: mergeCorrespondenceMetadata(void 0, options.metadata),
|
|
6795
|
+
sources: mergeCorrespondenceSources([], source)
|
|
6796
|
+
});
|
|
6686
6797
|
}
|
|
6687
6798
|
/**
|
|
6688
6799
|
* Gets the current node and all its direct relations, or, when filtered by node type, only the direct relations of that type.
|
|
@@ -6767,6 +6878,7 @@ var TreeOfLife = class {
|
|
|
6767
6878
|
const neighbors = this.adjacent.get(id2);
|
|
6768
6879
|
if (neighbors) {
|
|
6769
6880
|
for (const neighbor of neighbors) {
|
|
6881
|
+
this.edges.delete(makeCorrespondenceId(id2, neighbor));
|
|
6770
6882
|
const set = this.adjacent.get(neighbor);
|
|
6771
6883
|
if (!set) {
|
|
6772
6884
|
continue;
|
|
@@ -6982,6 +7094,7 @@ exports.WESTERN_ZODIAC_SIGNS = WESTERN_ZODIAC_SIGNS;
|
|
|
6982
7094
|
exports.WesternAstrologyTypes = WesternAstrologyTypes;
|
|
6983
7095
|
exports.createTree = createTree;
|
|
6984
7096
|
exports.id = id;
|
|
7097
|
+
exports.makeCorrespondenceId = makeCorrespondenceId;
|
|
6985
7098
|
exports.parseId = parseId;
|
|
6986
|
-
//# sourceMappingURL=chunk-
|
|
6987
|
-
//# sourceMappingURL=chunk-
|
|
7099
|
+
//# sourceMappingURL=chunk-3HYK4Q4B.js.map
|
|
7100
|
+
//# sourceMappingURL=chunk-3HYK4Q4B.js.map
|