@itentialopensource/adapter-gitlab 0.19.0 → 0.20.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.
- package/CHANGELOG.md +16 -0
- package/adapter.js +35 -2
- package/entities/projects/schema.json +2 -2
- package/package.json +8 -8
- package/propertiesSchema.json +17 -16
- package/report/adapterInfo.json +5 -5
- package/report/auto-adapter-openapi.json +6 -6
- package/report/updateReport1771001177298.json +120 -0
- package/sampleProperties.json +1 -1
- package/test/unit/adapterTestUnit.js +2 -2
- package/utils/methodDocumentor.js +62 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.20.0 [02-13-2026]
|
|
3
|
+
|
|
4
|
+
* minor/auto-migrate/20260213-114616
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/adapter-gitlab!58
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0.19.1 [02-06-2026]
|
|
11
|
+
|
|
12
|
+
* Fix repository file content encoding handling
|
|
13
|
+
|
|
14
|
+
See merge request itentialopensource/adapters/adapter-gitlab!56
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
2
18
|
## 0.15.4 [10-15-2024]
|
|
3
19
|
|
|
4
20
|
* Changes made at 2024.10.14_21:29PM
|
package/adapter.js
CHANGED
|
@@ -15,6 +15,39 @@ const path = require('path');
|
|
|
15
15
|
/* Fetch in the other needed components for the this Adaptor */
|
|
16
16
|
const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Prevents GitLab API encoding mismatch issues by ensuring the encoding field
|
|
20
|
+
* accurately reflects content format (base64 vs text).
|
|
21
|
+
*
|
|
22
|
+
* @param {object} payload - The request payload
|
|
23
|
+
* @return {object} A new object with content encoded if necessary
|
|
24
|
+
*/
|
|
25
|
+
function handleRepositoryFileEncoding(payload) {
|
|
26
|
+
const result = { ...payload };
|
|
27
|
+
|
|
28
|
+
const isContentEncoded = result.isEncoded === true;
|
|
29
|
+
delete result.isEncoded;
|
|
30
|
+
|
|
31
|
+
if (isContentEncoded) {
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (result.content === undefined || result.content === null) {
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (result.encoding === 'text') {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ((result.encoding === 'base64' || !result.encoding) && typeof result.content === 'string') {
|
|
44
|
+
result.content = Buffer.from(result.content).toString('base64');
|
|
45
|
+
result.encoding = 'base64';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
18
51
|
/**
|
|
19
52
|
* This is the adapter/interface into Gitlab
|
|
20
53
|
*/
|
|
@@ -28717,7 +28750,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
28717
28750
|
const queryParamsAvailable = {};
|
|
28718
28751
|
const queryParams = {};
|
|
28719
28752
|
const pathVars = [id, filePath];
|
|
28720
|
-
const bodyVars = body;
|
|
28753
|
+
const bodyVars = handleRepositoryFileEncoding(body);
|
|
28721
28754
|
|
|
28722
28755
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28723
28756
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -28803,7 +28836,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
28803
28836
|
const queryParamsAvailable = {};
|
|
28804
28837
|
const queryParams = {};
|
|
28805
28838
|
const pathVars = [id, filePath];
|
|
28806
|
-
const bodyVars = body;
|
|
28839
|
+
const bodyVars = handleRepositoryFileEncoding(body);
|
|
28807
28840
|
|
|
28808
28841
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28809
28842
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -895,9 +895,9 @@
|
|
|
895
895
|
},
|
|
896
896
|
"content": {
|
|
897
897
|
"type": "string",
|
|
898
|
-
"description": "Include file content
|
|
898
|
+
"description": "Include file content",
|
|
899
899
|
"parse": true,
|
|
900
|
-
"encode":
|
|
900
|
+
"encode": false,
|
|
901
901
|
"encrypt": {
|
|
902
902
|
"type": "AES",
|
|
903
903
|
"key": ""
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-gitlab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "This adapter integrates with system described as: gitlab.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Gitlab",
|
|
7
|
-
"wizardVersion": "3.
|
|
8
|
-
"engineVersion": "1.
|
|
7
|
+
"wizardVersion": "3.12.1",
|
|
8
|
+
"engineVersion": "1.82.5",
|
|
9
9
|
"adapterType": "http",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"preinstall": "node utils/setup.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
],
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
43
|
-
"npm": ">=
|
|
42
|
+
"node": ">= 18.18.0",
|
|
43
|
+
"npm": ">= 9.8.1"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"author": "Itential",
|
|
50
50
|
"homepage": "https://gitlab.com/itentialopensource/adapters/adapter-gitlab#readme",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@itentialopensource/adapter-utils": "6.1.
|
|
52
|
+
"@itentialopensource/adapter-utils": "6.1.14",
|
|
53
53
|
"acorn": "8.14.1",
|
|
54
54
|
"ajv": "8.17.1",
|
|
55
|
-
"axios": "1.
|
|
55
|
+
"axios": "1.13.5",
|
|
56
56
|
"commander": "11.1.0",
|
|
57
57
|
"fs-extra": "11.3.0",
|
|
58
58
|
"json-query": "2.2.2",
|
|
59
|
-
"mocha": "
|
|
59
|
+
"mocha": "11.3.0",
|
|
60
60
|
"mocha-param": "2.0.1",
|
|
61
61
|
"mongodb": "4.17.2",
|
|
62
62
|
"ping": "0.4.4",
|
package/propertiesSchema.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"boolean",
|
|
67
67
|
"string"
|
|
68
68
|
],
|
|
69
|
-
"description": "When true the metrics collected by the adapter will be stored in mongo or
|
|
69
|
+
"description": "When true the metrics collected by the adapter will be stored in mongo or in the adapter. If a full path is provided, metrics will be saved in the path provided.",
|
|
70
70
|
"default": false
|
|
71
71
|
},
|
|
72
72
|
"stub": {
|
|
@@ -460,7 +460,7 @@
|
|
|
460
460
|
"type": "integer",
|
|
461
461
|
"description": "How often the healthcheck should run (in milliseconds).",
|
|
462
462
|
"default": 300000,
|
|
463
|
-
"minimum":
|
|
463
|
+
"minimum": 30000,
|
|
464
464
|
"maximum": 3600000
|
|
465
465
|
},
|
|
466
466
|
"protocol": {
|
|
@@ -698,9 +698,10 @@
|
|
|
698
698
|
},
|
|
699
699
|
"keep_alive_interval": {
|
|
700
700
|
"type": "integer",
|
|
701
|
-
"description": "TCP keep-alive interval in
|
|
701
|
+
"description": "TCP keep-alive interval in milliseconds to prevent connection timeout during long-running requests. 0 = disabled (default). Minimum value when enabled is 30000ms (30 seconds). Values below 30000ms will be auto-corrected to 30000ms with a warning.",
|
|
702
702
|
"default": 0,
|
|
703
|
-
"minimum": 0
|
|
703
|
+
"minimum": 0,
|
|
704
|
+
"maximum": 3600000
|
|
704
705
|
}
|
|
705
706
|
},
|
|
706
707
|
"required": [
|
|
@@ -1112,7 +1113,7 @@
|
|
|
1112
1113
|
},
|
|
1113
1114
|
"requestFields": {
|
|
1114
1115
|
"type": "object",
|
|
1115
|
-
"description": "The json object with
|
|
1116
|
+
"description": "The json object with request fields of the call to getDevice",
|
|
1116
1117
|
"additionalProperties": {
|
|
1117
1118
|
"type": [
|
|
1118
1119
|
"string",
|
|
@@ -1255,7 +1256,7 @@
|
|
|
1255
1256
|
},
|
|
1256
1257
|
"requestFields": {
|
|
1257
1258
|
"type": "object",
|
|
1258
|
-
"description": "The json object with
|
|
1259
|
+
"description": "The json object with request fields of the call to getDevice",
|
|
1259
1260
|
"additionalProperties": {
|
|
1260
1261
|
"type": [
|
|
1261
1262
|
"string",
|
|
@@ -1366,7 +1367,7 @@
|
|
|
1366
1367
|
},
|
|
1367
1368
|
"requestFields": {
|
|
1368
1369
|
"type": "object",
|
|
1369
|
-
"description": "The json object with
|
|
1370
|
+
"description": "The json object with request fields of the call to getDevice",
|
|
1370
1371
|
"additionalProperties": {
|
|
1371
1372
|
"type": [
|
|
1372
1373
|
"string",
|
|
@@ -1462,7 +1463,7 @@
|
|
|
1462
1463
|
},
|
|
1463
1464
|
"requestFields": {
|
|
1464
1465
|
"type": "object",
|
|
1465
|
-
"description": "The json object with
|
|
1466
|
+
"description": "The json object with request fields of the call to getDevice",
|
|
1466
1467
|
"additionalProperties": {
|
|
1467
1468
|
"type": [
|
|
1468
1469
|
"string",
|
|
@@ -1547,7 +1548,7 @@
|
|
|
1547
1548
|
},
|
|
1548
1549
|
"requestFields": {
|
|
1549
1550
|
"type": "object",
|
|
1550
|
-
"description": "The json object with
|
|
1551
|
+
"description": "The json object with request fields of the call to getDevice",
|
|
1551
1552
|
"additionalProperties": {
|
|
1552
1553
|
"type": [
|
|
1553
1554
|
"string",
|
|
@@ -1630,12 +1631,12 @@
|
|
|
1630
1631
|
"properties": {
|
|
1631
1632
|
"path": {
|
|
1632
1633
|
"type": "string",
|
|
1633
|
-
"description": "The fully qualified path of the call to
|
|
1634
|
+
"description": "The fully qualified path of the call to populate the cache (e.g. /rest/api/devices)",
|
|
1634
1635
|
"default": ""
|
|
1635
1636
|
},
|
|
1636
1637
|
"method": {
|
|
1637
1638
|
"type": "string",
|
|
1638
|
-
"description": "The method of the call to
|
|
1639
|
+
"description": "The method of the call to populate the cache",
|
|
1639
1640
|
"default": "GET"
|
|
1640
1641
|
},
|
|
1641
1642
|
"pagination": {
|
|
@@ -1672,7 +1673,7 @@
|
|
|
1672
1673
|
},
|
|
1673
1674
|
"query": {
|
|
1674
1675
|
"type": "object",
|
|
1675
|
-
"description": "The json object with query parameters of the call to
|
|
1676
|
+
"description": "The json object with query parameters of the call to populate the cache",
|
|
1676
1677
|
"additionalProperties": {
|
|
1677
1678
|
"type": [
|
|
1678
1679
|
"string",
|
|
@@ -1682,7 +1683,7 @@
|
|
|
1682
1683
|
},
|
|
1683
1684
|
"body": {
|
|
1684
1685
|
"type": "object",
|
|
1685
|
-
"description": "The json object with body of the call to
|
|
1686
|
+
"description": "The json object with body of the call to populate the cache",
|
|
1686
1687
|
"additionalProperties": {
|
|
1687
1688
|
"type": [
|
|
1688
1689
|
"string",
|
|
@@ -1692,7 +1693,7 @@
|
|
|
1692
1693
|
},
|
|
1693
1694
|
"headers": {
|
|
1694
1695
|
"type": "object",
|
|
1695
|
-
"description": "The json object with headers of the call to
|
|
1696
|
+
"description": "The json object with headers of the call to populate the cache",
|
|
1696
1697
|
"additionalProperties": {
|
|
1697
1698
|
"type": [
|
|
1698
1699
|
"string",
|
|
@@ -1711,7 +1712,7 @@
|
|
|
1711
1712
|
},
|
|
1712
1713
|
"requestFields": {
|
|
1713
1714
|
"type": "object",
|
|
1714
|
-
"description": "The json object with
|
|
1715
|
+
"description": "The json object with request fields of the call to populate the cache",
|
|
1715
1716
|
"additionalProperties": {
|
|
1716
1717
|
"type": [
|
|
1717
1718
|
"string",
|
|
@@ -1727,7 +1728,7 @@
|
|
|
1727
1728
|
},
|
|
1728
1729
|
"responseFields": {
|
|
1729
1730
|
"type": "object",
|
|
1730
|
-
"description": "The json object with response fields of the call to
|
|
1731
|
+
"description": "The json object with response fields of the call to populate the cache",
|
|
1731
1732
|
"additionalProperties": {
|
|
1732
1733
|
"type": [
|
|
1733
1734
|
"string",
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "0.19.0",
|
|
3
|
+
"configLines": 42850,
|
|
4
4
|
"scriptLines": 2498,
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
5
|
+
"codeLines": 45252,
|
|
6
|
+
"testLines": 43109,
|
|
7
7
|
"testCases": 2271,
|
|
8
|
-
"totalCodeLines":
|
|
8
|
+
"totalCodeLines": 90859,
|
|
9
9
|
"wfTasks": 571
|
|
10
10
|
}
|
|
@@ -37396,12 +37396,12 @@
|
|
|
37396
37396
|
}
|
|
37397
37397
|
],
|
|
37398
37398
|
"requestBody": {
|
|
37399
|
-
"description": "indeterminate body object",
|
|
37400
37399
|
"content": {
|
|
37401
37400
|
"application/json": {
|
|
37402
37401
|
"schema": {
|
|
37403
|
-
"type": "
|
|
37404
|
-
}
|
|
37402
|
+
"type": "string"
|
|
37403
|
+
},
|
|
37404
|
+
"example": "handleRepositoryFileEncoding()"
|
|
37405
37405
|
}
|
|
37406
37406
|
}
|
|
37407
37407
|
}
|
|
@@ -37457,12 +37457,12 @@
|
|
|
37457
37457
|
}
|
|
37458
37458
|
],
|
|
37459
37459
|
"requestBody": {
|
|
37460
|
-
"description": "indeterminate body object",
|
|
37461
37460
|
"content": {
|
|
37462
37461
|
"application/json": {
|
|
37463
37462
|
"schema": {
|
|
37464
|
-
"type": "
|
|
37465
|
-
}
|
|
37463
|
+
"type": "string"
|
|
37464
|
+
},
|
|
37465
|
+
"example": "handleRepositoryFileEncoding()"
|
|
37466
37466
|
}
|
|
37467
37467
|
}
|
|
37468
37468
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 31
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 15
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 6
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 17
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "6.1.14"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 83
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "markdown",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 345
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
52
|
+
"value": 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
57
|
+
"value": 682
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
62
|
+
"value": 57
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
67
|
+
"value": 70
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the BROKER.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "unitTestJS",
|
|
76
|
+
"description": "Number of lines of code in unit tests",
|
|
77
|
+
"value": 25354
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "unitTestJS",
|
|
81
|
+
"description": "Number of unit tests",
|
|
82
|
+
"value": 1633
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "integrationTestJS",
|
|
86
|
+
"description": "Number of lines of code in integration tests",
|
|
87
|
+
"value": 15890
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "integrationTestJS",
|
|
91
|
+
"description": "Number of integration tests",
|
|
92
|
+
"value": 556
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "staticFile",
|
|
96
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
97
|
+
"value": 1527
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "staticFile",
|
|
101
|
+
"description": "Number of static files added",
|
|
102
|
+
"value": 37
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "Overall",
|
|
106
|
+
"description": "Total lines of Code",
|
|
107
|
+
"value": 42771
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "Overall",
|
|
111
|
+
"description": "Total Tests",
|
|
112
|
+
"value": 2189
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "Overall",
|
|
116
|
+
"description": "Total Files",
|
|
117
|
+
"value": 6
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -280,10 +280,10 @@ describe('[unit] GitLab Adapter Test', () => {
|
|
|
280
280
|
assert.notEqual(null, packageDotJson.dependencies);
|
|
281
281
|
assert.notEqual('', packageDotJson.dependencies);
|
|
282
282
|
assert.equal('8.17.1', packageDotJson.dependencies.ajv);
|
|
283
|
-
assert.equal('1.
|
|
283
|
+
assert.equal('1.13.5', packageDotJson.dependencies.axios);
|
|
284
284
|
assert.equal('11.1.0', packageDotJson.dependencies.commander);
|
|
285
285
|
assert.equal('11.3.0', packageDotJson.dependencies['fs-extra']);
|
|
286
|
-
assert.equal('
|
|
286
|
+
assert.equal('11.3.0', packageDotJson.dependencies.mocha);
|
|
287
287
|
assert.equal('2.0.1', packageDotJson.dependencies['mocha-param']);
|
|
288
288
|
assert.equal('0.4.4', packageDotJson.dependencies.ping);
|
|
289
289
|
assert.equal('1.4.10', packageDotJson.dependencies['readline-sync']);
|
|
@@ -19,17 +19,14 @@ function createObjectForFunction(
|
|
|
19
19
|
workflow
|
|
20
20
|
) {
|
|
21
21
|
const funcObject = {};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
funcObject.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
funcObject.description = description;
|
|
31
|
-
funcObject.workflow = workflow;
|
|
32
|
-
}
|
|
22
|
+
funcObject.method_signature = `${funcName}(${funcArgs.join(', ')})`;
|
|
23
|
+
funcObject.path = entityPath !== undefined ? entityPath : '';
|
|
24
|
+
if (description === undefined) {
|
|
25
|
+
funcObject.description = '';
|
|
26
|
+
funcObject.workflow = 'No';
|
|
27
|
+
} else {
|
|
28
|
+
funcObject.description = description;
|
|
29
|
+
funcObject.workflow = workflow;
|
|
33
30
|
}
|
|
34
31
|
return funcObject;
|
|
35
32
|
}
|
|
@@ -77,7 +74,8 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
77
74
|
// parsing the file to get the function and class declarations.
|
|
78
75
|
const aFileFuncArgs = acorn.parse(aFile, { ecmaVersion: 2020 });
|
|
79
76
|
|
|
80
|
-
|
|
77
|
+
// Track all method names that can be called (identifyRequest + any proxy methods)
|
|
78
|
+
const allowedCallNames = new Set(['identifyRequest']);
|
|
81
79
|
// Looping through all the declarations parsed:
|
|
82
80
|
aFileFuncArgs.body.forEach((e) => {
|
|
83
81
|
// Getting only the class declaration as it has our required functions.
|
|
@@ -103,9 +101,10 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
103
101
|
method.value.body.body.forEach((statement) => {
|
|
104
102
|
recurseCallExpressions(statement, callList);
|
|
105
103
|
});
|
|
104
|
+
// Find calls to identifyRequest OR any discovered proxy methods
|
|
106
105
|
const requests = [];
|
|
107
106
|
for (let i = 0; i < callList.length; i += 1) {
|
|
108
|
-
if (callList[i].callee.property && callList[i].callee.property.name
|
|
107
|
+
if (callList[i].callee.property && allowedCallNames.has(callList[i].callee.property.name)) {
|
|
109
108
|
requests.push(callList[i]);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
@@ -114,34 +113,60 @@ function readFileUsingLib(filename, descriptionObj, workflowObj, functionList) {
|
|
|
114
113
|
if (expr.arguments.length < 2) {
|
|
115
114
|
throw new Error(`Bad inputs in method ${funcName}`);
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
|
|
117
|
+
const arg0Type = expr.arguments[0].type;
|
|
118
|
+
const arg1Type = expr.arguments[1].type;
|
|
119
|
+
|
|
120
|
+
let entityPath;
|
|
121
|
+
|
|
122
|
+
if (arg0Type === 'Literal' && arg1Type === 'Literal') {
|
|
123
|
+
const entity = expr.arguments[0].value;
|
|
124
|
+
const actionName = expr.arguments[1].value;
|
|
125
|
+
entityPath = getPathFromEntity(entity, actionName);
|
|
126
|
+
} else {
|
|
127
|
+
// Non-standard format: anything that's not both literals
|
|
128
|
+
// Special handling for proxy methods (both args are identifiers matching first 2 params)
|
|
129
|
+
if (arg0Type === 'Identifier' && arg1Type === 'Identifier') {
|
|
130
|
+
const param1 = method.value.params[0];
|
|
131
|
+
const param2 = method.value.params[1];
|
|
132
|
+
const arg0Name = expr.arguments[0].name;
|
|
133
|
+
const arg1Name = expr.arguments[1].name;
|
|
134
|
+
|
|
135
|
+
// Check if this is a valid proxy method
|
|
136
|
+
const isValidProxy = param1 && param2
|
|
137
|
+
&& param1.type === 'Identifier' && param2.type === 'Identifier'
|
|
138
|
+
&& param1.name === arg0Name && param2.name === arg1Name;
|
|
139
|
+
|
|
140
|
+
// Only process valid proxy methods
|
|
141
|
+
if (isValidProxy) {
|
|
142
|
+
const calledMethod = expr.callee.property.name;
|
|
143
|
+
|
|
144
|
+
// Skip nested proxies (proxies calling other proxies)
|
|
145
|
+
if (calledMethod !== 'identifyRequest') {
|
|
146
|
+
console.log(`Skipping nested proxy method: ${funcName} (calls ${calledMethod})`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// First-level proxy: calls identifyRequest directly
|
|
151
|
+
// Add this proxy to the set so other methods can call it
|
|
152
|
+
allowedCallNames.add(funcName);
|
|
153
|
+
}
|
|
128
154
|
}
|
|
129
|
-
|
|
155
|
+
|
|
156
|
+
// All non-standard formats get documented without path
|
|
157
|
+
entityPath = undefined;
|
|
130
158
|
}
|
|
131
|
-
const entityPath = getPathFromEntity(entity, actionName);
|
|
132
159
|
|
|
133
160
|
// Creating and storing the object for the method.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
);
|
|
144
|
-
}
|
|
161
|
+
functionList.push(
|
|
162
|
+
createObjectForFunction(
|
|
163
|
+
funcName,
|
|
164
|
+
funcArgs,
|
|
165
|
+
entityPath,
|
|
166
|
+
descriptionObj[funcName],
|
|
167
|
+
workflowObj[funcName]
|
|
168
|
+
)
|
|
169
|
+
);
|
|
145
170
|
}
|
|
146
171
|
});
|
|
147
172
|
}
|