@shipworthy/openapi-transformer 0.0.2 → 1.0.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.
Files changed (32) hide show
  1. package/README.md +19 -3
  2. package/dist/case.d.ts +15 -0
  3. package/dist/case.js +153 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/transformers/3.1/callbacks.d.ts +463 -465
  7. package/dist/transformers/3.1/callbacks.js +4 -4
  8. package/dist/transformers/3.1/content.js +4 -4
  9. package/dist/transformers/3.1/examples.d.ts +181 -183
  10. package/dist/transformers/3.1/examples.js +4 -4
  11. package/dist/transformers/3.1/extensions.d.ts +1 -1
  12. package/dist/transformers/3.1/extensions.js +2 -1
  13. package/dist/transformers/3.1/headers.d.ts +37 -39
  14. package/dist/transformers/3.1/headers.js +3 -3
  15. package/dist/transformers/3.1/index.d.ts +3700 -3712
  16. package/dist/transformers/3.1/index.js +2 -2
  17. package/dist/transformers/3.1/operation.d.ts +12 -8
  18. package/dist/transformers/3.1/operation.js +1 -2
  19. package/dist/transformers/3.1/parameters.d.ts +212 -214
  20. package/dist/transformers/3.1/parameters.js +2 -2
  21. package/dist/transformers/3.1/paths.d.ts +979 -977
  22. package/dist/transformers/3.1/paths.js +5 -4
  23. package/dist/transformers/3.1/pointer.js +5 -5
  24. package/dist/transformers/3.1/request.d.ts +176 -178
  25. package/dist/transformers/3.1/request.js +3 -3
  26. package/dist/transformers/3.1/responses.d.ts +134 -138
  27. package/dist/transformers/3.1/responses.js +5 -5
  28. package/dist/transformers/3.1/securities.d.ts +108 -110
  29. package/dist/transformers/3.1/securities.js +4 -4
  30. package/dist/transformers/3.1/servers.d.ts +14 -18
  31. package/dist/transformers/3.1/servers.js +2 -2
  32. package/package.json +6 -6
@@ -1,5 +1,5 @@
1
1
  import { OpenApiRequestBody, } from "@shipworthy/openapi-parser/schemas/3.1";
2
- import { Effect } from "effect";
2
+ import { Array, Effect, Record } from "effect";
3
3
  import { child, resolve } from "./pointer.js";
4
4
  import { readExtensions } from "./extensions.js";
5
5
  import { transformBodyContent } from "./content.js";
@@ -17,9 +17,9 @@ export const transformRequestBody = Effect.fnUntraced(function* (document, value
17
17
  };
18
18
  });
19
19
  export const transformRequestBodyMap = Effect.fnUntraced(function* (document, value, at) {
20
- const entries = yield* Effect.forEach(Object.entries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
20
+ const entries = yield* Effect.forEach(Record.toEntries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
21
21
  const body = yield* transformRequestBody(document, entry, child(at, key));
22
22
  return body === undefined ? [] : [[key, body]];
23
23
  }));
24
- return Object.fromEntries(entries.flat());
24
+ return Record.fromEntries(Array.flatten(entries));
25
25
  });
@@ -2001,27 +2001,25 @@ export declare const transformLinkMap: (document: {
2001
2001
  } | undefined;
2002
2002
  } | undefined;
2003
2003
  };
