@itentialopensource/adapter-gitlab 0.18.1 → 0.19.1

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 CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ ## 0.19.1 [02-06-2026]
3
+
4
+ * Fix repository file content encoding handling
5
+
6
+ See merge request itentialopensource/adapters/adapter-gitlab!56
7
+
8
+ ---
9
+
2
10
  ## 0.15.4 [10-15-2024]
3
11
 
4
12
  * Changes made at 2024.10.14_21:29PM
package/PROPERTIES.md CHANGED
@@ -54,7 +54,8 @@ This section defines **all** the properties that are available for the adapter,
54
54
  "healthcheck_on_timeout": false,
55
55
  "return_raw": false,
56
56
  "archiving": false,
57
- "return_request": false
57
+ "return_request": false,
58
+ "keep_alive_interval": 0
58
59
  },
59
60
  "ssl": {
60
61
  "ecdhCurve": "",
@@ -403,6 +404,10 @@ The request section defines properties to help handle requests.
403
404
  <td style="padding:15px">return_request</td>
404
405
  <td style="padding:15px">Optional flag. Default is false. Will return the actual request that is made including headers. This should only be used during debugging issues as there could be credentials in the actual request.</td>
405
406
  </tr>
407
+ <tr>
408
+ <td style="padding:15px">keep_alive_interval</td>
409
+ <td style="padding:15px">Optional. TCP keep-alive interval in seconds for long-lived connections. Set to 0 to disable keep-alive (default). When enabled, minimum value is 30 seconds.</td>
410
+ </tr>
406
411
  </table>
407
412
  <br>
408
413
 
package/TAB2.md CHANGED
@@ -128,7 +128,8 @@ Sample Properties can be used to help you configure the adapter in the Itential
128
128
  "healthcheck_on_timeout": true,
129
129
  "return_raw": false,
130
130
  "archiving": false,
131
- "return_request": false
131
+ "return_request": false,
132
+ "keep_alive_interval": 0
132
133
  },
133
134
  "proxy": {
134
135
  "enabled": false,
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 - encoded",
898
+ "description": "Include file content",
899
899
  "parse": true,
900
- "encode": true,
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.18.1",
3
+ "version": "0.19.1",
4
4
  "description": "This adapter integrates with system described as: gitlab.",
5
5
  "main": "adapter.js",
6
6
  "systemName": "Gitlab",
7
7
  "wizardVersion": "3.8.0",
8
- "engineVersion": "1.79.2",
8
+ "engineVersion": "1.80.0",
9
9
  "adapterType": "http",
10
10
  "scripts": {
11
11
  "preinstall": "node utils/setup.js",
@@ -49,7 +49,7 @@
49
49
  "author": "Itential",
50
50
  "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-gitlab#readme",
51
51
  "dependencies": {
52
- "@itentialopensource/adapter-utils": "6.0.3",
52
+ "@itentialopensource/adapter-utils": "6.1.7",
53
53
  "acorn": "8.14.1",
54
54
  "ajv": "8.17.1",
55
55
  "axios": "1.12.2",
@@ -695,6 +695,12 @@
695
695
  "type": "boolean",
696
696
  "description": "This property turns on returning the response information - need to be carefull in case credentials are in the path",
697
697
  "default": false
698
+ },
699
+ "keep_alive_interval": {
700
+ "type": "integer",
701
+ "description": "TCP keep-alive interval in seconds for long-lived connections. Set to 0 to disable (default). Minimum 30 seconds when enabled.",
702
+ "default": 0,
703
+ "minimum": 0
698
704
  }
699
705
  },
700
706
  "required": [
@@ -1762,4 +1768,4 @@
1762
1768
  }
1763
1769
  }
1764
1770
  }
1765
- }
1771
+ }
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.16.4",
3
- "configLines": 42806,
2
+ "version": "0.19.0",
3
+ "configLines": 42850,
4
4
  "scriptLines": 2498,
5
- "codeLines": 45166,
6
- "testLines": 43103,
5
+ "codeLines": 45252,
6
+ "testLines": 43109,
7
7
  "testCases": 2271,
8
- "totalCodeLines": 90767,
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": "object"
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": "object"
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.7"
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
+ }
@@ -81,7 +81,8 @@
81
81
  "healthcheck_on_timeout": true,
82
82
  "return_raw": false,
83
83
  "archiving": false,
84
- "return_request": false
84
+ "return_request": false,
85
+ "keep_alive_interval": 0
85
86
  },
86
87
  "proxy": {
87
88
  "enabled": false,