@kosha-ai/server 0.5.0 → 0.5.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.
|
@@ -116,7 +116,7 @@ let ConfigurationsService = class ConfigurationsService {
|
|
|
116
116
|
// unanchored `[a-z]+` matches inside `acme/evil`, so a pattern meant to
|
|
117
117
|
// constrain a value would quietly accept one that escapes it.
|
|
118
118
|
if (field.pattern !== undefined &&
|
|
119
|
-
!new RegExp(`^(?:${field.pattern})
|
|
119
|
+
!new RegExp(`^(?:${field.pattern})$`, 'v').test(value)) {
|
|
120
120
|
throw new BadRequestException(`${field.label} is not in the expected format`);
|
|
121
121
|
}
|
|
122
122
|
if (field.type !== 'url' && field.type !== 'host')
|
|
@@ -183,7 +183,9 @@ function declaredFields(integration, supplied, options = {}) {
|
|
|
183
183
|
const fields = {};
|
|
184
184
|
for (const field of declared) {
|
|
185
185
|
const value = supplied?.[field.key];
|
|
186
|
-
if (value === undefined ||
|
|
186
|
+
if (value === undefined ||
|
|
187
|
+
value === '' ||
|
|
188
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
187
189
|
// On create a required field must be there; on update, absent means
|
|
188
190
|
// "leave what is stored".
|
|
189
191
|
if (options.required && field.required) {
|
|
@@ -191,6 +193,13 @@ function declaredFields(integration, supplied, options = {}) {
|
|
|
191
193
|
}
|
|
192
194
|
continue;
|
|
193
195
|
}
|
|
196
|
+
if (field.type === 'select') {
|
|
197
|
+
const allowed = new Set((field.options ?? []).map((option) => option.value));
|
|
198
|
+
const values = Array.isArray(value) ? value : [value];
|
|
199
|
+
if (values.some((option) => typeof option !== 'string' || !allowed.has(option))) {
|
|
200
|
+
throw new BadRequestException(`${field.label} contains an unsupported option`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
194
203
|
fields[field.key] = value;
|
|
195
204
|
}
|
|
196
205
|
return Object.keys(fields).length > 0 ? fields : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosha-ai/server",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Kosha server: OAuth handshake, encrypted credential storage, token refresh, and an authenticated request proxy for third-party integrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kosha",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"rxjs": "^7.8.0",
|
|
110
110
|
"tslib": "^2.3.0",
|
|
111
111
|
"zod": "4.5.4",
|
|
112
|
-
"@kosha-ai/integration-sdk": "0.5.
|
|
112
|
+
"@kosha-ai/integration-sdk": "0.5.1"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@nestjs/testing": "^11.0.0",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@types/node-forge": "^1.3.14",
|
|
118
118
|
"@types/pg": "^8.23.1",
|
|
119
119
|
"prisma": "^7.10.0",
|
|
120
|
-
"@kosha-ai/integration-github": "0.5.
|
|
121
|
-
"@kosha-ai/integration-slack": "0.5.
|
|
120
|
+
"@kosha-ai/integration-github": "0.5.1",
|
|
121
|
+
"@kosha-ai/integration-slack": "0.5.1"
|
|
122
122
|
}
|
|
123
123
|
}
|