@btst/stack 1.6.0 → 1.8.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 (85) hide show
  1. package/dist/api/index.cjs +7 -1
  2. package/dist/api/index.d.cts +2 -2
  3. package/dist/api/index.d.mts +2 -2
  4. package/dist/api/index.d.ts +2 -2
  5. package/dist/api/index.mjs +7 -1
  6. package/dist/client/index.cjs +6 -2
  7. package/dist/client/index.d.cts +2 -1
  8. package/dist/client/index.d.mts +2 -1
  9. package/dist/client/index.d.ts +2 -1
  10. package/dist/client/index.mjs +6 -2
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/packages/better-stack/src/plugins/open-api/api/generator.cjs +300 -0
  15. package/dist/packages/better-stack/src/plugins/open-api/api/generator.mjs +284 -0
  16. package/dist/packages/better-stack/src/plugins/open-api/api/plugin.cjs +115 -0
  17. package/dist/packages/better-stack/src/plugins/open-api/api/plugin.mjs +113 -0
  18. package/dist/packages/better-stack/src/plugins/open-api/db.cjs +7 -0
  19. package/dist/packages/better-stack/src/plugins/open-api/db.mjs +5 -0
  20. package/dist/packages/better-stack/src/plugins/open-api/logo.cjs +8 -0
  21. package/dist/packages/better-stack/src/plugins/open-api/logo.mjs +6 -0
  22. package/dist/packages/better-stack/src/plugins/route-docs/client/components/loading/docs-skeleton.cjs +43 -0
  23. package/dist/packages/better-stack/src/plugins/route-docs/client/components/loading/docs-skeleton.mjs +41 -0
  24. package/dist/packages/better-stack/src/plugins/route-docs/client/components/pages/docs-page.cjs +794 -0
  25. package/dist/packages/better-stack/src/plugins/route-docs/client/components/pages/docs-page.mjs +788 -0
  26. package/dist/packages/better-stack/src/plugins/route-docs/client/plugin.cjs +111 -0
  27. package/dist/packages/better-stack/src/plugins/route-docs/client/plugin.mjs +106 -0
  28. package/dist/packages/better-stack/src/plugins/route-docs/generator.cjs +244 -0
  29. package/dist/packages/better-stack/src/plugins/route-docs/generator.mjs +227 -0
  30. package/dist/packages/ui/src/components/sheet.cjs +25 -0
  31. package/dist/packages/ui/src/components/sheet.mjs +24 -1
  32. package/dist/plugins/api/index.d.cts +2 -2
  33. package/dist/plugins/api/index.d.mts +2 -2
  34. package/dist/plugins/api/index.d.ts +2 -2
  35. package/dist/plugins/blog/api/index.d.cts +1 -1
  36. package/dist/plugins/blog/api/index.d.mts +1 -1
  37. package/dist/plugins/blog/api/index.d.ts +1 -1
  38. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  39. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  40. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  41. package/dist/plugins/blog/client/index.d.cts +1 -1
  42. package/dist/plugins/blog/client/index.d.mts +1 -1
  43. package/dist/plugins/blog/client/index.d.ts +1 -1
  44. package/dist/plugins/blog/query-keys.d.cts +2 -2
  45. package/dist/plugins/blog/query-keys.d.mts +2 -2
  46. package/dist/plugins/blog/query-keys.d.ts +2 -2
  47. package/dist/plugins/client/index.d.cts +2 -2
  48. package/dist/plugins/client/index.d.mts +2 -2
  49. package/dist/plugins/client/index.d.ts +2 -2
  50. package/dist/plugins/open-api/api/index.cjs +9 -0
  51. package/dist/plugins/open-api/api/index.d.cts +95 -0
  52. package/dist/plugins/open-api/api/index.d.mts +95 -0
  53. package/dist/plugins/open-api/api/index.d.ts +95 -0
  54. package/dist/plugins/open-api/api/index.mjs +2 -0
  55. package/dist/plugins/route-docs/client/index.cjs +10 -0
  56. package/dist/plugins/route-docs/client/index.d.cts +126 -0
  57. package/dist/plugins/route-docs/client/index.d.mts +126 -0
  58. package/dist/plugins/route-docs/client/index.d.ts +126 -0
  59. package/dist/plugins/route-docs/client/index.mjs +1 -0
  60. package/dist/plugins/route-docs/client.css +3 -0
  61. package/dist/plugins/route-docs/style.css +19 -0
  62. package/dist/shared/{stack.ByOugz9d.d.cts → stack.u9iYV6vt.d.cts} +28 -3
  63. package/dist/shared/{stack.ByOugz9d.d.mts → stack.u9iYV6vt.d.mts} +28 -3
  64. package/dist/shared/{stack.ByOugz9d.d.ts → stack.u9iYV6vt.d.ts} +28 -3
  65. package/package.json +28 -1
  66. package/src/api/index.ts +14 -2
  67. package/src/client/index.ts +11 -4
  68. package/src/plugins/open-api/api/generator.ts +433 -0
  69. package/src/plugins/open-api/api/index.ts +8 -0
  70. package/src/plugins/open-api/api/plugin.ts +243 -0
  71. package/src/plugins/open-api/db.ts +7 -0
  72. package/src/plugins/open-api/logo.ts +7 -0
  73. package/src/plugins/route-docs/client/components/loading/docs-skeleton.tsx +82 -0
  74. package/src/plugins/route-docs/client/components/loading/index.tsx +1 -0
  75. package/src/plugins/route-docs/client/components/pages/docs-page.tsx +1240 -0
  76. package/src/plugins/route-docs/client/index.ts +7 -0
  77. package/src/plugins/route-docs/client/plugin.tsx +187 -0
  78. package/src/plugins/route-docs/client.css +3 -0
  79. package/src/plugins/route-docs/generator.ts +385 -0
  80. package/src/plugins/route-docs/index.ts +12 -0
  81. package/src/plugins/route-docs/style.css +19 -0
  82. package/src/types.ts +34 -2
  83. package/dist/shared/{stack.CcI4sYJP.d.mts → stack.DLhzx1-D.d.cts} +1 -1
  84. package/dist/shared/{stack.CcI4sYJP.d.ts → stack.DLhzx1-D.d.mts} +1 -1
  85. package/dist/shared/{stack.CcI4sYJP.d.cts → stack.DLhzx1-D.d.ts} +1 -1
