juxscript 1.1.362 → 1.1.364

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 (93) hide show
  1. package/dist/components/routes.d.ts +22 -72
  2. package/dist/components/routes.d.ts.map +1 -1
  3. package/dist/components/routes.js +76 -156
  4. package/dist/components/routes.js.map +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/package.json +1 -1
  10. package/dist/lib/components/blocks/menu.d.ts +0 -40
  11. package/dist/lib/components/blocks/menu.d.ts.map +0 -1
  12. package/dist/lib/components/blocks/menu.js +0 -136
  13. package/dist/lib/components/button.d.ts +0 -33
  14. package/dist/lib/components/button.d.ts.map +0 -1
  15. package/dist/lib/components/button.js +0 -107
  16. package/dist/lib/components/checkbox.d.ts +0 -62
  17. package/dist/lib/components/checkbox.d.ts.map +0 -1
  18. package/dist/lib/components/checkbox.js +0 -178
  19. package/dist/lib/components/container.d.ts +0 -58
  20. package/dist/lib/components/container.d.ts.map +0 -1
  21. package/dist/lib/components/container.js +0 -151
  22. package/dist/lib/components/data.d.ts +0 -58
  23. package/dist/lib/components/data.d.ts.map +0 -1
  24. package/dist/lib/components/data.js +0 -130
  25. package/dist/lib/components/grid.d.ts +0 -58
  26. package/dist/lib/components/grid.d.ts.map +0 -1
  27. package/dist/lib/components/grid.js +0 -127
  28. package/dist/lib/components/include.d.ts +0 -86
  29. package/dist/lib/components/include.d.ts.map +0 -1
  30. package/dist/lib/components/include.js +0 -238
  31. package/dist/lib/components/input.d.ts +0 -58
  32. package/dist/lib/components/input.d.ts.map +0 -1
  33. package/dist/lib/components/input.js +0 -161
  34. package/dist/lib/components/link.d.ts +0 -35
  35. package/dist/lib/components/link.d.ts.map +0 -1
  36. package/dist/lib/components/link.js +0 -135
  37. package/dist/lib/components/list.d.ts +0 -48
  38. package/dist/lib/components/list.d.ts.map +0 -1
  39. package/dist/lib/components/list.js +0 -178
  40. package/dist/lib/components/nav.d.ts +0 -46
  41. package/dist/lib/components/nav.d.ts.map +0 -1
  42. package/dist/lib/components/nav.js +0 -189
  43. package/dist/lib/components/radio.d.ts +0 -40
  44. package/dist/lib/components/radio.d.ts.map +0 -1
  45. package/dist/lib/components/radio.js +0 -112
  46. package/dist/lib/components/select.d.ts +0 -41
  47. package/dist/lib/components/select.d.ts.map +0 -1
  48. package/dist/lib/components/select.js +0 -111
  49. package/dist/lib/components/sidebar.d.ts +0 -40
  50. package/dist/lib/components/sidebar.d.ts.map +0 -1
  51. package/dist/lib/components/sidebar.js +0 -141
  52. package/dist/lib/components/store.d.ts +0 -78
  53. package/dist/lib/components/store.d.ts.map +0 -1
  54. package/dist/lib/components/store.js +0 -248
  55. package/dist/lib/components/style.d.ts +0 -27
  56. package/dist/lib/components/style.d.ts.map +0 -1
  57. package/dist/lib/components/style.js +0 -52
  58. package/dist/lib/components/table.d.ts +0 -56
  59. package/dist/lib/components/table.d.ts.map +0 -1
  60. package/dist/lib/components/table.js +0 -199
  61. package/dist/lib/components/tabs.d.ts +0 -52
  62. package/dist/lib/components/tabs.d.ts.map +0 -1
  63. package/dist/lib/components/tabs.js +0 -206
  64. package/dist/lib/components/tag.d.ts +0 -41
  65. package/dist/lib/components/tag.d.ts.map +0 -1
  66. package/dist/lib/components/tag.js +0 -103
  67. package/dist/lib/devtools/devtools.d.ts +0 -3
  68. package/dist/lib/devtools/devtools.d.ts.map +0 -1
  69. package/dist/lib/devtools/devtools.js +0 -181
  70. package/dist/lib/index.d.ts +0 -68
  71. package/dist/lib/index.d.ts.map +0 -1
  72. package/dist/lib/index.js +0 -63
  73. package/dist/lib/state/pageState.d.ts +0 -19
  74. package/dist/lib/state/pageState.d.ts.map +0 -1
  75. package/dist/lib/state/pageState.js +0 -360
  76. package/dist/lib/utils/codeHighlight.d.ts +0 -7
  77. package/dist/lib/utils/codeHighlight.d.ts.map +0 -1
  78. package/dist/lib/utils/codeHighlight.js +0 -105
  79. package/dist/lib/utils/codeparser.d.ts +0 -29
  80. package/dist/lib/utils/codeparser.d.ts.map +0 -1
  81. package/dist/lib/utils/codeparser.js +0 -384
  82. package/dist/lib/utils/fetch.d.ts +0 -176
  83. package/dist/lib/utils/fetch.d.ts.map +0 -1
  84. package/dist/lib/utils/fetch.js +0 -427
  85. package/dist/lib/utils/formatId.d.ts +0 -16
  86. package/dist/lib/utils/formatId.d.ts.map +0 -1
  87. package/dist/lib/utils/formatId.js +0 -27
  88. package/dist/lib/utils/idgen.d.ts +0 -2
  89. package/dist/lib/utils/idgen.d.ts.map +0 -1
  90. package/dist/lib/utils/idgen.js +0 -4
  91. package/dist/lib/utils/niceName.d.ts +0 -14
  92. package/dist/lib/utils/niceName.d.ts.map +0 -1
  93. package/dist/lib/utils/niceName.js +0 -22
@@ -1,384 +0,0 @@
1
- /**
2
- * Simple keyword list
3
- */
4
- const KEYWORDS = new Set([
5
- 'async', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue',
6
- 'debugger', 'default', 'delete', 'do', 'else', 'export', 'extends',
7
- 'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof',
8
- 'let', 'new', 'return', 'super', 'switch', 'this', 'throw', 'try',
9
- 'typeof', 'var', 'void', 'while', 'with', 'yield', 'from', 'of',
10
- 'static', 'get', 'set', 'as', 'interface', 'type', 'enum', 'namespace',
11
- 'jux', 'state', 'registry', 'render', 'bind', 'sync', ';', '=', '==', '===',
12
- '!=', '!==', '+', '-', '*', '/', '%', '++', '--', '&&', '||', '!', '<', '>',
13
- '<=', '>=', '=>', '...', '.', ',', '(', ')', '{', '}', '[', ']', ':', '?'
14
- ]);
15
- /**
16
- * Categorized token sets for semantic highlighting
17
- */
18
- // Control flow keywords (loops, conditionals, etc.)
19
- const CONTROL_FLOW = new Set([
20
- 'if', 'else', 'switch', 'case', 'default',
21
- 'for', 'while', 'do', 'break', 'continue',
22
- 'return', 'throw', 'try', 'catch', 'finally'
23
- ]);
24
- // Declaration keywords
25
- const DECLARATIONS = new Set([
26
- 'const', 'let', 'var', 'function', 'class',
27
- 'import', 'export', 'from', 'as',
28
- 'interface', 'type', 'enum', 'namespace',
29
- 'static', 'get', 'set', 'extends'
30
- ]);
31
- // Operator keywords
32
- const OPERATORS = new Set([
33
- 'new', 'delete', 'typeof', 'instanceof',
34
- 'void', 'await', 'yield', 'in', 'of'
35
- ]);
36
- // Special keywords
37
- const SPECIAL = new Set([
38
- 'this', 'super', 'async', 'debugger', 'with'
39
- ]);
40
- // JUX-specific keywords
41
- const JUX_KEYWORDS = new Set([
42
- 'jux', 'state', 'registry', 'render', 'bind', 'sync'
43
- ]);
44
- // Combine all keywords for quick lookup
45
- const ALL_KEYWORDS = new Set([
46
- ...CONTROL_FLOW,
47
- ...DECLARATIONS,
48
- ...OPERATORS,
49
- ...SPECIAL,
50
- ...JUX_KEYWORDS
51
- ]);
52
- /**
53
- * Escape HTML entities
54
- */
55
- function escapeHtml(text) {
56
- return text
57
- .replace(/&/g, '&amp;')
58
- .replace(/</g, '&lt;')
59
- .replace(/>/g, '&gt;')
60
- .replace(/"/g, '&quot;')
61
- .replace(/'/g, '&#39;');
62
- }
63
- /**
64
- * Parse code into lines - CHARACTER-BY-CHARACTER TOKENIZATION
65
- */
66
- export function parseCode(code, language = 'javascript') {
67
- const lines = code.split('\n');
68
- return lines.map((line, index) => ({
69
- lineNumber: index + 1,
70
- html: tokenizeLine(line),
71
- raw: line
72
- }));
73
- }
74
- /**
75
- * Get the appropriate CSS class for a keyword
76
- */
77
- function getKeywordClass(word) {
78
- if (CONTROL_FLOW.has(word))
79
- return 'token-control';
80
- if (DECLARATIONS.has(word))
81
- return 'token-declaration';
82
- if (OPERATORS.has(word))
83
- return 'token-operator-keyword';
84
- if (SPECIAL.has(word))
85
- return 'token-special';
86
- if (JUX_KEYWORDS.has(word))
87
- return 'token-jux';
88
- return 'token-keyword'; // fallback
89
- }
90
- /**
91
- * Check if character is a structural punctuation (braces, brackets, parens)
92
- */
93
- function isStructural(char) {
94
- return '(){}[]'.includes(char);
95
- }
96
- /**
97
- * Check if character is a delimiter (semicolon, comma, colon)
98
- */
99
- function isDelimiter(char) {
100
- return ';,:'.includes(char);
101
- }
102
- /**
103
- * Check if character is an operator
104
- */
105
- function isOperator(char) {
106
- return '+-*/%=<>!&|^~?'.includes(char);
107
- }
108
- /**
109
- * Check if character starts a multi-char operator
110
- */
111
- function consumeOperator(line, i) {
112
- const char = line[i];
113
- const next = line[i + 1];
114
- const next2 = line[i + 2];
115
- // Three-char operators
116
- if (char === '=' && next === '=' && next2 === '=')
117
- return '===';
118
- if (char === '!' && next === '=' && next2 === '=')
119
- return '!==';
120
- if (char === '>' && next === '>' && next2 === '>')
121
- return '>>>';
122
- // Two-char operators
123
- if (char === '=' && next === '=')
124
- return '==';
125
- if (char === '!' && next === '=')
126
- return '!=';
127
- if (char === '<' && next === '=')
128
- return '<=';
129
- if (char === '>' && next === '=')
130
- return '>=';
131
- if (char === '&' && next === '&')
132
- return '&&';
133
- if (char === '|' && next === '|')
134
- return '||';
135
- if (char === '+' && next === '+')
136
- return '++';
137
- if (char === '-' && next === '-')
138
- return '--';
139
- if (char === '=' && next === '>')
140
- return '=>';
141
- if (char === '>' && next === '>')
142
- return '>>';
143
- if (char === '<' && next === '<')
144
- return '<<';
145
- if (char === '*' && next === '*')
146
- return '**';
147
- if (char === '.' && next === '.' && next2 === '.')
148
- return '...';
149
- // Single-char operator
150
- return char;
151
- }
152
- /**
153
- * Tokenize a single line character-by-character with semantic categories
154
- */
155
- function tokenizeLine(line) {
156
- if (!line.trim())
157
- return ' ';
158
- let result = '';
159
- let i = 0;
160
- const len = line.length;
161
- // Check for comment at start
162
- if (line.trim().startsWith('//')) {
163
- return `<span class="token-comment">${escapeHtml(line)}</span>`;
164
- }
165
- while (i < len) {
166
- const char = line[i];
167
- // Whitespace - preserve
168
- if (/\s/.test(char)) {
169
- result += char;
170
- i++;
171
- continue;
172
- }
173
- // Comment (// or /* */)
174
- if (char === '/' && i + 1 < len) {
175
- if (line[i + 1] === '/') {
176
- // Line comment - consume rest of line
177
- const comment = line.slice(i);
178
- result += `<span class="token-comment">${escapeHtml(comment)}</span>`;
179
- break;
180
- }
181
- else if (line[i + 1] === '*') {
182
- // Block comment start
183
- const commentEnd = line.indexOf('*/', i + 2);
184
- if (commentEnd !== -1) {
185
- const comment = line.slice(i, commentEnd + 2);
186
- result += `<span class="token-comment">${escapeHtml(comment)}</span>`;
187
- i = commentEnd + 2;
188
- continue;
189
- }
190
- }
191
- }
192
- // String literals (single, double, backtick)
193
- if (char === '"' || char === "'" || char === '`') {
194
- let j = i + 1;
195
- let escaped = false;
196
- // Find matching quote
197
- while (j < len) {
198
- if (escaped) {
199
- escaped = false;
200
- j++;
201
- continue;
202
- }
203
- if (line[j] === '\\') {
204
- escaped = true;
205
- j++;
206
- continue;
207
- }
208
- if (line[j] === char) {
209
- j++;
210
- break;
211
- }
212
- j++;
213
- }
214
- const str = line.slice(i, j);
215
- result += `<span class="token-string">${escapeHtml(str)}</span>`;
216
- i = j;
217
- continue;
218
- }
219
- // Word (identifier or keyword)
220
- if (/[a-zA-Z_$]/.test(char)) {
221
- const word = consumeWord(line, i);
222
- const escaped = escapeHtml(word);
223
- if (ALL_KEYWORDS.has(word)) {
224
- const tokenClass = getKeywordClass(word);
225
- result += `<span class="${tokenClass}">${escaped}</span>`;
226
- }
227
- else {
228
- // Check if it's a function call
229
- let k = i + word.length;
230
- while (k < len && line[k] === ' ')
231
- k++;
232
- if (line[k] === '(') {
233
- result += `<span class="token-function">${escaped}</span>`;
234
- }
235
- else {
236
- result += `<span class="token-identifier">${escaped}</span>`;
237
- }
238
- }
239
- i += word.length;
240
- continue;
241
- }
242
- // Number
243
- if (/\d/.test(char)) {
244
- const num = consumeNumber(line, i);
245
- result += `<span class="token-number">${escapeHtml(num)}</span>`;
246
- i += num.length;
247
- continue;
248
- }
249
- // Dot/spread
250
- if (char === '.') {
251
- const op = consumeOperator(line, i);
252
- result += `<span class="token-operator">${escapeHtml(op)}</span>`;
253
- i += op.length;
254
- continue;
255
- }
256
- // Operators (multi-char)
257
- if (isOperator(char)) {
258
- const op = consumeOperator(line, i);
259
- result += `<span class="token-operator">${escapeHtml(op)}</span>`;
260
- i += op.length;
261
- continue;
262
- }
263
- // Structural punctuation (braces, brackets, parens)
264
- if (isStructural(char)) {
265
- result += `<span class="token-structural">${escapeHtml(char)}</span>`;
266
- i++;
267
- continue;
268
- }
269
- // Delimiters (semicolon, comma, colon)
270
- if (isDelimiter(char)) {
271
- result += `<span class="token-delimiter">${escapeHtml(char)}</span>`;
272
- i++;
273
- continue;
274
- }
275
- // Everything else - just escape and append
276
- result += escapeHtml(char);
277
- i++;
278
- }
279
- return result || ' ';
280
- }
281
- /**
282
- * Consume a complete word (identifier)
283
- */
284
- function consumeWord(line, start) {
285
- let i = start;
286
- while (i < line.length && /[a-zA-Z0-9_$]/.test(line[i])) {
287
- i++;
288
- }
289
- return line.substring(start, i);
290
- }
291
- /**
292
- * Consume a complete number
293
- */
294
- function consumeNumber(line, start) {
295
- let i = start;
296
- let hasDot = false;
297
- while (i < line.length) {
298
- const char = line[i];
299
- if (/\d/.test(char)) {
300
- i++;
301
- }
302
- else if (char === '.' && !hasDot) {
303
- hasDot = true;
304
- i++;
305
- }
306
- else {
307
- break;
308
- }
309
- }
310
- return line.substring(start, i);
311
- }
312
- /**
313
- * Render a parsed line
314
- */
315
- export function renderLineWithTokens(parsedLine) {
316
- return parsedLine.html;
317
- }
318
- /**
319
- * Generate CSS for syntax highlighting
320
- */
321
- export function getSyntaxHighlightCSS() {
322
- return `
323
- .jux-code {
324
- font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
325
- font-size: 14px;
326
- font-weight: 500;
327
- line-height: 1.7;
328
- background: hsl(var(--muted, 0 0% 96%));
329
- color: hsl(var(--foreground, 0 0% 9%));
330
- border: 1px solid hsl(var(--border, 0 0% 89.8%));
331
- border-radius: var(--radius, 6px);
332
- overflow: hidden;
333
- margin: 0;
334
- padding: 1rem;
335
- overflow-x: auto;
336
- }
337
- .jux-code-lines {
338
- display: block;
339
- }
340
- .jux-code-line {
341
- display: flex;
342
- align-items: flex-start;
343
- min-height: 1.7em;
344
- }
345
- .jux-code-line:hover {
346
- background-color: hsl(var(--accent, 0 0% 93%) / 0.5);
347
- }
348
- .jux-code-line-number {
349
- display: inline-block;
350
- min-width: 2.5rem;
351
- text-align: right;
352
- padding-right: 1rem;
353
- color: hsl(var(--muted-foreground, 0 0% 45%));
354
- user-select: none;
355
- flex-shrink: 0;
356
- font-size: 12px;
357
- }
358
- .jux-code-line-content {
359
- flex: 1;
360
- white-space: pre;
361
- }
362
-
363
- /* Token colors — shadcn-aware light theme */
364
- .token-control { color: hsl(262 83% 50%); font-weight: 700; }
365
- .token-declaration { color: hsl(221 83% 45%); font-weight: 700; }
366
- .token-operator-keyword { color: hsl(0 68% 45%); font-weight: 600; }
367
- .token-special { color: hsl(35 80% 40%); font-weight: 600; }
368
- .token-jux { color: hsl(187 70% 35%); font-weight: 700; }
369
- .token-number { color: hsl(25 85% 45%); font-weight: 500; }
370
- .token-string { color: hsl(142 60% 35%); font-weight: 500; }
371
- .token-comment { color: hsl(var(--muted-foreground, 0 0% 45%)); font-style: italic; font-weight: 400; }
372
- .token-function { color: hsl(221 83% 45%); font-weight: 600; }
373
- .token-identifier { color: hsl(var(--foreground, 0 0% 9%)); font-weight: 500; }
374
- .token-structural { color: hsl(var(--foreground, 0 0% 9%)); font-weight: 700; }
375
- .token-delimiter { color: hsl(var(--muted-foreground, 0 0% 45%)); font-weight: 500; }
376
- .token-operator { color: hsl(187 70% 35%); font-weight: 600; }
377
- `;
378
- }
379
- export default {
380
- parse: parseCode,
381
- renderLine: renderLineWithTokens,
382
- getCSS: getSyntaxHighlightCSS,
383
- escapeHtml
384
- };
@@ -1,176 +0,0 @@
1
- /**
2
- * Jux Fetch Utility
3
- *
4
- * A lightweight fetch wrapper with sensible defaults, error handling, and method chaining.
5
- * Includes configuration helpers for juxconfig.js integration.
6
- *
7
- * Usage:
8
- * // Configure once (optional)
9
- * jux.fetch.config({
10
- * baseUrl: 'https://api.example.com',
11
- * credentials: 'include',
12
- * timeout: 10000,
13
- * log: 'errors',
14
- * onUnauthorized: () => window.location.href = '/login'
15
- * });
16
- *
17
- * // Simple GET
18
- * const { data, error } = await jux.fetch('/users').send();
19
- *
20
- * // Method chaining
21
- * const { data, error } = await jux.fetch('/users')
22
- * .method('POST')
23
- * .body({ name: 'John' })
24
- * .params({ limit: 10 })
25
- * .timeout(5000)
26
- * .log(true)
27
- * .send();
28
- *
29
- * // With juxconfig services
30
- * const { data } = await jux.fetch('/users')
31
- * .baseUrl(jux.fetch.getServiceUrl('database'))
32
- * .send();
33
- *
34
- * // Service client helper
35
- * const db = jux.fetch.serviceClient('database');
36
- * const { data } = await db.fetch('/users').send();
37
- */
38
- export type LogLevel = boolean | 'errors';
39
- export interface FetchConfig {
40
- baseUrl?: string;
41
- credentials?: RequestCredentials;
42
- headers?: Record<string, string>;
43
- timeout?: number;
44
- log?: LogLevel;
45
- onUnauthorized?: () => void;
46
- onError?: (error: FetchError) => void;
47
- }
48
- export interface FetchOptions extends Omit<RequestInit, 'body'> {
49
- params?: Record<string, any>;
50
- body?: any;
51
- timeout?: number;
52
- log?: LogLevel;
53
- onUnauthorized?: () => void;
54
- onError?: (error: FetchError) => void;
55
- parseResponse?: boolean;
56
- }
57
- export interface FetchError {
58
- message: string;
59
- status?: number;
60
- statusText?: string;
61
- data?: any;
62
- }
63
- export interface FetchResult<T = any> {
64
- data: T | null;
65
- error: FetchError | null;
66
- status: number;
67
- response: Response;
68
- }
69
- /**
70
- * Configure global fetch defaults
71
- */
72
- export declare function configureFetch(config: FetchConfig): void;
73
- /**
74
- * FetchBuilder class for method chaining
75
- */
76
- declare class FetchBuilder<T = any> {
77
- url: string;
78
- options: FetchOptions;
79
- constructor(url: string, options?: FetchOptions);
80
- method(value: string): this;
81
- body(value: any): this;
82
- params(value: Record<string, any>): this;
83
- headers(value: Record<string, string>): this;
84
- header(key: string, value: string): this;
85
- timeout(value: number): this;
86
- credentials(value: RequestCredentials): this;
87
- log(value: LogLevel): this;
88
- parseResponse(value: boolean): this;
89
- onUnauthorized(callback: () => void): this;
90
- onError(callback: (error: FetchError) => void): this;
91
- /**
92
- * Execute the fetch request
93
- */
94
- send(): Promise<FetchResult<T>>;
95
- /**
96
- * Alias for send()
97
- */
98
- fetch(): Promise<FetchResult<T>>;
99
- /**
100
- * Make the builder thenable (Promise-like) so it can be awaited directly
101
- * This allows: await jux.fetch('/users') without needing .send()
102
- */
103
- then<TResult1 = FetchResult<T>, TResult2 = never>(onfulfilled?: ((value: FetchResult<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
104
- /**
105
- * Make the builder catchable for Promise.catch()
106
- */
107
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<FetchResult<T> | TResult>;
108
- /**
109
- * Make the builder finally-able for Promise.finally()
110
- */
111
- finally(onfinally?: (() => void) | null): Promise<FetchResult<T>>;
112
- }
113
- /**
114
- * Create a fetch builder
115
- */
116
- export declare function juxFetch<T = any>(url: string, options?: FetchOptions): FetchBuilder<T>;
117
- /**
118
- * Convenience methods for common HTTP verbs
119
- */
120
- export declare const fetchHelpers: {
121
- get: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
122
- post: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
123
- put: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
124
- patch: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
125
- delete: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
126
- };
127
- /**
128
- * Fetch multiple URLs in parallel
129
- */
130
- export declare function fetchAll<T = any>(urls: string[], options?: FetchOptions): Promise<FetchResult<T>[]>;
131
- /**
132
- * Get a service URL from window.juxConfig
133
- */
134
- export declare function getServiceUrl(serviceName: string): string | null;
135
- /**
136
- * Create a fetch instance preconfigured for a specific service
137
- *
138
- * Usage:
139
- * const api = jux.fetch.serviceClient('database');
140
- * const { data } = await api.fetch('/users').send();
141
- */
142
- export declare function serviceClient(serviceName: string): {
143
- fetch: (url: string, options?: any) => FetchBuilder<any>;
144
- baseUrl: string | null;
145
- };
146
- /**
147
- * Setup fetch from juxconfig
148
- * Call this in your bootstrap function
149
- *
150
- * Usage:
151
- * export default {
152
- * bootstrap: [
153
- * async function initFetch() {
154
- * await jux.fetch.setupConfig();
155
- * }
156
- * ]
157
- * };
158
- */
159
- export declare function setupConfig(): Promise<{
160
- services: any;
161
- getServiceUrl: typeof getServiceUrl;
162
- } | undefined>;
163
- export declare const fetchAPI: typeof juxFetch & {
164
- all: typeof fetchAll;
165
- get: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
166
- post: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
167
- put: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
168
- patch: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
169
- delete: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
170
- config: typeof configureFetch;
171
- setupConfig: typeof setupConfig;
172
- getServiceUrl: typeof getServiceUrl;
173
- serviceClient: typeof serviceClient;
174
- };
175
- export {};
176
- //# sourceMappingURL=fetch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../lib/utils/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,QAAQ,GA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