wrekenfile-converter 2.0.0 → 2.0.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.
@@ -46,15 +46,32 @@ function mapType(type, format) {
46
46
  return 'TIMESTAMP';
47
47
  if (format === 'binary')
48
48
  return 'STRING'; // File uploads
49
- const t = type === null || type === void 0 ? void 0 : type.toLowerCase();
50
- if (t === 'string')
51
- return 'STRING';
52
- if (t === 'integer' || t === 'int')
53
- return 'INT';
54
- if (t === 'number')
55
- return 'FLOAT';
56
- if (t === 'boolean')
57
- return 'BOOL';
49
+ if (typeof type === 'string') {
50
+ const t = type.toLowerCase();
51
+ if (t === 'string')
52
+ return 'STRING';
53
+ if (t === 'integer' || t === 'int')
54
+ return 'INT';
55
+ if (t === 'number')
56
+ return 'FLOAT';
57
+ if (t === 'boolean')
58
+ return 'BOOL';
59
+ return 'ANY';
60
+ }
61
+ // Handle array of types (OpenAPI allows type: ['string', 'null'])
62
+ if (Array.isArray(type) && type.length > 0 && typeof type[0] === 'string') {
63
+ const t = type[0].toLowerCase();
64
+ if (t === 'string')
65
+ return 'STRING';
66
+ if (t === 'integer' || t === 'int')
67
+ return 'INT';
68
+ if (t === 'number')
69
+ return 'FLOAT';
70
+ if (t === 'boolean')
71
+ return 'BOOL';
72
+ return 'ANY';
73
+ }
74
+ // Fallback for missing or unexpected type
58
75
  return 'ANY';
59
76
  }
60
77
  function generateDesc(op, method, path) {
@@ -46,15 +46,32 @@ function mapType(type, format) {
46
46
  return 'TIMESTAMP';
47
47
  if (format === 'binary')
48
48
  return 'STRING'; // File uploads
49
- const t = type === null || type === void 0 ? void 0 : type.toLowerCase();
50
- if (t === 'string')
51
- return 'STRING';
52
- if (t === 'integer' || t === 'int')
53
- return 'INT';
54
- if (t === 'number')
55
- return 'FLOAT';
56
- if (t === 'boolean')
57
- return 'BOOL';
49
+ if (typeof type === 'string') {
50
+ const t = type.toLowerCase();
51
+ if (t === 'string')
52
+ return 'STRING';
53
+ if (t === 'integer' || t === 'int')
54
+ return 'INT';
55
+ if (t === 'number')
56
+ return 'FLOAT';
57
+ if (t === 'boolean')
58
+ return 'BOOL';
59
+ return 'ANY';
60
+ }
61
+ // Handle array of types (OpenAPI allows type: ['string', 'null'])
62
+ if (Array.isArray(type) && type.length > 0 && typeof type[0] === 'string') {
63
+ const t = type[0].toLowerCase();
64
+ if (t === 'string')
65
+ return 'STRING';
66
+ if (t === 'integer' || t === 'int')
67
+ return 'INT';
68
+ if (t === 'number')
69
+ return 'FLOAT';
70
+ if (t === 'boolean')
71
+ return 'BOOL';
72
+ return 'ANY';
73
+ }
74
+ // Fallback for missing or unexpected type
58
75
  return 'ANY';
59
76
  }
60
77
  function generateDesc(op, method, path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrekenfile-converter",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Convert OpenAPI and Postman specs to Wrekenfile format with mini-chunking for vector DB storage",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",