n8n-nodes-apexapi 0.1.4 → 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',
@@ -157,16 +152,6 @@ class ApexApi {
157
152
  ],
158
153
  default: 'generate',
159
154
  },
160
- {
161
- displayName: 'Model Name or ID',
162
- name: 'model',
163
- type: 'options',
164
- description: 'Choose from the list of ApexApi video models. Choose from the list, or specify an ID using an expression.',
165
- typeOptions: { loadOptionsMethod: 'getVideoModels' },
166
- displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
167
- default: '',
168
- required: true,
169
- },
170
155
  {
171
156
  displayName: 'Prompt',
172
157
  name: 'prompt',
@@ -202,14 +187,13 @@ class ApexApi {
202
187
  };
203
188
  this.methods = {
204
189
  loadOptions: {
205
- async getChatModels() {
206
- return (0, loadOptions_1.loadModels)(this, 'chat');
207
- },
208
- async getImageModels() {
209
- return (0, loadOptions_1.loadModels)(this, 'image');
210
- },
211
- async getVideoModels() {
212
- 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);
213
197
  },
214
198
  },
215
199
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-apexapi",
3
- "version": "0.1.4",
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",