2004
- } | undefined, at: string) => Effect.Effect<{
2005
- [k: string]: {
2006
- id: string;
2007
- key: string;
2008
- reference: {
2009
- $ref: string;
2010
- summary: string | undefined;
2011
- description: string | undefined;
2012
- } | undefined;
2013
- operationRef: string | undefined;
2014
- operationId: string | undefined;
2015
- parameters: {
2016
- readonly [x: string]: unknown;
2017
- } | undefined;
2018
- requestBody?: unknown;
2004
+ } | undefined, at: string) => Effect.Effect<Record<string, {
2005
+ id: string;
2006
+ key: string;
2007
+ reference: {
2008
+ $ref: string;
2009
+ summary: string | undefined;
2019
2010
  description: string | undefined;
2020
- extensions: {
2021
- readonly [x: string]: unknown;
2022
- };
2011
+ } | undefined;
2012
+ operationRef: string | undefined;
2013
+ operationId: string | undefined;
2014
+ parameters: {
2015
+ readonly [x: string]: unknown;
2016
+ } | undefined;
2017
+ requestBody?: unknown;
2018
+ description: string | undefined;
2019
+ extensions: {
2020
+ readonly [x: string]: unknown;
2023
2021
  };
2024
- }, import("effect/SchemaIssue").Pointer, never>;
2022
+ }>, import("effect/SchemaIssue").Pointer, never>;
2025
2023
  export declare const transformResponse: (document: {
2026
2024
  readonly [x: string]: unknown;
2027
2025
  readonly openapi: string;
@@ -4445,16 +4443,32 @@ export declare const transformResponseMap: (document: {
4445
4443
  };
4446
4444
  } | undefined;
4447
4445
  };
4448
- } | undefined, at: string) => Effect.Effect<{
4449
- [k: string]: {
4450
- id: string;
4451
- reference: {
4452
- $ref: string;
4453
- summary: string | undefined;
4454
- description: string | undefined;
4446
+ } | undefined, at: string) => Effect.Effect<Record<string, {
4447
+ id: string;
4448
+ reference: {
4449
+ $ref: string;
4450
+ summary: string | undefined;
4451
+ description: string | undefined;
4452
+ } | undefined;
4453
+ description: string;
4454
+ headers: {
4455
+ readonly id: string;
4456
+ readonly extensions: {
4457
+ readonly [x: string]: unknown;
4458
+ };
4459
+ readonly reference?: {
4460
+ readonly $ref: string;
4461
+ readonly summary?: string | undefined;
4462
+ readonly description?: string | undefined;
4455
4463
  } | undefined;
4456
- description: string;
4457
- headers: {
4464
+ readonly name: string;
4465
+ readonly style: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited";
4466
+ readonly explode?: boolean | undefined;
4467
+ readonly required: boolean;
4468
+ readonly deprecated: boolean;
4469
+ readonly description?: string | undefined;
4470
+ readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4471
+ readonly contents: readonly {
4458
4472
  readonly id: string;
4459
4473
  readonly extensions: {
4460
4474
  readonly [x: string]: unknown;
@@ -4464,42 +4478,8 @@ export declare const transformResponseMap: (document: {
4464
4478
  readonly summary?: string | undefined;
4465
4479
  readonly description?: string | undefined;
4466
4480
  } | undefined;
4467
- readonly name: string;
4468
- readonly style: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited";
4469
- readonly explode?: boolean | undefined;
4470
- readonly required: boolean;
4471
- readonly deprecated: boolean;
4472
- readonly description?: string | undefined;
4481
+ readonly mediaType: string;
4473
4482
  readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4474
- readonly contents: readonly {
4475
- readonly id: string;
4476
- readonly extensions: {
4477
- readonly [x: string]: unknown;
4478
- };
4479
- readonly reference?: {
4480
- readonly $ref: string;
4481
- readonly summary?: string | undefined;
4482
- readonly description?: string | undefined;
4483
- } | undefined;
4484
- readonly mediaType: string;
4485
- readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4486
- readonly examples: readonly {
4487
- readonly id: string;
4488
- readonly extensions: {
4489
- readonly [x: string]: unknown;
4490
- };
4491
- readonly reference?: {
4492
- readonly $ref: string;
4493
- readonly summary?: string | undefined;
4494
- readonly description?: string | undefined;
4495
- } | undefined;
4496
- readonly key: string;
4497
- readonly summary?: string | undefined;
4498
- readonly description?: string | undefined;
4499
- readonly value?: unknown;
4500
- readonly externalValue?: string | undefined;
4501
- }[];
4502
- }[];
4503
4483
  readonly examples: readonly {
4504
4484
  readonly id: string;
4505
4485
  readonly extensions: {
@@ -4517,13 +4497,55 @@ export declare const transformResponseMap: (document: {
4517
4497
  readonly externalValue?: string | undefined;
4518
4498
  }[];
4519
4499
  }[];
4520
- contents: {
4521
- id: string;
4522
- mediaType: string;
4523
- schema: boolean | {
4500
+ readonly examples: readonly {
4501
+ readonly id: string;
4502
+ readonly extensions: {
4524
4503
  readonly [x: string]: unknown;
4504
+ };
4505
+ readonly reference?: {
4506
+ readonly $ref: string;
4507
+ readonly summary?: string | undefined;
4508
+ readonly description?: string | undefined;
4525
4509
  } | undefined;
4526
- examples: {
4510
+ readonly key: string;
4511
+ readonly summary?: string | undefined;
4512
+ readonly description?: string | undefined;
4513
+ readonly value?: unknown;
4514
+ readonly externalValue?: string | undefined;
4515
+ }[];
4516
+ }[];
4517
+ contents: {
4518
+ id: string;
4519
+ mediaType: string;
4520
+ schema: boolean | {
4521
+ readonly [x: string]: unknown;
4522
+ } | undefined;
4523
+ examples: {
4524
+ readonly id: string;
4525
+ readonly extensions: {
4526
+ readonly [x: string]: unknown;
4527
+ };
4528
+ readonly reference?: {
4529
+ readonly $ref: string;
4530
+ readonly summary?: string | undefined;
4531
+ readonly description?: string | undefined;
4532
+ } | undefined;
4533
+ readonly key: string;
4534
+ readonly summary?: string | undefined;
4535
+ readonly description?: string | undefined;
4536
+ readonly value?: unknown;
4537
+ readonly externalValue?: string | undefined;
4538
+ }[];
4539
+ extensions: {
4540
+ readonly [x: string]: unknown;
4541
+ };
4542
+ encodings: {
4543
+ property: string;
4544
+ mediaType: string | undefined;
4545
+ style: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited";
4546
+ explode: boolean | undefined;
4547
+ allowReserved: boolean | undefined;
4548
+ headers: {
4527
4549
  readonly id: string;
4528
4550
  readonly extensions: {
4529
4551
  readonly [x: string]: unknown;
@@ -4533,22 +4555,14 @@ export declare const transformResponseMap: (document: {
4533
4555
  readonly summary?: string | undefined;
4534
4556
  readonly description?: string | undefined;
4535
4557
  } | undefined;
4536
- readonly key: string;
4537
- readonly summary?: string | undefined;
4558
+ readonly name: string;
4559
+ readonly style: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited";
4560
+ readonly explode?: boolean | undefined;
4561
+ readonly required: boolean;
4562
+ readonly deprecated: boolean;
4538
4563
  readonly description?: string | undefined;
4539
- readonly value?: unknown;
4540
- readonly externalValue?: string | undefined;
4541
- }[];
4542
- extensions: {
4543
- readonly [x: string]: unknown;
4544
- };
4545
- encodings: {
4546
- property: string;
4547
- mediaType: string | undefined;
4548
- style: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited";
4549
- explode: boolean | undefined;
4550
- allowReserved: boolean | undefined;
4551
- headers: {
4564
+ readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4565
+ readonly contents: readonly {
4552
4566
  readonly id: string;
4553
4567
  readonly extensions: {
4554
4568
  readonly [x: string]: unknown;
@@ -4558,42 +4572,8 @@ export declare const transformResponseMap: (document: {
4558
4572
  readonly summary?: string | undefined;
4559
4573
  readonly description?: string | undefined;
4560
4574
  } | undefined;
4561
- readonly name: string;
4562
- readonly style: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited";
4563
- readonly explode?: boolean | undefined;
4564
- readonly required: boolean;
4565
- readonly deprecated: boolean;
4566
- readonly description?: string | undefined;
4575
+ readonly mediaType: string;
4567
4576
  readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4568
- readonly contents: readonly {
4569
- readonly id: string;
4570
- readonly extensions: {
4571
- readonly [x: string]: unknown;
4572
- };
4573
- readonly reference?: {
4574
- readonly $ref: string;
4575
- readonly summary?: string | undefined;
4576
- readonly description?: string | undefined;
4577
- } | undefined;
4578
- readonly mediaType: string;
4579
- readonly schema?: import("../../model/schema.ts").ParsedSchema | undefined;
4580
- readonly examples: readonly {
4581
- readonly id: string;
4582
- readonly extensions: {
4583
- readonly [x: string]: unknown;
4584
- };
4585
- readonly reference?: {
4586
- readonly $ref: string;
4587
- readonly summary?: string | undefined;
4588
- readonly description?: string | undefined;
4589
- } | undefined;
4590
- readonly key: string;
4591
- readonly summary?: string | undefined;
4592
- readonly description?: string | undefined;
4593
- readonly value?: unknown;
4594
- readonly externalValue?: string | undefined;
4595
- }[];
4596
- }[];
4597
4577
  readonly examples: readonly {
4598
4578
  readonly id: string;
4599
4579
  readonly extensions: {
@@ -4611,35 +4591,51 @@ export declare const transformResponseMap: (document: {
4611
4591
  readonly externalValue?: string | undefined;
4612
4592
  }[];
4613
4593
  }[];
4614
- extensions: {
4615
- readonly [x: string]: unknown;
4616
- };
4594
+ readonly examples: readonly {
4595
+ readonly id: string;
4596
+ readonly extensions: {
4597
+ readonly [x: string]: unknown;
4598
+ };
4599
+ readonly reference?: {
4600
+ readonly $ref: string;
4601
+ readonly summary?: string | undefined;
4602
+ readonly description?: string | undefined;
4603
+ } | undefined;
4604
+ readonly key: string;
4605
+ readonly summary?: string | undefined;
4606
+ readonly description?: string | undefined;
4607
+ readonly value?: unknown;
4608
+ readonly externalValue?: string | undefined;
4609
+ }[];
4617
4610
  }[];
4618
- }[];
4619
- links: {
4620
- id: string;
4621
- key: string;
4622
- reference: {
4623
- $ref: string;
4624
- summary: string | undefined;
4625
- description: string | undefined;
4626
- } | undefined;
4627
- operationRef: string | undefined;
4628
- operationId: string | undefined;
4629
- parameters: {
4630
- readonly [x: string]: unknown;
4631
- } | undefined;
4632
- requestBody?: unknown;
4633
- description: string | undefined;
4634
4611
  extensions: {
4635
4612
  readonly [x: string]: unknown;
4636
4613
  };
4637
4614
  }[];
4615
+ }[];
4616
+ links: {
4617
+ id: string;
4618
+ key: string;
4619
+ reference: {
4620
+ $ref: string;
4621
+ summary: string | undefined;
4622
+ description: string | undefined;
4623
+ } | undefined;
4624
+ operationRef: string | undefined;
4625
+ operationId: string | undefined;
4626
+ parameters: {
4627
+ readonly [x: string]: unknown;
4628
+ } | undefined;
4629
+ requestBody?: unknown;
4630
+ description: string | undefined;
4638
4631
  extensions: {
4639
4632
  readonly [x: string]: unknown;
4640
4633
  };
4634
+ }[];
4635
+ extensions: {
4636
+ readonly [x: string]: unknown;
4641
4637
  };
4642
- }, import("effect/SchemaIssue").Issue, never>;
4638
+ }>, import("effect/SchemaIssue").Issue, never>;
4643
4639
  export declare const transformOperationResponses: (document: {
4644
4640
  readonly [x: string]: unknown;
4645
4641
  readonly openapi: string;
@@ -1,5 +1,5 @@
1
1
  import { OpenApiLink, OpenApiResponse, } from "@shipworthy/openapi-parser/schemas/3.1";
2
- import { Effect } from "effect";
2
+ import { Array, Effect, Record, String } from "effect";
3
3
  import { child, resolve } from "./pointer.js";
4
4
  import { readExtensions } from "./extensions.js";
5
5
  import { transformBodyContent } from "./content.js";
@@ -19,7 +19,7 @@ export const transformLink = Effect.fnUntraced(function* (document, key, value,
19
19
  };
20
20
  });
21
21
  export const transformLinkMap = Effect.fnUntraced(function* (document, value, at) {
22
- return Object.fromEntries(yield* Effect.forEach(Object.entries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
22
+ return Record.fromEntries(yield* Effect.forEach(Record.toEntries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
23
23
  return [key, yield* transformLink(document, key, entry, child(at, key))];
24
24
  })));
25
25
  });
@@ -31,17 +31,17 @@ export const transformResponse = Effect.fnUntraced(function* (document, value, a
31
31
  description: reference?.description ?? response.description,
32
32
  headers: yield* transformHeaderList(document, response.headers, child(id, "headers")),
33
33
  contents: yield* transformBodyContent(document, response.content, child(id, "content")),
34
- links: Object.values(yield* transformLinkMap(document, response.links, child(id, "links"))),
34
+ links: Record.values(yield* transformLinkMap(document, response.links, child(id, "links"))),
35
35
  extensions: readExtensions(response),
36
36
  };
37
37
  });
38
38
  export const transformResponseMap = Effect.fnUntraced(function* (document, value, at) {
39
- return Object.fromEntries(yield* Effect.forEach(Object.entries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
39
+ return Record.fromEntries(yield* Effect.forEach(Record.toEntries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
40
40
  return [key, yield* transformResponse(document, entry, child(at, key))];
41
41
  })));
42
42
  });
43
43
  export const transformOperationResponses = Effect.fnUntraced(function* (document, value, at) {
44
- const entries = Object.entries(value ?? {}).filter(([code]) => !code.startsWith("x-"));
44
+ const entries = Array.filter(Record.toEntries(value ?? {}), ([code]) => !String.startsWith("x-")(code));
45
45
  return yield* Effect.forEach(entries, Effect.fnUntraced(function* ([code, entry]) {
46
46
  const fields = yield* transformResponse(document, entry, child(at, code));
47
47
  return { ...fields, code };
@@ -1035,128 +1035,126 @@ export declare const transformSecuritySchemeMap: (document: {
1035
1035
  readonly type: "mutualTLS";
1036
1036
  readonly description?: string | undefined;
1037
1037
  };
1038
- } | undefined, at: string) => Effect.Effect<{
1039
- [k: string]: {
1040
- id: string;
1041
- key: string;
1042
- reference: {
1043
- $ref: string;
1044
- summary: string | undefined;
1045
- description: string | undefined;
1046
- } | undefined;
1038
+ } | undefined, at: string) => Effect.Effect<Record<string, {
1039
+ id: string;
1040
+ key: string;
1041
+ reference: {
1042
+ $ref: string;
1043
+ summary: string | undefined;
1047
1044
  description: string | undefined;
1048
- extensions: {
1049
- readonly [x: string]: unknown;
1050
- };
1051
- type: "oauth2";
1052
- flows: {
1053
- implicit: {
1054
- authorizationUrl: string | undefined;
1055
- tokenUrl: string | undefined;
1056
- refreshUrl: string | undefined;
1057
- scopes: {
1058
- readonly [x: string]: string;
1059
- };
1060
- extensions: {
1061
- readonly [x: string]: unknown;
1062
- };
1063
- } | undefined;
1064
- password: {
1065
- authorizationUrl: string | undefined;
1066
- tokenUrl: string | undefined;
1067
- refreshUrl: string | undefined;
1068
- scopes: {
1069
- readonly [x: string]: string;
1070
- };
1071
- extensions: {
1072
- readonly [x: string]: unknown;
1073
- };
1074
- } | undefined;
1075
- clientCredentials: {
1076
- authorizationUrl: string | undefined;
1077
- tokenUrl: string | undefined;
1078
- refreshUrl: string | undefined;
1079
- scopes: {
1080
- readonly [x: string]: string;
1081
- };
1082
- extensions: {
1083
- readonly [x: string]: unknown;
1084
- };
1085
- } | undefined;
1086
- authorizationCode: {
1087
- authorizationUrl: string | undefined;
1088
- tokenUrl: string | undefined;
1089
- refreshUrl: string | undefined;
1090
- scopes: {
1091
- readonly [x: string]: string;
1092
- };
1093
- extensions: {
1094
- readonly [x: string]: unknown;
1095
- };
1096
- } | undefined;
1045
+ } | undefined;
1046
+ description: string | undefined;
1047
+ extensions: {
1048
+ readonly [x: string]: unknown;
1049
+ };
1050
+ type: "oauth2";
1051
+ flows: {
1052
+ implicit: {
1053
+ authorizationUrl: string | undefined;
1054
+ tokenUrl: string | undefined;
1055
+ refreshUrl: string | undefined;
1056
+ scopes: {
1057
+ readonly [x: string]: string;
1058
+ };
1097
1059
  extensions: {
1098
1060
  readonly [x: string]: unknown;
1099
1061
  };
1100
- };
1101
- } | {
1102
- type: "apiKey";
1103
- name: string;
1104
- in: "cookie" | "header" | "query";
1105
- id: string;
1106
- key: string;
1107
- reference: {
1108
- $ref: string;
1109
- summary: string | undefined;
1110
- description: string | undefined;
1111
1062
  } | undefined;
1112
- description: string | undefined;
1113
- extensions: {
1114
- readonly [x: string]: unknown;
1115
- };
1116
- } | {
1117
- type: "http";
1118
- scheme: string;
1119
- bearerFormat?: string | undefined;
1120
- id: string;
1121
- key: string;
1122
- reference: {
1123
- $ref: string;
1124
- summary: string | undefined;
1125
- description: string | undefined;
1063
+ password: {
1064
+ authorizationUrl: string | undefined;
1065
+ tokenUrl: string | undefined;
1066
+ refreshUrl: string | undefined;
1067
+ scopes: {
1068
+ readonly [x: string]: string;
1069
+ };
1070
+ extensions: {
1071
+ readonly [x: string]: unknown;
1072
+ };
1126
1073
  } | undefined;
1127
- description: string | undefined;
1128
- extensions: {
1129
- readonly [x: string]: unknown;
1130
- };
1131
- } | {
1132
- type: "openIdConnect";
1133
- openIdConnectUrl: string;
1134
- id: string;
1135
- key: string;
1136
- reference: {
1137
- $ref: string;
1138
- summary: string | undefined;
1139
- description: string | undefined;
1074
+ clientCredentials: {
1075
+ authorizationUrl: string | undefined;
1076
+ tokenUrl: string | undefined;
1077
+ refreshUrl: string | undefined;
1078
+ scopes: {
1079
+ readonly [x: string]: string;
1080
+ };
1081
+ extensions: {
1082
+ readonly [x: string]: unknown;
1083
+ };
1140
1084
  } | undefined;
1141
- description: string | undefined;
1142
- extensions: {
1143
- readonly [x: string]: unknown;
1144
- };
1145
- } | {
1146
- type: "mutualTLS";
1147
- id: string;
1148
- key: string;
1149
- reference: {
1150
- $ref: string;
1151
- summary: string | undefined;
1152
- description: string | undefined;
1085
+ authorizationCode: {
1086
+ authorizationUrl: string | undefined;
1087
+ tokenUrl: string | undefined;
1088
+ refreshUrl: string | undefined;
1089
+ scopes: {
1090
+ readonly [x: string]: string;
1091
+ };
1092
+ extensions: {
1093
+ readonly [x: string]: unknown;
1094
+ };
1153
1095
  } | undefined;
1154
- description: string | undefined;
1155
1096
  extensions: {
1156
1097
  readonly [x: string]: unknown;
1157
1098
  };
1158
1099
  };
1159
- }, import("effect/SchemaIssue").Pointer, never>;
1100
+ } | {
1101
+ type: "apiKey";
1102
+ name: string;
1103
+ in: "cookie" | "header" | "query";
1104
+ id: string;
1105
+ key: string;
1106
+ reference: {
1107
+ $ref: string;
1108
+ summary: string | undefined;
1109
+ description: string | undefined;
1110
+ } | undefined;
1111
+ description: string | undefined;
1112
+ extensions: {
1113
+ readonly [x: string]: unknown;
1114
+ };
1115
+ } | {
1116
+ type: "http";
1117
+ scheme: string;
1118
+ bearerFormat?: string | undefined;
1119
+ id: string;
1120
+ key: string;
1121
+ reference: {
1122
+ $ref: string;
1123
+ summary: string | undefined;
1124
+ description: string | undefined;
1125
+ } | undefined;
1126
+ description: string | undefined;
1127
+ extensions: {
1128
+ readonly [x: string]: unknown;
1129
+ };
1130
+ } | {
1131
+ type: "openIdConnect";
1132
+ openIdConnectUrl: string;
1133
+ id: string;
1134
+ key: string;
1135
+ reference: {
1136
+ $ref: string;
1137
+ summary: string | undefined;
1138
+ description: string | undefined;
1139
+ } | undefined;
1140
+ description: string | undefined;
1141
+ extensions: {
1142
+ readonly [x: string]: unknown;
1143
+ };
1144
+ } | {
1145
+ type: "mutualTLS";
1146
+ id: string;
1147
+ key: string;
1148
+ reference: {
1149
+ $ref: string;
1150
+ summary: string | undefined;
1151
+ description: string | undefined;
1152
+ } | undefined;
1153
+ description: string | undefined;
1154
+ extensions: {
1155
+ readonly [x: string]: unknown;
1156
+ };
1157
+ }>, import("effect/SchemaIssue").Pointer, never>;
1160
1158
  export declare const transformSecurityRequirements: (value: readonly OpenApiSecurityRequirement[] | undefined, schemes: Readonly<Record<string, typeof ParsedSecurityScheme.Encoded>>) => Effect.Effect<{
1161
1159
  readonly scheme: {
1162
1160
  readonly id: string;
@@ -1,5 +1,5 @@
1
1
  import { OpenApiSecurityScheme, } from "@shipworthy/openapi-parser/schemas/3.1";
2
- import { Effect } from "effect";
2
+ import { Array, Effect, Record } from "effect";
3
3
  import { child, resolve } from "./pointer.js";
4
4
  import { readExtensions } from "./extensions.js";
5
5
  const transformOAuthFlow = (value) => Effect.sync(() => {
@@ -41,14 +41,14 @@ const transformSecurityScheme = Effect.fnUntraced(function* (document, key, valu
41
41
  return { ...scheme, ...common };
42
42
  });
43
43
  export const transformSecuritySchemeMap = Effect.fnUntraced(function* (document, value, at) {
44
- return Object.fromEntries(yield* Effect.forEach(Object.entries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
44
+ return Record.fromEntries(yield* Effect.forEach(Record.toEntries(value ?? {}), Effect.fnUntraced(function* ([key, entry]) {
45
45
  return [key, yield* transformSecurityScheme(document, key, entry, child(at, key))];
46
46
  })));
47
47
  });
48
48
  export const transformSecurityRequirements = (value, schemes) => Effect.sync(() => {
49
- return (value ?? []).map((entry) => {
49
+ return Array.map(value ?? [], (entry) => {
50
50
  const uses = [];
51
- for (const [key, scopes] of Object.entries(entry)) {
51
+ for (const [key, scopes] of Record.toEntries(entry)) {
52
52
  const scheme = schemes[key];
53
53
  if (scheme)
54
54
  uses.push({ scheme, scopes });