n8n-nodes-apexapi 0.1.3 → 0.1.5

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.
@@ -48,9 +48,14 @@ class ApexApi {
48
48
  displayName: 'Model Name or ID',
49
49
  name: 'model',
50
50
  type: 'options',
51
- description: 'Choose from the list of ApexApi chat models. Choose from the list, or specify an ID using an expression.',
52
- typeOptions: { loadOptionsMethod: 'getChatModels' },
53
- displayOptions: { show: { resource: ['chat'] } },
51
+ description: 'Choose from the list of ApexApi models for the selected resource. The list refreshes when you change Resource. You can also set an ID via an expression.',
52
+ // ONE model field for every resource. loadOptionsDependsOn: ['resource'] makes
53
+ // n8n reload the list (instead of reusing a stale cache) whenever Resource changes.
54
+ typeOptions: { loadOptionsMethod: 'getModels', loadOptionsDependsOn: ['resource'] },
55
+ displayOptions: {
56
+ show: { resource: ['chat', 'image', 'video'] },
57
+ hide: { operation: ['getResult'] },
58
+ },
54
59
  default: '',
55
60
  required: true,
56
61
  },
@@ -92,16 +97,6 @@ class ApexApi {
92
97
  options: [{ name: 'Generate Image', value: 'generate', action: 'Generate an image' }],
93
98
  default: 'generate',
94
99
  },
95
- {
96
- displayName: 'Model Name or ID',
97
- name: 'model',
98
- type: 'options',
99
- description: 'Choose from the list of ApexApi image models. Choose from the list, or specify an ID using an expression.',
100
- typeOptions: { loadOptionsMethod: 'getImageModels' },
101
- displayOptions: { show: { resource: ['image'] } },
102
- default: '',
103
- required: true,
104
- },
105
100
  {
106
101
  displayName: 'Prompt',
107
102
  name: 'prompt',
@@ -118,17 +113,13 @@ class ApexApi {
118
113
  displayOptions: { show: { resource: ['image'] } },
119
114
  options: [
120
115
  { name: 'Square 1:1 — 1024×1024', value: '1024x1024' },
121
- { name: 'Square 1:1 — 1080×1080 (Instagram post)', value: '1080x1080' },
122
- { name: 'Portrait 9:16 — 1080×1920 (Story / Reel / TikTok)', value: '1080x1920' },
123
- { name: 'Landscape 16:9 — 1920×1080 (YouTube / X)', value: '1920x1080' },
124
- { name: 'Landscape 1.91:1 — 1200×630 (Facebook / link share)', value: '1200x630' },
125
- { name: 'Portrait 4:5 — 1080×1350 (Instagram portrait)', value: '1080x1350' },
126
- { name: 'Portrait 2:3 — 1024×1536', value: '1024x1536' },
127
- { name: 'Landscape 3:2 — 1536×1024', value: '1536x1024' },
116
+ { name: 'Square 1:1 — 1080×1080', value: '1080x1080' },
117
+ { name: 'Portrait 9:16 — 1080×1920', value: '1080x1920' },
118
+ { name: 'Landscape 16:9 — 1920×1080', value: '1920x1080' },
128
119
  { name: 'Custom (WIDTHxHEIGHT)…', value: 'custom' },
129
120
  ],
130
121
  default: '1024x1024',
131
- description: 'Output resolution / aspect ratio. Note: some models only support specific sizes. Max 4096 per side.',
122
+ description: 'Output size / aspect ratio. Works on every model the API adapts it per provider (exact pixels for fal/flux, nearest aspect ratio for Imagen/Gemini/GPT-Image).',
132
123
  },
133
124
  {
134
125
  displayName: 'Custom Size',
@@ -161,16 +152,6 @@ class ApexApi {
161
152
  ],
162
153
  default: 'generate',
163
154
  },
164
- {
165
- displayName: 'Model Name or ID',
166
- name: 'model',
167
- type: 'options',
168
- description: 'Choose from the list of ApexApi video models. Choose from the list, or specify an ID using an expression.',
169
- typeOptions: { loadOptionsMethod: 'getVideoModels' },
170
- displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
171
- default: '',
172
- required: true,
173
- },
174
155
  {
175
156
  displayName: 'Prompt',
176
157
  name: 'prompt',
@@ -206,14 +187,13 @@ class ApexApi {
206
187
  };
207
188
  this.methods = {
208
189
  loadOptions: {
209
- async getChatModels() {
210
- return (0, loadOptions_1.loadModels)(this, 'chat');
211
- },
212
- async getImageModels() {
213
- return (0, loadOptions_1.loadModels)(this, 'image');
214
- },
215
- async getVideoModels() {
216
- return (0, loadOptions_1.loadModels)(this, 'video');
190
+ // ONE method for every resource: read the currently-selected resource and load
191
+ // the matching model list. Paired with loadOptionsDependsOn: ['resource'] on the
192
+ // model field so the dropdown refreshes the instant Resource changes.
193
+ async getModels() {
194
+ const resource = this.getCurrentNodeParameter('resource');
195
+ const modelType = resource === 'image' ? 'image' : resource === 'video' ? 'video' : 'chat';
196
+ return (0, loadOptions_1.loadModels)(this, modelType);
217
197
  },
218
198
  },
219
199
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-apexapi",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "n8n community node for ApexApi — call 14 AI providers (OpenAI, Anthropic, Google, Mistral, and more) through one OpenAI-compatible API.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",