@trayio/commons 5.26.0 → 5.27.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.
@@ -65,7 +65,7 @@ class CamelCasePropertyNameCodec {
65
65
  }
66
66
  if (Array.isArray(propertyValue)) {
67
67
  const nestedArray = this.camelCasePropertyNameFromArrayIfPresent(propertyValue);
68
- return { ...acc, [key]: nestedArray };
68
+ return { ...acc, [StringExtensions_1.StringExtensions.camelCase(key)]: nestedArray };
69
69
  }
70
70
  return { ...acc, [StringExtensions_1.StringExtensions.camelCase(key)]: propertyValue };
71
71
  }, {});
@@ -135,4 +135,18 @@ describe('CamelCasePropertyNameCodec', () => {
135
135
  };
136
136
  expect(actualValue).toEqual(expectedValue);
137
137
  });
138
+ test('should camel case top-level keys whose value is an array', () => {
139
+ const value = {
140
+ access_token: 'abc',
141
+ required_scopes: ['mcp:list_tools', 'mcp:call_tool'],
142
+ resource: 'r',
143
+ };
144
+ const actualValue = testCamelCasePropertyNameCodec.encode(value);
145
+ const expectedValue = {
146
+ accessToken: 'abc',
147
+ requiredScopes: ['mcp:list_tools', 'mcp:call_tool'],
148
+ resource: 'r',
149
+ };
150
+ expect(actualValue).toEqual(expectedValue);
151
+ });
138
152
  });
@@ -65,7 +65,7 @@ class SnakeCasePropertyNameCodec {
65
65
  }
66
66
  if (Array.isArray(propertyValue)) {
67
67
  const nestedArray = this.snakeCasePropertyNameFromArrayIfPresent(propertyValue);
68
- return { ...acc, [key]: nestedArray };
68
+ return { ...acc, [StringExtensions_1.StringExtensions.snakeCase(key)]: nestedArray };
69
69
  }
70
70
  return { ...acc, [StringExtensions_1.StringExtensions.snakeCase(key)]: propertyValue };
71
71
  }, {});
@@ -135,4 +135,18 @@ describe('SnakeCasePropertyNameCodec', () => {
135
135
  };
136
136
  expect(actualValue).toEqual(expectedValue);
137
137
  });
138
+ test('should snake case top-level keys whose value is an array', () => {
139
+ const value = {
140
+ accessToken: 'abc',
141
+ requiredScopes: ['mcp:list_tools', 'mcp:call_tool'],
142
+ resource: 'r',
143
+ };
144
+ const actualValue = testSnakeCasePropertyNameCodec.encode(value);
145
+ const expectedValue = {
146
+ access_token: 'abc',
147
+ required_scopes: ['mcp:list_tools', 'mcp:call_tool'],
148
+ resource: 'r',
149
+ };
150
+ expect(actualValue).toEqual(expectedValue);
151
+ });
138
152
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/commons",
3
- "version": "5.26.0",
3
+ "version": "5.27.0",
4
4
  "description": "Extensions to the standard/core libraries and basic features",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"