@growsalesai/n8n-nodes-ycloud 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class YCloudApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YCloudApi = void 0;
4
+ class YCloudApi {
5
+ constructor() {
6
+ this.name = 'yCloudApi';
7
+ this.displayName = 'YCloud API';
8
+ this.documentationUrl = 'https://docs.ycloud.com/reference/introduction';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ required: true,
17
+ description: 'Your YCloud API key. Find it in your YCloud dashboard under Settings → API Keys.',
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.YCloudApi = YCloudApi;
23
+ //# sourceMappingURL=YCloudApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YCloudApi.credentials.js","sourceRoot":"","sources":["../../credentials/YCloudApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAAtB;QACE,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,gDAAgD,CAAC;QACpE,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,kFAAkF;aACrF;SACF,CAAC;IACJ,CAAC;CAAA;AAhBD,8BAgBC"}
@@ -0,0 +1,4 @@
1
+ import type { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IDataObject } from 'n8n-workflow';
2
+ export declare function ycloudApiRequest(this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<any>;
3
+ export declare function ycloudApiRequestAllItems(this: IExecuteFunctions, method: string, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject[]>;
4
+ export declare function removeEmpty(obj: IDataObject): IDataObject;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ycloudApiRequest = ycloudApiRequest;
4
+ exports.ycloudApiRequestAllItems = ycloudApiRequestAllItems;
5
+ exports.removeEmpty = removeEmpty;
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const API_BASE = 'https://api.ycloud.com/v2';
8
+ async function ycloudApiRequest(method, endpoint, body, qs) {
9
+ var _a, _b, _c;
10
+ const credentials = await this.getCredentials('yCloudApi');
11
+ const options = {
12
+ method,
13
+ url: `${API_BASE}${endpoint}`,
14
+ headers: {
15
+ 'X-API-Key': credentials.apiKey,
16
+ },
17
+ json: true,
18
+ };
19
+ if (qs && Object.keys(qs).length > 0) {
20
+ options.qs = qs;
21
+ }
22
+ if (body && Object.keys(body).length > 0) {
23
+ options.body = body;
24
+ }
25
+ try {
26
+ return await this.helpers.request(options);
27
+ }
28
+ catch (error) {
29
+ const errBody = (_a = error.response) === null || _a === void 0 ? void 0 : _a.body;
30
+ if (errBody) {
31
+ const parsed = typeof errBody === 'string' ? JSON.parse(errBody) : errBody;
32
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), parsed, {
33
+ message: ((_b = parsed === null || parsed === void 0 ? void 0 : parsed.error) === null || _b === void 0 ? void 0 : _b.message) || error.message,
34
+ httpCode: (_c = error.statusCode) === null || _c === void 0 ? void 0 : _c.toString(),
35
+ });
36
+ }
37
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
38
+ }
39
+ }
40
+ async function ycloudApiRequestAllItems(method, endpoint, body = {}, qs = {}) {
41
+ const returnData = [];
42
+ let page = 1;
43
+ while (true) {
44
+ const response = await ycloudApiRequest.call(this, method, endpoint, body, {
45
+ ...qs,
46
+ page,
47
+ limit: 100,
48
+ });
49
+ const items = response.items || [];
50
+ returnData.push(...items);
51
+ if (!response.nextPage || items.length === 0)
52
+ break;
53
+ page++;
54
+ }
55
+ return returnData;
56
+ }
57
+ function removeEmpty(obj) {
58
+ return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== '' && v !== undefined && v !== null));
59
+ }
60
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/YCloud/GenericFunctions.ts"],"names":[],"mappings":";;AAWA,4CAuCC;AAED,4DAuBC;AAED,kCAIC;AA1ED,+CAA4C;AAE5C,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAEtC,KAAK,UAAU,gBAAgB,CAEpC,MAAc,EACd,QAAgB,EAChB,IAAkB,EAClB,EAAgB;;IAEhB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAE3D,MAAM,OAAO,GAAgB;QAC3B,MAAM;QACN,GAAG,EAAE,GAAG,QAAQ,GAAG,QAAQ,EAAE;QAC7B,OAAO,EAAE;YACP,WAAW,EAAE,WAAW,CAAC,MAAgB;SAC1C;QACD,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,CAAC,I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C,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;QACpD,IAAI,EAAE,CAAC;IACT,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAgB,WAAW,CAAC,GAAgB;IAC1C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,CACjF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">
2
+ <rect width="60" height="60" rx="12" fill="#1A73E8"/>
3
+ <path d="M18 16 L30 32 L42 16 L38 16 L30 26 L22 16 Z" fill="white"/>
4
+ <rect x="27" y="30" width="6" height="14" rx="3" fill="white"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class YCloud implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }