@rimori/client 2.5.32-next.0 → 2.5.32-next.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.
@@ -40,22 +40,18 @@ export class AccomplishmentController {
40
40
  if (payload.type === 'macro' && (payload.errorRatio < 0 || payload.errorRatio > 1)) {
41
41
  throw new Error('The error ratio must be between 0 and 1');
42
42
  }
43
- //regex check meta data key
44
- if (payload.meta) {
45
- payload.meta.forEach((meta) => {
46
- if (!/^[a-z_]+$/.test(meta.key)) {
47
- throw new Error('Invalid meta data key ' + meta.key + ', only lowercase letters and underscores are allowed');
48
- }
49
- });
50
- }
51
43
  return true;
52
44
  }
53
45
  sanitizeAccomplishment(payload) {
54
- var _a;
46
+ var _a, _b;
55
47
  payload.description = payload.description.replace(/[^\x20-\x7E]/g, '');
56
48
  (_a = payload.meta) === null || _a === void 0 ? void 0 : _a.forEach((meta) => {
57
49
  meta.description = meta.description.replace(/[^\x20-\x7E]/g, '');
58
50
  });
51
+ //convert meta keys to snakecase
52
+ (_b = payload.meta) === null || _b === void 0 ? void 0 : _b.forEach((meta) => {
53
+ meta.key = meta.key.replace(/([A-Z])/g, '_$1').toLowerCase();
54
+ });
59
55
  return payload;
60
56
  }
61
57
  getDecoupledTopic(topic) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.32-next.0",
3
+ "version": "2.5.32-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {