@scalar/api-client 2.17.3 → 2.17.4

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 (104) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +15 -10
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +70 -55
  6. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +12 -8
  8. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +3 -5
  9. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +31 -31
  11. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +4 -6
  12. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/build-request.js +20 -21
  14. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  15. package/dist/v2/blocks/operation-block/helpers/get-example.js +22 -16
  16. package/dist/v2/blocks/operation-block/helpers/send-request.js +26 -26
  17. package/dist/v2/blocks/operation-block/index.d.ts +1 -0
  18. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-block/index.js +4 -2
  20. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +9 -4
  21. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  23. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +81 -88
  24. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -4
  25. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  26. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  27. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  28. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +1 -1
  29. package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -0
  30. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  31. package/dist/v2/blocks/operation-code-sample/index.js +11 -9
  32. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
  33. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  35. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +59 -63
  36. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  37. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  38. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +78 -74
  39. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +3 -3
  40. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  41. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +43 -42
  42. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +96 -86
  44. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +8 -0
  45. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +1 -0
  46. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +33 -0
  47. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +7 -0
  48. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +1 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +13 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +3 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  52. package/dist/v2/blocks/scalar-auth-selector-block/index.js +8 -2
  53. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  54. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  55. package/dist/v2/components/data-table/DataTableInput.vue2.js +25 -24
  56. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  57. package/dist/v2/features/app/App.vue.js +34 -33
  58. package/dist/v2/features/app/helpers/routes.d.ts +2 -0
  59. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  60. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -1
  61. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +29 -29
  62. package/dist/v2/features/collection/DocumentCollection.vue.js +4 -3
  63. package/dist/v2/features/collection/WorkspaceCollection.vue.js +8 -7
  64. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  65. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  66. package/dist/v2/features/collection/components/Authentication.vue2.js +7 -6
  67. package/dist/v2/features/collection/components/Cookies.vue.js +1 -0
  68. package/dist/v2/features/collection/components/Environment.vue.js +1 -0
  69. package/dist/v2/features/collection/components/Overview.vue2.js +8 -7
  70. package/dist/v2/features/collection/components/Servers.vue.js +25 -24
  71. package/dist/v2/features/collection/components/Settings.vue.js +8 -7
  72. package/dist/v2/features/modal/Modal.vue.d.ts +6 -0
  73. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  74. package/dist/v2/features/modal/Modal.vue.js +2 -2
  75. package/dist/v2/features/modal/Modal.vue2.js +66 -62
  76. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +16 -16
  77. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  78. package/dist/v2/features/modal/helpers/create-api-client-modal.js +36 -29
  79. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -1
  80. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +25 -12
  81. package/dist/v2/features/modal/index.d.ts +2 -1
  82. package/dist/v2/features/modal/index.d.ts.map +1 -1
  83. package/dist/v2/features/modal/index.js +3 -1
  84. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  85. package/dist/v2/features/operation/Operation.vue.js +54 -62
  86. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
  87. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
  88. package/dist/v2/features/operation/helpers/get-security-requirements.js +2 -2
  89. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -2
  90. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  91. package/dist/v2/features/operation/helpers/get-selected-security.js +11 -11
  92. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +10 -0
  93. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -0
  94. package/dist/v2/features/operation/helpers/get-selected-server.js +4 -0
  95. package/dist/v2/features/operation/index.d.ts +3 -0
  96. package/dist/v2/features/operation/index.d.ts.map +1 -1
  97. package/dist/v2/features/operation/index.js +8 -2
  98. package/dist/v2/helpers/index.d.ts +3 -0
  99. package/dist/v2/helpers/index.d.ts.map +1 -0
  100. package/dist/v2/helpers/index.js +4 -0
  101. package/dist/v2/helpers/plugins.d.ts +7 -1
  102. package/dist/v2/helpers/plugins.d.ts.map +1 -1
  103. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  104. package/package.json +22 -17
@@ -1,8 +1,8 @@
1
- import { defineComponent as z, computed as r, createBlock as u, openBlock as s, unref as l, normalizeClass as D, withCtx as n, createVNode as d, createCommentVNode as c, createElementVNode as m, createElementBlock as v, Fragment as U, toDisplayString as $ } from "vue";
1
+ import { defineComponent as T, computed as r, createBlock as m, openBlock as s, unref as l, normalizeClass as z, withCtx as n, createVNode as i, createCommentVNode as c, createElementVNode as u, createElementBlock as v, Fragment as D, toDisplayString as $ } from "vue";
2
2
  import { ScalarTooltip as q, ScalarIcon as h, ScalarButton as y } from "@scalar/components";
