n8n-nodes-clientify 0.2.14 → 0.2.16
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.
- package/dist/credentials/ClientifyApi.credentials.d.ts +3 -2
- package/dist/credentials/ClientifyApi.credentials.js +21 -22
- package/dist/credentials/clientify.svg +3 -0
- package/dist/nodes/ClientifyApi/ClientifyApi.node.d.ts +1 -1
- package/dist/nodes/ClientifyApi/ClientifyApi.node.js +50 -34
- package/dist/nodes/ClientifyApi/ClientifyApiCatalog.d.ts +14 -2
- package/dist/nodes/ClientifyApi/ClientifyApiCatalog.js +58 -9
- package/dist/nodes/ClientifyApi/operations.generated.js +2991 -1
- package/dist/nodes/ClientifyMcp/clientify.png +0 -0
- package/dist/nodes/ClientifyMcp/clientify.svg +3 -0
- package/dist/nodes/ClientifyTrigger/ClientifyTrigger.node.js +1 -0
- package/package.json +12 -14
- package/dist/README.md +0 -103
- package/dist/package.json +0 -62
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ICredentialTestRequest, ICredentialType, INodeProperties } from
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from "n8n-workflow";
|
|
2
2
|
export declare class ClientifyApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
|
+
icon: "file:clientify.svg";
|
|
5
6
|
documentationUrl: string;
|
|
6
|
-
authenticate:
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
7
8
|
test: ICredentialTestRequest;
|
|
8
9
|
properties: INodeProperties[];
|
|
9
10
|
}
|
|
@@ -3,46 +3,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClientifyApi = void 0;
|
|
4
4
|
class ClientifyApi {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.name =
|
|
7
|
-
this.displayName =
|
|
8
|
-
this.
|
|
6
|
+
this.name = "clientifyApi";
|
|
7
|
+
this.displayName = "Clientify API";
|
|
8
|
+
this.icon = "file:clientify.svg";
|
|
9
|
+
this.documentationUrl = "https://newapi.clientify.com/";
|
|
9
10
|
this.authenticate = {
|
|
10
|
-
type:
|
|
11
|
+
type: "generic",
|
|
11
12
|
properties: {
|
|
12
13
|
headers: {
|
|
13
|
-
Authorization:
|
|
14
|
+
Authorization: "=Token {{$credentials.apiKey}}",
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
18
|
this.test = {
|
|
18
19
|
request: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
url: '/me/?fields=id,email',
|
|
23
|
-
method: 'GET',
|
|
20
|
+
baseURL: "={{$credentials.baseUrl}}",
|
|
21
|
+
url: "/me/?fields=id,email",
|
|
22
|
+
method: "GET",
|
|
24
23
|
},
|
|
25
24
|
};
|
|
26
25
|
this.properties = [
|
|
27
26
|
{
|
|
28
|
-
displayName:
|
|
29
|
-
name:
|
|
30
|
-
type:
|
|
27
|
+
displayName: "API Key",
|
|
28
|
+
name: "apiKey",
|
|
29
|
+
type: "string",
|
|
31
30
|
typeOptions: {
|
|
32
31
|
password: true,
|
|
33
32
|
},
|
|
34
|
-
default:
|
|
33
|
+
default: "",
|
|
35
34
|
required: true,
|
|
36
|
-
placeholder:
|
|
37
|
-
description: 'Clientify API key (used as
|
|
35
|
+
placeholder: "Enter your Clientify API key",
|
|
36
|
+
description: 'Clientify API key (used as "Authorization: Token <apiKey>")',
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
|
-
displayName:
|
|
41
|
-
name:
|
|
42
|
-
type:
|
|
43
|
-
default:
|
|
44
|
-
placeholder:
|
|
45
|
-
description:
|
|
39
|
+
displayName: "Base URL",
|
|
40
|
+
name: "baseUrl",
|
|
41
|
+
type: "string",
|
|
42
|
+
default: "https://api-plus.clientify.com/v2",
|
|
43
|
+
placeholder: "https://api-plus.clientify.com/v2",
|
|
44
|
+
description: "Optional override for the Clientify API base URL",
|
|
46
45
|
},
|
|
47
46
|
];
|
|
48
47
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="60" height="60" fill="none">
|
|
2
|
+
<image width="60" height="60" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAJ10lEQVR42uWba2xcxRXHf2fm3l3b8WMTh7xIQh4lRUATWoFCChRaEBUVlPIQKjQgIVoqJChSkFA/9FtBlfqlqqC0oqraCvUBihAUVaGReKSF8JAakpAEkpCEPAghCQ6OH7t778ycfri7tvOovd6sjROutF7bu567/zln/ud//jOWT3oSvf+pLv65IaaEQTmzLqOQl8ANS1Iev3MKcvMTB/TZtTGm1aIKnGGQpfLwvYFbLnNIfN9hDZqBPdOiOxQ0CAZH5ILlTL+08tVjMXzBri8c4GhMSELASDWVZMhr2W9ChS9UT2PAImBFSANQVnyqIAoSsudgQCV7Y5Q9rFWMyYCHMD6kGTUiosaCS4RQ9thmx9cWGJYutCyZFTFtssVESl8/7DmUsmm/Z+N++PCQ8NlRj/cWrIV8NhfVyWOMMuCUABuBoII76pk1zXHnMsMdl7axeHa+Qg96TEoPcqbnQHdg80cpaz8os3Z7yuu7Db1lizHgnYAoUZT9ddDs0ZhM/PGRuoayRnBlsFJixbURK65rZUZbfuB1H06EW/3ZHkOVAVC+/2Q3T79usM0ws93Rn3i6uiyohZxBchAZUNVTSv+6IhxZSPuUhdMS/nBPE1d+uR0QXFCMCEaOB3WS2qgQVHFBiK0Qi4IJ+CI8cCPc9fUOXtlSZs32wKvbymw9IKTlCGIDcfYZQPFhjAFbK6S9ykULyrzwYIHZhTyJD8RGiIyMmuSypaFDGF1RtczoyHP7sjy3L4PEOTbsc7zyXonVm0q8vdvQc9SAGKRZxg6wMeCKwgVzU158qMD01jzOKznb6HKuqAqJz9I4F8VcMi/mknnNPHxd4MNPi/z7/ZTn1if8492YQO2gzWgiog4KzSWefaCF6a05fAhEVsakfEhlWViT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l7akrBqU8LaHcLBXoNUm2iRyiajNvRQ2qkDHiIunBMoeSa1Oq5YFHHNeZbz5+SY0yHkYiV1woEez/rdjtVbEl7/QOnrsVknkjMYOz5eWEMADzQNIqQeKFcpVjE5ITIOrxafAC47X0WTDBwuCxPpyMOoSolqRlotgoglhKxVTEJ2aNLmwTRX1mGdwmHCAB7K4oNANCM3GWTm4Plcr2isbzDRPOov1L8ASObIeAxM6A2wxpCqIOIwtyxx+L7AhPRUGxZZIfQEblrsiZ5YPhnRI7ywIVAmOuP+WUtEaNLADZcn/Gb5ZP4Hx5Ze7w4npGQAAAAASUVORK5CYII=" />
|
|
3
|
+
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
2
2
|
export declare class ClientifyApi implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
4
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
@@ -6,35 +6,46 @@ const ClientifyApiCatalog_1 = require("./ClientifyApiCatalog");
|
|
|
6
6
|
class ClientifyApi {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.description = {
|
|
9
|
-
displayName:
|
|
10
|
-
name:
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
displayName: "Clientify",
|
|
10
|
+
name: "clientifyApi",
|
|
11
|
+
usableAsTool: true,
|
|
12
|
+
icon: "file:clientify.svg",
|
|
13
|
+
group: ["transform"],
|
|
13
14
|
version: 1,
|
|
14
|
-
subtitle: '={{$parameter["operation"]}}',
|
|
15
|
-
description:
|
|
15
|
+
subtitle: '={{$parameter["resource"] + " · " + $parameter["operation"]}}',
|
|
16
|
+
description: "Clientify CRM (direct REST API)",
|
|
16
17
|
defaults: {
|
|
17
|
-
name:
|
|
18
|
+
name: "Clientify",
|
|
18
19
|
},
|
|
19
|
-
inputs: [
|
|
20
|
-
outputs: [
|
|
20
|
+
inputs: ["main"],
|
|
21
|
+
outputs: ["main"],
|
|
21
22
|
credentials: [
|
|
22
23
|
{
|
|
23
|
-
name:
|
|
24
|
+
name: "clientifyApi",
|
|
24
25
|
required: true,
|
|
25
26
|
},
|
|
26
27
|
],
|
|
27
28
|
properties: (() => {
|
|
28
29
|
const props = [
|
|
29
30
|
{
|
|
30
|
-
displayName:
|
|
31
|
-
name:
|
|
32
|
-
type:
|
|
31
|
+
displayName: "Resource",
|
|
32
|
+
name: "resource",
|
|
33
|
+
type: "options",
|
|
34
|
+
options: ClientifyApiCatalog_1.resourceOptions,
|
|
35
|
+
default: "auto",
|
|
36
|
+
required: true,
|
|
37
|
+
noDataExpression: true,
|
|
38
|
+
description: "Choose a resource first, then pick an action",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: "Action",
|
|
42
|
+
name: "operation",
|
|
43
|
+
type: "options",
|
|
33
44
|
options: ClientifyApiCatalog_1.operationOptions,
|
|
34
|
-
default:
|
|
45
|
+
default: "GetCurrentUser",
|
|
35
46
|
required: true,
|
|
36
47
|
noDataExpression: true,
|
|
37
|
-
description:
|
|
48
|
+
description: "Select the Clientify action to execute (mirrors the AppMixer connector action list)",
|
|
38
49
|
},
|
|
39
50
|
...ClientifyApiCatalog_1.operationFields,
|
|
40
51
|
];
|
|
@@ -45,11 +56,11 @@ class ClientifyApi {
|
|
|
45
56
|
async execute() {
|
|
46
57
|
const items = this.getInputData();
|
|
47
58
|
const returnData = [];
|
|
48
|
-
const credentials = await this.getCredentials(
|
|
49
|
-
const
|
|
50
|
-
const baseUrl = credentials.baseUrl || 'https://api-plus.clientify.com/v2';
|
|
59
|
+
const credentials = await this.getCredentials("clientifyApi");
|
|
60
|
+
const baseUrl = credentials.baseUrl || "https://api-plus.clientify.com/v2";
|
|
51
61
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
52
|
-
const
|
|
62
|
+
const selectedResource = this.getNodeParameter("resource", itemIndex, "auto");
|
|
63
|
+
const operation = this.getNodeParameter("operation", itemIndex);
|
|
53
64
|
const def = ClientifyApiCatalog_1.operationDefinitions[operation];
|
|
54
65
|
if (!def) {
|
|
55
66
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation "${operation}". Ensure the operation catalog is present in this node package build output.`);
|
|
@@ -65,17 +76,18 @@ class ClientifyApi {
|
|
|
65
76
|
continue;
|
|
66
77
|
}
|
|
67
78
|
// Apply per-operation defaults if user left the field empty.
|
|
68
|
-
if ((value ===
|
|
79
|
+
if ((value === "" || value === null || value === undefined) &&
|
|
80
|
+
fieldName in def.fieldDefaults) {
|
|
69
81
|
value = def.fieldDefaults[fieldName];
|
|
70
82
|
}
|
|
71
83
|
// Avoid accidentally sending empty optional values (n8n defaults).
|
|
72
84
|
const isRequired = def.requiredFieldNames.includes(fieldName);
|
|
73
85
|
if (!isRequired) {
|
|
74
|
-
if (value ===
|
|
86
|
+
if (value === "" || value === null || value === undefined)
|
|
75
87
|
continue;
|
|
76
|
-
if (typeof value ===
|
|
88
|
+
if (typeof value === "number" && value === 0)
|
|
77
89
|
continue;
|
|
78
|
-
if (typeof value ===
|
|
90
|
+
if (typeof value === "boolean" && value === false)
|
|
79
91
|
continue;
|
|
80
92
|
}
|
|
81
93
|
input[fieldName] = value;
|
|
@@ -83,35 +95,39 @@ class ClientifyApi {
|
|
|
83
95
|
// Validate required fields are present (avoid confusing API errors).
|
|
84
96
|
for (const fieldName of def.requiredFieldNames) {
|
|
85
97
|
const value = input[fieldName];
|
|
86
|
-
if (value === undefined || value === null || value ===
|
|
98
|
+
if (value === undefined || value === null || value === "") {
|
|
87
99
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${fieldName} is required`);
|
|
88
100
|
}
|
|
89
|
-
if (typeof value ===
|
|
101
|
+
if (typeof value === "number" && value <= 0) {
|
|
90
102
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${fieldName} must be a positive number`);
|
|
91
103
|
}
|
|
92
104
|
}
|
|
93
105
|
const url = (0, ClientifyApiCatalog_1.renderPathTemplate)(def.pathTemplate, input);
|
|
94
106
|
const rest = (0, ClientifyApiCatalog_1.omitKeys)(input, def.pathParamNames);
|
|
95
|
-
const isQueryMethod = def.method ===
|
|
96
|
-
const qs = isQueryMethod
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
const isQueryMethod = def.method === "GET" || def.method === "DELETE";
|
|
108
|
+
const qs = isQueryMethod
|
|
109
|
+
? Object.assign(Object.assign({}, (def.fixedQuery || {})), rest)
|
|
110
|
+
: undefined;
|
|
111
|
+
const body = !isQueryMethod && Object.keys(rest).length > 0
|
|
112
|
+
? rest
|
|
113
|
+
: undefined;
|
|
114
|
+
const result = await this.helpers.httpRequestWithAuthentication.call(this, "clientifyApi", {
|
|
99
115
|
method: def.method,
|
|
100
116
|
url: `${baseUrl}${url}`,
|
|
101
117
|
qs,
|
|
102
118
|
body,
|
|
103
119
|
json: true,
|
|
104
|
-
headers: {
|
|
105
|
-
Authorization: `Token ${apiKey}`,
|
|
106
|
-
},
|
|
107
120
|
});
|
|
108
|
-
const normalized = result === undefined || result === null || result ===
|
|
121
|
+
const normalized = result === undefined || result === null || result === ""
|
|
109
122
|
? { ok: true }
|
|
110
|
-
: typeof result ===
|
|
123
|
+
: typeof result === "object"
|
|
111
124
|
? result
|
|
112
125
|
: { data: result };
|
|
113
126
|
returnData.push({
|
|
114
127
|
json: Object.assign(Object.assign({}, normalized), { _meta: {
|
|
128
|
+
resource: selectedResource === "auto"
|
|
129
|
+
? (0, ClientifyApiCatalog_1.getResourceForOperation)(operation)
|
|
130
|
+
: selectedResource,
|
|
115
131
|
operation,
|
|
116
132
|
method: def.method,
|
|
117
133
|
path: url,
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { INodeProperties } from
|
|
2
|
-
import { operationDefinitions } from
|
|
1
|
+
import { INodeProperties } from "n8n-workflow";
|
|
2
|
+
import { operationDefinitions } from "./operations.generated";
|
|
3
|
+
type ClientifyResource = "auto" | "companies" | "contacts" | "tasks" | "users" | "misc";
|
|
4
|
+
export declare function getResourceForOperation(operation: string): Exclude<ClientifyResource, "auto">;
|
|
5
|
+
export declare const resourceOptions: {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
3
10
|
export declare const operationOptions: {
|
|
4
11
|
name: string;
|
|
5
12
|
value: string;
|
|
6
13
|
description: string;
|
|
14
|
+
displayOptions: {
|
|
15
|
+
show: {
|
|
16
|
+
resource: string[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
7
19
|
}[];
|
|
8
20
|
export declare const operationFields: INodeProperties[];
|
|
9
21
|
export declare function renderPathTemplate(pathTemplate: string, input: Record<string, unknown>): string;
|
|
@@ -1,28 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.operationDefinitions = exports.operationFields = exports.operationOptions = void 0;
|
|
3
|
+
exports.operationDefinitions = exports.operationFields = exports.operationOptions = exports.resourceOptions = void 0;
|
|
4
|
+
exports.getResourceForOperation = getResourceForOperation;
|
|
4
5
|
exports.renderPathTemplate = renderPathTemplate;
|
|
5
6
|
exports.omitKeys = omitKeys;
|
|
6
7
|
const operations_generated_1 = require("./operations.generated");
|
|
7
8
|
Object.defineProperty(exports, "operationDefinitions", { enumerable: true, get: function () { return operations_generated_1.operationDefinitions; } });
|
|
8
9
|
function mapInspectorTypeToN8nType(type) {
|
|
9
|
-
if (type ===
|
|
10
|
-
return
|
|
11
|
-
if (type ===
|
|
12
|
-
return
|
|
13
|
-
return
|
|
10
|
+
if (type === "number")
|
|
11
|
+
return "number";
|
|
12
|
+
if (type === "toggle")
|
|
13
|
+
return "boolean";
|
|
14
|
+
return "string";
|
|
14
15
|
}
|
|
16
|
+
function inferResourceFromPath(pathTemplate) {
|
|
17
|
+
if (pathTemplate.startsWith("/companies/"))
|
|
18
|
+
return "companies";
|
|
19
|
+
if (pathTemplate.startsWith("/contacts/"))
|
|
20
|
+
return "contacts";
|
|
21
|
+
if (pathTemplate.startsWith("/tasks/"))
|
|
22
|
+
return "tasks";
|
|
23
|
+
if (pathTemplate.startsWith("/users/"))
|
|
24
|
+
return "users";
|
|
25
|
+
return "misc";
|
|
26
|
+
}
|
|
27
|
+
const resourceLabels = {
|
|
28
|
+
companies: "Companies",
|
|
29
|
+
contacts: "Contacts",
|
|
30
|
+
tasks: "Tasks",
|
|
31
|
+
users: "Users",
|
|
32
|
+
misc: "Misc",
|
|
33
|
+
};
|
|
34
|
+
const operationResourceMap = Object.fromEntries(Object.values(operations_generated_1.operationDefinitions).map((def) => [
|
|
35
|
+
def.operation,
|
|
36
|
+
inferResourceFromPath(def.pathTemplate),
|
|
37
|
+
]));
|
|
38
|
+
function getResourceForOperation(operation) {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = operationResourceMap[operation]) !== null && _a !== void 0 ? _a : "misc";
|
|
41
|
+
}
|
|
42
|
+
exports.resourceOptions = [
|
|
43
|
+
{
|
|
44
|
+
name: "Auto (Legacy Workflows)",
|
|
45
|
+
value: "auto",
|
|
46
|
+
description: "Shows all actions and keeps legacy operation-only workflows compatible",
|
|
47
|
+
},
|
|
48
|
+
...Array.from(new Set(Object.values(operationResourceMap)))
|
|
49
|
+
.sort((a, b) => resourceLabels[a].localeCompare(resourceLabels[b]))
|
|
50
|
+
.map((resource) => ({
|
|
51
|
+
name: resourceLabels[resource],
|
|
52
|
+
value: resource,
|
|
53
|
+
description: `Actions related to ${resourceLabels[resource].toLowerCase()}`,
|
|
54
|
+
})),
|
|
55
|
+
];
|
|
15
56
|
exports.operationOptions = Object.values(operations_generated_1.operationDefinitions)
|
|
16
57
|
.sort((a, b) => a.label.localeCompare(b.label))
|
|
17
58
|
.map((def) => ({
|
|
18
59
|
name: def.label,
|
|
19
60
|
value: def.operation,
|
|
20
61
|
description: def.description,
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: {
|
|
64
|
+
resource: [getResourceForOperation(def.operation), "auto"],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
21
67
|
}));
|
|
22
68
|
exports.operationFields = (() => {
|
|
23
69
|
var _a;
|
|
24
70
|
const fields = [];
|
|
25
71
|
for (const def of Object.values(operations_generated_1.operationDefinitions)) {
|
|
72
|
+
const resource = getResourceForOperation(def.operation);
|
|
26
73
|
const inspectorInputs = def.inspectorInputs || {};
|
|
27
74
|
const sortedFieldEntries = Object.entries(inspectorInputs).sort((a, b) => {
|
|
28
75
|
var _a, _b, _c, _d;
|
|
@@ -33,16 +80,18 @@ exports.operationFields = (() => {
|
|
|
33
80
|
for (const [fieldName, inputDef] of sortedFieldEntries) {
|
|
34
81
|
const isRequired = def.requiredFieldNames.includes(fieldName);
|
|
35
82
|
const n8nType = mapInspectorTypeToN8nType(inputDef === null || inputDef === void 0 ? void 0 : inputDef.type);
|
|
36
|
-
const
|
|
83
|
+
const fallbackDefault = n8nType === "number" ? 0 : n8nType === "boolean" ? false : "";
|
|
84
|
+
const defaultValue = (_a = def.fieldDefaults[fieldName]) !== null && _a !== void 0 ? _a : fallbackDefault;
|
|
37
85
|
fields.push({
|
|
38
86
|
displayName: (inputDef === null || inputDef === void 0 ? void 0 : inputDef.label) || fieldName,
|
|
39
87
|
name: fieldName,
|
|
40
88
|
type: n8nType,
|
|
41
89
|
default: defaultValue,
|
|
42
90
|
required: isRequired,
|
|
43
|
-
description: (inputDef === null || inputDef === void 0 ? void 0 : inputDef.tooltip) ||
|
|
91
|
+
description: (inputDef === null || inputDef === void 0 ? void 0 : inputDef.tooltip) || "",
|
|
44
92
|
displayOptions: {
|
|
45
93
|
show: {
|
|
94
|
+
resource: [resource, "auto"],
|
|
46
95
|
operation: [def.operation],
|
|
47
96
|
},
|
|
48
97
|
},
|
|
@@ -56,7 +105,7 @@ function renderPathTemplate(pathTemplate, input) {
|
|
|
56
105
|
const key = String(expr).trim();
|
|
57
106
|
const value = input[key];
|
|
58
107
|
if (value === undefined || value === null)
|
|
59
|
-
return
|
|
108
|
+
return "";
|
|
60
109
|
return encodeURIComponent(String(value));
|
|
61
110
|
});
|
|
62
111
|
}
|