@astro-api/n8n-nodes-astrology 0.1.1 → 0.1.2

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 CHANGED
@@ -65,58 +65,51 @@ For Docker deployments, mount the package or use `N8N_CUSTOM_EXTENSIONS`.
65
65
 
66
66
  ## Usage Examples
67
67
 
68
- ### Get Planetary Positions
69
-
70
- ```json
71
- {
72
- "resource": "data",
73
- "operation": "positions",
74
- "year": 1990,
75
- "month": 6,
76
- "day": 15,
77
- "hour": 14,
78
- "minute": 30,
79
- "locationType": "city",
80
- "city": "Kyiv",
81
- "countryCode": "UA"
82
- }
83
- ```
68
+ ### Quick Start
84
69
 
85
- ### Get Daily Horoscope
70
+ 1. Install the node via **Settings → Community Nodes** → `@astro-api/n8n-nodes-astrology`
71
+ 2. Add **Astrology API** credentials with your API key from [astrology-api.io](https://astrology-api.io)
72
+ 3. Add the **Astrology** node to your workflow
73
+ 4. Select a resource and operation from the table below
74
+ 5. Configure the required parameters and execute
86
75
 
87
- ```json
88
- {
89
- "resource": "horoscope",
90
- "operation": "signDaily",
91
- "sign": "aries",
92
- "language": "en",
93
- "tradition": "universal"
94
- }
95
- ```
76
+ ### Operations Overview
96
77
 
97
- ### Generate Natal Chart
98
-
99
- ```json
100
- {
101
- "resource": "charts",
102
- "operation": "natal",
103
- "year": 1990,
104
- "month": 6,
105
- "day": 15,
106
- "hour": 14,
107
- "minute": 30,
108
- "city": "London",
109
- "countryCode": "GB"
110
- }
111
- ```
78
+ | Use Case | Resource | Operation | What You Get |
79
+ |----------|----------|-----------|--------------|
80
+ | Planet positions | Data | Positions | Zodiac signs, degrees, retrograde status for each planet |
81
+ | House boundaries | Data | House Cusps | Astrological house boundaries (23+ house systems) |
82
+ | Planetary aspects | Data | Aspects | Angular relationships between celestial bodies |
83
+ | Moon data | Data | Lunar Metrics | Moon phase, illumination, void-of-course periods |
84
+ | Current sky | Data | Current Time | Real-time astrological data for the current moment |
85
+ | Daily horoscope | Horoscope | Sign Daily | Daily prediction for any zodiac sign |
86
+ | Weekly horoscope | Horoscope | Sign Weekly | Weekly prediction for any zodiac sign |
87
+ | Monthly horoscope | Horoscope | Sign Monthly | Monthly prediction for any zodiac sign |
88
+ | Yearly horoscope | Horoscope | Sign Yearly | Yearly prediction for any zodiac sign |
89
+ | Personal forecast | Horoscope | Personal Daily/Weekly/Monthly/Yearly | Birth chart-based personalized predictions |
90
+ | Chinese astrology | Horoscope | Chinese Bazi | Four Pillars of Destiny analysis |
91
+ | Birth chart | Charts | Natal | SVG natal chart with configurable house system |
92
+
93
+ ### Common Use Cases
94
+
95
+ **Planetary Positions & Birth Data**
96
+ Configure **Data → Positions** to calculate planetary positions for any date and location. Returns zodiac signs, degrees, minutes, and retrograde status. Supports both city-based and coordinate-based location input.
97
+
98
+ **Horoscopes in Multiple Languages**
99
+ Use **Horoscope → Sign Daily/Weekly/Monthly/Yearly** for zodiac sign predictions. Supports multiple languages (EN, RU, UK, ES, DE, FR) and traditions (Western, Vedic, Chinese).
100
+
101
+ **Personal Horoscopes**
102
+ Use **Horoscope → Personal Daily/Weekly/Monthly/Yearly** for customized predictions based on birth chart data. Combines natal positions with current transits for personalized forecasts.
103
+
104
+ **Natal Chart Generation**
105
+ Generate SVG birth charts with **Charts → Natal**. Supports 23+ house systems including Placidus, Koch, Equal, and Whole Sign.
106
+
107
+ ### Ready-to-Use Workflows
112
108
 
113
- ## Resources & Operations
109
+ Import complete workflow examples from the [`examples/`](examples/) folder:
114
110
 
115
- | Resource | Operations |
116
- |----------|------------|
117
- | **Data** | Current Time, Planetary Positions, House Cusps, Aspects, Lunar Metrics |
118
- | **Horoscope** | Sign Daily/Weekly/Monthly/Yearly, Personal Daily/Weekly/Monthly/Yearly, Chinese Bazi |
119
- | **Charts** | Natal Chart (more coming soon) |
111
+ - **[Personal Horoscope Workflow](examples/personal-horoscope-workflow.json)** — Generates personalized horoscopes (day/week/month/year) by comparing natal chart with current transits. Includes AI interpretation.
112
+ - **[Tarot Reading Workflow](examples/tarot-reading-workflow.json)** — Performs tarot card readings influenced by current planetary positions and moon phase. Supports multiple spread types.
120
113
 
121
114
  ## API Documentation
122
115
 
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Astrology = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
4
5
  const operations_1 = require("./operations");
5
6
  const handlers_1 = require("./handlers");
6
7
  const DEFAULT_API_BASE_URL = "https://api.astrology-api.io";
@@ -55,22 +56,34 @@ class Astrology {
55
56
  const baseUrl = getBaseUrl(credentials);
56
57
  const apiKey = credentials.apiKey;
57
58
  for (let itemIndex = 0; itemIndex < items.length; itemIndex += 1) {
58
- const resource = this.getNodeParameter("resource", itemIndex);
59
- const operation = this.getNodeParameter("operation", itemIndex);
60
- // Build handler context
61
- const context = {
62
- executeFunctions: this,
63
- itemIndex,
64
- baseUrl,
65
- apiKey,
66
- };
67
- // Route to appropriate handler
68
- const handler = resourceHandlers[resource];
69
- if (!handler) {
70
- throw new Error(`Resource "${resource}" is not supported`);
59
+ try {
60
+ const resource = this.getNodeParameter("resource", itemIndex);
61
+ const operation = this.getNodeParameter("operation", itemIndex);
62
+ // Build handler context
63
+ const context = {
64
+ executeFunctions: this,
65
+ itemIndex,
66
+ baseUrl,
67
+ apiKey,
68
+ };
69
+ // Route to appropriate handler
70
+ const handler = resourceHandlers[resource];
71
+ if (!handler) {
72
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource '${resource}' is not supported`, { itemIndex });
73
+ }
74
+ const responseData = await handler(context, operation);
75
+ returnData.push(responseData);
76
+ }
77
+ catch (error) {
78
+ if (this.continueOnFail()) {
79
+ returnData.push({
80
+ error: error.message,
81
+ itemIndex,
82
+ });
83
+ continue;
84
+ }
85
+ throw error;
71
86
  }
72
- const responseData = await handler(context, operation);
73
- returnData.push(responseData);
74
87
  }
75
88
  return [this.helpers.returnJsonArray(returnData)];
76
89
  }
@@ -122,7 +122,7 @@ async function handleChartsResource(context, operation) {
122
122
  if (op === "natal") {
123
123
  return await handleNatalChart(context);
124
124
  }
125
- throw new Error(`Operation "${operation}" is not supported for charts resource`);
125
+ throw new Error(`The operation '${operation}' is not supported for the charts resource`);
126
126
  }
127
127
  /**
128
128
  * Handles natal chart generation
@@ -195,5 +195,7 @@ async function handleNatalChart(context) {
195
195
  subject,
196
196
  options,
197
197
  };
198
- return await (0, shared_1.makeApiRequest)(executeFunctions, "POST", baseUrl, "/api/v3/charts/natal", apiKey, body);
198
+ const responseData = await (0, shared_1.makeApiRequest)(executeFunctions, "POST", baseUrl, "/api/v3/charts/natal", apiKey, body);
199
+ const simplify = executeFunctions.getNodeParameter("simplify", itemIndex, true);
200
+ return simplify ? (0, shared_1.simplifyResponse)(responseData) : responseData;
199
201
  }
@@ -30,5 +30,7 @@ async function handleDataResource(context, operation) {
30
30
  const birthData = (0, shared_1.buildBirthData)(executeFunctions, itemIndex);
31
31
  const body = (0, shared_1.createSubjectRequest)(birthData);
32
32
  const endpoint = DATA_ENDPOINTS[op] || DATA_ENDPOINTS.positions;
33
- return await (0, shared_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
33
+ const responseData = await (0, shared_1.makeApiRequest)(executeFunctions, "POST", baseUrl, endpoint, apiKey, body);
34
+ const simplify = executeFunctions.getNodeParameter("simplify", itemIndex, true);
35
+ return simplify ? (0, shared_1.simplifyResponse)(responseData) : responseData;
34
36
  }
@@ -22,7 +22,7 @@ async function handleHoroscopeResource(context, operation) {
22
22
  if (operation === "chineseBazi") {
23
23
  return await handleChineseBaziOperation(context);
24
24
  }
25
- throw new Error(`Operation "${operation}" is not supported for horoscope`);
25
+ throw new Error(`The operation '${operation}' is not supported for the horoscope resource`);
26
26
  }
27
27
  /**
28
28
  * Handles sign-based horoscope operations
@@ -435,6 +435,21 @@ const useCacheField = {
435
435
  default: true,
436
436
  description: "Whether to use cached calculations when available",
437
437
  };
438
+ /**
439
+ * Simplify output toggle for charts resource
440
+ */
441
+ const simplifyField = {
442
+ displayName: "Simplify",
443
+ name: "simplify",
444
+ type: "boolean",
445
+ displayOptions: {
446
+ show: {
447
+ resource: ["charts"],
448
+ },
449
+ },
450
+ default: true,
451
+ description: "Whether to return a simplified version of the response instead of the raw data",
452
+ };
438
453
  /**
439
454
  * Combined charts operations export
440
455
  */
@@ -450,6 +465,7 @@ exports.chartsOperations = [
450
465
  customActivePointsField,
451
466
  perspectiveField,
452
467
  precisionField,
468
+ simplifyField,
453
469
  showAdvancedOptionsField,
454
470
  enableFixedStarsField,
455
471
  fixedStarPresetsField,
@@ -1,6 +1,2 @@
1
1
  import type { INodeProperties } from "n8n-workflow";
2
- /**
3
- * All properties for the data resource
4
- * Uses shared field creators to avoid duplication
5
- */
6
2
  export declare const dataOperations: INodeProperties[];
@@ -25,26 +25,26 @@ const dataOperationField = {
25
25
  {
26
26
  name: "Planetary Positions",
27
27
  value: "positions",
28
- description: "Get planetary positions with zodiac signs and degrees",
29
- action: "Get planetary positions",
28
+ description: "Calculate planetary positions with zodiac signs and degrees",
29
+ action: "Get planetary positions data",
30
30
  },
31
31
  {
32
32
  name: "House Cusps",
33
33
  value: "houseCusps",
34
- description: "Get astrological house boundaries",
35
- action: "Get house cusps",
34
+ description: "Calculate astrological house boundaries",
35
+ action: "Get house cusps data",
36
36
  },
37
37
  {
38
38
  name: "Aspects",
39
39
  value: "aspects",
40
- description: "Get angular relationships between celestial bodies",
41
- action: "Get aspects",
40
+ description: "Calculate angular relationships between celestial bodies",
41
+ action: "Get aspects data",
42
42
  },
43
43
  {
44
44
  name: "Lunar Metrics",
45
45
  value: "lunarMetrics",
46
- description: "Get moon phase cycles and illumination data",
47
- action: "Get lunar metrics",
46
+ description: "Calculate moon phase cycles and illumination",
47
+ action: "Get lunar metrics data",
48
48
  },
49
49
  ],
50
50
  default: "positions",
@@ -53,6 +53,24 @@ const dataOperationField = {
53
53
  * All properties for the data resource
54
54
  * Uses shared field creators to avoid duplication
55
55
  */
56
+ /**
57
+ * Simplify output toggle for data resource
58
+ */
59
+ const simplifyField = {
60
+ displayName: "Simplify",
61
+ name: "simplify",
62
+ type: "boolean",
63
+ displayOptions: {
64
+ show: {
65
+ resource: ["data"],
66
+ },
67
+ hide: {
68
+ operation: ["now"],
69
+ },
70
+ },
71
+ default: true,
72
+ description: "Whether to return a simplified version of the response instead of the raw data",
73
+ };
56
74
  exports.dataOperations = [
57
75
  // Operation selector
58
76
  dataOperationField,
@@ -60,4 +78,6 @@ exports.dataOperations = [
60
78
  ...(0, shared_1.createBirthDataFields)("data", undefined, ["now"]),
61
79
  // Location fields (hidden for 'now' operation)
62
80
  ...(0, shared_1.createLocationFields)("data", undefined, ["now"]),
81
+ // Simplify output (hidden for 'now' operation)
82
+ simplifyField,
63
83
  ];
@@ -196,6 +196,7 @@ exports.horoscopeOperations = [
196
196
  },
197
197
  },
198
198
  default: 1990,
199
+ placeholder: "e.g. 1990",
199
200
  description: "Birth year",
200
201
  required: true,
201
202
  },
@@ -210,6 +211,7 @@ exports.horoscopeOperations = [
210
211
  },
211
212
  },
212
213
  default: 1,
214
+ placeholder: "e.g. 6",
213
215
  typeOptions: {
214
216
  minValue: 1,
215
217
  maxValue: 12,
@@ -228,6 +230,7 @@ exports.horoscopeOperations = [
228
230
  },
229
231
  },
230
232
  default: 1,
233
+ placeholder: "e.g. 15",
231
234
  typeOptions: {
232
235
  minValue: 1,
233
236
  maxValue: 31,
@@ -246,6 +249,7 @@ exports.horoscopeOperations = [
246
249
  },
247
250
  },
248
251
  default: 12,
252
+ placeholder: "e.g. 14",
249
253
  typeOptions: {
250
254
  minValue: 0,
251
255
  maxValue: 23,
@@ -264,6 +268,7 @@ exports.horoscopeOperations = [
264
268
  },
265
269
  },
266
270
  default: 0,
271
+ placeholder: "e.g. 30",
267
272
  typeOptions: {
268
273
  minValue: 0,
269
274
  maxValue: 59,
@@ -343,6 +348,7 @@ exports.horoscopeOperations = [
343
348
  },
344
349
  },
345
350
  default: 0,
351
+ placeholder: "e.g. 50.45",
346
352
  typeOptions: {
347
353
  minValue: -90,
348
354
  maxValue: 90,
@@ -362,6 +368,7 @@ exports.horoscopeOperations = [
362
368
  },
363
369
  },
364
370
  default: 0,
371
+ placeholder: "e.g. 30.52",
365
372
  typeOptions: {
366
373
  minValue: -180,
367
374
  maxValue: 180,
@@ -29,6 +29,7 @@ function createBirthDataFields(resourceName, showForOperations, hideForOperation
29
29
  type: "number",
30
30
  displayOptions: { ...baseDisplayOptions },
31
31
  default: 1990,
32
+ placeholder: "e.g. 1990",
32
33
  description: "Birth year",
33
34
  required: true,
34
35
  },
@@ -38,6 +39,7 @@ function createBirthDataFields(resourceName, showForOperations, hideForOperation
38
39
  type: "number",
39
40
  displayOptions: { ...baseDisplayOptions },
40
41
  default: 1,
42
+ placeholder: "e.g. 6",
41
43
  typeOptions: {
42
44
  minValue: 1,
43
45
  maxValue: 12,
@@ -51,6 +53,7 @@ function createBirthDataFields(resourceName, showForOperations, hideForOperation
51
53
  type: "number",
52
54
  displayOptions: { ...baseDisplayOptions },
53
55
  default: 1,
56
+ placeholder: "e.g. 15",
54
57
  typeOptions: {
55
58
  minValue: 1,
56
59
  maxValue: 31,
@@ -64,6 +67,7 @@ function createBirthDataFields(resourceName, showForOperations, hideForOperation
64
67
  type: "number",
65
68
  displayOptions: { ...baseDisplayOptions },
66
69
  default: 12,
70
+ placeholder: "e.g. 14",
67
71
  typeOptions: {
68
72
  minValue: 0,
69
73
  maxValue: 23,
@@ -77,6 +81,7 @@ function createBirthDataFields(resourceName, showForOperations, hideForOperation
77
81
  type: "number",
78
82
  displayOptions: { ...baseDisplayOptions },
79
83
  default: 0,
84
+ placeholder: "e.g. 30",
80
85
  typeOptions: {
81
86
  minValue: 0,
82
87
  maxValue: 59,
@@ -28,3 +28,14 @@ export declare function makeApiRequest(executeFunctions: IExecuteFunctions, meth
28
28
  * @returns Request body with subject wrapper
29
29
  */
30
30
  export declare function createSubjectRequest(birthData: IBirthData, additionalFields?: IDataObject): IDataObject;
31
+ /**
32
+ * Simplifies a response object by keeping only top-level keys
33
+ * up to the specified maximum number of fields.
34
+ *
35
+ * Note: Nested objects are returned as-is; no flattening is performed.
36
+ *
37
+ * @param data - The full API response
38
+ * @param maxFields - Maximum number of top-level fields to return (default 10)
39
+ * @returns Simplified data object
40
+ */
41
+ export declare function simplifyResponse(data: IDataObject, maxFields?: number): IDataObject;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildBirthData = buildBirthData;
4
4
  exports.makeApiRequest = makeApiRequest;
5
5
  exports.createSubjectRequest = createSubjectRequest;
6
+ exports.simplifyResponse = simplifyResponse;
6
7
  /**
7
8
  * Builds birth data object from node parameters
8
9
  *
@@ -76,3 +77,24 @@ function createSubjectRequest(birthData, additionalFields) {
76
77
  ...additionalFields,
77
78
  };
78
79
  }
80
+ /**
81
+ * Simplifies a response object by keeping only top-level keys
82
+ * up to the specified maximum number of fields.
83
+ *
84
+ * Note: Nested objects are returned as-is; no flattening is performed.
85
+ *
86
+ * @param data - The full API response
87
+ * @param maxFields - Maximum number of top-level fields to return (default 10)
88
+ * @returns Simplified data object
89
+ */
90
+ function simplifyResponse(data, maxFields = 10) {
91
+ const keys = Object.keys(data);
92
+ if (keys.length <= maxFields) {
93
+ return data;
94
+ }
95
+ const simplified = {};
96
+ for (let i = 0; i < maxFields; i++) {
97
+ simplified[keys[i]] = data[keys[i]];
98
+ }
99
+ return simplified;
100
+ }
@@ -1,4 +1,4 @@
1
1
  export { createBirthDataFields } from "./birthData.fields";
2
2
  export { createLocationFields } from "./location.fields";
3
3
  export { zodiacSignOptions, createZodiacSignField, traditionOptions, createTraditionField, } from "./zodiac.fields";
4
- export { buildBirthData, makeApiRequest, createSubjectRequest, } from "./helpers";
4
+ export { buildBirthData, makeApiRequest, createSubjectRequest, simplifyResponse, } from "./helpers";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSubjectRequest = exports.makeApiRequest = exports.buildBirthData = exports.createTraditionField = exports.traditionOptions = exports.createZodiacSignField = exports.zodiacSignOptions = exports.createLocationFields = exports.createBirthDataFields = void 0;
3
+ exports.simplifyResponse = exports.createSubjectRequest = exports.makeApiRequest = exports.buildBirthData = exports.createTraditionField = exports.traditionOptions = exports.createZodiacSignField = exports.zodiacSignOptions = exports.createLocationFields = exports.createBirthDataFields = void 0;
4
4
  // Shared field creators
5
5
  var birthData_fields_1 = require("./birthData.fields");
6
6
  Object.defineProperty(exports, "createBirthDataFields", { enumerable: true, get: function () { return birthData_fields_1.createBirthDataFields; } });
@@ -16,3 +16,4 @@ var helpers_1 = require("./helpers");
16
16
  Object.defineProperty(exports, "buildBirthData", { enumerable: true, get: function () { return helpers_1.buildBirthData; } });
17
17
  Object.defineProperty(exports, "makeApiRequest", { enumerable: true, get: function () { return helpers_1.makeApiRequest; } });
18
18
  Object.defineProperty(exports, "createSubjectRequest", { enumerable: true, get: function () { return helpers_1.createSubjectRequest; } });
19
+ Object.defineProperty(exports, "simplifyResponse", { enumerable: true, get: function () { return helpers_1.simplifyResponse; } });
@@ -93,6 +93,7 @@ function createLocationFields(resourceName, showForOperations, hideForOperations
93
93
  type: "number",
94
94
  displayOptions: coordDisplayOptions,
95
95
  default: 0,
96
+ placeholder: "e.g. 50.45",
96
97
  typeOptions: {
97
98
  minValue: -90,
98
99
  maxValue: 90,
@@ -106,6 +107,7 @@ function createLocationFields(resourceName, showForOperations, hideForOperations
106
107
  type: "number",
107
108
  displayOptions: coordDisplayOptions,
108
109
  default: 0,
110
+ placeholder: "e.g. 30.52",
109
111
  typeOptions: {
110
112
  minValue: -180,
111
113
  maxValue: 180,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astro-api/n8n-nodes-astrology",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "n8n community node for Astrology API - professional astrological calculations, charts, horoscopes, and interpretations",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {