appflare 0.2.24 → 0.2.26

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 (138) hide show
  1. package/Documentation.md +758 -758
  2. package/cli/commands/index.ts +238 -238
  3. package/cli/generate.ts +178 -178
  4. package/cli/index.ts +120 -120
  5. package/cli/load-config.ts +184 -184
  6. package/cli/schema-compiler.ts +1183 -1183
  7. package/cli/templates/auth/README.md +156 -156
  8. package/cli/templates/auth/config.ts +61 -61
  9. package/cli/templates/auth/route-config.ts +1 -1
  10. package/cli/templates/auth/route-handler.ts +1 -1
  11. package/cli/templates/auth/route-request-utils.ts +5 -5
  12. package/cli/templates/auth/route.config.ts +18 -18
  13. package/cli/templates/auth/route.handler.ts +18 -18
  14. package/cli/templates/auth/route.request-utils.ts +55 -55
  15. package/cli/templates/auth/route.ts +14 -14
  16. package/cli/templates/core/README.md +266 -266
  17. package/cli/templates/core/app-creation.ts +19 -19
  18. package/cli/templates/core/client/appflare.ts +112 -112
  19. package/cli/templates/core/client/handlers/index.ts +748 -749
  20. package/cli/templates/core/client/handlers.ts +1 -1
  21. package/cli/templates/core/client/index.ts +7 -7
  22. package/cli/templates/core/client/storage.ts +180 -180
  23. package/cli/templates/core/client/types.ts +184 -184
  24. package/cli/templates/core/client-modules/appflare.ts +1 -1
  25. package/cli/templates/core/client-modules/handlers.ts +1 -1
  26. package/cli/templates/core/client-modules/index.ts +1 -1
  27. package/cli/templates/core/client-modules/storage.ts +1 -1
  28. package/cli/templates/core/client-modules/types.ts +1 -1
  29. package/cli/templates/core/client.artifacts.ts +39 -39
  30. package/cli/templates/core/client.ts +4 -4
  31. package/cli/templates/core/drizzle.ts +15 -15
  32. package/cli/templates/core/export.ts +14 -14
  33. package/cli/templates/core/handlers.route.ts +24 -24
  34. package/cli/templates/core/handlers.ts +1 -1
  35. package/cli/templates/core/imports.ts +9 -9
  36. package/cli/templates/core/server.ts +38 -38
  37. package/cli/templates/core/types.ts +6 -6
  38. package/cli/templates/core/wrangler.ts +109 -109
  39. package/cli/templates/dashboard/builders/functions/index.ts +17 -17
  40. package/cli/templates/dashboard/builders/functions/render-page/header.ts +20 -20
  41. package/cli/templates/dashboard/builders/functions/render-page/index.ts +33 -33
  42. package/cli/templates/dashboard/builders/functions/render-page/request-panel.ts +171 -171
  43. package/cli/templates/dashboard/builders/functions/render-page/result-panel.ts +85 -85
  44. package/cli/templates/dashboard/builders/functions/render-page/scripts.ts +554 -554
  45. package/cli/templates/dashboard/builders/navigation.ts +122 -122
  46. package/cli/templates/dashboard/builders/storage/index.ts +13 -13
  47. package/cli/templates/dashboard/builders/storage/routes/create-directory-route.ts +29 -29
  48. package/cli/templates/dashboard/builders/storage/routes/delete-route.ts +18 -18
  49. package/cli/templates/dashboard/builders/storage/routes/download-route.ts +23 -23
  50. package/cli/templates/dashboard/builders/storage/routes/index.ts +22 -22
  51. package/cli/templates/dashboard/builders/storage/routes/list-route.ts +25 -25
  52. package/cli/templates/dashboard/builders/storage/routes/preview-route.ts +21 -21
  53. package/cli/templates/dashboard/builders/storage/routes/upload-route.ts +21 -21
  54. package/cli/templates/dashboard/builders/storage/runtime/helpers.ts +72 -72
  55. package/cli/templates/dashboard/builders/storage/runtime/storage-page.ts +130 -130
  56. package/cli/templates/dashboard/builders/table-routes/common/drawer-panel.ts +27 -27
  57. package/cli/templates/dashboard/builders/table-routes/common/pagination.ts +30 -30
  58. package/cli/templates/dashboard/builders/table-routes/common/search-bar.ts +23 -23
  59. package/cli/templates/dashboard/builders/table-routes/fragments.ts +217 -217
  60. package/cli/templates/dashboard/builders/table-routes/helpers.ts +45 -45
  61. package/cli/templates/dashboard/builders/table-routes/index.ts +8 -8
  62. package/cli/templates/dashboard/builders/table-routes/table/actions-cell.ts +71 -71
  63. package/cli/templates/dashboard/builders/table-routes/table/get-route.ts +291 -291
  64. package/cli/templates/dashboard/builders/table-routes/table/index.ts +80 -80
  65. package/cli/templates/dashboard/builders/table-routes/table/post-routes.ts +163 -163
  66. package/cli/templates/dashboard/builders/table-routes/table-route.ts +7 -7
  67. package/cli/templates/dashboard/builders/table-routes/users/get-route.ts +69 -69
  68. package/cli/templates/dashboard/builders/table-routes/users/html/modals.ts +57 -57
  69. package/cli/templates/dashboard/builders/table-routes/users/html/page.ts +27 -27
  70. package/cli/templates/dashboard/builders/table-routes/users/html/table.ts +128 -128
  71. package/cli/templates/dashboard/builders/table-routes/users/index.ts +32 -32
  72. package/cli/templates/dashboard/builders/table-routes/users/post-routes.ts +150 -150
  73. package/cli/templates/dashboard/builders/table-routes/users/redirect.ts +14 -14
  74. package/cli/templates/dashboard/builders/table-routes/users-route.ts +10 -10
  75. package/cli/templates/dashboard/components/dashboard-home.ts +23 -23
  76. package/cli/templates/dashboard/components/layout.ts +388 -388
  77. package/cli/templates/dashboard/components/login-page.ts +65 -65
  78. package/cli/templates/dashboard/index.ts +61 -61
  79. package/cli/templates/dashboard/types.ts +9 -9
  80. package/cli/templates/handlers/README.md +353 -353
  81. package/cli/templates/handlers/auth.ts +37 -37
  82. package/cli/templates/handlers/execution.ts +42 -42
  83. package/cli/templates/handlers/generators/context/context-creation.ts +101 -101
  84. package/cli/templates/handlers/generators/context/error-helpers.ts +11 -11
  85. package/cli/templates/handlers/generators/context/scheduler.ts +24 -24
  86. package/cli/templates/handlers/generators/context/storage-api.ts +134 -112
  87. package/cli/templates/handlers/generators/context/storage-helpers.ts +59 -59
  88. package/cli/templates/handlers/generators/context/types.ts +18 -18
  89. package/cli/templates/handlers/generators/context.ts +43 -43
  90. package/cli/templates/handlers/generators/execution.ts +15 -15
  91. package/cli/templates/handlers/generators/handlers.ts +13 -13
  92. package/cli/templates/handlers/generators/registration/modules/cron.ts +26 -26
  93. package/cli/templates/handlers/generators/registration/modules/realtime/auth.ts +75 -75
  94. package/cli/templates/handlers/generators/registration/modules/realtime/durable-object.ts +144 -144
  95. package/cli/templates/handlers/generators/registration/modules/realtime/index.ts +14 -14
  96. package/cli/templates/handlers/generators/registration/modules/realtime/publisher.ts +102 -102
  97. package/cli/templates/handlers/generators/registration/modules/realtime/routes.ts +164 -164
  98. package/cli/templates/handlers/generators/registration/modules/realtime/types.ts +30 -30
  99. package/cli/templates/handlers/generators/registration/modules/realtime/utils.ts +516 -516
  100. package/cli/templates/handlers/generators/registration/modules/scheduler.ts +56 -56
  101. package/cli/templates/handlers/generators/registration/modules/storage.ts +196 -194
  102. package/cli/templates/handlers/generators/registration/sections.ts +210 -210
  103. package/cli/templates/handlers/generators/types/context.ts +68 -66
  104. package/cli/templates/handlers/generators/types/core.ts +106 -106
  105. package/cli/templates/handlers/generators/types/operations.ts +135 -135
  106. package/cli/templates/handlers/generators/types/query-definitions/filter-and-where-types.ts +259 -259
  107. package/cli/templates/handlers/generators/types/query-definitions/query-api-types.ts +135 -135
  108. package/cli/templates/handlers/generators/types/query-definitions/query-helper-functions.ts +1031 -1031
  109. package/cli/templates/handlers/generators/types/query-definitions/schema-and-table-types.ts +246 -246
  110. package/cli/templates/handlers/generators/types/query-definitions.ts +13 -13
  111. package/cli/templates/handlers/generators/types/query-runtime/handled-error.ts +13 -13
  112. package/cli/templates/handlers/generators/types/query-runtime/runtime-aggregate-and-footer.ts +174 -174
  113. package/cli/templates/handlers/generators/types/query-runtime/runtime-read.ts +121 -121
  114. package/cli/templates/handlers/generators/types/query-runtime/runtime-setup.ts +45 -45
  115. package/cli/templates/handlers/generators/types/query-runtime/runtime-write.ts +676 -676
  116. package/cli/templates/handlers/generators/types/query-runtime.ts +15 -15
  117. package/cli/templates/handlers/index.ts +43 -43
  118. package/cli/templates/handlers/operations.ts +116 -116
  119. package/cli/templates/handlers/registration.ts +91 -83
  120. package/cli/templates/handlers/types.ts +15 -15
  121. package/cli/templates/handlers/utils.ts +48 -48
  122. package/cli/types.ts +110 -110
  123. package/cli/utils/handler-discovery.ts +466 -466
  124. package/cli/utils/json-utils.ts +24 -24
  125. package/cli/utils/path-utils.ts +19 -19
  126. package/cli/utils/schema-discovery.ts +399 -399
  127. package/dist/cli/index.js +61 -28
  128. package/dist/cli/index.mjs +61 -28
  129. package/index.ts +18 -18
  130. package/package.json +58 -58
  131. package/react/index.ts +5 -5
  132. package/react/use-infinite-query.ts +252 -252
  133. package/react/use-mutation.ts +89 -89
  134. package/react/use-query.ts +207 -207
  135. package/schema.ts +415 -415
  136. package/test-better-auth-hash.ts +2 -2
  137. package/tsconfig.json +6 -6
  138. package/tsup.config.ts +82 -82