3
3
  import { ScalarIconTrash as I } from "@scalar/icons";
4
4
  import { unpackProxyObject as p } from "@scalar/workspace-store/helpers/unpack-proxy";
5
- import { RouterLink as S } from "vue-router";
5
+ import { RouterLink as U } from "vue-router";
6
6
  import { getFileName as k } from "../helpers/files.js";
7
7
  import { validateParameter as j } from "../helpers/validate-parameter.js";
8
8
  import E from "./RequestTableTooltip.vue.js";
@@ -13,7 +13,7 @@ import w from "../../../components/code-input/CodeInput.vue.js";
13
13
  const P = { class: "text-c-2 filemask flex w-full max-w-[100%] items-center justify-center overflow-hidden p-1" }, G = {
14
14
  key: 1,
15
15
  class: "p-0.5"
16
- }, ee = /* @__PURE__ */ z({
16
+ }, ee = /* @__PURE__ */ T({
17
17
  __name: "RequestTableRow",
18
18
  props: {
19
19
  data: {},
@@ -25,45 +25,45 @@ const P = { class: "text-c-2 filemask flex w-full max-w-[100%] items-center just
25
25
  showUploadButton: { type: Boolean }
26
26
  },
27
27
  emits: ["updateRow", "deleteRow", "uploadFile", "removeFile"],
28
- setup(t, { emit: R }) {
29
- const i = R, V = r(() => t.data.schema?.default), g = r(() => t.data.schema?.enum), B = r(
28
+ setup(t, { emit: g }) {
29
+ const d = g, R = r(() => t.data.schema?.default), V = r(() => t.data.schema?.enum), B = r(
30
30
  () => t.data.schema && "minimum" in t.data.schema ? t.data.schema.minimum : void 0
31
31
  ), C = r(
32
32
  () => t.data.schema && "maximum" in t.data.schema ? t.data.schema.maximum : void 0
33
- ), F = r(
33
+ ), x = r(
34
34
  () => t.data.schema && "type" in t.data.schema ? t.data.schema.type : void 0
35
35
  ), b = r(
36
36
  () => j(t.data.schema, t.data.value)
37
- ), x = (e) => e instanceof File, T = r({
37
+ ), F = (e) => e instanceof File, S = r({
38
38
  get: () => {
39
39
  const e = p(t.data.value);
40
40
  return e instanceof File ? k(p(t.data.value)) ?? "" : e === null ? "" : e;
41
41
  },
42
42
  set: (e) => {
43
- typeof e == "string" && i("updateRow", { value: e });
43
+ typeof e == "string" && d("updateRow", { value: e });
44
44
  }
45
45
  });
46
- return (e, a) => (s(), u(l(N), {
46
+ return (e, a) => (s(), m(l(N), {
47
47
  id: e.data.name,
48
- class: D({
48
+ class: z({
49
49
  alert: b.value.ok === !1,
50
50
  error: b.value.ok === !1 && e.invalidParams?.has(e.data.name)
51
51
  })
52
52
  }, {
53
53
  default: n(() => [
54
- e.data.globalRoute !== void 0 ? (s(), u(l(S), {
54
+ e.data.globalRoute !== void 0 ? (s(), m(l(U), {
55
55
  key: 0,
56
56
  class: "text-c-2 flex items-center justify-center border-t !border-r",
57
57
  to: e.data.globalRoute ?? {}
58
58
  }, {
59
59
  default: n(() => [
60
- a[7] || (a[7] = m("span", { class: "sr-only" }, "Global", -1)),
61
- d(l(q), {
60
+ a[7] || (a[7] = u("span", { class: "sr-only" }, "Global", -1)),
61
+ i(l(q), {
62
62
  content: "Global cookies are shared across the whole workspace.",
63
63
  placement: "top"
64
64
  }, {
65
65
  default: n(() => [
66
- d(l(h), {
66
+ i(l(h), {
67
67
  class: "text-c-1",
68
68
  icon: "Globe",
69
69
  size: "xs",
@@ -74,16 +74,16 @@ const P = { class: "text-c-2 filemask flex w-full max-w-[100%] items-center just
74
74
  })
75
75
  ]),
76
76
  _: 1
77
- }, 8, ["to"])) : (s(), u(l(O), {
77
+ }, 8, ["to"])) : (s(), m(l(O), {
78
78
  key: 1,
79
79
  class: "!border-r",
80
80
  disabled: e.hasCheckboxDisabled ?? !1,
81
81
  modelValue: !e.data.isDisabled,
82
- "onUpdate:modelValue": a[0] || (a[0] = (o) => i("updateRow", { isDisabled: !o }))
82
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => d("updateRow", { isDisabled: !o }))
83
83
  }, null, 8, ["disabled", "modelValue"])),
84
- d(l(f), null, {
84
+ i(l(f), null, {
85
85
  default: n(() => [
86
- d(l(w), {
86
+ i(l(w), {
87
87
  "aria-label": `${e.label} Key`,
88
88
  disableCloseBrackets: "",
89
89
  disabled: e.isReadOnly,
@@ -94,46 +94,47 @@ const P = { class: "text-c-2 filemask flex w-full max-w-[100%] items-center just
94
94
  modelValue: e.data.name,
95
95
  placeholder: "Key",
96
96
  required: !!e.data.isRequired,
97
- onSelectVariable: a[1] || (a[1] = (o) => i("updateRow", { key: o })),
98
- "onUpdate:modelValue": a[2] || (a[2] = (o) => i("updateRow", { key: o }))
97
+ onSelectVariable: a[1] || (a[1] = (o) => d("updateRow", { key: o })),
98
+ "onUpdate:modelValue": a[2] || (a[2] = (o) => d("updateRow", { key: o }))
99
99
  }, null, 8, ["aria-label", "disabled", "environment", "modelValue", "required"])
100
100
  ]),
101
101
  _: 1
102
102
  }),
103
- d(l(f), null, {
103
+ i(l(f), null, {
104
104
  default: n(() => [
105
- d(l(w), {
105
+ i(l(w), {
106
106
  "aria-label": `${e.label} Value`,
107
107
  class: "pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10",
108
- default: V.value,
108
+ default: R.value,
109
109
  disableCloseBrackets: "",
110
110
  disabled: e.isReadOnly,
111
111
  disableEnter: "",
112
112
  disableTabIndent: "",
113
- enum: g.value ?? [],
113
+ enum: V.value ?? [],
114
114
  environment: e.environment,
115
+ examples: e.data.schema?.examples?.map((o) => String(o)) ?? [],
115
116
  lineWrapping: "",
116
117
  max: C.value,
117
118
  min: B.value,
118
- modelValue: T.value,
119
+ modelValue: S.value,
119
120
  placeholder: "Value",
120
- type: F.value,
121
- "onUpdate:modelValue": a[4] || (a[4] = (o) => i("updateRow", { value: o }))
121
+ type: x.value,
122
+ "onUpdate:modelValue": a[4] || (a[4] = (o) => d("updateRow", { value: o }))
122
123
  }, {
123
124
  icon: n(() => [
124
- (e.data.name || e.data.value) && !e.data.isRequired ? (s(), u(l(y), {
125
+ (e.data.name || e.data.value) && !e.data.isRequired ? (s(), m(l(y), {
125
126
  key: 0,
126
127
  class: "text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex",
127
128
  size: "sm",
128
129
  variant: "ghost",
129
- onClick: a[3] || (a[3] = (o) => i("deleteRow"))
130
+ onClick: a[3] || (a[3] = (o) => d("deleteRow"))
130
131
  }, {
131
132
  default: n(() => [
132
- d(l(I), { class: "size-3.5" })
133
+ i(l(I), { class: "size-3.5" })
133
134
  ]),
134
135
  _: 1
135
136
  })) : c("", !0),
136
- e.data.schema ? (s(), u(E, {
137
+ e.data.schema ? (s(), m(E, {
137
138
  key: 1,
138
139
  description: e.data.description,
139
140
  schema: e.data.schema,
@@ -141,34 +142,34 @@ const P = { class: "text-c-2 filemask flex w-full max-w-[100%] items-center just
141
142
  }, null, 8, ["description", "schema", "value"])) : c("", !0)
142
143
  ]),
143
144
  _: 1
144
- }, 8, ["aria-label", "default", "disabled", "enum", "environment", "max", "min", "modelValue", "type"])
145
+ }, 8, ["aria-label", "default", "disabled", "enum", "environment", "examples", "max", "min", "modelValue", "type"])
145
146
  ]),
146
147
  _: 1
147
148
  }),
148
- e.showUploadButton ? (s(), u(l(f), {
149
+ e.showUploadButton ? (s(), m(l(f), {
149
150
  key: 2,
150
151
  class: "group/upload flex items-center justify-center whitespace-nowrap"
151
152
  }, {
152
153
  default: n(() => [
153
- x(l(p)(e.data.value)) ? (s(), v(U, { key: 0 }, [
154
- m("div", P, [
155
- m("span", null, $(l(k)(l(p)(e.data.value))), 1)
154
+ F(l(p)(e.data.value)) ? (s(), v(D, { key: 0 }, [
155
+ u("div", P, [
156
+ u("span", null, $(l(k)(l(p)(e.data.value))), 1)
156
157
  ]),
157
- m("button", {
158
+ u("button", {
158
159
  class: "bg-b-2 centered-x centered-y absolute hidden w-[calc(100%_-_8px)] rounded p-0.5 text-center text-xs font-medium group-hover/upload:block",
159
160
  type: "button",
160
- onClick: a[5] || (a[5] = (o) => i("removeFile"))
161
+ onClick: a[5] || (a[5] = (o) => d("removeFile"))
161
162
  }, " Delete ")
162
163
  ], 64)) : (s(), v("div", G, [
163
- d(l(y), {
164
+ i(l(y), {
164
165
  class: "bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none",
165
166
  size: "sm",
166
167
  variant: "outlined",
167
- onClick: a[6] || (a[6] = (o) => i("uploadFile"))
168
+ onClick: a[6] || (a[6] = (o) => d("uploadFile"))
168
169
  }, {
169
170
  default: n(() => [
170
- a[8] || (a[8] = m("span", null, "Upload File", -1)),
171
- d(l(h), {
171
+ a[8] || (a[8] = u("span", null, "Select File", -1)),
172
+ i(l(h), {
172
173
  class: "ml-1",
173
174
  icon: "Upload",
174
175
  size: "xs",
@@ -1 +1 @@
1
- {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AA2PA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,KAAK,EAEV,gBAAgB,EAChB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,KAAK,WAAW,GAAG;IACf,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,gBAAgB,CAAA;IACvB,IAAI,EAAE,MAAM,gBAAgB,CAAA;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwhBJ,wBAOG"}
1
+ {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AA4QA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAEV,gBAAgB,EAChB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,KAAK,WAAW,GAAG;IACf,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,gBAAgB,CAAA;IACvB,IAAI,EAAE,MAAM,gBAAgB,CAAA;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwiBJ,wBAOG"}
@@ -1,12 +1,12 @@
1
- import { defineComponent as z, computed as C, createElementBlock as k, openBlock as i, Fragment as V, createVNode as o, unref as n, withCtx as l, createTextVNode as u, createElementVNode as x, createBlock as f, createCommentVNode as v } from "vue";
2
- import { useLoadingState as T, ScalarButton as U } from "@scalar/components";
3
- import { pkceOptions as b } from "@scalar/oas-utils/entities/spec";
4
- import { useToasts as B } from "@scalar/use-toasts";
5
- import P from "./OAuthScopesInput.vue.js";
6
- import { authorizeOauth2 as R } from "../helpers/oauth.js";
1
+ import { defineComponent as z, computed as C, watch as T, createElementBlock as k, openBlock as i, Fragment as V, createVNode as o, unref as a, withCtx as t, createTextVNode as u, createElementVNode as x, createBlock as v, createCommentVNode as f } from "vue";
2
+ import { useLoadingState as b, ScalarButton as w } from "@scalar/components";
3
+ import { pkceOptions as B } from "@scalar/oas-utils/entities/spec";
4
+ import { useToasts as P } from "@scalar/use-toasts";
5
+ import R from "./OAuthScopesInput.vue.js";
6
+ import { authorizeOauth2 as F } from "../helpers/oauth.js";
7
7
  import m from "./RequestAuthDataTableInput.vue.js";
8
8
  import d from "../../../../components/DataTable/DataTableRow.vue.js";
9
- const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { class: "flex h-8 w-full items-center justify-end border-t" }, M = /* @__PURE__ */ z({
9
+ const O = { class: "flex h-8 items-center justify-end gap-2 border-t" }, A = { class: "flex h-8 w-full items-center justify-end border-t" }, $ = /* @__PURE__ */ z({
10
10
  __name: "OAuth2",
11
11
  props: {
12
12
  environment: {},
@@ -17,37 +17,47 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
17
17
  proxyUrl: {}
18
18
  },
19
19
  emits: ["update:securityScheme", "update:selectedScopes"],
20
- setup(p, { emit: w }) {
21
- const y = w, c = T(), { toast: S } = B(), t = C(() => p.flows[p.type]), s = (a) => y("update:securityScheme", {
20
+ setup(p, { emit: U }) {
21
+ const y = U, c = b(), { toast: S } = P(), l = C(() => p.flows[p.type]), s = (n) => y("update:securityScheme", {
22
22
  type: "oauth2",
23
23
  flows: {
24
- [p.type]: a
24
+ [p.type]: n
25
25
  }
26
- }), g = async () => {
26
+ });
27
+ T(
28
+ () => l.value["x-scalar-secret-redirect-uri"],
29
+ (n) => {
30
+ n || typeof window > "u" || s({
31
+ "x-scalar-secret-redirect-uri": window.location.origin + window.location.pathname
32
+ });
33
+ },
34
+ { immediate: !0 }
35
+ );
36
+ const g = async () => {
27
37
  if (c.isLoading)
28
38
  return;
29
39
  c.start();
30
- const [a, e] = await R(
40
+ const [n, e] = await F(
31
41
  p.flows,
32
42
  p.type,
33
43
  p.selectedScopes,
34
44
  p.server,
35
45
  p.proxyUrl
36
46
  );
37
- await c.clear(), e ? s({ "x-scalar-secret-token": e }) : (console.error(a), S(a?.message ?? "Failed to authorize", "error"));
47
+ await c.clear(), e ? s({ "x-scalar-secret-token": e }) : (console.error(n), S(n?.message ?? "Failed to authorize", "error"));
38
48
  };
39
- return (a, e) => t.value["x-scalar-secret-token"] ? (i(), k(V, { key: 0 }, [
40
- o(n(d), null, {
41
- default: l(() => [
49
+ return (n, e) => l.value["x-scalar-secret-token"] ? (i(), k(V, { key: 0 }, [
50
+ o(a(d), null, {
51
+ default: t(() => [
42
52
  o(m, {
43
53
  class: "border-r-transparent",
44
- environment: a.environment,
45
- modelValue: t.value["x-scalar-secret-token"],
54
+ environment: n.environment,
55
+ modelValue: l.value["x-scalar-secret-token"],
46
56
  placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
47
57
  type: "password",
48
58
  "onUpdate:modelValue": e[0] || (e[0] = (r) => s({ "x-scalar-secret-token": r }))
49
59
  }, {
50
- default: l(() => [...e[11] || (e[11] = [
60
+ default: t(() => [...e[11] || (e[11] = [
51
61
  u(" Access Token ", -1)
52
62
  ])]),
53
63
  _: 1
@@ -55,17 +65,17 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
55
65
  ]),
56
66
  _: 1
57
67
  }),
58
- o(n(d), { class: "min-w-full" }, {
59
- default: l(() => [
60
- x("div", F, [
61
- o(n(U), {
68
+ o(a(d), { class: "min-w-full" }, {
69
+ default: t(() => [
70
+ x("div", O, [
71
+ o(a(w), {
62
72
  class: "mr-1 p-0 px-2 py-0.5",
63
- loader: n(c),
73
+ loader: a(c),
64
74
  size: "sm",
65
75
  variant: "outlined",
66
76
  onClick: e[1] || (e[1] = () => s({ "x-scalar-secret-token": "" }))
67
77
  }, {
68
- default: l(() => [...e[12] || (e[12] = [
78
+ default: t(() => [...e[12] || (e[12] = [
69
79
  u(" Clear ", -1)
70
80
  ])]),
71
81
  _: 1
@@ -75,63 +85,63 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
75
85
  _: 1
76
86
  })
77
87
  ], 64)) : (i(), k(V, { key: 1 }, [
78
- o(n(d), null, {
79
- default: l(() => [
80
- "authorizationUrl" in t.value ? (i(), f(m, {
88
+ o(a(d), null, {
89
+ default: t(() => [
90
+ "authorizationUrl" in l.value ? (i(), v(m, {
81
91
  key: 0,
82
92
  containerClass: "border-r-0",
83
- environment: a.environment,
84
- modelValue: t.value.authorizationUrl,
93
+ environment: n.environment,
94
+ modelValue: l.value.authorizationUrl,
85
95
  placeholder: "https://galaxy.scalar.com/authorize",
86
96
  "onUpdate:modelValue": e[2] || (e[2] = (r) => s({ authorizationUrl: r }))
87
97
  }, {
88
- default: l(() => [...e[13] || (e[13] = [
98
+ default: t(() => [...e[13] || (e[13] = [
89
99
  u(" Auth URL ", -1)
90
100
  ])]),
91
101
  _: 1
92
- }, 8, ["environment", "modelValue"])) : v("", !0),
93
- "tokenUrl" in t.value ? (i(), f(m, {
102
+ }, 8, ["environment", "modelValue"])) : f("", !0),
103
+ "tokenUrl" in l.value ? (i(), v(m, {
94
104
  key: 1,
95
- environment: a.environment,
96
- modelValue: t.value.tokenUrl,
105
+ environment: n.environment,
106
+ modelValue: l.value.tokenUrl,
97
107
  placeholder: "https://galaxy.scalar.com/token",
98
108
  "onUpdate:modelValue": e[3] || (e[3] = (r) => s({ tokenUrl: r }))
99
109
  }, {
100
- default: l(() => [...e[14] || (e[14] = [
110
+ default: t(() => [...e[14] || (e[14] = [
101
111
  u(" Token URL ", -1)
102
112
  ])]),
103
113
  _: 1
104
- }, 8, ["environment", "modelValue"])) : v("", !0)
114
+ }, 8, ["environment", "modelValue"])) : f("", !0)
105
115
  ]),
106
116
  _: 1
107
117
  }),
108
- "x-scalar-secret-redirect-uri" in t.value ? (i(), f(n(d), { key: 0 }, {
109
- default: l(() => [
118
+ "x-scalar-secret-redirect-uri" in l.value ? (i(), v(a(d), { key: 0 }, {
119
+ default: t(() => [
110
120
  o(m, {
111
- environment: a.environment,
112
- modelValue: t.value["x-scalar-secret-redirect-uri"],
121
+ environment: n.environment,
122
+ modelValue: l.value["x-scalar-secret-redirect-uri"],
113
123
  placeholder: "https://galaxy.scalar.com/callback",
114
124
  "onUpdate:modelValue": e[4] || (e[4] = (r) => s({ "x-scalar-secret-redirect-uri": r }))
115
125
  }, {
116
- default: l(() => [...e[15] || (e[15] = [
126
+ default: t(() => [...e[15] || (e[15] = [
117
127
  u(" Redirect URL ", -1)
118
128
  ])]),
119
129
  _: 1
120
130
  }, 8, ["environment", "modelValue"])
121
131
  ]),
122
132
  _: 1
123
- })) : v("", !0),
124
- "x-scalar-secret-username" in t.value && "x-scalar-secret-password" in t.value ? (i(), k(V, { key: 1 }, [
125
- o(n(d), null, {
126
- default: l(() => [
133
+ })) : f("", !0),
134
+ "x-scalar-secret-username" in l.value && "x-scalar-secret-password" in l.value ? (i(), k(V, { key: 1 }, [
135
+ o(a(d), null, {
136
+ default: t(() => [
127
137
  o(m, {
128
138
  class: "text-c-2",
129
- environment: a.environment,
130
- modelValue: t.value["x-scalar-secret-username"],
139
+ environment: n.environment,
140
+ modelValue: l.value["x-scalar-secret-username"],
131
141
  placeholder: "janedoe",
132
142
  "onUpdate:modelValue": e[5] || (e[5] = (r) => s({ "x-scalar-secret-username": r }))
133
143
  }, {
134
- default: l(() => [...e[16] || (e[16] = [
144
+ default: t(() => [...e[16] || (e[16] = [
135
145
  u(" Username ", -1)
136
146
  ])]),
137
147
  _: 1
@@ -139,16 +149,16 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
139
149
  ]),
140
150
  _: 1
141
151
  }),
142
- o(n(d), null, {
143
- default: l(() => [
152
+ o(a(d), null, {
153
+ default: t(() => [
144
154
  o(m, {
145
- environment: a.environment,
146
- modelValue: t.value["x-scalar-secret-password"],
155
+ environment: n.environment,
156
+ modelValue: l.value["x-scalar-secret-password"],
147
157
  placeholder: "********",
148
158
  type: "password",
149
159
  "onUpdate:modelValue": e[6] || (e[6] = (r) => s({ "x-scalar-secret-password": r }))
150
160
  }, {
151
- default: l(() => [...e[17] || (e[17] = [
161
+ default: t(() => [...e[17] || (e[17] = [
152
162
  u(" Password ", -1)
153
163
  ])]),
154
164
  _: 1
@@ -156,16 +166,16 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
156
166
  ]),
157
167
  _: 1
158
168
  })
159
- ], 64)) : v("", !0),
160
- o(n(d), null, {
161
- default: l(() => [
169
+ ], 64)) : f("", !0),
170
+ o(a(d), null, {
171
+ default: t(() => [
162
172
  o(m, {
163
- environment: a.environment,
164
- modelValue: t.value["x-scalar-secret-client-id"],
173
+ environment: n.environment,
174
+ modelValue: l.value["x-scalar-secret-client-id"],
165
175
  placeholder: "12345",
166
176
  "onUpdate:modelValue": e[7] || (e[7] = (r) => s({ "x-scalar-secret-client-id": r }))
167
177
  }, {
168
- default: l(() => [...e[18] || (e[18] = [
178
+ default: t(() => [...e[18] || (e[18] = [
169
179
  u(" Client ID ", -1)
170
180
  ])]),
171
181
  _: 1
@@ -173,63 +183,63 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
173
183
  ]),
174
184
  _: 1
175
185
  }),
176
- "x-scalar-secret-client-secret" in t.value ? (i(), f(n(d), { key: 2 }, {
177
- default: l(() => [
186
+ "x-scalar-secret-client-secret" in l.value ? (i(), v(a(d), { key: 2 }, {
187
+ default: t(() => [
178
188
  o(m, {
179
- environment: a.environment,
180
- modelValue: t.value["x-scalar-secret-client-secret"],
189
+ environment: n.environment,
190
+ modelValue: l.value["x-scalar-secret-client-secret"],
181
191
  placeholder: "XYZ123",
182
192
  type: "password",
183
193
  "onUpdate:modelValue": e[8] || (e[8] = (r) => s({ "x-scalar-secret-client-secret": r }))
184
194
  }, {
185
- default: l(() => [...e[19] || (e[19] = [
195
+ default: t(() => [...e[19] || (e[19] = [
186
196
  u(" Client Secret ", -1)
187
197
  ])]),
188
198
  _: 1
189
199
  }, 8, ["environment", "modelValue"])
190
200
  ]),
191
201
  _: 1
192
- })) : v("", !0),
193
- "x-usePkce" in t.value ? (i(), f(n(d), { key: 3 }, {
194
- default: l(() => [
202
+ })) : f("", !0),
203
+ "x-usePkce" in l.value ? (i(), v(a(d), { key: 3 }, {
204
+ default: t(() => [
195
205
  o(m, {
196
- enum: n(b),
197
- environment: a.environment,
198
- modelValue: t.value["x-usePkce"],
206
+ enum: a(B),
207
+ environment: n.environment,
208
+ modelValue: l.value["x-usePkce"],
199
209
  readOnly: "",
200
210
  "onUpdate:modelValue": e[9] || (e[9] = (r) => s({
201
211
  "x-usePkce": r
202
212
  }))
203
213
  }, {
204
- default: l(() => [...e[20] || (e[20] = [
214
+ default: t(() => [...e[20] || (e[20] = [
205
215
  u(" Use PKCE ", -1)
206
216
  ])]),
207
217
  _: 1
208
218
  }, 8, ["enum", "environment", "modelValue"])
209
219
  ]),
210
220
  _: 1
211
- })) : v("", !0),
212
- Object.keys(t.value.scopes ?? {}).length ? (i(), f(n(d), { key: 4 }, {
213
- default: l(() => [
214
- o(P, {
215
- flow: t.value,
216
- selectedScopes: a.selectedScopes,
221
+ })) : f("", !0),
222
+ Object.keys(l.value.scopes ?? {}).length ? (i(), v(a(d), { key: 4 }, {
223
+ default: t(() => [
224
+ o(R, {
225
+ flow: l.value,
226
+ selectedScopes: n.selectedScopes,
217
227
  "onUpdate:selectedScopes": e[10] || (e[10] = (r) => y("update:selectedScopes", r))
218
228
  }, null, 8, ["flow", "selectedScopes"])
219
229
  ]),
220
230
  _: 1
221
- })) : v("", !0),
222
- o(n(d), { class: "min-w-full" }, {
223
- default: l(() => [
224
- x("div", O, [
225
- o(n(U), {
231
+ })) : f("", !0),
232
+ o(a(d), { class: "min-w-full" }, {
233
+ default: t(() => [
234
+ x("div", A, [
235
+ o(a(w), {
226
236
  class: "mr-0.75 p-0 px-2 py-0.5",
227
- loader: n(c),
237
+ loader: a(c),
228
238
  size: "sm",
229
239
  variant: "outlined",
230
240
  onClick: g
231
241
  }, {
232
- default: l(() => [...e[21] || (e[21] = [
242
+ default: t(() => [...e[21] || (e[21] = [
233
243
  u(" Authorize ", -1)
234
244
  ])]),
235
245
  _: 1
@@ -242,5 +252,5 @@ const F = { class: "flex h-8 items-center justify-end gap-2 border-t" }, O = { c
242
252
  }
243
253
  });
244
254
  export {
245
- M as default
255
+ $ as default
246
256
  };
@@ -0,0 +1,8 @@
1
+ import type { SecurityScheme } from '@scalar/oas-utils/entities/spec';
2
+ import { type SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ import type { PartialDeep } from 'type-fest';
4
+ /**
5
+ * Convert the old security scheme to the new one with secret extensions
6
+ */
7
+ export declare const convertSecuritySchemeSecrets: (scheme: PartialDeep<SecurityScheme & SecuritySchemeObject>) => SecuritySchemeObject;
8
+ //# sourceMappingURL=convert-security-scheme-secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAiC5C;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,WAAW,CAAC,cAAc,GAAG,oBAAoB,CAAC,KACzD,oBA+BF,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { objectEntries as l } from "@scalar/helpers/object/object-entries";
2
+ import { coerceValue as a } from "@scalar/workspace-store/schemas/typebox-coerce";
3
+ import { SecuritySchemeObjectSchema as n } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
4
+ const S = {
5
+ clientSecret: "x-scalar-secret-client-secret",
6
+ password: "x-scalar-secret-password",
7
+ token: "x-scalar-secret-token",
8
+ username: "x-scalar-secret-username",
9
+ value: "x-scalar-secret-token",
10
+ "x-scalar-client-id": "x-scalar-secret-client-id",
11
+ "x-scalar-redirect-uri": "x-scalar-secret-redirect-uri"
12
+ }, i = (e) => {
13
+ const r = { ...e };
14
+ for (const [t, s] of l(S))
15
+ e[t] && (r[s] ||= e[t]);
16
+ return r;
17
+ }, E = (e) => {
18
+ if (e.type === "oauth2") {
19
+ const r = /* @__PURE__ */ new Set(), t = l(e.flows ?? {}).reduce(
20
+ (o, [d, c]) => (o[d] = c && i(c), c?.selectedScopes?.forEach((u) => r.add(u)), o),
21
+ {}
22
+ ), s = r.size > 0 && !e["x-default-scopes"]?.length ? { "x-default-scopes": Array.from(r) } : {};
23
+ return a(n, {
24
+ ...e,
25
+ flows: t,
26
+ ...s
27
+ });
28
+ }
29
+ return a(n, i(e));
30
+ };
31
+ export {
32
+ E as convertSecuritySchemeSecrets
33
+ };
@@ -0,0 +1,7 @@
1
+ import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
2
+ import type { ComponentsObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /** Document security merged with the config security schemes */
4
+ export type MergedSecuritySchemes = NonNullable<ComponentsObject['securitySchemes']>;
5
+ /** Merge the authentication config with the document security schemes */
6
+ export declare const mergeAuthConfig: (documentSecuritySchemes?: ComponentsObject["securitySchemes"], configSecuritySchemes?: AuthenticationConfiguration["securitySchemes"]) => MergedSecuritySchemes;
7
+ //# sourceMappingURL=merge-auth-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-auth-config.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAA;AAMpG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAEpF,yEAAyE;AACzE,eAAO,MAAM,eAAe,GAC1B,0BAAyB,gBAAgB,CAAC,iBAAiB,CAAM,EACjE,wBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,KACzE,qBAcF,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { objectEntries as s } from "@scalar/helpers/object/object-entries";
2
+ import { mergeObjects as n } from "@scalar/workspace-store/helpers/merge-object";
3
+ import { convertSecuritySchemeSecrets as i } from "./convert-security-scheme-secrets.js";
4
+ import { getResolvedRefDeep as S } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
5
+ const u = (e = {}, r = {}) => {
6
+ const t = S(e), o = n(t, r) ?? {};
7
+ return Object.fromEntries(
8
+ s(o).map(([c, m]) => [c, i(m)])
9
+ );
10
+ };
11
+ export {
12
+ u as mergeAuthConfig
13
+ };
@@ -1,2 +1,5 @@
1
1
  export { default as AuthSelector } from './components/AuthSelector.vue.js';
2
+ export { convertSecuritySchemeSecrets } from './helpers/convert-security-scheme-secrets.js';
3
+ export { isAuthOptional } from './helpers/is-auth-optional.js';
4
+ export { type MergedSecuritySchemes, mergeAuthConfig } from './helpers/merge-auth-config.js';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/scalar-auth-selector-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/scalar-auth-selector-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,KAAK,qBAAqB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA"}
@@ -1,4 +1,10 @@
1
- import { default as o } from "./components/AuthSelector.vue.js";
1
+ import { default as t } from "./components/AuthSelector.vue.js";
2
+ import { convertSecuritySchemeSecrets as f } from "./helpers/convert-security-scheme-secrets.js";
3
+ import { isAuthOptional as c } from "./helpers/is-auth-optional.js";
4
+ import { mergeAuthConfig as u } from "./helpers/merge-auth-config.js";
2
5
  export {
3
- o as AuthSelector
6
+ t as AuthSelector,
7
+ f as convertSecuritySchemeSecrets,
8
+ c as isAuthOptional,
9
+ u as mergeAuthConfig
4
10
  };