mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Minor improvements to Strapi-Node
This commit is contained in:
@@ -17,6 +17,9 @@ export class StrapiApi implements ICredentialType {
|
|||||||
displayName: 'Password',
|
displayName: 'Password',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
|
typeOptions: {
|
||||||
|
password: true,
|
||||||
|
},
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -24,6 +27,7 @@ export class StrapiApi implements ICredentialType {
|
|||||||
name: 'url',
|
name: 'url',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
|
placeholder: 'https://api.example.com',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export const entryFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the content type',
|
description: 'Name of the content type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Columns',
|
displayName: 'Columns',
|
||||||
@@ -86,6 +86,7 @@ export const entryFields = [
|
|||||||
placeholder: 'id,name,description',
|
placeholder: 'id,name,description',
|
||||||
description: 'Comma separated list of the properties which should used as columns for the new rows.',
|
description: 'Comma separated list of the properties which should used as columns for the new rows.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* entry:delete */
|
/* entry:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -105,7 +106,7 @@ export const entryFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the content type',
|
description: 'Name of the content type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Entry ID',
|
displayName: 'Entry ID',
|
||||||
@@ -123,8 +124,9 @@ export const entryFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'The ID of the entry to get.',
|
description: 'The ID of the entry to delete.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* entry:get */
|
/* entry:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -144,7 +146,7 @@ export const entryFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the content type',
|
description: 'Name of the content type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Entry ID',
|
displayName: 'Entry ID',
|
||||||
@@ -164,6 +166,7 @@ export const entryFields = [
|
|||||||
},
|
},
|
||||||
description: 'The ID of the entry to get.',
|
description: 'The ID of the entry to get.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* entry:getAll */
|
/* entry:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -286,6 +289,7 @@ export const entryFields = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* entry:update */
|
/* entry:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -305,7 +309,7 @@ export const entryFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the content type',
|
description: 'Name of the content type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Key',
|
displayName: 'Update Key',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
export async function strapiApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function strapiApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const credentials = this.getCredentials('strapiApi') as IDataObject;
|
const credentials = this.getCredentials('strapiApi') as IDataObject;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class Strapi implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
responseData = await strapiApiRequest.call(this, 'POST', `/${contentType}`, body, qs);
|
responseData = await strapiApiRequest.call(this, 'POST', `/${contentType}`, body, qs);
|
||||||
|
|
||||||
returnData.push(responseData);
|
returnData.push(responseData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ export class Strapi implements INodeType {
|
|||||||
const contentType = this.getNodeParameter('contentType', i) as string;
|
const contentType = this.getNodeParameter('contentType', i) as string;
|
||||||
|
|
||||||
const entryId = this.getNodeParameter('entryId', i) as string;
|
const entryId = this.getNodeParameter('entryId', i) as string;
|
||||||
|
|
||||||
responseData = await strapiApiRequest.call(this, 'DELETE', `/${contentType}/${entryId}`, {}, qs);
|
responseData = await strapiApiRequest.call(this, 'DELETE', `/${contentType}/${entryId}`, {}, qs);
|
||||||
|
|
||||||
returnData.push(responseData);
|
returnData.push(responseData);
|
||||||
@@ -140,7 +140,7 @@ export class Strapi implements INodeType {
|
|||||||
responseData = await strapiApiRequestAllItems.call(this, 'GET', `/${contentType}`, {}, qs);
|
responseData = await strapiApiRequestAllItems.call(this, 'GET', `/${contentType}`, {}, qs);
|
||||||
} else {
|
} else {
|
||||||
qs._limit = this.getNodeParameter('limit', i) as number;
|
qs._limit = this.getNodeParameter('limit', i) as number;
|
||||||
|
|
||||||
responseData = await strapiApiRequest.call(this, 'GET', `/${contentType}`, {}, qs);
|
responseData = await strapiApiRequest.call(this, 'GET', `/${contentType}`, {}, qs);
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData);
|
returnData.push.apply(returnData, responseData);
|
||||||
@@ -181,7 +181,7 @@ export class Strapi implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
responseData = await strapiApiRequest.call(this, 'PUT', `/${contentType}/${entryId}`, body, qs);
|
responseData = await strapiApiRequest.call(this, 'PUT', `/${contentType}/${entryId}`, body, qs);
|
||||||
|
|
||||||
returnData.push(responseData);
|
returnData.push(responseData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user