@usebruno/filestore 0.6.0 → 0.7.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.
Files changed (46) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/workers/worker-script.js +1 -1
  4. package/dist/cjs/workers/worker-script.js.map +1 -1
  5. package/dist/constants.d.ts +3 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/esm/index.js +1 -1
  8. package/dist/esm/index.js.map +1 -1
  9. package/dist/esm/workers/worker-script.js +1 -1
  10. package/dist/esm/workers/worker-script.js.map +1 -1
  11. package/dist/formats/yml/items/parseWebsocketRequest.d.ts.map +1 -1
  12. package/dist/formats/yml/items/stringifyHttpRequest.d.ts.map +1 -1
  13. package/dist/formats/yml/parseCollection.d.ts.map +1 -1
  14. package/dist/formats/yml/parseEnvironment.d.ts.map +1 -1
  15. package/dist/formats/yml/parseFolder.d.ts.map +1 -1
  16. package/dist/formats/yml/stringifyCollection.d.ts.map +1 -1
  17. package/dist/formats/yml/stringifyEnvironment.d.ts.map +1 -1
  18. package/dist/formats/yml/stringifyFolder.d.ts.map +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/utils/index.d.ts +1 -0
  22. package/dist/utils/index.d.ts.map +1 -1
  23. package/dist/workers/index.d.ts.map +1 -1
  24. package/package.json +3 -3
  25. package/src/constants.ts +3 -0
  26. package/src/formats/yml/common/actions.ts +3 -3
  27. package/src/formats/yml/common/assertions.ts +4 -4
  28. package/src/formats/yml/common/body.ts +5 -5
  29. package/src/formats/yml/common/headers.ts +3 -3
  30. package/src/formats/yml/common/params.ts +3 -3
  31. package/src/formats/yml/common/variables.ts +3 -3
  32. package/src/formats/yml/items/parseGraphQLRequest.ts +4 -4
  33. package/src/formats/yml/items/parseGrpcRequest.ts +6 -6
  34. package/src/formats/yml/items/parseHttpRequest.ts +7 -7
  35. package/src/formats/yml/items/parseWebsocketRequest.ts +6 -5
  36. package/src/formats/yml/items/stringifyHttpRequest.ts +3 -2
  37. package/src/formats/yml/parseCollection.ts +30 -8
  38. package/src/formats/yml/parseEnvironment.ts +7 -6
  39. package/src/formats/yml/parseFolder.ts +8 -3
  40. package/src/formats/yml/stringifyCollection.ts +75 -33
  41. package/src/formats/yml/stringifyEnvironment.ts +4 -1
  42. package/src/formats/yml/stringifyFolder.ts +11 -0
  43. package/src/index.ts +10 -8
  44. package/src/utils/index.ts +10 -0
  45. package/src/workers/index.ts +4 -3
  46. package/src/workers/worker-script.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"parseWebsocketRequest.d.ts","sourceRoot":"","sources":["../../../../src/formats/yml/items/parseWebsocketRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,0CAA0C,CAAC;AAOnG,QAAA,MAAM,qBAAqB,cAAe,gBAAgB,KAAG,SA8F5D,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"parseWebsocketRequest.d.ts","sourceRoot":"","sources":["../../../../src/formats/yml/items/parseWebsocketRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,0CAA0C,CAAC;AAOnG,QAAA,MAAM,qBAAqB,cAAe,gBAAgB,KAAG,SA+F5D,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stringifyHttpRequest.d.ts","sourceRoot":"","sources":["../../../../src/formats/yml/items/stringifyHttpRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAA6C,MAAM,wCAAwC,CAAC;AAoB3H,QAAA,MAAM,oBAAoB,SAAU,SAAS,KAAG,MAsM/C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"stringifyHttpRequest.d.ts","sourceRoot":"","sources":["../../../../src/formats/yml/items/stringifyHttpRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAA6C,MAAM,wCAAwC,CAAC;AAoB3H,QAAA,MAAM,oBAAoB,SAAU,SAAS,KAAG,MAuM/C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseCollection.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseCollection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAO3E,UAAU,gBAAgB;IACxB,cAAc,EAAE,UAAU,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,QAAA,MAAM,eAAe,cAAe,MAAM,KAAG,gBAsL5C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"parseCollection.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseCollection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAS3E,UAAU,gBAAgB;IACxB,cAAc,EAAE,UAAU,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,QAAA,MAAM,eAAe,cAAe,MAAM,KAAG,gBA0M5C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseEnvironment.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,gBAAgB,EAAmD,MAAM,+CAA+C,CAAC;AAsCtJ,QAAA,MAAM,gBAAgB,cAAe,MAAM,KAAG,gBAe7C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"parseEnvironment.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,gBAAgB,EAAmD,MAAM,+CAA+C,CAAC;AAsCtJ,QAAA,MAAM,gBAAgB,cAAe,MAAM,KAAG,gBAgB7C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseFolder.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseFolder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAS3E,QAAA,MAAM,WAAW,cAAe,MAAM,KAAG,UA4ExC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"parseFolder.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/parseFolder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAU3E,QAAA,MAAM,WAAW,cAAe,MAAM,KAAG,UAgFxC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stringifyCollection.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyCollection.ts"],"names":[],"mappings":"AA4DA,QAAA,MAAM,mBAAmB,mBAAoB,GAAG,eAAe,GAAG,KAAG,MAuKpE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"stringifyCollection.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyCollection.ts"],"names":[],"mappings":"AAkEA,QAAA,MAAM,mBAAmB,mBAAoB,GAAG,eAAe,GAAG,KAAG,MA2MpE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stringifyEnvironment.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,gBAAgB,EAAmD,MAAM,+CAA+C,CAAC;AA2CtJ,QAAA,MAAM,oBAAoB,gBAAiB,gBAAgB,KAAG,MAmB7D,CAAC;AACF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"stringifyEnvironment.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,gBAAgB,EAAmD,MAAM,+CAA+C,CAAC;AA2CtJ,QAAA,MAAM,oBAAoB,gBAAiB,gBAAgB,KAAG,MAsB7D,CAAC;AACF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stringifyFolder.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyFolder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAgC3E,QAAA,MAAM,eAAe,eAAgB,UAAU,KAAG,MA8DjD,CAAC;AACF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"stringifyFolder.d.ts","sourceRoot":"","sources":["../../../src/formats/yml/stringifyFolder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAmC3E,QAAA,MAAM,eAAe,eAAgB,UAAU,KAAG,MAsEjD,CAAC;AACF,eAAe,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -20,4 +20,5 @@ export declare const stringifyEnvironment: (envObj: BrunoEnvironment, options?:
20
20
  export declare const parseDotEnv: (content: string) => Record<string, string>;
21
21
  export { BruParserWorker };
22
22
  export * from './types';
23
+ export * from './constants';
23
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":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CAAC;AAEF,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,OAAO,MAAM,EAAE,MAAM,CAElE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const isString: (value: unknown) => value is string;
2
2
  export declare const isNumber: (value: unknown) => value is number;
3
3
  export declare const isNonEmptyString: (value: unknown) => value is string;
4
+ export declare const ensureString: (value: unknown, fallback?: string) => string;
4
5
  export declare const uuid: () => any;
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,UAAW,OAAO,oBAA+C,CAAC;AAEvF,eAAO,MAAM,QAAQ,UAAW,OAAO,oBAA+C,CAAC;AAEvF,eAAO,MAAM,gBAAgB,UAAW,OAAO,oBAAgE,CAAC;AAEhH,eAAO,MAAM,IAAI,WAMhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,UAAW,OAAO,oBAA+C,CAAC;AAEvF,eAAO,MAAM,QAAQ,UAAW,OAAO,oBAA+C,CAAC;AAEvF,eAAO,MAAM,gBAAgB,UAAW,OAAO,oBAAgE,CAAC;AAEhH,eAAO,MAAM,YAAY,UAAW,OAAO,aAAY,MAAM,KAAQ,MAQpE,CAAC;AAEF,eAAO,MAAM,IAAI,WAMhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAmClD,cAAM,eAAe;IACnB,OAAO,CAAC,YAAY,CAAwB;;IAS5C,OAAO,CAAC,cAAc;YAUR,WAAW;IAanB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,gBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvE,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,gBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC;IAI3E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAoClD,cAAM,eAAe;IACnB,OAAO,CAAC,YAAY,CAAwB;;IAS5C,OAAO,CAAC,cAAc;YAUR,WAAW;IAanB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,gBAA4C,GAAG,OAAO,CAAC,GAAG,CAAC;IAI3F,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,gBAA4C,GAAG,OAAO,CAAC,GAAG,CAAC;IAI/F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B;AAED,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usebruno/filestore",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,7 +29,7 @@
29
29
  "@types/jest": "^29.5.11",
30
30
  "@types/lodash": "^4.14.191",
31
31
  "@types/node": "^24.1.0",
32
- "@usebruno/schema-types": "0.1.0",
32
+ "@usebruno/schema-types": "0.2.0",
33
33
  "babel-jest": "^29.7.0",
34
34
  "jest": "^29.2.0",
35
35
  "nanoid": "3.3.8",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@types/nanoid": "^2.1.0",
48
- "@usebruno/lang": "0.33.0",
48
+ "@usebruno/lang": "0.34.0",
49
49
  "ajv": "^8.17.1",
50
50
  "lodash": "^4.17.21",
51
51
  "yaml": "^2.3.4"
@@ -0,0 +1,3 @@
1
+ import type { CollectionFormat } from './types';
2
+
3
+ export const DEFAULT_COLLECTION_FORMAT: CollectionFormat = 'yml';
@@ -1,6 +1,6 @@
1
1
  import type { Action, ActionSetVariable, ActionVariableScope } from '@opencollection/types/common/actions';
2
2
  import type { Variable as BrunoVariable, Variables as BrunoVariables } from '@usebruno/schema-types/common/variables';
3
- import { uuid } from '../../../utils';
3
+ import { uuid, ensureString } from '../../../utils';
4
4
 
5
5
  /**
6
6
  * Convert Bruno post-response variables to OpenCollection actions.
@@ -58,8 +58,8 @@ export const toBrunoPostResponseVariables = (actions: Action[] | null | undefine
58
58
 
59
59
  const variable: BrunoVariable = {
60
60
  uid: uuid(),
61
- name: setVarAction.variable?.name || '',
62
- value: setVarAction.selector?.expression || '',
61
+ name: ensureString(setVarAction.variable?.name),
62
+ value: ensureString(setVarAction.selector?.expression),
63
63
  enabled: setVarAction.disabled !== true,
64
64
  local: false
65
65
  };
@@ -1,6 +1,6 @@
1
1
  import type { KeyValue as BrunoKeyValue } from '@usebruno/schema-types/common/key-value';
2
2
  import type { Assertion } from '@opencollection/types/common/assertions';
3
- import { uuid } from '../../../utils';
3
+ import { uuid, ensureString } from '../../../utils';
4
4
 
5
5
  const OPERATORS = [
6
6
  'eq',
@@ -119,14 +119,14 @@ export const toBrunoAssertions = (assertions: Assertion[] | null | undefined): B
119
119
 
120
120
  const brunoAssertions: BrunoKeyValue[] = assertions.map((assertion: Assertion): BrunoKeyValue => {
121
121
  // Reconstruct the "operator value" format that Bruno uses
122
- let valueString = assertion.operator;
122
+ let valueString = ensureString(assertion.operator);
123
123
  if (assertion.value !== undefined && assertion.value !== null) {
124
- valueString = `${assertion.operator} ${assertion.value}`;
124
+ valueString = `${assertion.operator} ${ensureString(assertion.value)}`;
125
125
  }
126
126
 
127
127
  const brunoAssertion: BrunoKeyValue = {
128
128
  uid: uuid(),
129
- name: assertion.expression || '',
129
+ name: ensureString(assertion.expression),
130
130
  value: valueString,
131
131
  enabled: assertion.disabled !== true
132
132
  };
@@ -10,7 +10,7 @@ import type {
10
10
  FileBodyEntry
11
11
  } from '@opencollection/types/requests/http';
12
12
  import type { KeyValue as BrunoKeyValue } from '@usebruno/schema-types/common/key-value';
13
- import { uuid } from '../../../utils';
13
+ import { uuid, ensureString } from '../../../utils';
14
14
 
15
15
  export const toOpenCollectionBody = (body: BrunoHttpRequestBody | null | undefined): HttpRequestBody | undefined => {
16
16
  if (!body) {
@@ -179,8 +179,8 @@ export const toBrunoBody = (body: HttpRequestBody | null | undefined): BrunoHttp
179
179
  brunoBody.formUrlEncoded = body.data?.map((entry): BrunoKeyValue => {
180
180
  const formEntry: BrunoKeyValue = {
181
181
  uid: uuid(),
182
- name: entry.name || '',
183
- value: entry.value || '',
182
+ name: ensureString(entry.name),
183
+ value: ensureString(entry.value),
184
184
  enabled: entry.disabled !== true
185
185
  };
186
186
 
@@ -202,8 +202,8 @@ export const toBrunoBody = (body: HttpRequestBody | null | undefined): BrunoHttp
202
202
  const multipartEntry: any = {
203
203
  uid: uuid(),
204
204
  type: entry.type,
205
- name: entry.name || '',
206
- value: entry.value || (entry.type === 'file' ? [] : ''),
205
+ name: ensureString(entry.name),
206
+ value: entry.type === 'file' ? (entry.value || []) : ensureString(entry.value),
207
207
  contentType: entry.contentType || null,
208
208
  enabled: entry.disabled !== true
209
209
  };
@@ -1,7 +1,7 @@
1
1
  import type { FolderRequest as BrunoFolderRequest } from '@usebruno/schema-types/collection/folder';
2
2
  import type { KeyValue as BrunoKeyValue } from '@usebruno/schema-types/common/key-value';
3
3
  import type { HttpRequestHeader, HttpResponseHeader } from '@opencollection/types/requests/http';
4
- import { uuid } from '../../../utils';
4
+ import { uuid, ensureString } from '../../../utils';
5
5
 
6
6
  export const toOpenCollectionHttpHeaders = (headers: BrunoFolderRequest['headers']): HttpRequestHeader[] | undefined => {
7
7
  if (!headers?.length) {
@@ -46,8 +46,8 @@ export const toBrunoHttpHeaders = (headers: HttpRequestHeader[] | HttpResponseHe
46
46
  const brunoHeaders = headers.map((header): BrunoKeyValue => {
47
47
  const brunoHeader: BrunoKeyValue = {
48
48
  uid: uuid(),
49
- name: header.name || '',
50
- value: header.value || '',
49
+ name: ensureString(header.name),
50
+ value: ensureString(header.value),
51
51
  enabled: ('disabled' in header) ? header.disabled !== true : true
52
52
  };
53
53
 
@@ -1,6 +1,6 @@
1
1
  import type { HttpRequestParam as BrunoHttpRequestParam } from '@usebruno/schema-types/requests/http';
2
2
  import type { HttpRequestParam } from '@opencollection/types/requests/http';
3
- import { uuid } from '../../../utils';
3
+ import { uuid, ensureString } from '../../../utils';
4
4
 
5
5
  export const toOpenCollectionParams = (params: BrunoHttpRequestParam[] | null | undefined): HttpRequestParam[] | undefined => {
6
6
  if (!params?.length) {
@@ -36,8 +36,8 @@ export const toBrunoParams = (params: HttpRequestParam[] | null | undefined): Br
36
36
  const brunoParams = params.map((param: HttpRequestParam): BrunoHttpRequestParam => {
37
37
  const brunoParam: BrunoHttpRequestParam = {
38
38
  uid: uuid(),
39
- name: param.name || '',
40
- value: param.value || '',
39
+ name: ensureString(param.name),
40
+ value: ensureString(param.value),
41
41
  type: param.type,
42
42
  enabled: param.disabled !== true
43
43
  };
@@ -1,7 +1,7 @@
1
1
  import { Variable } from '@opencollection/types/common/variables';
2
2
  import { FolderRequest as BrunoFolderRequest } from '@usebruno/schema-types/collection/folder';
3
3
  import { Variable as BrunoVariable, Variables as BrunoVariables } from '@usebruno/schema-types/common/variables';
4
- import { uuid } from '../../../utils';
4
+ import { uuid, ensureString } from '../../../utils';
5
5
 
6
6
  /**
7
7
  * Convert Bruno pre-request variables to OpenCollection variables format.
@@ -51,8 +51,8 @@ export const toBrunoVariables = (variables: Variable[] | null | undefined): { re
51
51
  variables.forEach((v: Variable) => {
52
52
  const variable: BrunoVariable = {
53
53
  uid: uuid(),
54
- name: v.name || '',
55
- value: v.value as string || '',
54
+ name: ensureString(v.name),
55
+ value: ensureString(v.value),
56
56
  enabled: v.disabled !== true,
57
57
  local: false
58
58
  };
@@ -8,7 +8,7 @@ import { toBrunoVariables } from '../common/variables';
8
8
  import { toBrunoPostResponseVariables } from '../common/actions';
9
9
  import { toBrunoScripts } from '../common/scripts';
10
10
  import { toBrunoAssertions } from '../common/assertions';
11
- import { uuid } from '../../../utils';
11
+ import { uuid, ensureString } from '../../../utils';
12
12
 
13
13
  const parseGraphQLRequest = (ocRequest: GraphQLRequest): BrunoItem => {
14
14
  const info = ocRequest.info;
@@ -16,8 +16,8 @@ const parseGraphQLRequest = (ocRequest: GraphQLRequest): BrunoItem => {
16
16
  const runtime = ocRequest.runtime;
17
17
 
18
18
  const brunoRequest: BrunoHttpRequest = {
19
- url: graphql?.url || '',
20
- method: graphql?.method || 'POST',
19
+ url: ensureString(graphql?.url),
20
+ method: ensureString(graphql?.method, 'POST'),
21
21
  headers: toBrunoHttpHeaders(graphql?.headers) || [],
22
22
  params: toBrunoParams(graphql?.params) || [],
23
23
  auth: toBrunoAuth(graphql?.auth),
@@ -86,7 +86,7 @@ const parseGraphQLRequest = (ocRequest: GraphQLRequest): BrunoItem => {
86
86
  uid: uuid(),
87
87
  type: 'graphql-request',
88
88
  seq: info?.seq || 1,
89
- name: info?.name || 'Untitled Request',
89
+ name: ensureString(info?.name, 'Untitled Request'),
90
90
  tags: info?.tags || [],
91
91
  request: brunoRequest,
92
92
  settings: null,
@@ -6,7 +6,7 @@ import { toBrunoAuth } from '../common/auth';
6
6
  import { toBrunoVariables } from '../common/variables';
7
7
  import { toBrunoScripts } from '../common/scripts';
8
8
  import { toBrunoAssertions } from '../common/assertions';
9
- import { isNonEmptyString, uuid } from '../../../utils';
9
+ import { isNonEmptyString, uuid, ensureString } from '../../../utils';
10
10
 
11
11
  const toBrunoGrpcMetadata = (metadata: GrpcMetadata[] | null | undefined): BrunoKeyValue[] | undefined => {
12
12
  if (!metadata?.length) {
@@ -16,8 +16,8 @@ const toBrunoGrpcMetadata = (metadata: GrpcMetadata[] | null | undefined): Bruno
16
16
  const brunoMetadata = metadata.map((meta: GrpcMetadata): BrunoKeyValue => {
17
17
  const brunoMeta: BrunoKeyValue = {
18
18
  uid: uuid(),
19
- name: meta.name || '',
20
- value: meta.value || '',
19
+ name: ensureString(meta.name),
20
+ value: ensureString(meta.value),
21
21
  enabled: meta.disabled !== true
22
22
  };
23
23
 
@@ -33,8 +33,8 @@ const parseGrpcRequest = (ocRequest: GrpcRequest): BrunoItem => {
33
33
  const runtime = ocRequest.runtime;
34
34
 
35
35
  const brunoRequest: BrunoGrpcRequest = {
36
- url: grpc?.url || '',
37
- method: grpc?.method || '',
36
+ url: ensureString(grpc?.url),
37
+ method: ensureString(grpc?.method),
38
38
  methodType: grpc?.methodType || '',
39
39
  protoPath: grpc?.protoFilePath || null,
40
40
  headers: toBrunoGrpcMetadata(grpc?.metadata) || [],
@@ -98,7 +98,7 @@ const parseGrpcRequest = (ocRequest: GrpcRequest): BrunoItem => {
98
98
  uid: uuid(),
99
99
  type: 'grpc-request',
100
100
  seq: info?.seq || 1,
101
- name: info?.name || 'Untitled Request',
101
+ name: ensureString(info?.name, 'Untitled Request'),
102
102
  tags: info?.tags || [],
103
103
  request: brunoRequest,
104
104
  settings: {},
@@ -9,7 +9,7 @@ import { toBrunoVariables } from '../common/variables';
9
9
  import { toBrunoPostResponseVariables } from '../common/actions';
10
10
  import { toBrunoScripts } from '../common/scripts';
11
11
  import { toBrunoAssertions } from '../common/assertions';
12
- import { uuid } from '../../../utils';
12
+ import { uuid, ensureString } from '../../../utils';
13
13
 
14
14
  const parseHttpRequest = (ocRequest: HttpRequest): BrunoItem => {
15
15
  const info = ocRequest.info;
@@ -17,8 +17,8 @@ const parseHttpRequest = (ocRequest: HttpRequest): BrunoItem => {
17
17
  const runtime = ocRequest.runtime;
18
18
 
19
19
  const brunoRequest: BrunoHttpRequest = {
20
- url: http?.url || '',
21
- method: http?.method || 'GET',
20
+ url: ensureString(http?.url),
21
+ method: ensureString(http?.method, 'GET'),
22
22
  headers: toBrunoHttpHeaders(http?.headers) || [],
23
23
  params: toBrunoParams(http?.params) || [],
24
24
  auth: toBrunoAuth(http?.auth),
@@ -84,7 +84,7 @@ const parseHttpRequest = (ocRequest: HttpRequest): BrunoItem => {
84
84
  uid: uuid(),
85
85
  type: 'http-request',
86
86
  seq: info?.seq || 1,
87
- name: info?.name || 'Untitled Request',
87
+ name: ensureString(info?.name, 'Untitled Request'),
88
88
  tags: info?.tags || [],
89
89
  request: brunoRequest,
90
90
  settings: null,
@@ -135,7 +135,7 @@ const parseHttpRequest = (ocRequest: HttpRequest): BrunoItem => {
135
135
  const brunoExample: any = {
136
136
  uid: uuid(),
137
137
  itemUid: uuid(),
138
- name: example.name || 'Untitled Example',
138
+ name: ensureString(example.name, 'Untitled Example'),
139
139
  type: 'http-request',
140
140
  request: null,
141
141
  response: null
@@ -151,8 +151,8 @@ const parseHttpRequest = (ocRequest: HttpRequest): BrunoItem => {
151
151
 
152
152
  if (example.request) {
153
153
  brunoExample.request = {
154
- url: example.request.url || '',
155
- method: example.request.method || 'GET',
154
+ url: ensureString(example.request.url),
155
+ method: ensureString(example.request.method, 'GET'),
156
156
  headers: toBrunoHttpHeaders(example.request.headers) || [],
157
157
  params: toBrunoParams(example.request.params) || [],
158
158
  body: toBrunoBody(example.request.body) || {
@@ -5,7 +5,7 @@ import { toBrunoAuth } from '../common/auth';
5
5
  import { toBrunoHttpHeaders } from '../common/headers';
6
6
  import { toBrunoVariables } from '../common/variables';
7
7
  import { toBrunoScripts } from '../common/scripts';
8
- import { uuid } from '../../../utils';
8
+ import { uuid, ensureString } from '../../../utils';
9
9
 
10
10
  const parseWebsocketRequest = (ocRequest: WebSocketRequest): BrunoItem => {
11
11
  const info = ocRequest.info;
@@ -13,7 +13,7 @@ const parseWebsocketRequest = (ocRequest: WebSocketRequest): BrunoItem => {
13
13
  const runtime = ocRequest.runtime;
14
14
 
15
15
  const brunoRequest: BrunoWebSocketRequest = {
16
- url: websocket?.url || '',
16
+ url: ensureString(websocket?.url),
17
17
  headers: toBrunoHttpHeaders(websocket?.headers) || [],
18
18
  auth: toBrunoAuth(websocket?.auth),
19
19
  body: {
@@ -36,11 +36,12 @@ const parseWebsocketRequest = (ocRequest: WebSocketRequest): BrunoItem => {
36
36
  // message
37
37
  if (websocket?.message) {
38
38
  const message = websocket.message as WebSocketMessage;
39
- if (message.data?.trim().length) {
39
+ const messageData = ensureString(message.data);
40
+ if (messageData.trim().length) {
40
41
  brunoRequest.body.ws = [{
41
42
  name: '',
42
43
  type: message.type || 'text',
43
- content: message.data
44
+ content: messageData
44
45
  }];
45
46
  }
46
47
  }
@@ -88,7 +89,7 @@ const parseWebsocketRequest = (ocRequest: WebSocketRequest): BrunoItem => {
88
89
  uid: uuid(),
89
90
  type: 'ws-request',
90
91
  seq: info?.seq || 1,
91
- name: info?.name || 'Untitled Request',
92
+ name: ensureString(info?.name, 'Untitled Request'),
92
93
  tags: info?.tags || [],
93
94
  request: brunoRequest,
94
95
  settings: wsSettings as any,
@@ -174,8 +174,9 @@ const stringifyHttpRequest = (item: BrunoItem): string => {
174
174
  if (example.response) {
175
175
  ocExample.response = {};
176
176
 
177
- if (example.response.status !== undefined && example.response.status !== null && isNumber(example.response.status)) {
178
- ocExample.response.status = Number(example.response.status);
177
+ const statusNum = Number(example.response.status);
178
+ if (Number.isInteger(statusNum) && statusNum > 0) {
179
+ ocExample.response.status = statusNum;
179
180
  }
180
181
 
181
182
  if (isNonEmptyString(example.response.statusText)) {
@@ -4,7 +4,9 @@ import { parseYml } from './utils';
4
4
  import { toBrunoAuth } from './common/auth';
5
5
  import { toBrunoHttpHeaders } from './common/headers';
6
6
  import { toBrunoVariables } from './common/variables';
7
+ import { toBrunoPostResponseVariables } from './common/actions';
7
8
  import { toBrunoScripts } from './common/scripts';
9
+ import { ensureString } from '../../utils';
8
10
 
9
11
  interface ParsedCollection {
10
12
  collectionRoot: FolderRoot;
@@ -18,17 +20,19 @@ const parseCollection = (ymlString: string): ParsedCollection => {
18
20
  // bruno config
19
21
  const brunoConfig: Record<string, any> = {
20
22
  opencollection: oc.opencollection || '1.0.0',
21
- name: oc.info?.name || 'Untitled Collection',
23
+ name: ensureString(oc.info?.name, 'Untitled Collection'),
22
24
  type: 'collection',
23
25
  ignore: []
24
26
  };
25
- if (oc.extensions?.ignore && Array.isArray(oc.extensions.ignore)) {
26
- brunoConfig.ignore = oc.extensions.ignore;
27
+
28
+ const brunoExtension = (oc.extensions as any)?.bruno;
29
+ if (brunoExtension?.ignore && Array.isArray(brunoExtension.ignore)) {
30
+ brunoConfig.ignore = brunoExtension.ignore;
27
31
  }
28
32
 
29
33
  // presets
30
- if (oc.extensions?.presets) {
31
- const presets = oc.extensions.presets as any;
34
+ if (brunoExtension?.presets) {
35
+ const presets = brunoExtension.presets as any;
32
36
  if (presets.request) {
33
37
  brunoConfig.presets = {
34
38
  requestType: presets.request.type || [],
@@ -37,15 +41,29 @@ const parseCollection = (ymlString: string): ParsedCollection => {
37
41
  }
38
42
  }
39
43
 
44
+ // bruno-specific script extensions
45
+ const brunoExtensions = oc.extensions?.bruno as any;
46
+ if (Array.isArray(brunoExtensions?.scripts?.additionalContextRoots)) {
47
+ const sanitizedRoots = brunoExtensions.scripts.additionalContextRoots
48
+ .filter((item: any) => typeof item === 'string');
49
+
50
+ if (sanitizedRoots.length > 0) {
51
+ brunoConfig.scripts = {
52
+ ...brunoConfig.scripts,
53
+ additionalContextRoots: sanitizedRoots
54
+ };
55
+ }
56
+ }
57
+
40
58
  // protobuf
41
59
  if (oc.config?.protobuf) {
42
60
  brunoConfig.protobuf = {
43
- protofFiles: oc.config.protobuf.protoFiles?.map((protoFile: any) => ({
61
+ protoFiles: oc.config.protobuf.protoFiles?.map((protoFile: any) => ({
44
62
  path: protoFile.path
45
63
  })) || [],
46
64
  importPaths: oc.config.protobuf.importPaths?.map((importPath: any) => ({
47
65
  path: importPath.path,
48
- disabled: importPath.disabled || false
66
+ enabled: importPath.disabled !== true
49
67
  })) || []
50
68
  };
51
69
  }
@@ -159,7 +177,11 @@ const parseCollection = (ymlString: string): ParsedCollection => {
159
177
 
160
178
  // variables
161
179
  const variables = toBrunoVariables(oc.request.variables);
162
- collectionRoot.request.vars = variables;
180
+ const postResponseVars = toBrunoPostResponseVariables((oc.request as any).actions);
181
+ collectionRoot.request.vars = {
182
+ req: variables.req,
183
+ res: postResponseVars
184
+ };
163
185
 
164
186
  // scripts
165
187
  const scripts = toBrunoScripts(oc.request.scripts);
@@ -2,7 +2,7 @@ import type { Environment as BrunoEnvironment, EnvironmentVariable as BrunoEnvir
2
2
  import type { Environment } from '@opencollection/types/config/environments';
3
3
  import type { Variable, SecretVariable } from '@opencollection/types/common/variables';
4
4
  import { parseYml } from './utils';
5
- import { uuid } from '../../utils';
5
+ import { uuid, ensureString } from '../../utils';
6
6
 
7
7
  const isSecretVariable = (v: Variable | SecretVariable): v is SecretVariable => {
8
8
  return 'secret' in v && v.secret === true;
@@ -17,7 +17,7 @@ const toBrunoEnvironmentVariables = (variables: (Variable | SecretVariable)[] |
17
17
  if (isSecretVariable(v)) {
18
18
  return {
19
19
  uid: uuid(),
20
- name: v.name || '',
20
+ name: ensureString(v.name),
21
21
  value: '',
22
22
  type: 'text',
23
23
  enabled: v.disabled !== true,
@@ -26,8 +26,8 @@ const toBrunoEnvironmentVariables = (variables: (Variable | SecretVariable)[] |
26
26
  }
27
27
  const variable: BrunoEnvironmentVariable = {
28
28
  uid: uuid(),
29
- name: v.name || '',
30
- value: (typeof v.value === 'string' ? v.value : '') || '',
29
+ name: ensureString(v.name),
30
+ value: ensureString(v.value),
31
31
  type: 'text',
32
32
  enabled: v.disabled !== true,
33
33
  secret: false
@@ -42,8 +42,9 @@ const parseEnvironment = (ymlString: string): BrunoEnvironment => {
42
42
 
43
43
  const brunoEnvironment: BrunoEnvironment = {
44
44
  uid: uuid(),
45
- name: ocEnvironment.name || 'Untitled Environment',
46
- variables: toBrunoEnvironmentVariables(ocEnvironment.variables)
45
+ name: ensureString(ocEnvironment.name, 'Untitled Environment'),
46
+ variables: toBrunoEnvironmentVariables(ocEnvironment.variables),
47
+ color: ocEnvironment.color || null
47
48
  };
48
49
 
49
50
  return brunoEnvironment;
@@ -4,8 +4,9 @@ import { parseYml } from './utils';
4
4
  import { toBrunoAuth } from './common/auth';
5
5
  import { toBrunoHttpHeaders } from './common/headers';
6
6
  import { toBrunoVariables } from './common/variables';
7
+ import { toBrunoPostResponseVariables } from './common/actions';
7
8
  import { toBrunoScripts } from './common/scripts';
8
- import { isNonEmptyString } from '../../utils';
9
+ import { ensureString } from '../../utils';
9
10
 
10
11
  const parseFolder = (ymlString: string): FolderRoot => {
11
12
  try {
@@ -15,7 +16,7 @@ const parseFolder = (ymlString: string): FolderRoot => {
15
16
 
16
17
  const folderRoot: FolderRoot = {
17
18
  meta: {
18
- name: info?.name || 'Untitled Folder',
19
+ name: ensureString(info?.name, 'Untitled Folder'),
19
20
  seq: info?.seq || 1
20
21
  },
21
22
  request: null,
@@ -52,7 +53,11 @@ const parseFolder = (ymlString: string): FolderRoot => {
52
53
 
53
54
  // variables
54
55
  const variables = toBrunoVariables(ocFolder.request.variables);
55
- folderRoot.request.vars = variables;
56
+ const postResponseVars = toBrunoPostResponseVariables((ocFolder.request as any).actions);
57
+ folderRoot.request.vars = {
58
+ req: variables.req,
59
+ res: postResponseVars
60
+ };
56
61
 
57
62
  // scripts
58
63
  const scripts = toBrunoScripts(ocFolder.request.scripts);