@krak-stack/registry 0.1.60 → 0.2.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.
- package/CHANGELOG.md +15 -0
- package/dist/components/ui/app-brand.js +17 -17
- package/dist/components/ui/code-block.js +6 -6
- package/dist/components/ui/color-picker.d.ts +30 -0
- package/dist/components/ui/color-picker.js +386 -0
- package/dist/components/ui/copy-button.js +4 -4
- package/dist/components/ui/data-table.js +468 -455
- package/dist/components/ui/editing-locale-switcher.js +10 -10
- package/dist/components/ui/effect-form.js +186 -185
- package/dist/components/ui/error-component.js +10 -18
- package/dist/components/ui/file-picker.js +2 -2
- package/dist/components/ui/form.d.ts +131 -335
- package/dist/components/ui/form.js +137 -136
- package/dist/components/ui/google-map.js +38 -6
- package/dist/components/ui/icon-input.js +48 -45
- package/dist/components/ui/krakstack-provider.js +2 -2
- package/dist/components/ui/locale-switcher.js +4 -4
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/search-menu.js +2 -2
- package/dist/components/ui/sidebar-layout.js +82 -80
- package/dist/components/ui/theme-switcher.js +6 -6
- package/dist/components/ui/virtualized-combobox.js +34 -31
- package/dist/lib/docs.d.ts +2 -2
- package/dist/lib/docs.js +187 -185
- package/dist/lib/docs.server.js +45 -23
- package/dist/lib/documentation-toolkit.d.ts +2 -2
- package/dist/lib/documentation-toolkit.js +45 -23
- package/dist/lib/httpapi-adapter.d.ts +11 -3
- package/dist/lib/httpapi-adapter.js +42 -15
- package/dist/lib/httpapi-cli.d.ts +13 -4
- package/dist/lib/httpapi-cli.js +70 -28
- package/dist/lib/httpapi-toolkit.js +40 -13
- package/dist/lib/query.d.ts +4 -4
- package/dist/lib/query.js +13 -13
- package/dist/lib/seo.js +2 -2
- package/dist/lib/webfetch-toolkit.js +7 -7
- package/dist/oxlint/anti-slop/index.js +2 -2
- package/dist/services/agent/client/index.js +155 -153
- package/dist/services/agent/index.js +3 -3
- package/dist/services/agent/schema.js +5 -5
- package/dist/services/events/browser.js +38 -23
- package/dist/services/events/client/audit-log-table.js +472 -459
- package/dist/services/events/client/tracking-notice.js +9 -4
- package/dist/services/events/index.d.ts +3 -1
- package/dist/services/events/index.js +79 -74
- package/dist/services/events/migrations.js +2 -2
- package/dist/services/events/record.js +2 -2
- package/dist/services/events/schema.d.ts +18 -10
- package/dist/services/events/schema.js +42 -42
- package/dist/services/file-extraction/index.js +4 -4
- package/dist/services/file-extraction/schema.d.ts +3 -1
- package/dist/services/file-extraction/schema.js +2 -2
- package/dist/services/health/api.builder.d.ts +8 -8
- package/dist/services/health/api.group.d.ts +8 -8
- package/dist/services/health/index.d.ts +10 -6
- package/dist/services/health/index.js +17 -13
- package/dist/services/health/schema.d.ts +7 -7
- package/dist/services/notification/channels/ses/index.js +2 -2
- package/dist/services/notification/channels/ses/schema.js +2 -2
- package/dist/services/notification/client/index.js +5 -5
- package/dist/services/notification/index.js +3 -3
- package/dist/services/notification/persistence/drizzle.js +2 -2
- package/dist/services/notification/persistence/index.js +15 -15
- package/dist/services/notification/persistence/schema.js +12 -12
- package/dist/services/notification/public.js +8 -8
- package/dist/services/notification/schema.d.ts +3 -1
- package/dist/services/notification/schema.js +2 -2
- package/dist/services/opentelemetry/api.js +7 -5
- package/dist/services/opentelemetry/browser.js +9 -9
- package/dist/services/opentelemetry/index.js +2 -2
- package/dist/services/opentelemetry/processor.d.ts +3 -1
- package/dist/services/opentelemetry/web-vitals.js +12 -7
- package/dist/services/s3/index.js +2 -2
- package/dist/services/s3/schema.d.ts +3 -1
- package/dist/services/s3/schema.js +2 -2
- package/dist/services/speech/api.js +3 -1
- package/dist/services/speech/index.js +15 -8
- package/dist/services/speech/schema.d.ts +3 -1
- package/dist/services/speech/schema.js +12 -10
- package/dist/services/webhooks/client/delivery-table.d.ts +62 -0
- package/dist/services/webhooks/client/delivery-table.js +4711 -0
- package/dist/services/webhooks/http-client.d.ts +1 -0
- package/dist/services/webhooks/http-client.js +17 -5
- package/dist/services/webhooks/index.d.ts +2 -0
- package/dist/services/webhooks/index.js +249 -114
- package/dist/services/webhooks/migrations.d.ts +3 -0
- package/dist/services/webhooks/migrations.js +21 -2
- package/dist/services/webhooks/receiver.d.ts +45 -0
- package/dist/services/webhooks/schema.d.ts +15 -5
- package/dist/services/webhooks/schema.js +41 -21
- package/dist/services/webhooks/url.d.ts +5 -0
- package/dist/services/webhooks/url.js +18 -2
- package/package.json +10 -1
package/dist/lib/docs.server.js
CHANGED
|
@@ -10,12 +10,13 @@ import { Cookies as Cookies2 } from "effect/http";
|
|
|
10
10
|
import {
|
|
11
11
|
forwardRef,
|
|
12
12
|
useDeferredValue,
|
|
13
|
-
useEffect as
|
|
14
|
-
useState as
|
|
13
|
+
useEffect as useEffect4,
|
|
14
|
+
useState as useState5
|
|
15
15
|
} from "react";
|
|
16
16
|
|
|
17
17
|
// ../../src/components/ui/app-brand.tsx
|
|
18
18
|
import { Link } from "@tanstack/react-router";
|
|
19
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
19
20
|
|
|
20
21
|
// ../../src/components/ui/badge.tsx
|
|
21
22
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
@@ -45,6 +46,7 @@ var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center
|
|
|
45
46
|
// ../../src/components/ui/button.tsx
|
|
46
47
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
47
48
|
import { cva as cva2 } from "class-variance-authority";
|
|
49
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
48
50
|
var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
49
51
|
variants: {
|
|
50
52
|
variant: {
|
|
@@ -76,6 +78,7 @@ var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justif
|
|
|
76
78
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
77
79
|
import { useEffect, useRef, useState } from "react";
|
|
78
80
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
81
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
79
82
|
|
|
80
83
|
// ../../src/components/ui/code-block.tsx
|
|
81
84
|
import { highlight } from "@tanstack/highlight";
|
|
@@ -83,6 +86,7 @@ import { createThemeCss } from "@tanstack/highlight/theme";
|
|
|
83
86
|
import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
|
|
84
87
|
import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
|
|
85
88
|
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
89
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
86
90
|
var themeCss = `${createThemeCss({
|
|
87
91
|
light: githubLightTheme,
|
|
88
92
|
dark: githubDarkTheme,
|
|
@@ -100,8 +104,12 @@ var themeCss = `${createThemeCss({
|
|
|
100
104
|
}
|
|
101
105
|
[data-code-theme] pre.th-code code { font: inherit; }`;
|
|
102
106
|
|
|
107
|
+
// ../../src/lib/markdown/content.tsx
|
|
108
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
109
|
+
|
|
103
110
|
// ../../src/components/ui/collapsible.tsx
|
|
104
111
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
112
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
105
113
|
|
|
106
114
|
// ../../src/components/ui/search-menu.tsx
|
|
107
115
|
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
@@ -114,15 +122,20 @@ import { SearchIcon } from "lucide-react";
|
|
|
114
122
|
// ../../src/components/ui/dialog.tsx
|
|
115
123
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
116
124
|
import { XIcon } from "lucide-react";
|
|
125
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
126
|
+
|
|
127
|
+
// ../../src/components/ui/command.tsx
|
|
128
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
117
129
|
|
|
118
130
|
// ../../src/components/ui/search-menu.tsx
|
|
119
131
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
132
|
+
import { jsx as jsx9, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
120
133
|
|
|
121
134
|
// ../../src/components/ui/sidebar-layout.tsx
|
|
122
135
|
import { Link as Link2, Outlet } from "@tanstack/react-router";
|
|
123
136
|
import { Option, Schema as Schema2 } from "effect";
|
|
124
137
|
import { Cookies } from "effect/http";
|
|
125
|
-
import { useState as
|
|
138
|
+
import { useState as useState4 } from "react";
|
|
126
139
|
|
|
127
140
|
// ../../src/components/ui/sidebar.tsx
|
|
128
141
|
import * as React2 from "react";
|
|
@@ -135,22 +148,30 @@ import * as React from "react";
|
|
|
135
148
|
|
|
136
149
|
// ../../src/components/ui/input.tsx
|
|
137
150
|
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
151
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
138
152
|
|
|
139
153
|
// ../../src/components/ui/separator.tsx
|
|
140
154
|
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
155
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
141
156
|
|
|
142
157
|
// ../../src/components/ui/sheet.tsx
|
|
143
158
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
144
159
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
160
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
145
161
|
"use client";
|
|
146
162
|
|
|
163
|
+
// ../../src/components/ui/skeleton.tsx
|
|
164
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
165
|
+
|
|
147
166
|
// ../../src/components/ui/tooltip.tsx
|
|
148
167
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
168
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
149
169
|
"use client";
|
|
150
170
|
|
|
151
171
|
// ../../src/components/ui/sidebar.tsx
|
|
152
172
|
import { PanelLeftIcon } from "lucide-react";
|
|
153
173
|
import { Schema } from "effect";
|
|
174
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
154
175
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
155
176
|
var SidebarContext = React2.createContext(null);
|
|
156
177
|
var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
@@ -172,19 +193,20 @@ var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-
|
|
|
172
193
|
});
|
|
173
194
|
|
|
174
195
|
// ../../src/components/ui/sidebar-layout.tsx
|
|
196
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
175
197
|
var SidebarOpenCookie = Schema2.Literals(["true", "false"]).annotate({
|
|
176
198
|
identifier: "SidebarOpenCookie"
|
|
177
199
|
});
|
|
178
200
|
|
|
179
201
|
// ../../src/lib/docs.tsx
|
|
180
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
202
|
+
import { jsx as jsx17, jsxs as jsxs11, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
181
203
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
182
204
|
var SidebarOpenCookie2 = Schema3.Literals(["true", "false"]).annotate({
|
|
183
205
|
identifier: "SidebarOpenCookie"
|
|
184
206
|
});
|
|
185
207
|
var getSidebarOpenCookie = createIsomorphicFn().server(() => getCookie(SIDEBAR_COOKIE_NAME)).client(() => Cookies2.parseHeader(globalThis.document?.cookie ?? "")[SIDEBAR_COOKIE_NAME]);
|
|
186
208
|
var makeIcon = (name, paths) => {
|
|
187
|
-
const Icon = forwardRef(({ absoluteStrokeWidth: _absoluteStrokeWidth, size = 24, ...props }, ref) => /* @__PURE__ */
|
|
209
|
+
const Icon = forwardRef(({ absoluteStrokeWidth: _absoluteStrokeWidth, size = 24, ...props }, ref) => /* @__PURE__ */ jsx17("svg", {
|
|
188
210
|
"aria-hidden": "true",
|
|
189
211
|
fill: "none",
|
|
190
212
|
height: size,
|
|
@@ -201,48 +223,48 @@ var makeIcon = (name, paths) => {
|
|
|
201
223
|
Icon.displayName = name;
|
|
202
224
|
return Icon;
|
|
203
225
|
};
|
|
204
|
-
var ArrowLeft = makeIcon("ArrowLeft", /* @__PURE__ */
|
|
226
|
+
var ArrowLeft = makeIcon("ArrowLeft", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
205
227
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ jsx17("path", {
|
|
207
229
|
d: "m12 19-7-7 7-7"
|
|
208
230
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ jsx17("path", {
|
|
210
232
|
d: "M19 12H5"
|
|
211
233
|
})
|
|
212
234
|
]
|
|
213
235
|
}));
|
|
214
|
-
var ArrowRight = makeIcon("ArrowRight", /* @__PURE__ */
|
|
236
|
+
var ArrowRight = makeIcon("ArrowRight", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
215
237
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx17("path", {
|
|
217
239
|
d: "M5 12h14"
|
|
218
240
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ jsx17("path", {
|
|
220
242
|
d: "m12 5 7 7-7 7"
|
|
221
243
|
})
|
|
222
244
|
]
|
|
223
245
|
}));
|
|
224
|
-
var BookOpen = makeIcon("BookOpen", /* @__PURE__ */
|
|
246
|
+
var BookOpen = makeIcon("BookOpen", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
225
247
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ jsx17("path", {
|
|
227
249
|
d: "M12 7v14"
|
|
228
250
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsx17("path", {
|
|
230
252
|
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4Z"
|
|
231
253
|
})
|
|
232
254
|
]
|
|
233
255
|
}));
|
|
234
|
-
var ChevronDown = makeIcon("ChevronDown", /* @__PURE__ */
|
|
256
|
+
var ChevronDown = makeIcon("ChevronDown", /* @__PURE__ */ jsx17("path", {
|
|
235
257
|
d: "m6 9 6 6 6-6"
|
|
236
258
|
}));
|
|
237
|
-
var ExternalLink = makeIcon("ExternalLink", /* @__PURE__ */
|
|
259
|
+
var ExternalLink = makeIcon("ExternalLink", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
238
260
|
children: [
|
|
239
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ jsx17("path", {
|
|
240
262
|
d: "M15 3h6v6"
|
|
241
263
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ jsx17("path", {
|
|
243
265
|
d: "M10 14 21 3"
|
|
244
266
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ jsx17("path", {
|
|
246
268
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
247
269
|
})
|
|
248
270
|
]
|
|
@@ -264,7 +286,7 @@ var DocsFrontmatter = Schema3.Struct({
|
|
|
264
286
|
title: Schema3.String,
|
|
265
287
|
description: Schema3.String,
|
|
266
288
|
icon: Schema3.optional(Schema3.String),
|
|
267
|
-
order: Schema3.
|
|
289
|
+
order: Schema3.Finite,
|
|
268
290
|
locale: Schema3.String,
|
|
269
291
|
section: DocsSection,
|
|
270
292
|
type: DocsPageType,
|
|
@@ -409,7 +431,7 @@ var compileMdxDocsPage = (sourceFile, source) => {
|
|
|
409
431
|
throw new Error(`Body title does not match frontmatter in ${sourceFile}`);
|
|
410
432
|
}
|
|
411
433
|
const body = bodySource.replace(/^\s*#\s+.+?\r?\n+/, "");
|
|
412
|
-
return Schema4.
|
|
434
|
+
return Schema4.decodeSync(DocsPageSchema)({
|
|
413
435
|
...frontmatter,
|
|
414
436
|
...compileDocsMarkdown(body),
|
|
415
437
|
sourceFile
|
|
@@ -424,7 +446,7 @@ var loadMdxDocsDirectory = async (root) => {
|
|
|
424
446
|
return pages;
|
|
425
447
|
};
|
|
426
448
|
export {
|
|
427
|
-
|
|
449
|
+
loadMdxDocsDirectory,
|
|
428
450
|
compileMdxDocsPage,
|
|
429
|
-
|
|
451
|
+
compileDocsMarkdown
|
|
430
452
|
};
|
|
@@ -13,7 +13,7 @@ export declare const DocumentationToolkit: Toolkit.Toolkit<{
|
|
|
13
13
|
readonly title: Schema.String;
|
|
14
14
|
readonly description: Schema.String;
|
|
15
15
|
readonly icon: Schema.optional<Schema.String>;
|
|
16
|
-
readonly order: Schema.
|
|
16
|
+
readonly order: Schema.Finite;
|
|
17
17
|
readonly locale: Schema.String;
|
|
18
18
|
readonly section: Schema.String;
|
|
19
19
|
readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
|
|
@@ -115,7 +115,7 @@ export declare const DocumentationToolkitLayer: ({ docs, locale, }: Documentatio
|
|
|
115
115
|
readonly title: Schema.String;
|
|
116
116
|
readonly description: Schema.String;
|
|
117
117
|
readonly icon: Schema.optional<Schema.String>;
|
|
118
|
-
readonly order: Schema.
|
|
118
|
+
readonly order: Schema.Finite;
|
|
119
119
|
readonly locale: Schema.String;
|
|
120
120
|
readonly section: Schema.String;
|
|
121
121
|
readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
|
|
@@ -10,12 +10,13 @@ import { Cookies as Cookies2 } from "effect/http";
|
|
|
10
10
|
import {
|
|
11
11
|
forwardRef,
|
|
12
12
|
useDeferredValue,
|
|
13
|
-
useEffect as
|
|
14
|
-
useState as
|
|
13
|
+
useEffect as useEffect4,
|
|
14
|
+
useState as useState5
|
|
15
15
|
} from "react";
|
|
16
16
|
|
|
17
17
|
// ../../src/components/ui/app-brand.tsx
|
|
18
18
|
import { Link } from "@tanstack/react-router";
|
|
19
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
19
20
|
|
|
20
21
|
// ../../src/components/ui/badge.tsx
|
|
21
22
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
@@ -45,6 +46,7 @@ var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center
|
|
|
45
46
|
// ../../src/components/ui/button.tsx
|
|
46
47
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
47
48
|
import { cva as cva2 } from "class-variance-authority";
|
|
49
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
48
50
|
var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
49
51
|
variants: {
|
|
50
52
|
variant: {
|
|
@@ -76,6 +78,7 @@ var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justif
|
|
|
76
78
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
77
79
|
import { useEffect, useRef, useState } from "react";
|
|
78
80
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
81
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
79
82
|
|
|
80
83
|
// ../../src/components/ui/code-block.tsx
|
|
81
84
|
import { highlight } from "@tanstack/highlight";
|
|
@@ -83,6 +86,7 @@ import { createThemeCss } from "@tanstack/highlight/theme";
|
|
|
83
86
|
import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
|
|
84
87
|
import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
|
|
85
88
|
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
89
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
86
90
|
var themeCss = `${createThemeCss({
|
|
87
91
|
light: githubLightTheme,
|
|
88
92
|
dark: githubDarkTheme,
|
|
@@ -100,8 +104,12 @@ var themeCss = `${createThemeCss({
|
|
|
100
104
|
}
|
|
101
105
|
[data-code-theme] pre.th-code code { font: inherit; }`;
|
|
102
106
|
|
|
107
|
+
// ../../src/lib/markdown/content.tsx
|
|
108
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
109
|
+
|
|
103
110
|
// ../../src/components/ui/collapsible.tsx
|
|
104
111
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
112
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
105
113
|
|
|
106
114
|
// ../../src/components/ui/search-menu.tsx
|
|
107
115
|
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
@@ -114,15 +122,20 @@ import { SearchIcon } from "lucide-react";
|
|
|
114
122
|
// ../../src/components/ui/dialog.tsx
|
|
115
123
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
116
124
|
import { XIcon } from "lucide-react";
|
|
125
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
126
|
+
|
|
127
|
+
// ../../src/components/ui/command.tsx
|
|
128
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
117
129
|
|
|
118
130
|
// ../../src/components/ui/search-menu.tsx
|
|
119
131
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
132
|
+
import { jsx as jsx9, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
120
133
|
|
|
121
134
|
// ../../src/components/ui/sidebar-layout.tsx
|
|
122
135
|
import { Link as Link2, Outlet } from "@tanstack/react-router";
|
|
123
136
|
import { Option, Schema as Schema2 } from "effect";
|
|
124
137
|
import { Cookies } from "effect/http";
|
|
125
|
-
import { useState as
|
|
138
|
+
import { useState as useState4 } from "react";
|
|
126
139
|
|
|
127
140
|
// ../../src/components/ui/sidebar.tsx
|
|
128
141
|
import * as React2 from "react";
|
|
@@ -135,22 +148,30 @@ import * as React from "react";
|
|
|
135
148
|
|
|
136
149
|
// ../../src/components/ui/input.tsx
|
|
137
150
|
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
151
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
138
152
|
|
|
139
153
|
// ../../src/components/ui/separator.tsx
|
|
140
154
|
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
155
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
141
156
|
|
|
142
157
|
// ../../src/components/ui/sheet.tsx
|
|
143
158
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
144
159
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
160
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
145
161
|
"use client";
|
|
146
162
|
|
|
163
|
+
// ../../src/components/ui/skeleton.tsx
|
|
164
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
165
|
+
|
|
147
166
|
// ../../src/components/ui/tooltip.tsx
|
|
148
167
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
168
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
149
169
|
"use client";
|
|
150
170
|
|
|
151
171
|
// ../../src/components/ui/sidebar.tsx
|
|
152
172
|
import { PanelLeftIcon } from "lucide-react";
|
|
153
173
|
import { Schema } from "effect";
|
|
174
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
154
175
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
155
176
|
var SidebarContext = React2.createContext(null);
|
|
156
177
|
var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
@@ -172,19 +193,20 @@ var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-
|
|
|
172
193
|
});
|
|
173
194
|
|
|
174
195
|
// ../../src/components/ui/sidebar-layout.tsx
|
|
196
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
175
197
|
var SidebarOpenCookie = Schema2.Literals(["true", "false"]).annotate({
|
|
176
198
|
identifier: "SidebarOpenCookie"
|
|
177
199
|
});
|
|
178
200
|
|
|
179
201
|
// ../../src/lib/docs.tsx
|
|
180
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
202
|
+
import { jsx as jsx17, jsxs as jsxs11, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
181
203
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
182
204
|
var SidebarOpenCookie2 = Schema3.Literals(["true", "false"]).annotate({
|
|
183
205
|
identifier: "SidebarOpenCookie"
|
|
184
206
|
});
|
|
185
207
|
var getSidebarOpenCookie = createIsomorphicFn().server(() => getCookie(SIDEBAR_COOKIE_NAME)).client(() => Cookies2.parseHeader(globalThis.document?.cookie ?? "")[SIDEBAR_COOKIE_NAME]);
|
|
186
208
|
var makeIcon = (name, paths) => {
|
|
187
|
-
const Icon = forwardRef(({ absoluteStrokeWidth: _absoluteStrokeWidth, size = 24, ...props }, ref) => /* @__PURE__ */
|
|
209
|
+
const Icon = forwardRef(({ absoluteStrokeWidth: _absoluteStrokeWidth, size = 24, ...props }, ref) => /* @__PURE__ */ jsx17("svg", {
|
|
188
210
|
"aria-hidden": "true",
|
|
189
211
|
fill: "none",
|
|
190
212
|
height: size,
|
|
@@ -201,48 +223,48 @@ var makeIcon = (name, paths) => {
|
|
|
201
223
|
Icon.displayName = name;
|
|
202
224
|
return Icon;
|
|
203
225
|
};
|
|
204
|
-
var ArrowLeft = makeIcon("ArrowLeft", /* @__PURE__ */
|
|
226
|
+
var ArrowLeft = makeIcon("ArrowLeft", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
205
227
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ jsx17("path", {
|
|
207
229
|
d: "m12 19-7-7 7-7"
|
|
208
230
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ jsx17("path", {
|
|
210
232
|
d: "M19 12H5"
|
|
211
233
|
})
|
|
212
234
|
]
|
|
213
235
|
}));
|
|
214
|
-
var ArrowRight = makeIcon("ArrowRight", /* @__PURE__ */
|
|
236
|
+
var ArrowRight = makeIcon("ArrowRight", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
215
237
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx17("path", {
|
|
217
239
|
d: "M5 12h14"
|
|
218
240
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ jsx17("path", {
|
|
220
242
|
d: "m12 5 7 7-7 7"
|
|
221
243
|
})
|
|
222
244
|
]
|
|
223
245
|
}));
|
|
224
|
-
var BookOpen = makeIcon("BookOpen", /* @__PURE__ */
|
|
246
|
+
var BookOpen = makeIcon("BookOpen", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
225
247
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ jsx17("path", {
|
|
227
249
|
d: "M12 7v14"
|
|
228
250
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsx17("path", {
|
|
230
252
|
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4Z"
|
|
231
253
|
})
|
|
232
254
|
]
|
|
233
255
|
}));
|
|
234
|
-
var ChevronDown = makeIcon("ChevronDown", /* @__PURE__ */
|
|
256
|
+
var ChevronDown = makeIcon("ChevronDown", /* @__PURE__ */ jsx17("path", {
|
|
235
257
|
d: "m6 9 6 6 6-6"
|
|
236
258
|
}));
|
|
237
|
-
var ExternalLink = makeIcon("ExternalLink", /* @__PURE__ */
|
|
259
|
+
var ExternalLink = makeIcon("ExternalLink", /* @__PURE__ */ jsxs11(Fragment3, {
|
|
238
260
|
children: [
|
|
239
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ jsx17("path", {
|
|
240
262
|
d: "M15 3h6v6"
|
|
241
263
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ jsx17("path", {
|
|
243
265
|
d: "M10 14 21 3"
|
|
244
266
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ jsx17("path", {
|
|
246
268
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
247
269
|
})
|
|
248
270
|
]
|
|
@@ -264,7 +286,7 @@ var DocsFrontmatter = Schema3.Struct({
|
|
|
264
286
|
title: Schema3.String,
|
|
265
287
|
description: Schema3.String,
|
|
266
288
|
icon: Schema3.optional(Schema3.String),
|
|
267
|
-
order: Schema3.
|
|
289
|
+
order: Schema3.Finite,
|
|
268
290
|
locale: Schema3.String,
|
|
269
291
|
section: DocsSection,
|
|
270
292
|
type: DocsPageType,
|
|
@@ -353,8 +375,8 @@ var DocumentationToolkitLayer = ({
|
|
|
353
375
|
readDocumentation: ({ paths }) => readDocumentation({ docs, locale, paths })
|
|
354
376
|
});
|
|
355
377
|
export {
|
|
356
|
-
|
|
357
|
-
DocumentationToolkitLayer,
|
|
378
|
+
searchDocumentation,
|
|
358
379
|
readDocumentation,
|
|
359
|
-
|
|
380
|
+
DocumentationToolkitLayer,
|
|
381
|
+
DocumentationToolkit
|
|
360
382
|
};
|
|
@@ -2,6 +2,14 @@ import { Context, Effect, JsonSchema, Layer, Schema } from "effect";
|
|
|
2
2
|
import type { Json } from "effect/Schema";
|
|
3
3
|
import { HttpClient } from "effect/http";
|
|
4
4
|
import { HttpApi, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
5
|
+
declare const HttpApiAdapterError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly _tag: "HttpApiAdapterError";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
declare class HttpApiAdapterError extends HttpApiAdapterError_base<{
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly cause?: unknown;
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
5
13
|
export type HttpApiMethod = "get" | "post" | "put" | "patch" | "delete";
|
|
6
14
|
declare const HttpApiOperation: Schema.Struct<{
|
|
7
15
|
readonly operationId: Schema.optional<Schema.String>;
|
|
@@ -64,10 +72,10 @@ export type HttpApiAdapterService = {
|
|
|
64
72
|
readonly execute: (options: HttpApiAdapterExecuteOptions) => Effect.Effect<unknown, Error>;
|
|
65
73
|
readonly encodeResult: (result: unknown, operation: HttpApiOperationDefinition) => Effect.Effect<Json, Error>;
|
|
66
74
|
};
|
|
67
|
-
export declare const encodeHttpApiOperationResult: (result: unknown) => Effect.Effect<string | number | boolean | Schema.JsonArray | Schema.JsonObject | null,
|
|
75
|
+
export declare const encodeHttpApiOperationResult: (result: unknown) => Effect.Effect<string | number | boolean | Schema.JsonArray | Schema.JsonObject | null, HttpApiAdapterError, never>;
|
|
68
76
|
declare const HttpApiAdapter_base: Context.ServiceClass<HttpApiAdapter, "@krak-stack/registry/HttpApiAdapter", HttpApiAdapterService>;
|
|
69
77
|
export declare class HttpApiAdapter extends HttpApiAdapter_base {
|
|
70
|
-
static readonly make: <Id extends string, Groups extends HttpApiGroup.Constraint>(config: HttpApiAdapterConfig<Id, Groups>) => Effect.Effect<HttpApiAdapterService,
|
|
71
|
-
static readonly layer: <Id extends string, Groups extends HttpApiGroup.Constraint>(config: HttpApiAdapterConfig<Id, Groups>) => Layer.Layer<HttpApiAdapter,
|
|
78
|
+
static readonly make: <Id extends string, Groups extends HttpApiGroup.Constraint>(config: HttpApiAdapterConfig<Id, Groups>) => Effect.Effect<HttpApiAdapterService, HttpApiAdapterError, HttpClient.HttpClient | import("effect/http-api/HttpApiMiddleware").MiddlewareClient<import("effect/http-api/HttpApiEndpoint").Middleware<HttpApiGroup.Endpoints<Groups>>>>;
|
|
79
|
+
static readonly layer: <Id extends string, Groups extends HttpApiGroup.Constraint>(config: HttpApiAdapterConfig<Id, Groups>) => Layer.Layer<HttpApiAdapter, HttpApiAdapterError, HttpClient.HttpClient | Exclude<import("effect/http-api/HttpApiMiddleware").MiddlewareClient<import("effect/http-api/HttpApiEndpoint").Middleware<HttpApiGroup.Endpoints<Groups>>>, import("effect/Scope").Scope>>;
|
|
72
80
|
}
|
|
73
81
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// ../../src/lib/httpapi-adapter.ts
|
|
2
|
+
import * as Data from "effect/Data";
|
|
2
3
|
import {
|
|
3
4
|
Context,
|
|
4
5
|
Effect,
|
|
@@ -9,6 +10,9 @@ import {
|
|
|
9
10
|
} from "effect";
|
|
10
11
|
import { HttpClient } from "effect/http";
|
|
11
12
|
import { HttpApi, HttpApiClient, OpenApi } from "effect/http-api";
|
|
13
|
+
|
|
14
|
+
class HttpApiAdapterError extends Data.TaggedError("HttpApiAdapterError") {
|
|
15
|
+
}
|
|
12
16
|
var HttpApiMethods = [
|
|
13
17
|
"get",
|
|
14
18
|
"post",
|
|
@@ -45,7 +49,7 @@ var HttpApiOperationResultValue = Schema.suspend(() => Schema.Union([
|
|
|
45
49
|
Schema.Null,
|
|
46
50
|
UndefinedFromNull,
|
|
47
51
|
Schema.String,
|
|
48
|
-
Schema.
|
|
52
|
+
Schema.Finite,
|
|
49
53
|
Schema.Boolean,
|
|
50
54
|
Schema.DateFromString,
|
|
51
55
|
Schema.Uint8ArrayFromBase64,
|
|
@@ -56,9 +60,15 @@ var HttpApiOperationResult = Schema.Union([
|
|
|
56
60
|
HttpApiOperationResultValue,
|
|
57
61
|
Schema.Undefined
|
|
58
62
|
]).annotate({ identifier: "HttpApiOperationResult" });
|
|
59
|
-
var encodeHttpApiOperationResult = Effect.fn("HttpApiAdapter.encodeOperationResult")((result) => Schema.encodeUnknownEffect(HttpApiOperationResult)(result).pipe(Effect.map((encoded) => encoded ?? null), Effect.mapError((cause) => new
|
|
60
|
-
|
|
61
|
-
cause
|
|
63
|
+
var encodeHttpApiOperationResult = Effect.fn("HttpApiAdapter.encodeOperationResult")((result) => Schema.encodeUnknownEffect(HttpApiOperationResult)(result).pipe(Effect.map((encoded) => encoded ?? null), Effect.mapError((cause) => new HttpApiAdapterError({
|
|
64
|
+
message: "HTTP API result is not serializable",
|
|
65
|
+
cause: { cause }.cause
|
|
66
|
+
}))));
|
|
67
|
+
var encodeOperationResult = Effect.fn("HttpApiAdapter.encodeResult")((result, operation) => operation.successSchema ? Schema.encodeUnknownEffect(operation.successSchema)(result).pipe(Effect.flatMap(encodeHttpApiOperationResult), Effect.mapError((cause) => new HttpApiAdapterError({
|
|
68
|
+
message: "HTTP API result does not match its success schema",
|
|
69
|
+
cause: {
|
|
70
|
+
cause
|
|
71
|
+
}.cause
|
|
62
72
|
}))) : encodeHttpApiOperationResult(result));
|
|
63
73
|
var reflectedSchema = (schema) => Schema.make(schema.ast);
|
|
64
74
|
var sanitizeHttpName = (name) => name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -66,7 +76,9 @@ var httpApiToolName = (entry) => (entry.operation.operationId || `${entry.method
|
|
|
66
76
|
var makeCatalogue = (api, methods, include) => Effect.try({
|
|
67
77
|
try: () => {
|
|
68
78
|
if (!HttpApi.isHttpApi(api))
|
|
69
|
-
throw new
|
|
79
|
+
throw new HttpApiAdapterError({
|
|
80
|
+
message: "HttpApiAdapter requires a valid HttpApi"
|
|
81
|
+
});
|
|
70
82
|
const spec = OpenApi.fromApi(api);
|
|
71
83
|
const reflected = new Map;
|
|
72
84
|
HttpApi.reflect(api, {
|
|
@@ -76,7 +88,9 @@ var makeCatalogue = (api, methods, include) => Effect.try({
|
|
|
76
88
|
onEndpoint: ({ endpoint, group, successes }) => {
|
|
77
89
|
const operationId = Context.getOrElse(endpoint.annotations, OpenApi.Identifier, () => group.topLevel ? endpoint.identifier : `${group.identifier}.${endpoint.identifier}`);
|
|
78
90
|
if (reflected.has(operationId))
|
|
79
|
-
throw new
|
|
91
|
+
throw new HttpApiAdapterError({
|
|
92
|
+
message: `Duplicate HTTP API operation ID: ${operationId}`
|
|
93
|
+
});
|
|
80
94
|
const fields = {};
|
|
81
95
|
if (endpoint.params)
|
|
82
96
|
fields.params = Schema.toType(reflectedSchema(endpoint.params));
|
|
@@ -115,10 +129,14 @@ var makeCatalogue = (api, methods, include) => Effect.try({
|
|
|
115
129
|
continue;
|
|
116
130
|
const metadata = entry.operation.operationId ? reflected.get(entry.operation.operationId) : undefined;
|
|
117
131
|
if (!metadata)
|
|
118
|
-
throw new
|
|
132
|
+
throw new HttpApiAdapterError({
|
|
133
|
+
message: `Missing endpoint schema for ${entry.operation.operationId}`
|
|
134
|
+
});
|
|
119
135
|
const name = httpApiToolName(entry);
|
|
120
136
|
if (!name || names.has(name))
|
|
121
|
-
throw new
|
|
137
|
+
throw new HttpApiAdapterError({
|
|
138
|
+
message: `Duplicate or empty HTTP API tool name: ${name}`
|
|
139
|
+
});
|
|
122
140
|
names.add(name);
|
|
123
141
|
const document = Schema.toJsonSchemaDocument(metadata.inputSchema.annotate({ identifier: undefined }));
|
|
124
142
|
operations.push({
|
|
@@ -137,7 +155,10 @@ var makeCatalogue = (api, methods, include) => Effect.try({
|
|
|
137
155
|
}
|
|
138
156
|
return { info: spec.info, operations };
|
|
139
157
|
},
|
|
140
|
-
catch: (cause) => new
|
|
158
|
+
catch: (cause) => new HttpApiAdapterError({
|
|
159
|
+
message: "Failed to build HTTP API adapter catalogue",
|
|
160
|
+
cause: { cause }.cause
|
|
161
|
+
})
|
|
141
162
|
});
|
|
142
163
|
var GeneratedOperation = Schema.declare((value) => value instanceof Function).annotate({ identifier: "GeneratedOperation" });
|
|
143
164
|
var GeneratedOperationEffect = Schema.declare((value) => Effect.isEffect(value)).annotate({ identifier: "GeneratedOperationEffect" });
|
|
@@ -146,15 +167,19 @@ var executeGeneratedOperation = Effect.fn("HttpApiAdapter.executeGeneratedOperat
|
|
|
146
167
|
const candidate = Object.entries(Object(group)).find(([name]) => name === operation.endpointIdentifier)?.[1];
|
|
147
168
|
const endpoint = Schema.decodeUnknownOption(GeneratedOperation)(candidate);
|
|
148
169
|
if (Option.isNone(endpoint))
|
|
149
|
-
return yield*
|
|
150
|
-
|
|
170
|
+
return yield* new HttpApiAdapterError({
|
|
171
|
+
message: `No generated API client operation for ${operation.operation.operationId}`
|
|
172
|
+
});
|
|
173
|
+
const result = Schema.decodeOption(GeneratedOperationEffect)(endpoint.value({
|
|
151
174
|
headers: input.headers ?? {},
|
|
152
175
|
params: input.params ?? {},
|
|
153
176
|
query: input.query ?? {},
|
|
154
177
|
payload: input.body
|
|
155
178
|
}));
|
|
156
179
|
if (Option.isNone(result))
|
|
157
|
-
return yield*
|
|
180
|
+
return yield* new HttpApiAdapterError({
|
|
181
|
+
message: `Generated API client operation ${operation.operation.operationId} is invalid`
|
|
182
|
+
});
|
|
158
183
|
return yield* result.value;
|
|
159
184
|
});
|
|
160
185
|
|
|
@@ -172,7 +197,9 @@ class HttpApiAdapter extends Context.Service()("@krak-stack/registry/HttpApiAdap
|
|
|
172
197
|
execute: Effect.fn("HttpApiAdapter.execute")(function* (options) {
|
|
173
198
|
const operation = catalogue.operations.find((entry) => entry.method === options.operation.method && entry.path === options.operation.path && entry.operation.operationId === options.operation.operation.operationId);
|
|
174
199
|
if (!operation) {
|
|
175
|
-
return yield*
|
|
200
|
+
return yield* new HttpApiAdapterError({
|
|
201
|
+
message: "Operation is not in this HTTP API adapter catalogue"
|
|
202
|
+
});
|
|
176
203
|
}
|
|
177
204
|
return yield* executeGeneratedOperation(client, {
|
|
178
205
|
operation,
|
|
@@ -184,6 +211,6 @@ class HttpApiAdapter extends Context.Service()("@krak-stack/registry/HttpApiAdap
|
|
|
184
211
|
static layer = (config) => Layer.effect(this, this.make(config));
|
|
185
212
|
}
|
|
186
213
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
214
|
+
encodeHttpApiOperationResult,
|
|
215
|
+
HttpApiAdapter
|
|
189
216
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
2
|
import { Command } from "effect/cli";
|
|
3
3
|
import { HttpApiAdapter } from "./httpapi-adapter.js";
|
|
4
|
+
declare const HttpApiCliError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly _tag: "HttpApiCliError";
|
|
6
|
+
} & Readonly<A>;
|
|
7
|
+
declare class HttpApiCliError extends HttpApiCliError_base<{
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
4
12
|
export declare const makeHttpApiCli: () => Effect.Effect<{
|
|
5
|
-
command: Command.Command<string, {}, {},
|
|
6
|
-
run: (args: ReadonlyArray<string>) => Effect.Effect<void,
|
|
7
|
-
},
|
|
13
|
+
command: Command.Command<string, {}, {}, Error | Schema.SchemaError, never>;
|
|
14
|
+
run: (args: ReadonlyArray<string>) => Effect.Effect<void, Error | Schema.SchemaError | import("effect/cli/CliError").CliError, Command.Environment>;
|
|
15
|
+
}, HttpApiCliError, HttpApiAdapter>;
|
|
16
|
+
export {};
|