@@ -11,8 +11,14 @@ function betterStack(config) {
11
11
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
12
12
  betterDbSchema = betterDbSchema.use(plugin.dbPlugin);
13
13
  }
14
+ const adapterInstance = adapter(betterDbSchema);
15
+ const context = {
16
+ plugins,
17
+ basePath,
18
+ adapter: adapterInstance
19
+ };
14
20
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
15
- const pluginRoutes = plugin.routes(adapter(betterDbSchema));
21
+ const pluginRoutes = plugin.routes(adapterInstance, context);
16
22
  for (const [routeKey, endpoint] of Object.entries(pluginRoutes)) {
17
23
  const compositeKey = `${pluginKey}_${routeKey}`;
18
24
  allRoutes[compositeKey] = endpoint;
@@ -1,5 +1,5 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.cjs';
2
- export { B as BackendPlugin } from '../shared/stack.ByOugz9d.cjs';
1
+ import { g as PrefixedPluginRoutes, h as BackendLibConfig, i as BackendLib } from '../shared/stack.u9iYV6vt.cjs';
2
+ export { B as BackendPlugin, a as BetterStackContext } from '../shared/stack.u9iYV6vt.cjs';
3
3
  export { toNodeHandler } from 'better-call/node';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
@@ -1,5 +1,5 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.mjs';
2
- export { B as BackendPlugin } from '../shared/stack.ByOugz9d.mjs';
1
+ import { g as PrefixedPluginRoutes, h as BackendLibConfig, i as BackendLib } from '../shared/stack.u9iYV6vt.mjs';
2
+ export { B as BackendPlugin, a as BetterStackContext } from '../shared/stack.u9iYV6vt.mjs';
3
3
  export { toNodeHandler } from 'better-call/node';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
@@ -1,5 +1,5 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.js';
2
- export { B as BackendPlugin } from '../shared/stack.ByOugz9d.js';
1
+ import { g as PrefixedPluginRoutes, h as BackendLibConfig, i as BackendLib } from '../shared/stack.u9iYV6vt.js';
2
+ export { B as BackendPlugin, a as BetterStackContext } from '../shared/stack.u9iYV6vt.js';
3
3
  export { toNodeHandler } from 'better-call/node';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
@@ -9,8 +9,14 @@ function betterStack(config) {
9
9
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
10
10
  betterDbSchema = betterDbSchema.use(plugin.dbPlugin);
11
11
  }
12
+ const adapterInstance = adapter(betterDbSchema);
13
+ const context = {
14
+ plugins,
15
+ basePath,
16
+ adapter: adapterInstance
17
+ };
12
18
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
13
- const pluginRoutes = plugin.routes(adapter(betterDbSchema));
19
+ const pluginRoutes = plugin.routes(adapterInstance, context);
14
20
  for (const [routeKey, endpoint] of Object.entries(pluginRoutes)) {
15
21
  const compositeKey = `${pluginKey}_${routeKey}`;
16
22
  allRoutes[compositeKey] = endpoint;
@@ -6,10 +6,14 @@ const metaUtils = require('../packages/better-stack/src/client/meta-utils.cjs');
6
6
  const pathUtils = require('../packages/better-stack/src/client/path-utils.cjs');
7
7
 
8
8
  function createStackClient(config) {
9
- const { plugins } = config;
9
+ const { plugins, basePath } = config;
10
10
  const allRoutes = {};
11
+ const clientStackContext = {
12
+ plugins,
13
+ basePath
14
+ };
11
15
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
12
- const pluginRoutes = plugin.routes();
16
+ const pluginRoutes = plugin.routes(clientStackContext);
13
17
  Object.assign(allRoutes, pluginRoutes);
14
18
  }
15
19
  const router = yar.createRouter(allRoutes);
@@ -1,4 +1,5 @@
1
- import { S as Sitemap, C as ClientPlugin, a as PluginRoutes, b as ClientLibConfig, c as ClientLib } from '../shared/stack.ByOugz9d.cjs';
1
+ import { c as Sitemap, C as ClientPlugin, d as PluginRoutes, e as ClientLibConfig, f as ClientLib } from '../shared/stack.u9iYV6vt.cjs';
2
+ export { b as ClientStackContext } from '../shared/stack.u9iYV6vt.cjs';
2
3
  import '@btst/yar';
3
4
  import '@btst/db';
4
5
  import 'better-call';
@@ -1,4 +1,5 @@
1
- import { S as Sitemap, C as ClientPlugin, a as PluginRoutes, b as ClientLibConfig, c as ClientLib } from '../shared/stack.ByOugz9d.mjs';
1
+ import { c as Sitemap, C as ClientPlugin, d as PluginRoutes, e as ClientLibConfig, f as ClientLib } from '../shared/stack.u9iYV6vt.mjs';
2
+ export { b as ClientStackContext } from '../shared/stack.u9iYV6vt.mjs';
2
3
  import '@btst/yar';
3
4
  import '@btst/db';
4
5
  import 'better-call';
@@ -1,4 +1,5 @@
1
- import { S as Sitemap, C as ClientPlugin, a as PluginRoutes, b as ClientLibConfig, c as ClientLib } from '../shared/stack.ByOugz9d.js';
1
+ import { c as Sitemap, C as ClientPlugin, d as PluginRoutes, e as ClientLibConfig, f as ClientLib } from '../shared/stack.u9iYV6vt.js';
2
+ export { b as ClientStackContext } from '../shared/stack.u9iYV6vt.js';
2
3
  import '@btst/yar';
3
4
  import '@btst/db';
4
5
  import 'better-call';
@@ -4,10 +4,14 @@ export { metaElementsToObject } from '../packages/better-stack/src/client/meta-u
4
4
  export { normalizePath } from '../packages/better-stack/src/client/path-utils.mjs';
5
5
 
6
6
  function createStackClient(config) {
7
- const { plugins } = config;
7
+ const { plugins, basePath } = config;
8
8
  const allRoutes = {};
9
+ const clientStackContext = {
10
+ plugins,
11
+ basePath
12
+ };
9
13
  for (const [pluginKey, plugin] of Object.entries(plugins)) {
10
- const pluginRoutes = plugin.routes();
14
+ const pluginRoutes = plugin.routes(clientStackContext);
11
15
  Object.assign(allRoutes, pluginRoutes);
12
16
  }
13
17
  const router = createRouter(allRoutes);
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { betterStack } from './api/index.cjs';
2
2
  export { toNodeHandler } from 'better-call/node';
3
- export { f as BackendLib, e as BackendLibConfig, B as BackendPlugin } from './shared/stack.ByOugz9d.cjs';
3
+ export { i as BackendLib, h as BackendLibConfig, B as BackendPlugin, a as BetterStackContext } from './shared/stack.u9iYV6vt.cjs';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
  import 'better-call';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { betterStack } from './api/index.mjs';
2
2
  export { toNodeHandler } from 'better-call/node';
3
- export { f as BackendLib, e as BackendLibConfig, B as BackendPlugin } from './shared/stack.ByOugz9d.mjs';
3
+ export { i as BackendLib, h as BackendLibConfig, B as BackendPlugin, a as BetterStackContext } from './shared/stack.u9iYV6vt.mjs';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
  import 'better-call';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { betterStack } from './api/index.js';
2
2
  export { toNodeHandler } from 'better-call/node';
3
- export { f as BackendLib, e as BackendLibConfig, B as BackendPlugin } from './shared/stack.ByOugz9d.js';
3
+ export { i as BackendLib, h as BackendLibConfig, B as BackendPlugin, a as BetterStackContext } from './shared/stack.u9iYV6vt.js';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
  import 'better-call';
@@ -0,0 +1,300 @@
1
+ 'use strict';
2
+
3
+ const z = require('zod');
4
+
5
+ function _interopNamespaceCompat(e) {
6
+ if (e && typeof e === 'object' && 'default' in e) return e;
7
+ const n = Object.create(null);
8
+ if (e) {
9
+ for (const k in e) {
10
+ n[k] = e[k];
11
+ }
12
+ }
13
+ n.default = e;
14
+ return n;
15
+ }
16
+
17
+ const z__namespace = /*#__PURE__*/_interopNamespaceCompat(z);
18
+
19
+ function toOpenApiPath(path) {
20
+ return path.split("/").map((part) => part.startsWith(":") ? `{${part.slice(1)}}` : part).join("/");
21
+ }
22
+ function getTypeFromZodType(zodType) {
23
+ if (zodType instanceof z__namespace.ZodString) return "string";
24
+ if (zodType instanceof z__namespace.ZodNumber) return "number";
25
+ if (zodType instanceof z__namespace.ZodBoolean) return "boolean";
26
+ if (zodType instanceof z__namespace.ZodArray) return "array";
27
+ if (zodType instanceof z__namespace.ZodObject) return "object";
28
+ const type = zodType.type;
29
+ if (type === "string") return "string";
30
+ if (type === "number") return "number";
31
+ if (type === "boolean") return "boolean";
32
+ if (type === "array") return "array";
33
+ if (type === "object") return "object";
34
+ return "string";
35
+ }
36
+ function processZodType(zodType) {
37
+ if (zodType instanceof z__namespace.ZodOptional) {
38
+ const innerType = zodType._def?.innerType || zodType.unwrap?.();
39
+ if (innerType) {
40
+ return processZodType(innerType);
41
+ }
42
+ }
43
+ if (zodType instanceof z__namespace.ZodNullable) {
44
+ const innerType = zodType._def?.innerType || zodType.unwrap?.();
45
+ if (innerType) {
46
+ const innerSchema = processZodType(innerType);
47
+ return {
48
+ ...innerSchema,
49
+ nullable: true
50
+ };
51
+ }
52
+ }
53
+ if (zodType instanceof z__namespace.ZodDefault) {
54
+ const innerType = zodType._def?.innerType;
55
+ const defaultValue = zodType._def?.defaultValue?.();
56
+ if (innerType) {
57
+ const innerSchema = processZodType(innerType);
58
+ if (defaultValue !== void 0) {
59
+ return {
60
+ ...innerSchema,
61
+ default: defaultValue
62
+ };
63
+ }
64
+ return innerSchema;
65
+ }
66
+ }
67
+ if (zodType instanceof z__namespace.ZodObject) {
68
+ const shape = zodType.shape || zodType._def?.shape?.();
69
+ if (shape) {
70
+ const properties = {};
71
+ const required = [];
72
+ for (const [key, value] of Object.entries(shape)) {
73
+ if (value instanceof z__namespace.ZodType) {
74
+ properties[key] = processZodType(value);
75
+ if (!(value instanceof z__namespace.ZodOptional)) {
76
+ required.push(key);
77
+ }
78
+ }
79
+ }
80
+ return {
81
+ type: "object",
82
+ properties,
83
+ ...required.length > 0 ? { required } : {}
84
+ };
85
+ }
86
+ }
87
+ if (zodType instanceof z__namespace.ZodArray) {
88
+ const elementType = zodType._def?.type || zodType.element;
89
+ return {
90
+ type: "array",
91
+ items: elementType ? processZodType(elementType) : { type: "string" }
92
+ };
93
+ }
94
+ if (zodType instanceof z__namespace.ZodEnum) {
95
+ const values = zodType._def?.values || zodType.options;
96
+ return {
97
+ type: "string",
98
+ enum: values
99
+ };
100
+ }
101
+ if (zodType instanceof z__namespace.ZodLiteral) {
102
+ const value = zodType._def?.value || zodType.value;
103
+ let type;
104
+ if (value === null) {
105
+ type = "null";
106
+ } else if (value === void 0) {
107
+ return { nullable: true };
108
+ } else {
109
+ type = typeof value;
110
+ }
111
+ return {
112
+ type,
113
+ const: value
114
+ };
115
+ }
116
+ if (zodType instanceof z__namespace.ZodUnion) {
117
+ const options = zodType._def?.options || zodType.options;
118
+ if (options && Array.isArray(options)) {
119
+ return {
120
+ oneOf: options.map((opt) => processZodType(opt))
121
+ };
122
+ }
123
+ }
124
+ if (zodType._def?.coerce) {
125
+ const innerType = zodType._def?.innerType;
126
+ if (innerType) {
127
+ return processZodType(innerType);
128
+ }
129
+ }
130
+ return {
131
+ type: getTypeFromZodType(zodType)
132
+ };
133
+ }
134
+ function getParameters(options) {
135
+ const parameters = [];
136
+ if (options.query instanceof z__namespace.ZodObject) {
137
+ const shape = options.query.shape || options.query._def?.shape?.();
138
+ if (shape) {
139
+ for (const [key, value] of Object.entries(shape)) {
140
+ if (value instanceof z__namespace.ZodType) {
141
+ parameters.push({
142
+ name: key,
143
+ in: "query",
144
+ required: !(value instanceof z__namespace.ZodOptional),
145
+ schema: processZodType(value)
146
+ });
147
+ }
148
+ }
149
+ }
150
+ }
151
+ if (options.params instanceof z__namespace.ZodObject) {
152
+ const shape = options.params.shape || options.params._def?.shape?.();
153
+ if (shape) {
154
+ for (const [key, value] of Object.entries(shape)) {
155
+ if (value instanceof z__namespace.ZodType) {
156
+ parameters.push({
157
+ name: key,
158
+ in: "path",
159
+ required: true,
160
+ schema: processZodType(value)
161
+ });
162
+ }
163
+ }
164
+ }
165
+ }
166
+ return parameters;
167
+ }
168
+ function getRequestBody(options) {
169
+ if (!options.body) return void 0;
170
+ if (options.body instanceof z__namespace.ZodType) {
171
+ const schema = processZodType(options.body);
172
+ const isOptional = options.body instanceof z__namespace.ZodOptional;
173
+ return {
174
+ required: !isOptional,
175
+ content: {
176
+ "application/json": {
177
+ schema
178
+ }
179
+ }
180
+ };
181
+ }
182
+ return void 0;
183
+ }
184
+ function createErrorSchema() {
185
+ return {
186
+ type: "object",
187
+ properties: {
188
+ message: { type: "string" }
189
+ },
190
+ required: ["message"]
191
+ };
192
+ }
193
+ function getErrorResponses() {
194
+ return {
195
+ "400": {
196
+ description: "Bad Request",
197
+ content: { "application/json": { schema: createErrorSchema() } }
198
+ },
199
+ "401": {
200
+ description: "Unauthorized",
201
+ content: { "application/json": { schema: createErrorSchema() } }
202
+ },
203
+ "403": {
204
+ description: "Forbidden",
205
+ content: { "application/json": { schema: createErrorSchema() } }
206
+ },
207
+ "404": {
208
+ description: "Not Found",
209
+ content: { "application/json": { schema: createErrorSchema() } }
210
+ },
211
+ "500": {
212
+ description: "Internal Server Error",
213
+ content: { "application/json": { schema: createErrorSchema() } }
214
+ }
215
+ };
216
+ }
217
+ function generateOpenAPISchema(context, options) {
218
+ const paths = {};
219
+ const tags = [];
220
+ for (const [pluginKey, plugin] of Object.entries(context.plugins)) {
221
+ if (pluginKey === "openApi" || plugin.name === "open-api") {
222
+ continue;
223
+ }
224
+ const pluginRoutes = plugin.routes(context.adapter, context);
225
+ const tagName = pluginKey.charAt(0).toUpperCase() + pluginKey.slice(1);
226
+ tags.push({
227
+ name: tagName,
228
+ description: `${tagName} plugin endpoints`
229
+ });
230
+ for (const [routeKey, endpoint] of Object.entries(pluginRoutes)) {
231
+ const ep = endpoint;
232
+ const path = ep.path;
233
+ const endpointOptions = ep.options || {};
234
+ const method = (endpointOptions.method || "GET").toLowerCase();
235
+ if (!path) continue;
236
+ const openApiPath = toOpenApiPath(path);
237
+ if (!paths[openApiPath]) {
238
+ paths[openApiPath] = {};
239
+ }
240
+ const operation = {
241
+ tags: [tagName],
242
+ operationId: `${pluginKey}_${routeKey}`,
243
+ summary: endpointOptions.metadata?.openapi?.summary,
244
+ description: endpointOptions.metadata?.openapi?.description,
245
+ parameters: getParameters(endpointOptions),
246
+ responses: {
247
+ "200": {
248
+ description: "Successful response",
249
+ content: {
250
+ "application/json": {
251
+ schema: { type: "object" }
252
+ }
253
+ }
254
+ },
255
+ ...getErrorResponses()
256
+ }
257
+ };
258
+ if (["post", "put", "patch"].includes(method)) {
259
+ const requestBody = getRequestBody(endpointOptions);
260
+ if (requestBody) {
261
+ operation.requestBody = requestBody;
262
+ }
263
+ }
264
+ paths[openApiPath][method] = operation;
265
+ }
266
+ }
267
+ return {
268
+ openapi: "3.1.0",
269
+ info: {
270
+ title: options?.title || "Better Stack API",
271
+ description: options?.description || "API Reference for your Better Stack application",
272
+ version: options?.version || "1.0.0"
273
+ },
274
+ servers: [
275
+ {
276
+ url: context.basePath,
277
+ description: "API Server"
278
+ }
279
+ ],
280
+ tags,
281
+ paths,
282
+ components: {
283
+ securitySchemes: {
284
+ bearerAuth: {
285
+ type: "http",
286
+ scheme: "bearer",
287
+ description: "Bearer token authentication"
288
+ },
289
+ cookieAuth: {
290
+ type: "apiKey",
291
+ in: "cookie",
292
+ name: "session",
293
+ description: "Session cookie authentication"
294
+ }
295
+ }
296
+ }
297
+ };
298
+ }
299
+
300
+ exports.generateOpenAPISchema = generateOpenAPISchema;