@astro-api/n8n-nodes-astrology 0.7.1 → 0.8.1
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/nodes/Astrology/Astrology.node.js +41 -4
- package/dist/nodes/Astrology/handlers/analysis.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/analysis.handler.js +137 -0
- package/dist/nodes/Astrology/handlers/astrocartography.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/astrocartography.handler.js +172 -0
- package/dist/nodes/Astrology/handlers/chinese.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/chinese.handler.js +117 -0
- package/dist/nodes/Astrology/handlers/eclipses.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/eclipses.handler.js +96 -0
- package/dist/nodes/Astrology/handlers/enhanced.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/enhanced.handler.js +75 -0
- package/dist/nodes/Astrology/handlers/fengshui.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/fengshui.handler.js +63 -0
- package/dist/nodes/Astrology/handlers/fixedStars.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/fixedStars.handler.js +83 -0
- package/dist/nodes/Astrology/handlers/glossary.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/glossary.handler.js +91 -0
- package/dist/nodes/Astrology/handlers/horary.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/horary.handler.js +108 -0
- package/dist/nodes/Astrology/handlers/index.d.ts +17 -0
- package/dist/nodes/Astrology/handlers/index.js +35 -1
- package/dist/nodes/Astrology/handlers/insights.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/insights.handler.js +214 -0
- package/dist/nodes/Astrology/handlers/kabbalah.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/kabbalah.handler.js +89 -0
- package/dist/nodes/Astrology/handlers/lunar.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/lunar.handler.js +49 -0
- package/dist/nodes/Astrology/handlers/pdf.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/pdf.handler.js +144 -0
- package/dist/nodes/Astrology/handlers/render.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/render.handler.js +85 -0
- package/dist/nodes/Astrology/handlers/traditional.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/traditional.handler.js +99 -0
- package/dist/nodes/Astrology/handlers/vedic.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/vedic.handler.js +185 -0
- package/dist/nodes/Astrology/handlers/ziwei.handler.d.ts +10 -0
- package/dist/nodes/Astrology/handlers/ziwei.handler.js +39 -0
- package/dist/nodes/Astrology/interfaces/types.d.ts +165 -1
- package/dist/nodes/Astrology/operations/analysis.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/analysis.operation.js +229 -0
- package/dist/nodes/Astrology/operations/astrocartography.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/astrocartography.operation.js +163 -0
- package/dist/nodes/Astrology/operations/chinese.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/chinese.operation.js +115 -0
- package/dist/nodes/Astrology/operations/eclipses.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/eclipses.operation.js +184 -0
- package/dist/nodes/Astrology/operations/enhanced.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/enhanced.operation.js +126 -0
- package/dist/nodes/Astrology/operations/fengshui.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/fengshui.operation.js +68 -0
- package/dist/nodes/Astrology/operations/fixedStars.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/fixedStars.operation.js +80 -0
- package/dist/nodes/Astrology/operations/glossary.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/glossary.operation.js +141 -0
- package/dist/nodes/Astrology/operations/horary.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/horary.operation.js +96 -0
- package/dist/nodes/Astrology/operations/index.d.ts +17 -0
- package/dist/nodes/Astrology/operations/index.js +35 -1
- package/dist/nodes/Astrology/operations/insights.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/insights.operation.js +325 -0
- package/dist/nodes/Astrology/operations/kabbalah.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/kabbalah.operation.js +95 -0
- package/dist/nodes/Astrology/operations/lunar.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/lunar.operation.js +87 -0
- package/dist/nodes/Astrology/operations/pdf.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/pdf.operation.js +275 -0
- package/dist/nodes/Astrology/operations/render.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/render.operation.js +67 -0
- package/dist/nodes/Astrology/operations/resource.options.js +85 -0
- package/dist/nodes/Astrology/operations/traditional.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/traditional.operation.js +211 -0
- package/dist/nodes/Astrology/operations/vedic.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/vedic.operation.js +209 -0
- package/dist/nodes/Astrology/operations/ziwei.operation.d.ts +5 -0
- package/dist/nodes/Astrology/operations/ziwei.operation.js +46 -0
- package/dist/nodes/Astrology/shared/astrocartography.fields.d.ts +50 -0
- package/dist/nodes/Astrology/shared/astrocartography.fields.js +315 -0
- package/dist/nodes/Astrology/shared/chinese.fields.d.ts +50 -0
- package/dist/nodes/Astrology/shared/chinese.fields.js +294 -0
- package/dist/nodes/Astrology/shared/dateTimeLocation.fields.d.ts +24 -0
- package/dist/nodes/Astrology/shared/dateTimeLocation.fields.js +251 -0
- package/dist/nodes/Astrology/shared/eclipses.fields.d.ts +21 -0
- package/dist/nodes/Astrology/shared/eclipses.fields.js +197 -0
- package/dist/nodes/Astrology/shared/fengshui.fields.d.ts +25 -0
- package/dist/nodes/Astrology/shared/fengshui.fields.js +134 -0
- package/dist/nodes/Astrology/shared/fixedStars.fields.d.ts +17 -0
- package/dist/nodes/Astrology/shared/fixedStars.fields.js +110 -0
- package/dist/nodes/Astrology/shared/glossary.fields.d.ts +17 -0
- package/dist/nodes/Astrology/shared/glossary.fields.js +123 -0
- package/dist/nodes/Astrology/shared/helpers.d.ts +10 -1
- package/dist/nodes/Astrology/shared/helpers.js +33 -0
- package/dist/nodes/Astrology/shared/horary.fields.d.ts +21 -0
- package/dist/nodes/Astrology/shared/horary.fields.js +231 -0
- package/dist/nodes/Astrology/shared/index.d.ts +14 -1
- package/dist/nodes/Astrology/shared/index.js +96 -1
- package/dist/nodes/Astrology/shared/insights.fields.d.ts +50 -0
- package/dist/nodes/Astrology/shared/insights.fields.js +280 -0
- package/dist/nodes/Astrology/shared/kabbalah.fields.d.ts +43 -0
- package/dist/nodes/Astrology/shared/kabbalah.fields.js +218 -0
- package/dist/nodes/Astrology/shared/pdf.fields.d.ts +21 -0
- package/dist/nodes/Astrology/shared/pdf.fields.js +230 -0
- package/dist/nodes/Astrology/shared/render.fields.d.ts +22 -0
- package/dist/nodes/Astrology/shared/render.fields.js +183 -0
- package/dist/nodes/Astrology/shared/vedic.fields.d.ts +36 -0
- package/dist/nodes/Astrology/shared/vedic.fields.js +305 -0
- package/package.json +1 -1
|
@@ -22,6 +22,23 @@ const resourceHandlers = {
|
|
|
22
22
|
humanDesign: handlers_1.handleHumanDesignResource,
|
|
23
23
|
numerology: handlers_1.handleNumerologyResource,
|
|
24
24
|
tarot: handlers_1.handleTarotResource,
|
|
25
|
+
lunar: handlers_1.handleLunarResource,
|
|
26
|
+
vedic: handlers_1.handleVedicResource,
|
|
27
|
+
analysis: handlers_1.handleAnalysisResource,
|
|
28
|
+
render: handlers_1.handleRenderResource,
|
|
29
|
+
insights: handlers_1.handleInsightsResource,
|
|
30
|
+
traditional: handlers_1.handleTraditionalResource,
|
|
31
|
+
astrocartography: handlers_1.handleAstrocartographyResource,
|
|
32
|
+
chinese: handlers_1.handleChineseResource,
|
|
33
|
+
kabbalah: handlers_1.handleKabbalahResource,
|
|
34
|
+
glossary: handlers_1.handleGlossaryResource,
|
|
35
|
+
horary: handlers_1.handleHoraryResource,
|
|
36
|
+
fengshui: handlers_1.handleFengshuiResource,
|
|
37
|
+
fixedStars: handlers_1.handleFixedStarsResource,
|
|
38
|
+
enhanced: handlers_1.handleEnhancedResource,
|
|
39
|
+
pdf: handlers_1.handlePdfResource,
|
|
40
|
+
eclipses: handlers_1.handleEclipsesResource,
|
|
41
|
+
ziwei: handlers_1.handleZiweiResource,
|
|
25
42
|
};
|
|
26
43
|
class Astrology {
|
|
27
44
|
constructor() {
|
|
@@ -53,6 +70,23 @@ class Astrology {
|
|
|
53
70
|
...operations_1.humanDesignOperations,
|
|
54
71
|
...operations_1.numerologyOperations,
|
|
55
72
|
...operations_1.tarotOperations,
|
|
73
|
+
...operations_1.lunarOperations,
|
|
74
|
+
...operations_1.vedicOperations,
|
|
75
|
+
...operations_1.analysisOperations,
|
|
76
|
+
...operations_1.renderOperations,
|
|
77
|
+
...operations_1.insightsOperations,
|
|
78
|
+
...operations_1.traditionalOperations,
|
|
79
|
+
...operations_1.astrocartographyOperations,
|
|
80
|
+
...operations_1.chineseOperations,
|
|
81
|
+
...operations_1.kabbalahOperations,
|
|
82
|
+
...operations_1.glossaryOperations,
|
|
83
|
+
...operations_1.horaryOperations,
|
|
84
|
+
...operations_1.fengshuiOperations,
|
|
85
|
+
...operations_1.fixedStarsOperations,
|
|
86
|
+
...operations_1.enhancedOperations,
|
|
87
|
+
...operations_1.pdfOperations,
|
|
88
|
+
...operations_1.eclipsesOperations,
|
|
89
|
+
...operations_1.ziweiOperations,
|
|
56
90
|
],
|
|
57
91
|
};
|
|
58
92
|
}
|
|
@@ -79,20 +113,23 @@ class Astrology {
|
|
|
79
113
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource '${resource}' is not supported`, { itemIndex });
|
|
80
114
|
}
|
|
81
115
|
const responseData = await handler(context, operation);
|
|
82
|
-
returnData.push(
|
|
116
|
+
returnData.push({
|
|
117
|
+
json: responseData,
|
|
118
|
+
pairedItem: { item: itemIndex },
|
|
119
|
+
});
|
|
83
120
|
}
|
|
84
121
|
catch (error) {
|
|
85
122
|
if (this.continueOnFail()) {
|
|
86
123
|
returnData.push({
|
|
87
|
-
error: error.message,
|
|
88
|
-
itemIndex,
|
|
124
|
+
json: { error: error.message },
|
|
125
|
+
pairedItem: { item: itemIndex },
|
|
89
126
|
});
|
|
90
127
|
continue;
|
|
91
128
|
}
|
|
92
129
|
throw error;
|
|
93
130
|
}
|
|
94
131
|
}
|
|
95
|
-
return [
|
|
132
|
+
return [returnData];
|
|
96
133
|
}
|
|
97
134
|
}
|
|
98
135
|
exports.Astrology = Astrology;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDataObject } from "n8n-workflow";
|
|
2
|
+
import type { IHandlerContext } from "../interfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Handles all analysis resource operations
|
|
5
|
+
*
|
|
6
|
+
* @param context - Handler context with execution functions and credentials
|
|
7
|
+
* @param operation - The operation to execute
|
|
8
|
+
* @returns API response data
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleAnalysisResource(context: IHandlerContext, operation: string): Promise<IDataObject>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAnalysisResource = handleAnalysisResource;
|
|
4
|
+
const helpers_1 = require("../shared/helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint mapping for analysis operations
|
|
7
|
+
*/
|
|
8
|
+
const ANALYSIS_ENDPOINTS = {
|
|
9
|
+
natalReport: "/api/v3/analysis/natal-report",
|
|
10
|
+
synastryReport: "/api/v3/analysis/synastry-report",
|
|
11
|
+
transitReport: "/api/v3/analysis/transit-report",
|
|
12
|
+
compositeReport: "/api/v3/analysis/composite-report",
|
|
13
|
+
solarReturnReport: "/api/v3/analysis/solar-return-report",
|
|
14
|
+
lunarReturnReport: "/api/v3/analysis/lunar-return-report",
|
|
15
|
+
progressionReport: "/api/v3/analysis/progression-report",
|
|
16
|
+
directionReport: "/api/v3/analysis/direction-report",
|
|
17
|
+
natalTransitReport: "/api/v3/analysis/natal-transit-report",
|
|
18
|
+
solarReturnTransitReport: "/api/v3/analysis/solar-return-transit-report",
|
|
19
|
+
lunarReturnTransitReport: "/api/v3/analysis/lunar-return-transit-report",
|
|
20
|
+
lunarAnalysis: "/api/v3/analysis/lunar-analysis",
|
|
21
|
+
compatibility: "/api/v3/analysis/compatibility",
|
|
22
|
+
compatibilityScore: "/api/v3/analysis/compatibility-score",
|
|
23
|
+
relationship: "/api/v3/analysis/relationship",
|
|
24
|
+
relationshipScore: "/api/v3/analysis/relationship-score",
|
|
25
|
+
career: "/api/v3/analysis/career",
|
|
26
|
+
vocational: "/api/v3/analysis/vocational",
|
|
27
|
+
health: "/api/v3/analysis/health",
|
|
28
|
+
psychological: "/api/v3/analysis/psychological",
|
|
29
|
+
spiritual: "/api/v3/analysis/spiritual",
|
|
30
|
+
karmic: "/api/v3/analysis/karmic",
|
|
31
|
+
predictive: "/api/v3/analysis/predictive",
|
|
32
|
+
relocation: "/api/v3/analysis/relocation",
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Operations that require two subjects
|
|
36
|
+
*/
|
|
37
|
+
const TWO_SUBJECT_OPERATIONS = [
|
|
38
|
+
"synastryReport",
|
|
39
|
+
"compositeReport",
|
|
40
|
+
"compatibility",
|
|
41
|
+
"compatibilityScore",
|
|
42
|
+
"relationship",
|
|
43
|
+
"relationshipScore",
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Operations that require transit time
|
|
47
|
+
*/
|
|
48
|
+
const TRANSIT_OPERATIONS = [
|
|
49
|
+
"transitReport",
|
|
50
|
+
"natalTransitReport",
|
|
51
|
+
"solarReturnTransitReport",
|
|
52
|
+
"lunarReturnTransitReport",
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* Builds report options from node parameters
|
|
56
|
+
*/
|
|
57
|
+
function buildReportOptions(context) {
|
|
58
|
+
const { executeFunctions, itemIndex } = context;
|
|
59
|
+
const reportOptions = {};
|
|
60
|
+
// Tradition (Western/Vedic)
|
|
61
|
+
const tradition = executeFunctions.getNodeParameter("tradition", itemIndex, "western");
|
|
62
|
+
if (tradition) {
|
|
63
|
+
reportOptions.tradition = tradition;
|
|
64
|
+
}
|
|
65
|
+
// Language
|
|
66
|
+
const language = executeFunctions.getNodeParameter("language", itemIndex, "en");
|
|
67
|
+
if (language) {
|
|
68
|
+
reportOptions.language = language;
|
|
69
|
+
}
|
|
70
|
+
return reportOptions;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Handles all analysis resource operations
|
|
74
|
+
*
|
|
75
|
+
* @param context - Handler context with execution functions and credentials
|
|
76
|
+
* @param operation - The operation to execute
|
|
77
|
+
* @returns API response data
|
|
78
|
+
*/
|
|
79
|
+
async function handleAnalysisResource(context, operation) {
|
|
80
|
+
const { executeFunctions, itemIndex, baseUrl, apiKey } = context;
|
|
81
|
+
const op = operation;
|
|
82
|
+
const birthData = (0, helpers_1.buildBirthData)(executeFunctions, itemIndex);
|
|
83
|
+
const reportOptions = buildReportOptions(context);
|
|
84
|
+
const includeAspectPatterns = executeFunctions.getNodeParameter("includeAspectPatterns", itemIndex, false);
|
|
85
|
+
const endpoint = ANALYSIS_ENDPOINTS[op] || ANALYSIS_ENDPOINTS.natalReport;
|
|
86
|
+
let body;
|
|
87
|
+
// Two-subject operations
|
|
88
|
+
if (TWO_SUBJECT_OPERATIONS.includes(op)) {
|
|
89
|
+
const secondBirthData = (0, helpers_1.buildSecondSubjectBirthData)(executeFunctions, itemIndex);
|
|
90
|
+
body = {
|
|
91
|
+
subject1: {
|
|
92
|
+
birth_data: birthData,
|
|
93
|
+
},
|
|
94
|
+
subject2: {
|
|
95
|
+
birth_data: secondBirthData,
|
|
96
|
+
},
|
|
97
|
+
report_options: reportOptions,
|
|
98
|
+
include_aspect_patterns: includeAspectPatterns,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Transit operations
|
|
102
|
+
else if (TRANSIT_OPERATIONS.includes(op)) {
|
|
103
|
+
const transitTime = (0, helpers_1.buildTransitTime)(executeFunctions, itemIndex);
|
|
104
|
+
// Check if date range is provided
|
|
105
|
+
let startDate;
|
|
106
|
+
let endDate;
|
|
107
|
+
try {
|
|
108
|
+
startDate = executeFunctions.getNodeParameter("startDate", itemIndex, "");
|
|
109
|
+
endDate = executeFunctions.getNodeParameter("endDate", itemIndex, "");
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Date range fields may not be available for all transit operations
|
|
113
|
+
}
|
|
114
|
+
body = {
|
|
115
|
+
...(0, helpers_1.createSubjectRequest)(birthData),
|
|
116
|
+
transit_time: {
|
|
117
|
+
datetime: transitTime,
|
|
118
|
+
},
|
|
119
|
+
report_options: reportOptions,
|
|
120
|
+
include_aspect_patterns: includeAspectPatterns,
|
|
121
|
+
};
|
|
122
|
+
if (startDate && endDate) {
|
|
123
|
+
body.start_date = startDate;
|
|
124
|
+
body.end_date = endDate;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Single subject operations
|
|
128
|
+
else {
|
|
129
|
+
body = {
|
|
130
|
+
...(0, helpers_1.createSubjectRequest)(birthData),
|
|
131
|
+
report_options: reportOptions,
|
|
132
|
+
include_aspect_patterns: includeAspectPatterns,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
|
|
136
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
137
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDataObject } from "n8n-workflow";
|
|
2
|
+
import type { IHandlerContext } from "../interfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Handles all astrocartography resource operations
|
|
5
|
+
*
|
|
6
|
+
* @param context - Handler context with execution functions and credentials
|
|
7
|
+
* @param operation - The operation to execute
|
|
8
|
+
* @returns API response data
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleAstrocartographyResource(context: IHandlerContext, operation: string): Promise<IDataObject>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAstrocartographyResource = handleAstrocartographyResource;
|
|
4
|
+
const helpers_1 = require("../shared/helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint mapping for astrocartography operations
|
|
7
|
+
*/
|
|
8
|
+
const ASTROCARTOGRAPHY_ENDPOINTS = {
|
|
9
|
+
supportedFeatures: "/api/v3/astrocartography/supported-features",
|
|
10
|
+
lineMeanings: "/api/v3/astrocartography/line-meanings",
|
|
11
|
+
map: "/api/v3/astrocartography/map",
|
|
12
|
+
render: "/api/v3/astrocartography/render",
|
|
13
|
+
lines: "/api/v3/astrocartography/lines",
|
|
14
|
+
locationAnalysis: "/api/v3/astrocartography/location-analysis",
|
|
15
|
+
searchLocations: "/api/v3/astrocartography/search-locations",
|
|
16
|
+
compareLocations: "/api/v3/astrocartography/compare-locations",
|
|
17
|
+
relocationChart: "/api/v3/astrocartography/relocation-chart",
|
|
18
|
+
powerZones: "/api/v3/astrocartography/power-zones",
|
|
19
|
+
paranMap: "/api/v3/astrocartography/paran-map",
|
|
20
|
+
astrodynes: "/api/v3/astrocartography/astrodynes",
|
|
21
|
+
astrodynesCompare: "/api/v3/astrocartography/astrodynes/compare",
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* GET operations (no body required)
|
|
25
|
+
*/
|
|
26
|
+
const GET_OPERATIONS = [
|
|
27
|
+
"supportedFeatures",
|
|
28
|
+
"lineMeanings",
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Operations that use planets selection
|
|
32
|
+
*/
|
|
33
|
+
const PLANETS_OPERATIONS = [
|
|
34
|
+
"map",
|
|
35
|
+
"render",
|
|
36
|
+
"lines",
|
|
37
|
+
"paranMap",
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Operations that use line types
|
|
41
|
+
*/
|
|
42
|
+
const LINE_TYPES_OPERATIONS = [
|
|
43
|
+
"map",
|
|
44
|
+
"render",
|
|
45
|
+
"lines",
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Operations that use target location
|
|
49
|
+
*/
|
|
50
|
+
const TARGET_LOCATION_OPERATIONS = [
|
|
51
|
+
"locationAnalysis",
|
|
52
|
+
"relocationChart",
|
|
53
|
+
"astrodynes",
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* Operations that use map visual options
|
|
57
|
+
*/
|
|
58
|
+
const MAP_VISUAL_OPERATIONS = [
|
|
59
|
+
"map",
|
|
60
|
+
"render",
|
|
61
|
+
"paranMap",
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Builds map options from node parameters
|
|
65
|
+
*/
|
|
66
|
+
function buildMapOptions(context, op) {
|
|
67
|
+
const { executeFunctions, itemIndex } = context;
|
|
68
|
+
const mapOptions = {};
|
|
69
|
+
if (PLANETS_OPERATIONS.includes(op)) {
|
|
70
|
+
const planets = executeFunctions.getNodeParameter("acPlanets", itemIndex, [
|
|
71
|
+
"Sun",
|
|
72
|
+
"Moon",
|
|
73
|
+
"Venus",
|
|
74
|
+
"Mars",
|
|
75
|
+
"Jupiter",
|
|
76
|
+
]);
|
|
77
|
+
mapOptions.planets = planets;
|
|
78
|
+
}
|
|
79
|
+
if (LINE_TYPES_OPERATIONS.includes(op)) {
|
|
80
|
+
const lineTypes = executeFunctions.getNodeParameter("lineTypes", itemIndex, ["AC", "MC"]);
|
|
81
|
+
mapOptions.line_types = lineTypes;
|
|
82
|
+
}
|
|
83
|
+
if (op === "lines") {
|
|
84
|
+
const coordinatePrecision = executeFunctions.getNodeParameter("coordinatePrecision", itemIndex, 4);
|
|
85
|
+
mapOptions.coordinate_precision = coordinatePrecision;
|
|
86
|
+
}
|
|
87
|
+
return mapOptions;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Builds visual options from node parameters
|
|
91
|
+
*/
|
|
92
|
+
function buildVisualOptions(context) {
|
|
93
|
+
const { executeFunctions, itemIndex } = context;
|
|
94
|
+
const theme = executeFunctions.getNodeParameter("mapTheme", itemIndex, "light");
|
|
95
|
+
const width = executeFunctions.getNodeParameter("mapWidth", itemIndex, 1200);
|
|
96
|
+
const height = executeFunctions.getNodeParameter("mapHeight", itemIndex, 800);
|
|
97
|
+
return {
|
|
98
|
+
theme,
|
|
99
|
+
width,
|
|
100
|
+
height,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Builds target location from node parameters
|
|
105
|
+
*/
|
|
106
|
+
function buildTargetLocation(context) {
|
|
107
|
+
const { executeFunctions, itemIndex } = context;
|
|
108
|
+
const city = executeFunctions.getNodeParameter("targetCity", itemIndex, "");
|
|
109
|
+
const countryCode = executeFunctions.getNodeParameter("targetCountryCode", itemIndex, "");
|
|
110
|
+
const latitude = executeFunctions.getNodeParameter("targetLatitude", itemIndex, 0);
|
|
111
|
+
const longitude = executeFunctions.getNodeParameter("targetLongitude", itemIndex, 0);
|
|
112
|
+
const location = {};
|
|
113
|
+
if (city)
|
|
114
|
+
location.city = city;
|
|
115
|
+
if (countryCode)
|
|
116
|
+
location.country_code = countryCode;
|
|
117
|
+
if (latitude !== 0)
|
|
118
|
+
location.latitude = latitude;
|
|
119
|
+
if (longitude !== 0)
|
|
120
|
+
location.longitude = longitude;
|
|
121
|
+
return location;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Handles all astrocartography resource operations
|
|
125
|
+
*
|
|
126
|
+
* @param context - Handler context with execution functions and credentials
|
|
127
|
+
* @param operation - The operation to execute
|
|
128
|
+
* @returns API response data
|
|
129
|
+
*/
|
|
130
|
+
async function handleAstrocartographyResource(context, operation) {
|
|
131
|
+
const { executeFunctions, itemIndex, baseUrl, apiKey } = context;
|
|
132
|
+
const op = operation;
|
|
133
|
+
const endpoint = ASTROCARTOGRAPHY_ENDPOINTS[op] || ASTROCARTOGRAPHY_ENDPOINTS.map;
|
|
134
|
+
// GET operations - no body
|
|
135
|
+
if (GET_OPERATIONS.includes(op)) {
|
|
136
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "GET", baseUrl, endpoint, apiKey);
|
|
137
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
138
|
+
}
|
|
139
|
+
// POST operations with birth data
|
|
140
|
+
const birthData = (0, helpers_1.buildBirthData)(executeFunctions, itemIndex);
|
|
141
|
+
const body = {
|
|
142
|
+
...(0, helpers_1.createSubjectRequest)(birthData),
|
|
143
|
+
};
|
|
144
|
+
// Add map options
|
|
145
|
+
const mapOptions = buildMapOptions(context, op);
|
|
146
|
+
if (Object.keys(mapOptions).length > 0) {
|
|
147
|
+
body.map_options = mapOptions;
|
|
148
|
+
}
|
|
149
|
+
// Add coordinate density for lines operation
|
|
150
|
+
if (op === "lines") {
|
|
151
|
+
const coordinateDensity = executeFunctions.getNodeParameter("coordinateDensity", itemIndex, 100);
|
|
152
|
+
body.coordinate_density = coordinateDensity;
|
|
153
|
+
}
|
|
154
|
+
// Add visual options
|
|
155
|
+
if (MAP_VISUAL_OPERATIONS.includes(op)) {
|
|
156
|
+
body.visual_options = buildVisualOptions(context);
|
|
157
|
+
}
|
|
158
|
+
// Add target location
|
|
159
|
+
if (TARGET_LOCATION_OPERATIONS.includes(op)) {
|
|
160
|
+
const targetLocation = buildTargetLocation(context);
|
|
161
|
+
if (Object.keys(targetLocation).length > 0) {
|
|
162
|
+
body.target_location = targetLocation;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Add power type for power zones and search
|
|
166
|
+
if (op === "powerZones" || op === "searchLocations") {
|
|
167
|
+
const powerType = executeFunctions.getNodeParameter("powerType", itemIndex, "overall");
|
|
168
|
+
body.power_type = powerType;
|
|
169
|
+
}
|
|
170
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
|
|
171
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
172
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDataObject } from "n8n-workflow";
|
|
2
|
+
import type { IHandlerContext } from "../interfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Handles all chinese resource operations
|
|
5
|
+
*
|
|
6
|
+
* @param context - Handler context with execution functions and credentials
|
|
7
|
+
* @param operation - The operation to execute
|
|
8
|
+
* @returns API response data
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleChineseResource(context: IHandlerContext, operation: string): Promise<IDataObject>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleChineseResource = handleChineseResource;
|
|
4
|
+
const helpers_1 = require("../shared/helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint mapping for chinese operations
|
|
7
|
+
*/
|
|
8
|
+
const CHINESE_ENDPOINTS = {
|
|
9
|
+
zodiacAnimal: "/api/v3/chinese/zodiac", // + /{animal}
|
|
10
|
+
solarTerms: "/api/v3/chinese/calendar/solar-terms", // + /{year}
|
|
11
|
+
elementsBalance: "/api/v3/chinese/elements/balance", // + /{year}
|
|
12
|
+
bazi: "/api/v3/chinese/bazi",
|
|
13
|
+
compatibility: "/api/v3/chinese/compatibility",
|
|
14
|
+
luckPillars: "/api/v3/chinese/luck-pillars",
|
|
15
|
+
mingGua: "/api/v3/chinese/ming-gua",
|
|
16
|
+
yearlyForecast: "/api/v3/chinese/yearly-forecast",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* GET operations with path parameters
|
|
20
|
+
*/
|
|
21
|
+
const GET_WITH_PATH_OPERATIONS = [
|
|
22
|
+
"zodiacAnimal",
|
|
23
|
+
"solarTerms",
|
|
24
|
+
"elementsBalance",
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Operations that require birth data
|
|
28
|
+
*/
|
|
29
|
+
const BIRTH_DATA_OPERATIONS = [
|
|
30
|
+
"bazi",
|
|
31
|
+
"luckPillars",
|
|
32
|
+
"mingGua",
|
|
33
|
+
"yearlyForecast",
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Handles all chinese resource operations
|
|
37
|
+
*
|
|
38
|
+
* @param context - Handler context with execution functions and credentials
|
|
39
|
+
* @param operation - The operation to execute
|
|
40
|
+
* @returns API response data
|
|
41
|
+
*/
|
|
42
|
+
async function handleChineseResource(context, operation) {
|
|
43
|
+
const { executeFunctions, itemIndex, baseUrl, apiKey } = context;
|
|
44
|
+
const op = operation;
|
|
45
|
+
// GET operations with path parameters
|
|
46
|
+
if (GET_WITH_PATH_OPERATIONS.includes(op)) {
|
|
47
|
+
let endpoint = CHINESE_ENDPOINTS[op];
|
|
48
|
+
if (op === "zodiacAnimal") {
|
|
49
|
+
const animal = executeFunctions.getNodeParameter("zodiacAnimal", itemIndex, "dragon");
|
|
50
|
+
endpoint = `${endpoint}/${animal}`;
|
|
51
|
+
}
|
|
52
|
+
else if (op === "solarTerms" || op === "elementsBalance") {
|
|
53
|
+
const year = executeFunctions.getNodeParameter("chineseYear", itemIndex, 2024);
|
|
54
|
+
endpoint = `${endpoint}/${year}`;
|
|
55
|
+
}
|
|
56
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "GET", baseUrl, endpoint, apiKey);
|
|
57
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
58
|
+
}
|
|
59
|
+
// Compatibility operation - two subjects
|
|
60
|
+
if (op === "compatibility") {
|
|
61
|
+
const birthData = (0, helpers_1.buildBirthData)(executeFunctions, itemIndex);
|
|
62
|
+
const secondBirthData = (0, helpers_1.buildSecondSubjectBirthData)(executeFunctions, itemIndex);
|
|
63
|
+
const language = executeFunctions.getNodeParameter("language", itemIndex, "en");
|
|
64
|
+
const body = {
|
|
65
|
+
subject1: {
|
|
66
|
+
birth_data: birthData,
|
|
67
|
+
},
|
|
68
|
+
subject2: {
|
|
69
|
+
birth_data: secondBirthData,
|
|
70
|
+
},
|
|
71
|
+
language,
|
|
72
|
+
};
|
|
73
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, CHINESE_ENDPOINTS[op], apiKey, body);
|
|
74
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
75
|
+
}
|
|
76
|
+
// Birth data operations
|
|
77
|
+
if (BIRTH_DATA_OPERATIONS.includes(op)) {
|
|
78
|
+
const birthData = (0, helpers_1.buildBirthData)(executeFunctions, itemIndex);
|
|
79
|
+
const language = executeFunctions.getNodeParameter("language", itemIndex, "en");
|
|
80
|
+
const body = {
|
|
81
|
+
subject: {
|
|
82
|
+
birth_data: birthData,
|
|
83
|
+
},
|
|
84
|
+
language,
|
|
85
|
+
};
|
|
86
|
+
// BaZi specific options
|
|
87
|
+
if (op === "bazi") {
|
|
88
|
+
const gender = executeFunctions.getNodeParameter("gender", itemIndex, "male");
|
|
89
|
+
const includeLuckPillars = executeFunctions.getNodeParameter("includeLuckPillars", itemIndex, false);
|
|
90
|
+
const includeAnnualPillars = executeFunctions.getNodeParameter("includeAnnualPillars", itemIndex, false);
|
|
91
|
+
const tradition = executeFunctions.getNodeParameter("chineseTradition", itemIndex, "classical");
|
|
92
|
+
const analysisDepth = executeFunctions.getNodeParameter("analysisDepth", itemIndex, "standard");
|
|
93
|
+
body.subject.gender = gender;
|
|
94
|
+
body.include_luck_pillars = includeLuckPillars;
|
|
95
|
+
body.include_annual_pillars = includeAnnualPillars;
|
|
96
|
+
body.tradition = tradition;
|
|
97
|
+
body.analysis_depth = analysisDepth;
|
|
98
|
+
}
|
|
99
|
+
// Luck pillars specific options
|
|
100
|
+
if (op === "luckPillars") {
|
|
101
|
+
const gender = executeFunctions.getNodeParameter("gender", itemIndex, "male");
|
|
102
|
+
body.subject.gender = gender;
|
|
103
|
+
}
|
|
104
|
+
// Yearly forecast specific options
|
|
105
|
+
if (op === "yearlyForecast") {
|
|
106
|
+
const tradition = executeFunctions.getNodeParameter("chineseTradition", itemIndex, "classical");
|
|
107
|
+
const analysisDepth = executeFunctions.getNodeParameter("analysisDepth", itemIndex, "standard");
|
|
108
|
+
body.tradition = tradition;
|
|
109
|
+
body.analysis_depth = analysisDepth;
|
|
110
|
+
}
|
|
111
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, CHINESE_ENDPOINTS[op], apiKey, body);
|
|
112
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
113
|
+
}
|
|
114
|
+
// Fallback
|
|
115
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, CHINESE_ENDPOINTS[op] || CHINESE_ENDPOINTS.bazi, apiKey, {});
|
|
116
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
117
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDataObject } from "n8n-workflow";
|
|
2
|
+
import type { IHandlerContext } from "../interfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Handles all eclipses resource operations
|
|
5
|
+
*
|
|
6
|
+
* @param context - Handler context with execution functions and credentials
|
|
7
|
+
* @param operation - The operation to execute
|
|
8
|
+
* @returns API response data
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleEclipsesResource(context: IHandlerContext, operation: string): Promise<IDataObject>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleEclipsesResource = handleEclipsesResource;
|
|
4
|
+
const helpers_1 = require("../shared/helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint mapping for eclipses operations
|
|
7
|
+
*/
|
|
8
|
+
const ECLIPSES_ENDPOINTS = {
|
|
9
|
+
upcoming: "/api/v3/eclipses/upcoming",
|
|
10
|
+
natalCheck: "/api/v3/eclipses/natal-check",
|
|
11
|
+
interpretation: "/api/v3/eclipses/interpretation",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Handles all eclipses resource operations
|
|
15
|
+
*
|
|
16
|
+
* @param context - Handler context with execution functions and credentials
|
|
17
|
+
* @param operation - The operation to execute
|
|
18
|
+
* @returns API response data
|
|
19
|
+
*/
|
|
20
|
+
async function handleEclipsesResource(context, operation) {
|
|
21
|
+
const { executeFunctions, itemIndex, baseUrl, apiKey } = context;
|
|
22
|
+
const op = operation;
|
|
23
|
+
const endpoint = ECLIPSES_ENDPOINTS[op] || ECLIPSES_ENDPOINTS.upcoming;
|
|
24
|
+
// Handle upcoming (GET)
|
|
25
|
+
if (op === "upcoming") {
|
|
26
|
+
const count = executeFunctions.getNodeParameter("count", itemIndex, 10);
|
|
27
|
+
const finalEndpoint = `${endpoint}?count=${count}`;
|
|
28
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "GET", baseUrl, finalEndpoint, apiKey);
|
|
29
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
30
|
+
}
|
|
31
|
+
// Handle natalCheck (POST)
|
|
32
|
+
if (op === "natalCheck") {
|
|
33
|
+
const birthData = (0, helpers_1.buildBirthData)(executeFunctions, itemIndex);
|
|
34
|
+
const startYear = executeFunctions.getNodeParameter("startYear", itemIndex);
|
|
35
|
+
const startMonth = executeFunctions.getNodeParameter("startMonth", itemIndex);
|
|
36
|
+
const startDay = executeFunctions.getNodeParameter("startDay", itemIndex);
|
|
37
|
+
const endYear = executeFunctions.getNodeParameter("endYear", itemIndex);
|
|
38
|
+
const endMonth = executeFunctions.getNodeParameter("endMonth", itemIndex);
|
|
39
|
+
const endDay = executeFunctions.getNodeParameter("endDay", itemIndex);
|
|
40
|
+
const maxOrb = executeFunctions.getNodeParameter("maxOrb", itemIndex, 5);
|
|
41
|
+
const body = {
|
|
42
|
+
subject: {
|
|
43
|
+
birth_data: birthData,
|
|
44
|
+
},
|
|
45
|
+
date_range: {
|
|
46
|
+
start_date: {
|
|
47
|
+
year: startYear,
|
|
48
|
+
month: startMonth,
|
|
49
|
+
day: startDay,
|
|
50
|
+
},
|
|
51
|
+
end_date: {
|
|
52
|
+
year: endYear,
|
|
53
|
+
month: endMonth,
|
|
54
|
+
day: endDay,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
max_orb: maxOrb,
|
|
58
|
+
};
|
|
59
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
|
|
60
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
61
|
+
}
|
|
62
|
+
// Handle interpretation (POST)
|
|
63
|
+
if (op === "interpretation") {
|
|
64
|
+
const eclipseId = executeFunctions.getNodeParameter("eclipseId", itemIndex, "");
|
|
65
|
+
const language = executeFunctions.getNodeParameter("language", itemIndex, "en");
|
|
66
|
+
const includePersonal = executeFunctions.getNodeParameter("includePersonal", itemIndex, false);
|
|
67
|
+
const body = {
|
|
68
|
+
eclipse_id: eclipseId,
|
|
69
|
+
language,
|
|
70
|
+
};
|
|
71
|
+
// Add optional birth data for personal interpretation
|
|
72
|
+
if (includePersonal) {
|
|
73
|
+
const birthYear = executeFunctions.getNodeParameter("birthYear", itemIndex);
|
|
74
|
+
const birthMonth = executeFunctions.getNodeParameter("birthMonth", itemIndex);
|
|
75
|
+
const birthDay = executeFunctions.getNodeParameter("birthDay", itemIndex);
|
|
76
|
+
const birthHour = executeFunctions.getNodeParameter("birthHour", itemIndex);
|
|
77
|
+
const birthMinute = executeFunctions.getNodeParameter("birthMinute", itemIndex);
|
|
78
|
+
const birthCity = executeFunctions.getNodeParameter("birthCity", itemIndex);
|
|
79
|
+
const birthCountryCode = executeFunctions.getNodeParameter("birthCountryCode", itemIndex);
|
|
80
|
+
body.birth_data = {
|
|
81
|
+
year: birthYear,
|
|
82
|
+
month: birthMonth,
|
|
83
|
+
day: birthDay,
|
|
84
|
+
hour: birthHour,
|
|
85
|
+
minute: birthMinute,
|
|
86
|
+
city: birthCity,
|
|
87
|
+
country_code: birthCountryCode,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
|
|
91
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
92
|
+
}
|
|
93
|
+
// Fallback
|
|
94
|
+
const responseData = await (0, helpers_1.makeApiRequest)(executeFunctions, "GET", baseUrl, endpoint, apiKey);
|
|
95
|
+
return (0, helpers_1.applySimplifyIfEnabled)(executeFunctions, itemIndex, responseData);
|
|
96
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDataObject } from "n8n-workflow";
|
|
2
|
+
import type { IHandlerContext } from "../interfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Handles all enhanced resource operations
|
|
5
|
+
*
|
|
6
|
+
* @param context - Handler context with execution functions and credentials
|
|
7
|
+
* @param operation - The operation to execute
|
|
8
|
+
* @returns API response data
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleEnhancedResource(context: IHandlerContext, operation: string): Promise<IDataObject>;
|