@@ -1,171 +1,171 @@
1
- import { DiscoveredHandlerOperation } from "../../../../../utils/handler-discovery";
2
-
3
- function renderArgInputType(type: string): string {
4
- if (type === "boolean") return "checkbox";
5
- if (type === "number") return "number";
6
- return "text";
7
- }
8
-
9
- function renderArgRows(h: DiscoveredHandlerOperation): string {
10
- const fields = h.args ?? [];
11
- if (fields.length === 0) {
12
- return `
13
- <div class="text-[11px] opacity-30 italic py-2">No arguments defined for this ${h.kind}.</div>
14
- `;
15
- }
16
-
17
- return fields
18
- .map((field) => {
19
- const inputType = renderArgInputType(field.type);
20
- const isCheckbox = inputType === "checkbox";
21
- const label = `${field.name}${field.optional ? "" : " *"}`;
22
- const badge =
23
- field.type !== "unknown"
24
- ? `<span class="badge badge-xs badge-ghost font-mono opacity-40 ml-1">${field.type}</span>`
25
- : "";
26
-
27
- if (isCheckbox) {
28
- return `
29
- <div class="flex items-center gap-3 py-1">
30
- <input
31
- type="checkbox"
32
- data-arg-key="${field.name}"
33
- data-arg-type="boolean"
34
- class="checkbox checkbox-sm checkbox-primary"
35
- ${field.defaultValue === "true" ? "checked" : ""}
36
- />
37
- <span class="text-sm font-mono opacity-70">${field.name}${badge}</span>
38
- ${field.optional ? '<span class="text-[10px] opacity-30 italic ml-auto">optional</span>' : ""}
39
- </div>
40
- `;
41
- }
42
-
43
- return `
44
- <div class="form-control">
45
- <label class="label py-0.5">
46
- <span class="label-text text-[11px] font-mono font-semibold">${label}${badge}</span>
47
- ${field.optional ? '<span class="label-text-alt text-[10px] opacity-30 italic">optional</span>' : ""}
48
- </label>
49
- <input
50
- type="${inputType}"
51
- placeholder="${field.defaultValue ?? ""}"
52
- data-arg-key="${field.name}"
53
- data-arg-type="${field.type}"
54
- value="${field.defaultValue ?? ""}"
55
- class="input input-sm input-bordered font-mono w-full bg-base-200/30 focus:bg-base-100 focus:border-primary transition-all rounded-xl border-base-200"
56
- ${!field.optional ? "required" : ""}
57
- />
58
- </div>
59
- `;
60
- })
61
- .join("\n");
62
- }
63
-
64
- function renderArgumentsSection(h: DiscoveredHandlerOperation): string {
65
- return `
66
- <div class="space-y-4">
67
- <div class="flex items-center justify-between">
68
- <div class="flex flex-col">
69
- <span class="text-[11px] font-bold uppercase tracking-wider opacity-40">Arguments</span>
70
- <span class="text-[10px] font-mono opacity-30">${h.kind}</span>
71
- </div>
72
- <label class="flex items-center gap-2 cursor-pointer select-none group" title="Enable realtime updates via WebSocket">
73
- <span class="text-[10px] font-bold uppercase tracking-wider opacity-40 group-hover:opacity-70 transition-opacity">Realtime</span>
74
- <input type="checkbox" id="realtime-toggle" class="toggle toggle-xs toggle-success" onchange="toggleRealtime(this.checked)" />
75
- </label>
76
- </div>
77
- <div id="args-rows" class="flex flex-col gap-3">
78
- ${renderArgRows(h)}
79
- </div>
80
- <p class="text-[11px] opacity-30 mt-2 italic">Values are sent as ${h.kind === "query" ? "query string params" : "JSON request body"}.</p>
81
- </div>
82
- `;
83
- }
84
-
85
- function renderBearerTokenSection(): string {
86
- return `
87
- <div class="space-y-4">
88
- <label class="text-[11px] font-bold uppercase tracking-wider opacity-40 block">Bearer Token <span class="font-normal normal-case">(optional)</span></label>
89
- <div class="relative group">
90
- <input
91
- type="password"
92
- name="token"
93
- id="bearer-token-input"
94
- class="input input-sm input-bordered font-mono text-sm w-full bg-base-200/30 focus:bg-base-100 focus:border-primary transition-all rounded-xl border-base-200 pr-9"
95
- placeholder="eyJhbGciOi..."
96
- />
97
- <button type="button" onclick="toggleTokenVisibility()" class="absolute right-2.5 top-1/2 -translate-y-1/2 opacity-30 hover:opacity-70 transition-opacity">
98
- <iconify-icon id="token-eye-icon" icon="solar:eye-linear" width="15" height="15"></iconify-icon>
99
- </button>
100
- </div>
101
- <p class="text-[10px] opacity-30 italic">Token will be included in the Authorization header.</p>
102
- </div>
103
- `;
104
- }
105
-
106
- function renderCustomHeadersSection(): string {
107
- return `
108
- <div class="space-y-4">
109
- <div class="flex items-center justify-between">
110
- <span class="text-[11px] font-bold uppercase tracking-wider opacity-40">Custom Headers</span>
111
- <button type="button" onclick="addHeaderRow()" class="btn btn-xs btn-ghost gap-1 opacity-50 hover:opacity-100">
112
- <iconify-icon icon="solar:add-circle-linear" width="14" height="14"></iconify-icon>
113
- Add
114
- </button>
115
- </div>
116
- <div id="headers-rows" class="flex flex-col gap-2">
117
- <!-- populated by addHeaderRow() -->
118
- </div>
119
- <p id="headers-error" class="text-[11px] text-error mt-1.5 hidden"></p>
120
- </div>
121
- `;
122
- }
123
-
124
- export function renderRequestPanel(h: DiscoveredHandlerOperation): string {
125
- return `
126
- <div class="card bg-base-100 border border-base-200 shadow-sm overflow-hidden flex flex-col h-full">
127
- <div class="px-5 py-3 border-b border-base-200 bg-base-200/20 flex items-center justify-between flex-none">
128
- <h3 class="text-xs font-bold uppercase tracking-widest opacity-40">Request</h3>
129
- <iconify-icon icon="solar:settings-linear" width="16" height="16" class="opacity-30"></iconify-icon>
130
- </div>
131
-
132
- <div class="flex-1 overflow-hidden flex flex-col">
133
- <form id="fn-form" onsubmit="return false" class="flex flex-col h-full">
134
- <!-- Tabs Navigation -->
135
- <div class="px-5 pt-4 flex-none">
136
- <div role="tablist" class="tabs tabs-box bg-base-200/50 p-1 rounded-xl">
137
- <a role="tab" id="req-tab-btn-args" class="tab tab-active !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('args')">Args</a>
138
- <a role="tab" id="req-tab-btn-auth" class="tab !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('auth')">Auth</a>
139
- <a role="tab" id="req-tab-btn-headers" class="tab !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('headers')">Headers</a>
140
- </div>
141
- </div>
142
-
143
- <!-- Tab Content -->
144
- <div class="flex-1 overflow-y-auto">
145
- <div id="request-tab-args" class="p-5">
146
- ${renderArgumentsSection(h)}
147
- </div>
148
- <div id="request-tab-auth" class="p-5 hidden">
149
- ${renderBearerTokenSection()}
150
- </div>
151
- <div id="request-tab-headers" class="p-5 hidden">
152
- ${renderCustomHeadersSection()}
153
- </div>
154
- </div>
155
-
156
- <!-- Submit Button (Fixed at bottom) -->
157
- <div class="p-5 border-t border-base-200 mt-auto bg-base-200/5">
158
- <button
159
- type="button"
160
- onclick="executeFn()"
161
- class="btn btn-primary w-full gap-2 rounded-xl shadow-lg shadow-primary/20 hover:shadow-xl hover:shadow-primary/30 transition-all font-semibold"
162
- >
163
- <iconify-icon icon="solar:play-bold" width="18" height="18"></iconify-icon>
164
- Run ${h.kind}
165
- </button>
166
- </div>
167
- </form>
168
- </div>
169
- </div>
170
- `;
171
- }
1
+ import { DiscoveredHandlerOperation } from "../../../../../utils/handler-discovery";
2
+
3
+ function renderArgInputType(type: string): string {
4
+ if (type === "boolean") return "checkbox";
5
+ if (type === "number") return "number";
6
+ return "text";
7
+ }
8
+
9
+ function renderArgRows(h: DiscoveredHandlerOperation): string {
10
+ const fields = h.args ?? [];
11
+ if (fields.length === 0) {
12
+ return `
13
+ <div class="text-[11px] opacity-30 italic py-2">No arguments defined for this ${h.kind}.</div>
14
+ `;
15
+ }
16
+
17
+ return fields
18
+ .map((field) => {
19
+ const inputType = renderArgInputType(field.type);
20
+ const isCheckbox = inputType === "checkbox";
21
+ const label = `${field.name}${field.optional ? "" : " *"}`;
22
+ const badge =
23
+ field.type !== "unknown"
24
+ ? `<span class="badge badge-xs badge-ghost font-mono opacity-40 ml-1">${field.type}</span>`
25
+ : "";
26
+
27
+ if (isCheckbox) {
28
+ return `
29
+ <div class="flex items-center gap-3 py-1">
30
+ <input
31
+ type="checkbox"
32
+ data-arg-key="${field.name}"
33
+ data-arg-type="boolean"
34
+ class="checkbox checkbox-sm checkbox-primary"
35
+ ${field.defaultValue === "true" ? "checked" : ""}
36
+ />
37
+ <span class="text-sm font-mono opacity-70">${field.name}${badge}</span>
38
+ ${field.optional ? '<span class="text-[10px] opacity-30 italic ml-auto">optional</span>' : ""}
39
+ </div>
40
+ `;
41
+ }
42
+
43
+ return `
44
+ <div class="form-control">
45
+ <label class="label py-0.5">
46
+ <span class="label-text text-[11px] font-mono font-semibold">${label}${badge}</span>
47
+ ${field.optional ? '<span class="label-text-alt text-[10px] opacity-30 italic">optional</span>' : ""}
48
+ </label>
49
+ <input
50
+ type="${inputType}"
51
+ placeholder="${field.defaultValue ?? ""}"
52
+ data-arg-key="${field.name}"
53
+ data-arg-type="${field.type}"
54
+ value="${field.defaultValue ?? ""}"
55
+ class="input input-sm input-bordered font-mono w-full bg-base-200/30 focus:bg-base-100 focus:border-primary transition-all rounded-xl border-base-200"
56
+ ${!field.optional ? "required" : ""}
57
+ />
58
+ </div>
59
+ `;
60
+ })
61
+ .join("\n");
62
+ }
63
+
64
+ function renderArgumentsSection(h: DiscoveredHandlerOperation): string {
65
+ return `
66
+ <div class="space-y-4">
67
+ <div class="flex items-center justify-between">
68
+ <div class="flex flex-col">
69
+ <span class="text-[11px] font-bold uppercase tracking-wider opacity-40">Arguments</span>
70
+ <span class="text-[10px] font-mono opacity-30">${h.kind}</span>
71
+ </div>
72
+ <label class="flex items-center gap-2 cursor-pointer select-none group" title="Enable realtime updates via WebSocket">
73
+ <span class="text-[10px] font-bold uppercase tracking-wider opacity-40 group-hover:opacity-70 transition-opacity">Realtime</span>
74
+ <input type="checkbox" id="realtime-toggle" class="toggle toggle-xs toggle-success" onchange="toggleRealtime(this.checked)" />
75
+ </label>
76
+ </div>
77
+ <div id="args-rows" class="flex flex-col gap-3">
78
+ ${renderArgRows(h)}
79
+ </div>
80
+ <p class="text-[11px] opacity-30 mt-2 italic">Values are sent as ${h.kind === "query" ? "query string params" : "JSON request body"}.</p>
81
+ </div>
82
+ `;
83
+ }
84
+
85
+ function renderBearerTokenSection(): string {
86
+ return `
87
+ <div class="space-y-4">
88
+ <label class="text-[11px] font-bold uppercase tracking-wider opacity-40 block">Bearer Token <span class="font-normal normal-case">(optional)</span></label>
89
+ <div class="relative group">
90
+ <input
91
+ type="password"
92
+ name="token"
93
+ id="bearer-token-input"
94
+ class="input input-sm input-bordered font-mono text-sm w-full bg-base-200/30 focus:bg-base-100 focus:border-primary transition-all rounded-xl border-base-200 pr-9"
95
+ placeholder="eyJhbGciOi..."
96
+ />
97
+ <button type="button" onclick="toggleTokenVisibility()" class="absolute right-2.5 top-1/2 -translate-y-1/2 opacity-30 hover:opacity-70 transition-opacity">
98
+ <iconify-icon id="token-eye-icon" icon="solar:eye-linear" width="15" height="15"></iconify-icon>
99
+ </button>
100
+ </div>
101
+ <p class="text-[10px] opacity-30 italic">Token will be included in the Authorization header.</p>
102
+ </div>
103
+ `;
104
+ }
105
+
106
+ function renderCustomHeadersSection(): string {
107
+ return `
108
+ <div class="space-y-4">
109
+ <div class="flex items-center justify-between">
110
+ <span class="text-[11px] font-bold uppercase tracking-wider opacity-40">Custom Headers</span>
111
+ <button type="button" onclick="addHeaderRow()" class="btn btn-xs btn-ghost gap-1 opacity-50 hover:opacity-100">
112
+ <iconify-icon icon="solar:add-circle-linear" width="14" height="14"></iconify-icon>
113
+ Add
114
+ </button>
115
+ </div>
116
+ <div id="headers-rows" class="flex flex-col gap-2">
117
+ <!-- populated by addHeaderRow() -->
118
+ </div>
119
+ <p id="headers-error" class="text-[11px] text-error mt-1.5 hidden"></p>
120
+ </div>
121
+ `;
122
+ }
123
+
124
+ export function renderRequestPanel(h: DiscoveredHandlerOperation): string {
125
+ return `
126
+ <div class="card bg-base-100 border border-base-200 shadow-sm overflow-hidden flex flex-col h-full">
127
+ <div class="px-5 py-3 border-b border-base-200 bg-base-200/20 flex items-center justify-between flex-none">
128
+ <h3 class="text-xs font-bold uppercase tracking-widest opacity-40">Request</h3>
129
+ <iconify-icon icon="solar:settings-linear" width="16" height="16" class="opacity-30"></iconify-icon>
130
+ </div>
131
+
132
+ <div class="flex-1 overflow-hidden flex flex-col">
133
+ <form id="fn-form" onsubmit="return false" class="flex flex-col h-full">
134
+ <!-- Tabs Navigation -->
135
+ <div class="px-5 pt-4 flex-none">
136
+ <div role="tablist" class="tabs tabs-box bg-base-200/50 p-1 rounded-xl">
137
+ <a role="tab" id="req-tab-btn-args" class="tab tab-active !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('args')">Args</a>
138
+ <a role="tab" id="req-tab-btn-auth" class="tab !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('auth')">Auth</a>
139
+ <a role="tab" id="req-tab-btn-headers" class="tab !text-[10px] !font-bold uppercase tracking-wider h-8" onclick="switchRequestTab('headers')">Headers</a>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Tab Content -->
144
+ <div class="flex-1 overflow-y-auto">
145
+ <div id="request-tab-args" class="p-5">
146
+ ${renderArgumentsSection(h)}
147
+ </div>
148
+ <div id="request-tab-auth" class="p-5 hidden">
149
+ ${renderBearerTokenSection()}
150
+ </div>
151
+ <div id="request-tab-headers" class="p-5 hidden">
152
+ ${renderCustomHeadersSection()}
153
+ </div>
154
+ </div>
155
+
156
+ <!-- Submit Button (Fixed at bottom) -->
157
+ <div class="p-5 border-t border-base-200 mt-auto bg-base-200/5">
158
+ <button
159
+ type="button"
160
+ onclick="executeFn()"
161
+ class="btn btn-primary w-full gap-2 rounded-xl shadow-lg shadow-primary/20 hover:shadow-xl hover:shadow-primary/30 transition-all font-semibold"
162
+ >
163
+ <iconify-icon icon="solar:play-bold" width="18" height="18"></iconify-icon>
164
+ Run ${h.kind}
165
+ </button>
166
+ </div>
167
+ </form>
168
+ </div>
169
+ </div>
170
+ `;
171
+ }
@@ -1,85 +1,85 @@
1
- export function renderResultPanel(): string {
2
- return `
3
- <div class="card bg-base-100 border border-base-200 shadow-sm overflow-hidden flex flex-col">
4
- <!-- Panel Header -->
5
- <div class="px-5 py-3 border-b border-base-200 bg-base-200/20 flex items-center justify-between">
6
- <h3 class="text-xs font-bold uppercase tracking-widest opacity-40">Response</h3>
7
- <div class="flex items-center gap-3">
8
- <span id="res-status-badge" class="hidden"></span>
9
- <span id="res-elapsed-badge" class="hidden text-xs font-mono opacity-50"></span>
10
- <div class="w-1.5 h-1.5 rounded-full bg-success animate-pulse opacity-0" id="execution-indicator"></div>
11
- </div>
12
- </div>
13
-
14
- <!-- Tabs -->
15
- <div role="tablist" class="tabs tabs-bordered tabs-sm px-4 pt-1 bg-base-200/10 border-b border-base-200">
16
- <a role="tab" class="tab tab-active text-xs font-semibold" id="tab-body" onclick="switchResultTab('body')">Body</a>
17
- <a role="tab" class="tab text-xs font-semibold" id="tab-resp-headers" onclick="switchResultTab('headers')">Headers</a>
18
- <a role="tab" class="tab text-xs font-semibold" id="tab-info" onclick="switchResultTab('info')">Info</a>
19
- <a role="tab" class="tab text-xs font-semibold gap-1.5" id="tab-realtime" onclick="switchResultTab('realtime')">
20
- <span class="w-1.5 h-1.5 rounded-full bg-base-content/20 transition-colors duration-300" id="rt-dot"></span>
21
- Realtime
22
- </a>
23
- </div>
24
-
25
- <!-- Tab Panes -->
26
- <div class="flex-1 relative min-h-[300px]">
27
-
28
- <!-- Body Tab -->
29
- <div id="result-tab-body" class="result-tab-pane absolute inset-0 overflow-auto">
30
- <div class="absolute inset-0 flex flex-col items-center justify-center opacity-20 pointer-events-none p-10 text-center" id="result-empty-state">
31
- <iconify-icon icon="solar:course-down-bold-duotone" width="48" height="48" class="mb-3"></iconify-icon>
32
- <p class="text-xs font-semibold uppercase tracking-widest">Execute To See Output</p>
33
- </div>
34
- <div id="result-body-content" class="hidden h-full font-mono text-sm p-4 overflow-auto"></div>
35
- </div>
36
-
37
- <!-- Headers Tab -->
38
- <div id="result-tab-headers" class="result-tab-pane absolute inset-0 overflow-auto hidden">
39
- <div id="result-headers-content" class="p-4">
40
- <div class="flex flex-col items-center justify-center h-40 opacity-20 text-center pointer-events-none">
41
- <iconify-icon icon="solar:list-check-bold-duotone" width="36" height="36" class="mb-2"></iconify-icon>
42
- <p class="text-xs font-semibold uppercase tracking-widest">No Response Yet</p>
43
- </div>
44
- </div>
45
- </div>
46
-
47
- <!-- Info Tab -->
48
- <div id="result-tab-info" class="result-tab-pane absolute inset-0 overflow-auto hidden">
49
- <div id="result-info-content" class="p-4">
50
- <div class="flex flex-col items-center justify-center h-40 opacity-20 text-center pointer-events-none">
51
- <iconify-icon icon="solar:info-circle-bold-duotone" width="36" height="36" class="mb-2"></iconify-icon>
52
- <p class="text-xs font-semibold uppercase tracking-widest">No Response Yet</p>
53
- </div>
54
- </div>
55
- </div>
56
-
57
- <!-- Realtime Tab -->
58
- <div id="result-tab-realtime" class="result-tab-pane absolute inset-0 overflow-auto hidden flex flex-col">
59
- <!-- Connection status bar -->
60
- <div class="flex items-center justify-between px-4 py-2 border-b border-base-200 bg-base-200/10 flex-none">
61
- <div class="flex items-center gap-2">
62
- <div class="w-2 h-2 rounded-full bg-base-content/20 transition-all duration-300" id="rt-status-dot"></div>
63
- <span class="text-[10px] font-mono uppercase tracking-wider opacity-50" id="rt-status-text">Disconnected</span>
64
- </div>
65
- <div class="flex items-center gap-2">
66
- <span class="text-[10px] font-mono opacity-30" id="rt-event-count" class="hidden">0 events</span>
67
- <button type="button" onclick="clearRealtimeLog()" class="btn btn-xs btn-ghost opacity-40 hover:opacity-100 px-2 h-6 min-h-0">
68
- <iconify-icon icon="solar:trash-bin-minimalistic-linear" width="12" height="12"></iconify-icon>
69
- Clear
70
- </button>
71
- </div>
72
- </div>
73
- <!-- Events log -->
74
- <div id="rt-log" class="flex-1 overflow-y-auto p-3 flex flex-col gap-1.5 font-mono text-xs">
75
- <div id="rt-empty-state" class="flex flex-col items-center justify-center h-full opacity-20 text-center pointer-events-none gap-2">
76
- <iconify-icon icon="solar:pulse-2-bold-duotone" width="40" height="40"></iconify-icon>
77
- <p class="text-xs font-semibold uppercase tracking-widest">Enable Realtime in Request Panel</p>
78
- </div>
79
- </div>
80
- </div>
81
-
82
- </div>
83
- </div>
84
- `;
85
- }
1
+ export function renderResultPanel(): string {
2
+ return `
3
+ <div class="card bg-base-100 border border-base-200 shadow-sm overflow-hidden flex flex-col">
4
+ <!-- Panel Header -->
5
+ <div class="px-5 py-3 border-b border-base-200 bg-base-200/20 flex items-center justify-between">
6
+ <h3 class="text-xs font-bold uppercase tracking-widest opacity-40">Response</h3>
7
+ <div class="flex items-center gap-3">
8
+ <span id="res-status-badge" class="hidden"></span>
9
+ <span id="res-elapsed-badge" class="hidden text-xs font-mono opacity-50"></span>
10
+ <div class="w-1.5 h-1.5 rounded-full bg-success animate-pulse opacity-0" id="execution-indicator"></div>
11
+ </div>
12
+ </div>
13
+
14
+ <!-- Tabs -->
15
+ <div role="tablist" class="tabs tabs-bordered tabs-sm px-4 pt-1 bg-base-200/10 border-b border-base-200">
16
+ <a role="tab" class="tab tab-active text-xs font-semibold" id="tab-body" onclick="switchResultTab('body')">Body</a>
17
+ <a role="tab" class="tab text-xs font-semibold" id="tab-resp-headers" onclick="switchResultTab('headers')">Headers</a>
18
+ <a role="tab" class="tab text-xs font-semibold" id="tab-info" onclick="switchResultTab('info')">Info</a>
19
+ <a role="tab" class="tab text-xs font-semibold gap-1.5" id="tab-realtime" onclick="switchResultTab('realtime')">
20
+ <span class="w-1.5 h-1.5 rounded-full bg-base-content/20 transition-colors duration-300" id="rt-dot"></span>
21
+ Realtime
22
+ </a>
23
+ </div>
24
+
25
+ <!-- Tab Panes -->
26
+ <div class="flex-1 relative min-h-[300px]">
27
+
28
+ <!-- Body Tab -->
29
+ <div id="result-tab-body" class="result-tab-pane absolute inset-0 overflow-auto">
30
+ <div class="absolute inset-0 flex flex-col items-center justify-center opacity-20 pointer-events-none p-10 text-center" id="result-empty-state">
31
+ <iconify-icon icon="solar:course-down-bold-duotone" width="48" height="48" class="mb-3"></iconify-icon>
32
+ <p class="text-xs font-semibold uppercase tracking-widest">Execute To See Output</p>
33
+ </div>
34
+ <div id="result-body-content" class="hidden h-full font-mono text-sm p-4 overflow-auto"></div>
35
+ </div>
36
+
37
+ <!-- Headers Tab -->
38
+ <div id="result-tab-headers" class="result-tab-pane absolute inset-0 overflow-auto hidden">
39
+ <div id="result-headers-content" class="p-4">
40
+ <div class="flex flex-col items-center justify-center h-40 opacity-20 text-center pointer-events-none">
41
+ <iconify-icon icon="solar:list-check-bold-duotone" width="36" height="36" class="mb-2"></iconify-icon>
42
+ <p class="text-xs font-semibold uppercase tracking-widest">No Response Yet</p>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <!-- Info Tab -->
48
+ <div id="result-tab-info" class="result-tab-pane absolute inset-0 overflow-auto hidden">
49
+ <div id="result-info-content" class="p-4">
50
+ <div class="flex flex-col items-center justify-center h-40 opacity-20 text-center pointer-events-none">
51
+ <iconify-icon icon="solar:info-circle-bold-duotone" width="36" height="36" class="mb-2"></iconify-icon>
52
+ <p class="text-xs font-semibold uppercase tracking-widest">No Response Yet</p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <!-- Realtime Tab -->
58
+ <div id="result-tab-realtime" class="result-tab-pane absolute inset-0 overflow-auto hidden flex flex-col">
59
+ <!-- Connection status bar -->
60
+ <div class="flex items-center justify-between px-4 py-2 border-b border-base-200 bg-base-200/10 flex-none">
61
+ <div class="flex items-center gap-2">
62
+ <div class="w-2 h-2 rounded-full bg-base-content/20 transition-all duration-300" id="rt-status-dot"></div>
63
+ <span class="text-[10px] font-mono uppercase tracking-wider opacity-50" id="rt-status-text">Disconnected</span>
64
+ </div>
65
+ <div class="flex items-center gap-2">
66
+ <span class="text-[10px] font-mono opacity-30" id="rt-event-count" class="hidden">0 events</span>
67
+ <button type="button" onclick="clearRealtimeLog()" class="btn btn-xs btn-ghost opacity-40 hover:opacity-100 px-2 h-6 min-h-0">
68
+ <iconify-icon icon="solar:trash-bin-minimalistic-linear" width="12" height="12"></iconify-icon>
69
+ Clear
70
+ </button>
71
+ </div>
72
+ </div>
73
+ <!-- Events log -->
74
+ <div id="rt-log" class="flex-1 overflow-y-auto p-3 flex flex-col gap-1.5 font-mono text-xs">
75
+ <div id="rt-empty-state" class="flex flex-col items-center justify-center h-full opacity-20 text-center pointer-events-none gap-2">
76
+ <iconify-icon icon="solar:pulse-2-bold-duotone" width="40" height="40"></iconify-icon>
77
+ <p class="text-xs font-semibold uppercase tracking-widest">Enable Realtime in Request Panel</p>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ </div>
83
+ </div>
84
+ `;
85
+ }