@skmtc/core 0.32.2 → 0.32.3

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.
@@ -98,8 +98,7 @@ export const toOperationsV3 = ({ paths, stackTrail, context }) => {
98
98
  }
99
99
  catch (error) {
100
100
  const normalized = error instanceof Error ? error : new Error(String(error));
101
- context.logIssue({
102
- key: method,
101
+ context.logIssueNoKey({
103
102
  parent: operation,
104
103
  level: 'error',
105
104
  message: normalized.message,
@@ -1,9 +1,23 @@
1
1
  import { OasServer } from '../../../oas/server/Server.js';
2
2
  import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
3
  import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
4
+ import { tryParseAt } from '../../../context/tryParseAt.js';
4
5
  export const toServersV3 = ({ servers, stackTrail, context }) => {
5
- return servers.map((server, index) => {
6
- return stackTrail.trace(server.url ?? index, st => toServerV3({ server, stackTrail: st, context }));
6
+ return servers.flatMap((server, index) => {
7
+ const parsed = tryParseAt({
8
+ stackTrail,
9
+ key: `${index}`,
10
+ context,
11
+ type: 'INVALID_OPERATION',
12
+ parent: servers,
13
+ fn: st => {
14
+ if (typeof server?.url !== 'string') {
15
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
16
+ }
17
+ return toServerV3({ server, stackTrail: st, context });
18
+ }
19
+ });
20
+ return parsed ? [parsed] : [];
7
21
  });
8
22
  };
9
23
  export const toOptionalServersV3 = ({ servers, stackTrail, context }) => {
@@ -111,8 +111,7 @@ export const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
111
111
  }
112
112
  catch (error) {
113
113
  const normalized = error instanceof Error ? error : new Error(String(error));
114
- context.logIssue({
115
- key: method,
114
+ context.logIssueNoKey({
116
115
  parent: operation,
117
116
  level: 'error',
118
117
  message: normalized.message,
@@ -101,8 +101,7 @@ export const toOperationsV3 = ({ paths, stackTrail, context }) => {
101
101
  }
102
102
  catch (error) {
103
103
  const normalized = error instanceof Error ? error : new Error(String(error));
104
- context.logIssue({
105
- key: method,
104
+ context.logIssueNoKey({
106
105
  parent: operation,
107
106
  level: 'error',
108
107
  message: normalized.message,
@@ -1,9 +1,23 @@
1
1
  import { OasServer } from '../../../oas/server/Server.js';
2
2
  import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
3
  import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
4
+ import { tryParseAt } from '../../../context/tryParseAt.js';
4
5
  export const toServersV3 = ({ servers, stackTrail, context }) => {
5
- return servers.map((server, index) => {
6
- return stackTrail.trace(server.url ?? index, st => toServerV3({ server, stackTrail: st, context }));
6
+ return servers.flatMap((server, index) => {
7
+ const parsed = tryParseAt({
8
+ stackTrail,
9
+ key: `${index}`,
10
+ context,
11
+ type: 'INVALID_OPERATION',
12
+ parent: servers,
13
+ fn: st => {
14
+ if (typeof server?.url !== 'string') {
15
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
16
+ }
17
+ return toServerV3({ server, stackTrail: st, context });
18
+ }
19
+ });
20
+ return parsed ? [parsed] : [];
7
21
  });
8
22
  };
9
23
  export const toOptionalServersV3 = ({ servers, stackTrail, context }) => {
@@ -111,8 +111,7 @@ export const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
111
111
  }
112
112
  catch (error) {
113
113
  const normalized = error instanceof Error ? error : new Error(String(error));
114
- context.logIssue({
115
- key: method,
114
+ context.logIssueNoKey({
116
115
  parent: operation,
117
116
  level: 'error',
118
117
  message: normalized.message,
@@ -110,8 +110,7 @@ export const toOperationsV3 = ({ paths, stackTrail, context }) => {
110
110
  }
111
111
  catch (error) {
112
112
  const normalized = error instanceof Error ? error : new Error(String(error));
113
- context.logIssue({
114
- key: method,
113
+ context.logIssueNoKey({
115
114
  parent: operation,
116
115
  level: 'error',
117
116
  message: normalized.message,
@@ -1,9 +1,23 @@
1
1
  import { OasServer } from '../../../oas/server/Server.js';
2
2
  import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
3
  import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
4
+ import { tryParseAt } from '../../../context/tryParseAt.js';
4
5
  export const toServersV3 = ({ servers, stackTrail, context }) => {
5
- return servers.map((server, index) => {
6
- return stackTrail.trace(server.url ?? index, st => toServerV3({ server, stackTrail: st, context }));
6
+ return servers.flatMap((server, index) => {
7
+ const parsed = tryParseAt({
8
+ stackTrail,
9
+ key: `${index}`,
10
+ context,
11
+ type: 'INVALID_OPERATION',
12
+ parent: servers,
13
+ fn: st => {
14
+ if (typeof server?.url !== 'string') {
15
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
16
+ }
17
+ return toServerV3({ server, stackTrail: st, context });
18
+ }
19
+ });
20
+ return parsed ? [parsed] : [];
7
21
  });
8
22
  };
9
23
  export const toOptionalServersV3 = ({ servers, stackTrail, context }) => {
@@ -120,8 +120,7 @@ export const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
120
120
  }
121
121
  catch (error) {
122
122
  const normalized = error instanceof Error ? error : new Error(String(error));
123
- context.logIssue({
124
- key: method,
123
+ context.logIssueNoKey({
125
124
  parent: operation,
126
125
  level: 'error',
127
126
  message: normalized.message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.32.2",
3
+ "version": "0.32.3",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -102,8 +102,7 @@ const toOperationsV3 = ({ paths, stackTrail, context }) => {
102
102
  }
103
103
  catch (error) {
104
104
  const normalized = error instanceof Error ? error : new Error(String(error));
105
- context.logIssue({
106
- key: method,
105
+ context.logIssueNoKey({
107
106
  parent: operation,
108
107
  level: 'error',
109
108
  message: normalized.message,
@@ -4,9 +4,23 @@ exports.toServerV3 = exports.toOptionalServersV3 = exports.toServersV3 = void 0;
4
4
  const Server_js_1 = require("../../../oas/server/Server.js");
5
5
  const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
6
6
  const toServerVariableV3_js_1 = require("../serverVariable/toServerVariableV3.js");
7
+ const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
7
8
  const toServersV3 = ({ servers, stackTrail, context }) => {
8
- return servers.map((server, index) => {
9
- return stackTrail.trace(server.url ?? index, st => (0, exports.toServerV3)({ server, stackTrail: st, context }));
9
+ return servers.flatMap((server, index) => {
10
+ const parsed = (0, tryParseAt_js_1.tryParseAt)({
11
+ stackTrail,
12
+ key: `${index}`,
13
+ context,
14
+ type: 'INVALID_OPERATION',
15
+ parent: servers,
16
+ fn: st => {
17
+ if (typeof server?.url !== 'string') {
18
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
19
+ }
20
+ return (0, exports.toServerV3)({ server, stackTrail: st, context });
21
+ }
22
+ });
23
+ return parsed ? [parsed] : [];
10
24
  });
11
25
  };
12
26
  exports.toServersV3 = toServersV3;
@@ -115,8 +115,7 @@ const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
115
115
  }
116
116
  catch (error) {
117
117
  const normalized = error instanceof Error ? error : new Error(String(error));
118
- context.logIssue({
119
- key: method,
118
+ context.logIssueNoKey({
120
119
  parent: operation,
121
120
  level: 'error',
122
121
  message: normalized.message,
@@ -105,8 +105,7 @@ const toOperationsV3 = ({ paths, stackTrail, context }) => {
105
105
  }
106
106
  catch (error) {
107
107
  const normalized = error instanceof Error ? error : new Error(String(error));
108
- context.logIssue({
109
- key: method,
108
+ context.logIssueNoKey({
110
109
  parent: operation,
111
110
  level: 'error',
112
111
  message: normalized.message,
@@ -4,9 +4,23 @@ exports.toServerV3 = exports.toOptionalServersV3 = exports.toServersV3 = void 0;
4
4
  const Server_js_1 = require("../../../oas/server/Server.js");
5
5
  const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
6
6
  const toServerVariableV3_js_1 = require("../serverVariable/toServerVariableV3.js");
7
+ const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
7
8
  const toServersV3 = ({ servers, stackTrail, context }) => {
8
- return servers.map((server, index) => {
9
- return stackTrail.trace(server.url ?? index, st => (0, exports.toServerV3)({ server, stackTrail: st, context }));
9
+ return servers.flatMap((server, index) => {
10
+ const parsed = (0, tryParseAt_js_1.tryParseAt)({
11
+ stackTrail,
12
+ key: `${index}`,
13
+ context,
14
+ type: 'INVALID_OPERATION',
15
+ parent: servers,
16
+ fn: st => {
17
+ if (typeof server?.url !== 'string') {
18
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
19
+ }
20
+ return (0, exports.toServerV3)({ server, stackTrail: st, context });
21
+ }
22
+ });
23
+ return parsed ? [parsed] : [];
10
24
  });
11
25
  };
12
26
  exports.toServersV3 = toServersV3;
@@ -115,8 +115,7 @@ const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
115
115
  }
116
116
  catch (error) {
117
117
  const normalized = error instanceof Error ? error : new Error(String(error));
118
- context.logIssue({
119
- key: method,
118
+ context.logIssueNoKey({
120
119
  parent: operation,
121
120
  level: 'error',
122
121
  message: normalized.message,
@@ -114,8 +114,7 @@ const toOperationsV3 = ({ paths, stackTrail, context }) => {
114
114
  }
115
115
  catch (error) {
116
116
  const normalized = error instanceof Error ? error : new Error(String(error));
117
- context.logIssue({
118
- key: method,
117
+ context.logIssueNoKey({
119
118
  parent: operation,
120
119
  level: 'error',
121
120
  message: normalized.message,
@@ -4,9 +4,23 @@ exports.toServerV3 = exports.toOptionalServersV3 = exports.toServersV3 = void 0;
4
4
  const Server_js_1 = require("../../../oas/server/Server.js");
5
5
  const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
6
6
  const toServerVariableV3_js_1 = require("../serverVariable/toServerVariableV3.js");
7
+ const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
7
8
  const toServersV3 = ({ servers, stackTrail, context }) => {
8
- return servers.map((server, index) => {
9
- return stackTrail.trace(server.url ?? index, st => (0, exports.toServerV3)({ server, stackTrail: st, context }));
9
+ return servers.flatMap((server, index) => {
10
+ const parsed = (0, tryParseAt_js_1.tryParseAt)({
11
+ stackTrail,
12
+ key: `${index}`,
13
+ context,
14
+ type: 'INVALID_OPERATION',
15
+ parent: servers,
16
+ fn: st => {
17
+ if (typeof server?.url !== 'string') {
18
+ throw new Error(`Expected a Server Object with a string url, got: ${JSON.stringify(server)}`);
19
+ }
20
+ return (0, exports.toServerV3)({ server, stackTrail: st, context });
21
+ }
22
+ });
23
+ return parsed ? [parsed] : [];
10
24
  });
11
25
  };
12
26
  exports.toServersV3 = toServersV3;
@@ -124,8 +124,7 @@ const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
124
124
  }
125
125
  catch (error) {
126
126
  const normalized = error instanceof Error ? error : new Error(String(error));
127
- context.logIssue({
128
- key: method,
127
+ context.logIssueNoKey({
129
128
  parent: operation,
130
129
  level: 'error',
131
130
  message: normalized.message,