fix(n8n): require explicit API URL
- Remove the default Docker service URL from credentials. - Move vault, verbose, and timeout into additional fields. - Keep optional command settings hidden until explicitly added. - Bump the n8n community node package to 0.1.1.
This commit is contained in:
@@ -29,14 +29,6 @@ export class ObsidianApi implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Vault',
|
||||
name: 'vault',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'work',
|
||||
description: 'Optional vault name/path. Overrides the credential default vault. Sent as vault=<value>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
@@ -183,13 +175,6 @@ export class ObsidianApi implements INodeType {
|
||||
],
|
||||
default: 'vaultInfo',
|
||||
},
|
||||
{
|
||||
displayName: 'Verbose',
|
||||
name: 'verbose',
|
||||
type: 'boolean',
|
||||
displayOptions: { show: { resource: ['vault'], operation: ['vaults'] } },
|
||||
default: true,
|
||||
},
|
||||
|
||||
// Raw command
|
||||
{
|
||||
@@ -202,11 +187,35 @@ export class ObsidianApi implements INodeType {
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Timeout Seconds',
|
||||
name: 'timeout',
|
||||
type: 'number',
|
||||
default: 60,
|
||||
description: 'Command timeout in seconds',
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Timeout Seconds',
|
||||
name: 'timeout',
|
||||
type: 'number',
|
||||
default: 60,
|
||||
description: 'Command timeout in seconds',
|
||||
},
|
||||
{
|
||||
displayName: 'Vault',
|
||||
name: 'vault',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'work',
|
||||
description: 'Optional vault name/path. Overrides the credential default vault. Sent as vault=<value>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Verbose',
|
||||
name: 'verbose',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Only used by the List Vaults operation',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -218,8 +227,9 @@ export class ObsidianApi implements INodeType {
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
const resource = this.getNodeParameter('resource', itemIndex) as string;
|
||||
const operation = this.getNodeParameter('operation', itemIndex) as string;
|
||||
const vault = this.getNodeParameter('vault', itemIndex, '') as string;
|
||||
const timeout = this.getNodeParameter('timeout', itemIndex, 60) as number;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', itemIndex, {}) as Record<string, unknown>;
|
||||
const vault = String(additionalFields.vault || '');
|
||||
const timeout = Number(additionalFields.timeout ?? 60);
|
||||
|
||||
let args: string[];
|
||||
|
||||
@@ -237,7 +247,7 @@ export class ObsidianApi implements INodeType {
|
||||
break;
|
||||
}
|
||||
case 'vault': {
|
||||
args = buildVaultArgs(this, operation, itemIndex);
|
||||
args = buildVaultArgs(this, operation, itemIndex, additionalFields);
|
||||
break;
|
||||
}
|
||||
case 'raw': {
|
||||
@@ -302,12 +312,14 @@ function buildSearchArgs(context: IExecuteFunctions, operation: string, itemInde
|
||||
]);
|
||||
}
|
||||
|
||||
function buildVaultArgs(context: IExecuteFunctions, operation: string, itemIndex: number): string[] {
|
||||
function buildVaultArgs(context: IExecuteFunctions, operation: string, itemIndex: number, additionalFields: Record<string, unknown>): string[] {
|
||||
switch (operation) {
|
||||
case 'vaultInfo':
|
||||
return ['vault'];
|
||||
case 'vaults':
|
||||
return compactArgs(['vaults', kv('verbose', context.getNodeParameter('verbose', itemIndex) as boolean)]);
|
||||
case 'vaults': {
|
||||
const verbose = additionalFields.verbose === undefined ? true : Boolean(additionalFields.verbose);
|
||||
return compactArgs(['vaults', kv('verbose', verbose)]);
|
||||
}
|
||||
default:
|
||||
throw new NodeOperationError(context.getNode(), `Unsupported vault operation: ${operation}`, { itemIndex });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user