@kozou/svelte-ui 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +108 -1
  3. package/build/client/_app/immutable/assets/0.Cg4B63gQ.css +2 -0
  4. package/build/client/_app/immutable/assets/0.Cg4B63gQ.css.br +0 -0
  5. package/build/client/_app/immutable/assets/0.Cg4B63gQ.css.gz +0 -0
  6. package/build/client/_app/immutable/chunks/BpIM_fT8.js +2 -0
  7. package/build/client/_app/immutable/chunks/BpIM_fT8.js.br +0 -0
  8. package/build/client/_app/immutable/chunks/BpIM_fT8.js.gz +0 -0
  9. package/build/client/_app/immutable/chunks/D4orYVgu.js +4 -0
  10. package/build/client/_app/immutable/chunks/D4orYVgu.js.br +0 -0
  11. package/build/client/_app/immutable/chunks/D4orYVgu.js.gz +0 -0
  12. package/build/client/_app/immutable/chunks/DdEzykkf.js +1 -0
  13. package/build/client/_app/immutable/chunks/DdEzykkf.js.br +0 -0
  14. package/build/client/_app/immutable/chunks/DdEzykkf.js.gz +0 -0
  15. package/build/client/_app/immutable/chunks/Dq0SIjgq.js +214 -0
  16. package/build/client/_app/immutable/chunks/Dq0SIjgq.js.br +0 -0
  17. package/build/client/_app/immutable/chunks/Dq0SIjgq.js.gz +0 -0
  18. package/build/client/_app/immutable/chunks/kNaey6uv.js +1 -0
  19. package/build/client/_app/immutable/chunks/kNaey6uv.js.br +0 -0
  20. package/build/client/_app/immutable/chunks/kNaey6uv.js.gz +0 -0
  21. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  22. package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
  23. package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
  24. package/build/client/_app/immutable/entry/app.B2E2jsYG.js +2 -0
  25. package/build/client/_app/immutable/entry/app.B2E2jsYG.js.br +0 -0
  26. package/build/client/_app/immutable/entry/app.B2E2jsYG.js.gz +0 -0
  27. package/build/client/_app/immutable/entry/start.Ccv3-hR2.js +1 -0
  28. package/build/client/_app/immutable/entry/start.Ccv3-hR2.js.br +0 -0
  29. package/build/client/_app/immutable/entry/start.Ccv3-hR2.js.gz +0 -0
  30. package/build/client/_app/immutable/nodes/0.C77vZJGR.js +1 -0
  31. package/build/client/_app/immutable/nodes/0.C77vZJGR.js.br +0 -0
  32. package/build/client/_app/immutable/nodes/0.C77vZJGR.js.gz +0 -0
  33. package/build/client/_app/immutable/nodes/1.9-mDK_1B.js +1 -0
  34. package/build/client/_app/immutable/nodes/1.9-mDK_1B.js.br +0 -0
  35. package/build/client/_app/immutable/nodes/1.9-mDK_1B.js.gz +0 -0
  36. package/build/client/_app/immutable/nodes/2.DKSRkbg2.js +1 -0
  37. package/build/client/_app/immutable/nodes/2.DKSRkbg2.js.br +0 -0
  38. package/build/client/_app/immutable/nodes/2.DKSRkbg2.js.gz +0 -0
  39. package/build/client/_app/immutable/nodes/3.BRseKH3J.js +1 -0
  40. package/build/client/_app/immutable/nodes/3.BRseKH3J.js.br +0 -0
  41. package/build/client/_app/immutable/nodes/3.BRseKH3J.js.gz +0 -0
  42. package/build/client/_app/immutable/nodes/4.D1ErMjLn.js +1 -0
  43. package/build/client/_app/immutable/nodes/4.D1ErMjLn.js.br +0 -0
  44. package/build/client/_app/immutable/nodes/4.D1ErMjLn.js.gz +0 -0
  45. package/build/client/_app/immutable/nodes/5.U1CG0AZz.js +1 -0
  46. package/build/client/_app/immutable/nodes/5.U1CG0AZz.js.br +0 -0
  47. package/build/client/_app/immutable/nodes/5.U1CG0AZz.js.gz +0 -0
  48. package/build/client/_app/immutable/nodes/6.BqfsXcpL.js +1 -0
  49. package/build/client/_app/immutable/nodes/6.BqfsXcpL.js.br +0 -0
  50. package/build/client/_app/immutable/nodes/6.BqfsXcpL.js.gz +0 -0
  51. package/build/client/_app/immutable/nodes/7.Bfhyc_gZ.js +1 -0
  52. package/build/client/_app/immutable/nodes/7.Bfhyc_gZ.js.br +0 -0
  53. package/build/client/_app/immutable/nodes/7.Bfhyc_gZ.js.gz +0 -0
  54. package/build/client/_app/version.json +1 -0
  55. package/build/client/_app/version.json.br +0 -0
  56. package/build/client/_app/version.json.gz +0 -0
  57. package/build/env.js +94 -0
  58. package/build/handler.js +1494 -0
  59. package/build/index.js +345 -0
  60. package/build/server/chunks/0-Cpki24QE.js +24 -0
  61. package/build/server/chunks/0-Cpki24QE.js.map +1 -0
  62. package/build/server/chunks/1-C_Zl16E8.js +9 -0
  63. package/build/server/chunks/1-C_Zl16E8.js.map +1 -0
  64. package/build/server/chunks/2-Bb7ROZP0.js +35 -0
  65. package/build/server/chunks/2-Bb7ROZP0.js.map +1 -0
  66. package/build/server/chunks/3-dXQmFZGn.js +71 -0
  67. package/build/server/chunks/3-dXQmFZGn.js.map +1 -0
  68. package/build/server/chunks/4-Dn5qQ29L.js +54 -0
  69. package/build/server/chunks/4-Dn5qQ29L.js.map +1 -0
  70. package/build/server/chunks/5-CKRn1yVS.js +69 -0
  71. package/build/server/chunks/5-CKRn1yVS.js.map +1 -0
  72. package/build/server/chunks/6-C7PGuXlN.js +70 -0
  73. package/build/server/chunks/6-C7PGuXlN.js.map +1 -0
  74. package/build/server/chunks/7-BtKcX-UD.js +66 -0
  75. package/build/server/chunks/7-BtKcX-UD.js.map +1 -0
  76. package/build/server/chunks/_layout.svelte-DcwZs9VT.js +15 -0
  77. package/build/server/chunks/_layout.svelte-DcwZs9VT.js.map +1 -0
  78. package/build/server/chunks/_page.svelte-69okwN_x.js +70 -0
  79. package/build/server/chunks/_page.svelte-69okwN_x.js.map +1 -0
  80. package/build/server/chunks/_page.svelte-7DhzytBp.js +79 -0
  81. package/build/server/chunks/_page.svelte-7DhzytBp.js.map +1 -0
  82. package/build/server/chunks/_page.svelte-BpS5HgaB.js +78 -0
  83. package/build/server/chunks/_page.svelte-BpS5HgaB.js.map +1 -0
  84. package/build/server/chunks/_page.svelte-BywGr3Tk.js +51 -0
  85. package/build/server/chunks/_page.svelte-BywGr3Tk.js.map +1 -0
  86. package/build/server/chunks/_page.svelte-ClFWSFQK.js +70 -0
  87. package/build/server/chunks/_page.svelte-ClFWSFQK.js.map +1 -0
  88. package/build/server/chunks/_page.svelte-Dfaz3pC_.js +86 -0
  89. package/build/server/chunks/_page.svelte-Dfaz3pC_.js.map +1 -0
  90. package/build/server/chunks/adapter-DSZ-_PM_.js +273 -0
  91. package/build/server/chunks/adapter-DSZ-_PM_.js.map +1 -0
  92. package/build/server/chunks/app-C1bzfcjj.js +12 -0
  93. package/build/server/chunks/app-C1bzfcjj.js.map +1 -0
  94. package/build/server/chunks/client-nr13Vsqj.js +69 -0
  95. package/build/server/chunks/client-nr13Vsqj.js.map +1 -0
  96. package/build/server/chunks/dev-yRSoS_kM.js +4498 -0
  97. package/build/server/chunks/dev-yRSoS_kM.js.map +1 -0
  98. package/build/server/chunks/error.svelte-B8LolEv3.js +68 -0
  99. package/build/server/chunks/error.svelte-B8LolEv3.js.map +1 -0
  100. package/build/server/chunks/hooks.server-BgTiHdgV.js +11706 -0
  101. package/build/server/chunks/hooks.server-BgTiHdgV.js.map +1 -0
  102. package/build/server/chunks/index-5kYmxIr9.js +191 -0
  103. package/build/server/chunks/index-5kYmxIr9.js.map +1 -0
  104. package/build/server/chunks/index-DBqjc0Yf.js +77 -0
  105. package/build/server/chunks/index-DBqjc0Yf.js.map +1 -0
  106. package/build/server/chunks/internal-Dtmf8fV4.js +1759 -0
  107. package/build/server/chunks/internal-Dtmf8fV4.js.map +1 -0
  108. package/build/server/chunks/list-params-DjWk7B1o.js +44 -0
  109. package/build/server/chunks/list-params-DjWk7B1o.js.map +1 -0
  110. package/build/server/chunks/widget-registry-Bfc0OPDn.js +242 -0
  111. package/build/server/chunks/widget-registry-Bfc0OPDn.js.map +1 -0
  112. package/build/server/chunks/zod-from-table-HRMJdgEv.js +7936 -0
  113. package/build/server/chunks/zod-from-table-HRMJdgEv.js.map +1 -0
  114. package/build/server/index.js +4447 -0
  115. package/build/server/index.js.map +1 -0
  116. package/build/server/manifest.js +86 -0
  117. package/build/server/manifest.js.map +1 -0
  118. package/build/shims.js +32 -0
  119. package/package.json +65 -4
package/build/index.js ADDED
@@ -0,0 +1,345 @@
1
+ import http from 'node:http';
2
+ import process from 'node:process';
3
+ import { handler } from './handler.js';
4
+ import { env, timeout_env } from './env.js';
5
+ import { setImmediate } from 'node:timers';
6
+ import * as qs from 'node:querystring';
7
+
8
+ /**
9
+ * @param {string|RegExp} input The route pattern
10
+ * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
11
+ */
12
+ function parse$1(input, loose) {
13
+ if (input instanceof RegExp) return { keys:false, pattern:input };
14
+ var c, o, tmp, ext, keys=[], pattern='', arr = input.split('/');
15
+ arr[0] || arr.shift();
16
+
17
+ while (tmp = arr.shift()) {
18
+ c = tmp[0];
19
+ if (c === '*') {
20
+ keys.push(c);
21
+ pattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';
22
+ } else if (c === ':') {
23
+ o = tmp.indexOf('?', 1);
24
+ ext = tmp.indexOf('.', 1);
25
+ keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );
26
+ pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';
27
+ if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext);
28
+ } else {
29
+ pattern += '/' + tmp;
30
+ }
31
+ }
32
+
33
+ return {
34
+ keys: keys,
35
+ pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i')
36
+ };
37
+ }
38
+
39
+ const MAP = {
40
+ "": 0,
41
+ GET: 1,
42
+ HEAD: 2,
43
+ PATCH: 3,
44
+ OPTIONS: 4,
45
+ CONNECT: 5,
46
+ DELETE: 6,
47
+ TRACE: 7,
48
+ POST: 8,
49
+ PUT: 9,
50
+ };
51
+
52
+ class Trouter {
53
+ constructor() {
54
+ this.routes = [];
55
+
56
+ this.all = this.add.bind(this, '');
57
+ this.get = this.add.bind(this, 'GET');
58
+ this.head = this.add.bind(this, 'HEAD');
59
+ this.patch = this.add.bind(this, 'PATCH');
60
+ this.options = this.add.bind(this, 'OPTIONS');
61
+ this.connect = this.add.bind(this, 'CONNECT');
62
+ this.delete = this.add.bind(this, 'DELETE');
63
+ this.trace = this.add.bind(this, 'TRACE');
64
+ this.post = this.add.bind(this, 'POST');
65
+ this.put = this.add.bind(this, 'PUT');
66
+ }
67
+
68
+ use(route, ...fns) {
69
+ let handlers = [].concat.apply([], fns);
70
+ let { keys, pattern } = parse$1(route, true);
71
+ this.routes.push({ keys, pattern, method: '', handlers, midx: MAP[''] });
72
+ return this;
73
+ }
74
+
75
+ add(method, route, ...fns) {
76
+ let { keys, pattern } = parse$1(route);
77
+ let handlers = [].concat.apply([], fns);
78
+ this.routes.push({ keys, pattern, method, handlers, midx: MAP[method] });
79
+ return this;
80
+ }
81
+
82
+ find(method, url) {
83
+ let midx = MAP[method];
84
+ let isHEAD = (midx === 2);
85
+ let i=0, j=0, k, tmp, arr=this.routes;
86
+ let matches=[], params={}, handlers=[];
87
+ for (; i < arr.length; i++) {
88
+ tmp = arr[i];
89
+ if (tmp.midx === midx || tmp.midx === 0 || (isHEAD && tmp.midx===1) ) {
90
+ if (tmp.keys === false) {
91
+ matches = tmp.pattern.exec(url);
92
+ if (matches === null) continue;
93
+ if (matches.groups !== void 0) for (k in matches.groups) params[k]=matches.groups[k];
94
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
95
+ } else if (tmp.keys.length > 0) {
96
+ matches = tmp.pattern.exec(url);
97
+ if (matches === null) continue;
98
+ for (j=0; j < tmp.keys.length;) params[tmp.keys[j]]=matches[++j];
99
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
100
+ } else if (tmp.pattern.test(url)) {
101
+ tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
102
+ }
103
+ } // else not a match
104
+ }
105
+
106
+ return { params, handlers };
107
+ }
108
+ }
109
+
110
+ /**
111
+ * @typedef ParsedURL
112
+ * @type {import('.').ParsedURL}
113
+ */
114
+
115
+ /**
116
+ * @typedef Request
117
+ * @property {string} url
118
+ * @property {ParsedURL} _parsedUrl
119
+ */
120
+
121
+ /**
122
+ * @param {Request} req
123
+ * @returns {ParsedURL|void}
124
+ */
125
+ function parse(req) {
126
+ let raw = req.url;
127
+ if (raw == null) return;
128
+
129
+ let prev = req._parsedUrl;
130
+ if (prev && prev.raw === raw) return prev;
131
+
132
+ let pathname=raw, search='', query;
133
+
134
+ if (raw.length > 1) {
135
+ let idx = raw.indexOf('?', 1);
136
+
137
+ if (idx !== -1) {
138
+ search = raw.substring(idx);
139
+ pathname = raw.substring(0, idx);
140
+ if (search.length > 1) {
141
+ query = qs.parse(search.substring(1));
142
+ }
143
+ }
144
+ }
145
+
146
+ return req._parsedUrl = { pathname, search, query, raw };
147
+ }
148
+
149
+ function onError(err, req, res) {
150
+ let code = typeof err.status === 'number' && err.status;
151
+ code = res.statusCode = (code && code >= 100 ? code : 500);
152
+ if (typeof err === 'string' || Buffer.isBuffer(err)) res.end(err);
153
+ else res.end(err.message || http.STATUS_CODES[code]);
154
+ }
155
+
156
+ const mount = fn => fn instanceof Polka ? fn.attach : fn;
157
+
158
+ class Polka extends Trouter {
159
+ constructor(opts={}) {
160
+ super();
161
+ this.parse = parse;
162
+ this.server = opts.server;
163
+ this.handler = this.handler.bind(this);
164
+ this.onError = opts.onError || onError; // catch-all handler
165
+ this.onNoMatch = opts.onNoMatch || this.onError.bind(null, { status: 404 });
166
+ this.attach = (req, res) => setImmediate(this.handler, req, res);
167
+ }
168
+
169
+ use(base, ...fns) {
170
+ if (base === '/') {
171
+ super.use(base, fns.map(mount));
172
+ } else if (typeof base === 'function' || base instanceof Polka) {
173
+ super.use('/', [base, ...fns].map(mount));
174
+ } else {
175
+ super.use(base,
176
+ (req, _, next) => {
177
+ if (typeof base === 'string') {
178
+ let len = base.length;
179
+ base.startsWith('/') || len++;
180
+ req.url = req.url.substring(len) || '/';
181
+ req.path = req.path.substring(len) || '/';
182
+ } else {
183
+ req.url = req.url.replace(base, '') || '/';
184
+ req.path = req.path.replace(base, '') || '/';
185
+ }
186
+ if (req.url.charAt(0) !== '/') {
187
+ req.url = '/' + req.url;
188
+ }
189
+ next();
190
+ },
191
+ fns.map(mount),
192
+ (req, _, next) => {
193
+ req.path = req._parsedUrl.pathname;
194
+ req.url = req.path + req._parsedUrl.search;
195
+ next();
196
+ }
197
+ );
198
+ }
199
+ return this; // chainable
200
+ }
201
+
202
+ listen() {
203
+ (this.server = this.server || http.createServer()).on('request', this.attach);
204
+ this.server.listen.apply(this.server, arguments);
205
+ return this;
206
+ }
207
+
208
+ handler(req, res, next) {
209
+ let info = this.parse(req), path = info.pathname;
210
+ let obj = this.find(req.method, req.path=path);
211
+
212
+ req.url = path + info.search;
213
+ req.originalUrl = req.originalUrl || req.url;
214
+ req.query = info.query || {};
215
+ req.search = info.search;
216
+ req.params = obj.params;
217
+
218
+ if (path.length > 1 && path.indexOf('%', 1) !== -1) {
219
+ for (let k in req.params) {
220
+ try { req.params[k] = decodeURIComponent(req.params[k]); }
221
+ catch (e) { /* malform uri segment */ }
222
+ }
223
+ }
224
+
225
+ let i=0, arr=obj.handlers.concat(this.onNoMatch), len=arr.length;
226
+ let loop = async () => res.finished || (i < len) && arr[i++](req, res, next);
227
+ (next = next || (err => err ? this.onError(err, req, res, next) : loop().catch(next)))(); // init
228
+ }
229
+ }
230
+
231
+ function polka (opts) {
232
+ return new Polka(opts);
233
+ }
234
+
235
+ const path = env('SOCKET_PATH', false);
236
+ const host = env('HOST', '0.0.0.0');
237
+ const port = env('PORT', !path && '3000');
238
+
239
+ const shutdown_timeout = parseInt(env('SHUTDOWN_TIMEOUT', '30'));
240
+ const idle_timeout = parseInt(env('IDLE_TIMEOUT', '0'));
241
+ const listen_pid = parseInt(env('LISTEN_PID', '0'));
242
+ const listen_fds = parseInt(env('LISTEN_FDS', '0'));
243
+ // https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
244
+ const SD_LISTEN_FDS_START = 3;
245
+
246
+ if (listen_pid !== 0 && listen_pid !== process.pid) {
247
+ throw new Error(`received LISTEN_PID ${listen_pid} but current process id is ${process.pid}`);
248
+ }
249
+ if (listen_fds > 1) {
250
+ throw new Error(
251
+ `only one socket is allowed for socket activation, but LISTEN_FDS was set to ${listen_fds}`
252
+ );
253
+ }
254
+
255
+ const socket_activation = listen_pid === process.pid && listen_fds === 1;
256
+
257
+ let requests = 0;
258
+ /** @type {NodeJS.Timeout | void} */
259
+ let shutdown_timeout_id;
260
+ /** @type {NodeJS.Timeout | void} */
261
+ let idle_timeout_id;
262
+
263
+ // Initialize the HTTP server here so that we can set properties before starting to listen.
264
+ // Otherwise, polka delays creating the server until listen() is called. Settings these
265
+ // properties after the server has started listening could lead to race conditions.
266
+ const httpServer = http.createServer();
267
+
268
+ const keep_alive_timeout = timeout_env('KEEP_ALIVE_TIMEOUT');
269
+ if (keep_alive_timeout !== undefined) {
270
+ // Convert the keep-alive timeout from seconds to milliseconds (the unit Node.js expects).
271
+ httpServer.keepAliveTimeout = keep_alive_timeout * 1000;
272
+ }
273
+
274
+ const headers_timeout = timeout_env('HEADERS_TIMEOUT');
275
+ if (headers_timeout !== undefined) {
276
+ // Convert the headers timeout from seconds to milliseconds (the unit Node.js expects).
277
+ httpServer.headersTimeout = headers_timeout * 1000;
278
+ }
279
+
280
+ const server = polka({ server: httpServer }).use(handler);
281
+
282
+ if (socket_activation) {
283
+ server.listen({ fd: SD_LISTEN_FDS_START }, () => {
284
+ console.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);
285
+ });
286
+ } else {
287
+ server.listen({ path, host, port }, () => {
288
+ console.log(`Listening on ${path || `http://${host}:${port}`}`);
289
+ });
290
+ }
291
+
292
+ /** @param {'SIGINT' | 'SIGTERM' | 'IDLE'} reason */
293
+ function graceful_shutdown(reason) {
294
+ if (shutdown_timeout_id) return;
295
+
296
+ // If a connection was opened with a keep-alive header close() will wait for the connection to
297
+ // time out rather than close it even if it is not handling any requests, so call this first
298
+ httpServer.closeIdleConnections();
299
+
300
+ httpServer.close((error) => {
301
+ // occurs if the server is already closed
302
+ if (error) return;
303
+
304
+ if (shutdown_timeout_id) {
305
+ clearTimeout(shutdown_timeout_id);
306
+ }
307
+ if (idle_timeout_id) {
308
+ clearTimeout(idle_timeout_id);
309
+ }
310
+
311
+ // @ts-expect-error custom events cannot be typed
312
+ process.emit('sveltekit:shutdown', reason);
313
+ });
314
+
315
+ shutdown_timeout_id = setTimeout(() => httpServer.closeAllConnections(), shutdown_timeout * 1000);
316
+ }
317
+
318
+ httpServer.on(
319
+ 'request',
320
+ /** @param {import('node:http').IncomingMessage} req */
321
+ (req) => {
322
+ requests++;
323
+
324
+ if (socket_activation && idle_timeout_id) {
325
+ idle_timeout_id = clearTimeout(idle_timeout_id);
326
+ }
327
+
328
+ req.on('close', () => {
329
+ requests--;
330
+
331
+ if (shutdown_timeout_id) {
332
+ // close connections as soon as they become idle, so they don't accept new requests
333
+ httpServer.closeIdleConnections();
334
+ }
335
+ if (requests === 0 && socket_activation && idle_timeout) {
336
+ idle_timeout_id = setTimeout(() => graceful_shutdown('IDLE'), idle_timeout * 1000);
337
+ }
338
+ });
339
+ }
340
+ );
341
+
342
+ process.on('SIGTERM', graceful_shutdown);
343
+ process.on('SIGINT', graceful_shutdown);
344
+
345
+ export { host, path, port, server };
@@ -0,0 +1,24 @@
1
+ //#region src/routes/+layout.server.ts
2
+ var load = ({ locals }) => {
3
+ return {
4
+ appName: "Kozou",
5
+ tableCount: locals.schema.tables.length,
6
+ viewCount: locals.schema.views.length
7
+ };
8
+ };
9
+
10
+ var _layout_server_ts = /*#__PURE__*/Object.freeze({
11
+ __proto__: null,
12
+ load: load
13
+ });
14
+
15
+ const index = 0;
16
+ let component_cache;
17
+ const component = async () => component_cache ??= (await import('./_layout.svelte-DcwZs9VT.js')).default;
18
+ const server_id = "src/routes/+layout.server.ts";
19
+ const imports = ["_app/immutable/nodes/0.C77vZJGR.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/xihTtKlq.js"];
20
+ const stylesheets = ["_app/immutable/assets/0.Cg4B63gQ.css"];
21
+ const fonts = [];
22
+
23
+ export { component, fonts, imports, index, _layout_server_ts as server, server_id, stylesheets };
24
+ //# sourceMappingURL=0-Cpki24QE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0-Cpki24QE.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_layout.server.ts.js","../../../.svelte-kit/adapter-node/nodes/0.js"],"sourcesContent":["//#region src/routes/+layout.server.ts\nvar load = ({ locals }) => {\n\treturn {\n\t\tappName: \"Kozou\",\n\t\ttableCount: locals.schema.tables.length,\n\t\tviewCount: locals.schema.views.length\n\t};\n};\n//#endregion\nexport { load };\n","import * as server from '../entries/pages/_layout.server.ts.js';\n\nexport const index = 0;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/+layout.server.ts\";\nexport const imports = [\"_app/immutable/nodes/0.C77vZJGR.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [\"_app/immutable/assets/0.Cg4B63gQ.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAAA;AACA,IAAI,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK;AAC3B,CAAC,OAAO;AACR,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM;AACzC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AACjC,EAAE;AACF,CAAC;;;;;;;ACLW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,8BAAoC,CAAC,EAAE;AAElG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC;AACxH,MAAC,WAAW,GAAG,CAAC,sCAAsC;AACtD,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,9 @@
1
+ const index = 1;
2
+ let component_cache;
3
+ const component = async () => component_cache ??= (await import('./error.svelte-B8LolEv3.js')).default;
4
+ const imports = ["_app/immutable/nodes/1.9-mDK_1B.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/D4orYVgu.js","_app/immutable/chunks/xihTtKlq.js"];
5
+ const stylesheets = [];
6
+ const fonts = [];
7
+
8
+ export { component, fonts, imports, index, stylesheets };
9
+ //# sourceMappingURL=1-C_Zl16E8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1-C_Zl16E8.js","sources":["../../../.svelte-kit/adapter-node/nodes/1.js"],"sourcesContent":["\n\nexport const index = 1;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/1.9-mDK_1B.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/D4orYVgu.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAsC,CAAC,EAAE;AACpG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC5J,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,35 @@
1
+ //#region src/lib/dashboard/group.ts
2
+ function groupForDashboard(schema) {
3
+ return {
4
+ tables: schema.tables.map(toDashboardItem).sort((a, b) => a.label.localeCompare(b.label)),
5
+ views: schema.views.map(toDashboardItem).sort((a, b) => a.label.localeCompare(b.label))
6
+ };
7
+ }
8
+ function toDashboardItem(item) {
9
+ return {
10
+ qualifiedName: item.qualifiedName,
11
+ label: item.label,
12
+ description: item.description
13
+ };
14
+ }
15
+ //#endregion
16
+ //#region src/routes/+page.server.ts
17
+ var load = ({ locals }) => {
18
+ return { dashboard: groupForDashboard(locals.schema) };
19
+ };
20
+
21
+ var _page_server_ts = /*#__PURE__*/Object.freeze({
22
+ __proto__: null,
23
+ load: load
24
+ });
25
+
26
+ const index = 2;
27
+ let component_cache;
28
+ const component = async () => component_cache ??= (await import('./_page.svelte-BywGr3Tk.js')).default;
29
+ const server_id = "src/routes/+page.server.ts";
30
+ const imports = ["_app/immutable/nodes/2.DKSRkbg2.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/xihTtKlq.js"];
31
+ const stylesheets = [];
32
+ const fonts = [];
33
+
34
+ export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
35
+ //# sourceMappingURL=2-Bb7ROZP0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2-Bb7ROZP0.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/2.js"],"sourcesContent":["//#region src/lib/dashboard/group.ts\nfunction groupForDashboard(schema) {\n\treturn {\n\t\ttables: schema.tables.map(toDashboardItem).sort((a, b) => a.label.localeCompare(b.label)),\n\t\tviews: schema.views.map(toDashboardItem).sort((a, b) => a.label.localeCompare(b.label))\n\t};\n}\nfunction toDashboardItem(item) {\n\treturn {\n\t\tqualifiedName: item.qualifiedName,\n\t\tlabel: item.label,\n\t\tdescription: item.description\n\t};\n}\n//#endregion\n//#region src/routes/+page.server.ts\nvar load = ({ locals }) => {\n\treturn { dashboard: groupForDashboard(locals.schema) };\n};\n//#endregion\nexport { load };\n","import * as server from '../entries/pages/_page.server.ts.js';\n\nexport const index = 2;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/2.DKSRkbg2.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAAA;AACA,SAAS,iBAAiB,CAAC,MAAM,EAAE;AACnC,CAAC,OAAO;AACR,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3F,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;AACxF,EAAE;AACF;AACA,SAAS,eAAe,CAAC,IAAI,EAAE;AAC/B,CAAC,OAAO;AACR,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa;AACnC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK;AACnB,EAAE,WAAW,EAAE,IAAI,CAAC;AACpB,EAAE;AACF;AACA;AACA;AACA,IAAI,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK;AAC3B,CAAC,OAAO,EAAE,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;AACvD,CAAC;;;;;;;AChBW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAkC,CAAC,EAAE;AAEhG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC;AACxH,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,71 @@
1
+ import { g as getAdapter } from './adapter-DSZ-_PM_.js';
2
+ import { p as parseListParamsFromUrl } from './list-params-DjWk7B1o.js';
3
+ import { e as error } from './index-5kYmxIr9.js';
4
+ import './index-DBqjc0Yf.js';
5
+
6
+ //#region src/routes/tables/[table]/+page.server.ts
7
+ var DISPLAY_COLUMN_LIMIT = 5;
8
+ var TEXT_LIKE_TYPE_PREFIXES = [
9
+ "text",
10
+ "character",
11
+ "varchar",
12
+ "citext",
13
+ "name",
14
+ "uuid"
15
+ ];
16
+ var load = async ({ params, locals, url }) => {
17
+ const table = locals.schema.tables.find((t) => t.qualifiedName === params.table);
18
+ if (!table) throw error(404, `Unknown table: ${params.table}`);
19
+ const displayColumns = pickDisplayColumns(table);
20
+ const listParams = parseListParamsFromUrl({
21
+ url,
22
+ searchFields: pickSearchFields(table)
23
+ });
24
+ const result = await getAdapter().list(table.qualifiedName, listParams);
25
+ return {
26
+ table: {
27
+ qualifiedName: table.qualifiedName,
28
+ label: table.label,
29
+ primaryKey: table.primaryKey,
30
+ displayField: table.displayField,
31
+ columns: displayColumns.map((c) => ({
32
+ name: c.name,
33
+ label: c.label
34
+ }))
35
+ },
36
+ list: result,
37
+ listParams: {
38
+ search: listParams.search,
39
+ sort: listParams.sort,
40
+ page: listParams.page,
41
+ pageSize: listParams.pageSize
42
+ }
43
+ };
44
+ };
45
+ function pickDisplayColumns(table) {
46
+ const display = table.displayField;
47
+ return [...table.columns].sort((a, b) => {
48
+ if (a.name === display && b.name !== display) return -1;
49
+ if (b.name === display && a.name !== display) return 1;
50
+ return 0;
51
+ }).slice(0, DISPLAY_COLUMN_LIMIT);
52
+ }
53
+ function pickSearchFields(table) {
54
+ return table.columns.filter((c) => TEXT_LIKE_TYPE_PREFIXES.some((prefix) => c.dataType.toLowerCase().startsWith(prefix))).map((c) => c.name);
55
+ }
56
+
57
+ var _page_server_ts = /*#__PURE__*/Object.freeze({
58
+ __proto__: null,
59
+ load: load
60
+ });
61
+
62
+ const index = 3;
63
+ let component_cache;
64
+ const component = async () => component_cache ??= (await import('./_page.svelte-Dfaz3pC_.js')).default;
65
+ const server_id = "src/routes/tables/[table]/+page.server.ts";
66
+ const imports = ["_app/immutable/nodes/3.BRseKH3J.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/xihTtKlq.js"];
67
+ const stylesheets = [];
68
+ const fonts = [];
69
+
70
+ export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
71
+ //# sourceMappingURL=3-dXQmFZGn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3-dXQmFZGn.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/tables/_table_/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/3.js"],"sourcesContent":["import { t as getAdapter } from \"../../../../chunks/adapter.js\";\nimport { t as parseListParamsFromUrl } from \"../../../../chunks/list-params.js\";\nimport { error } from \"@sveltejs/kit\";\n//#region src/routes/tables/[table]/+page.server.ts\nvar DISPLAY_COLUMN_LIMIT = 5;\nvar TEXT_LIKE_TYPE_PREFIXES = [\n\t\"text\",\n\t\"character\",\n\t\"varchar\",\n\t\"citext\",\n\t\"name\",\n\t\"uuid\"\n];\nvar load = async ({ params, locals, url }) => {\n\tconst table = locals.schema.tables.find((t) => t.qualifiedName === params.table);\n\tif (!table) throw error(404, `Unknown table: ${params.table}`);\n\tconst displayColumns = pickDisplayColumns(table);\n\tconst listParams = parseListParamsFromUrl({\n\t\turl,\n\t\tsearchFields: pickSearchFields(table)\n\t});\n\tconst result = await getAdapter().list(table.qualifiedName, listParams);\n\treturn {\n\t\ttable: {\n\t\t\tqualifiedName: table.qualifiedName,\n\t\t\tlabel: table.label,\n\t\t\tprimaryKey: table.primaryKey,\n\t\t\tdisplayField: table.displayField,\n\t\t\tcolumns: displayColumns.map((c) => ({\n\t\t\t\tname: c.name,\n\t\t\t\tlabel: c.label\n\t\t\t}))\n\t\t},\n\t\tlist: result,\n\t\tlistParams: {\n\t\t\tsearch: listParams.search,\n\t\t\tsort: listParams.sort,\n\t\t\tpage: listParams.page,\n\t\t\tpageSize: listParams.pageSize\n\t\t}\n\t};\n};\nfunction pickDisplayColumns(table) {\n\tconst display = table.displayField;\n\treturn [...table.columns].sort((a, b) => {\n\t\tif (a.name === display && b.name !== display) return -1;\n\t\tif (b.name === display && a.name !== display) return 1;\n\t\treturn 0;\n\t}).slice(0, DISPLAY_COLUMN_LIMIT);\n}\nfunction pickSearchFields(table) {\n\treturn table.columns.filter((c) => TEXT_LIKE_TYPE_PREFIXES.some((prefix) => c.dataType.toLowerCase().startsWith(prefix))).map((c) => c.name);\n}\n//#endregion\nexport { load };\n","import * as server from '../entries/pages/tables/_table_/_page.server.ts.js';\n\nexport const index = 3;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/tables/_table_/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/tables/[table]/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/3.BRseKH3J.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;AAGA;AACA,IAAI,oBAAoB,GAAG,CAAC;AAC5B,IAAI,uBAAuB,GAAG;AAC9B,CAAC,MAAM;AACP,CAAC,WAAW;AACZ,CAAC,SAAS;AACV,CAAC,QAAQ;AACT,CAAC,MAAM;AACP,CAAC;AACD,CAAC;AACD,IAAI,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK;AAC9C,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa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AE,CAAC,KAAK;AAC1C,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE;AACzD,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,OAAO,CAAC;AACxD,EAAE,OAAO,CAAC;AACV,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC;AAClC;AACA,SAAS,gBAAgB,CAAC,KAAK,EAAE;AACjC,CAAC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,uBAAuB,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AAC7I;;;;;;;AClDY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAiD,CAAC,EAAE;AAE/G,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC;AACxH,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,54 @@
1
+ import { g as getAdapter } from './adapter-DSZ-_PM_.js';
2
+ import { e as error, r as redirect } from './index-5kYmxIr9.js';
3
+ import './index-DBqjc0Yf.js';
4
+
5
+ //#region src/routes/tables/[table]/[id]/+page.server.ts
6
+ function findTable(tables, slug) {
7
+ return tables.find((t) => t.qualifiedName === slug) ?? null;
8
+ }
9
+ function tableViewModel(table) {
10
+ return {
11
+ qualifiedName: table.qualifiedName,
12
+ label: table.label,
13
+ columns: table.columns.map((c) => ({
14
+ name: c.name,
15
+ label: c.label,
16
+ widget: c.widget,
17
+ isPrimaryKey: c.isPrimaryKey,
18
+ isForeignKey: c.isForeignKey
19
+ }))
20
+ };
21
+ }
22
+ var load = async ({ params, locals }) => {
23
+ const table = findTable(locals.schema.tables, params.table);
24
+ if (!table) throw error(404, `Unknown table: ${params.table}`);
25
+ const row = await getAdapter().get(table.qualifiedName, params.id);
26
+ return {
27
+ table: tableViewModel(table),
28
+ row,
29
+ id: params.id
30
+ };
31
+ };
32
+ var actions = { delete: async ({ params, locals }) => {
33
+ const table = findTable(locals.schema.tables, params.table);
34
+ if (!table) throw error(404, `Unknown table: ${params.table}`);
35
+ await getAdapter().delete(table.qualifiedName, params.id);
36
+ throw redirect(303, `/tables/${table.qualifiedName}`);
37
+ } };
38
+
39
+ var _page_server_ts = /*#__PURE__*/Object.freeze({
40
+ __proto__: null,
41
+ actions: actions,
42
+ load: load
43
+ });
44
+
45
+ const index = 4;
46
+ let component_cache;
47
+ const component = async () => component_cache ??= (await import('./_page.svelte-7DhzytBp.js')).default;
48
+ const server_id = "src/routes/tables/[table]/[id]/+page.server.ts";
49
+ const imports = ["_app/immutable/nodes/4.D1ErMjLn.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/DdEzykkf.js","_app/immutable/chunks/D4orYVgu.js","_app/immutable/chunks/xihTtKlq.js"];
50
+ const stylesheets = [];
51
+ const fonts = [];
52
+
53
+ export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
54
+ //# sourceMappingURL=4-Dn5qQ29L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4-Dn5qQ29L.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/tables/_table_/_id_/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/4.js"],"sourcesContent":["import { t as getAdapter } from \"../../../../../chunks/adapter.js\";\nimport { error, redirect } from \"@sveltejs/kit\";\n//#region src/routes/tables/[table]/[id]/+page.server.ts\nfunction findTable(tables, slug) {\n\treturn tables.find((t) => t.qualifiedName === slug) ?? null;\n}\nfunction tableViewModel(table) {\n\treturn {\n\t\tqualifiedName: table.qualifiedName,\n\t\tlabel: table.label,\n\t\tcolumns: table.columns.map((c) => ({\n\t\t\tname: c.name,\n\t\t\tlabel: c.label,\n\t\t\twidget: c.widget,\n\t\t\tisPrimaryKey: c.isPrimaryKey,\n\t\t\tisForeignKey: c.isForeignKey\n\t\t}))\n\t};\n}\nvar load = async ({ params, locals }) => {\n\tconst table = findTable(locals.schema.tables, params.table);\n\tif (!table) throw error(404, `Unknown table: ${params.table}`);\n\tconst row = await getAdapter().get(table.qualifiedName, params.id);\n\treturn {\n\t\ttable: tableViewModel(table),\n\t\trow,\n\t\tid: params.id\n\t};\n};\nvar actions = { delete: async ({ params, locals }) => {\n\tconst table = findTable(locals.schema.tables, params.table);\n\tif (!table) throw error(404, `Unknown table: ${params.table}`);\n\tawait getAdapter().delete(table.qualifiedName, params.id);\n\tthrow redirect(303, `/tables/${table.qualifiedName}`);\n} };\n//#endregion\nexport { actions, load };\n","import * as server from '../entries/pages/tables/_table_/_id_/_page.server.ts.js';\n\nexport const index = 4;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/tables/_table_/_id_/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/tables/[table]/[id]/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/4.D1ErMjLn.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/DdEzykkf.js\",\"_app/immutable/chunks/D4orYVgu.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;AAEA;AACA,SAAS,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE;AACjC,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,IAAI;AAC5D;AACA,SAAS,cAAc,CAAC,KAAK,EAAE;AAC/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AAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC,MAAM,UAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;AAC1D,CAAC,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AACtD,CAAC,EAAE;;;;;;;;AChCS,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAsD,CAAC,EAAE;AAEpH,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAChM,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
@@ -0,0 +1,69 @@
1
+ import { g as getAdapter } from './adapter-DSZ-_PM_.js';
2
+ import { a as superValidate, z as zod, b as zodFromTable } from './zod-from-table-HRMJdgEv.js';
3
+ import { e as error, f as fail, r as redirect } from './index-5kYmxIr9.js';
4
+ import './internal-Dtmf8fV4.js';
5
+ import 'node:module';
6
+ import './dev-yRSoS_kM.js';
7
+ import 'clsx';
8
+ import './index-DBqjc0Yf.js';
9
+ import './client-nr13Vsqj.js';
10
+ import './app-C1bzfcjj.js';
11
+ import 'zod/v3';
12
+ import 'zod';
13
+
14
+ //#region src/routes/tables/[table]/[id]/edit/+page.server.ts
15
+ function findTable(tables, slug) {
16
+ return tables.find((t) => t.qualifiedName === slug) ?? null;
17
+ }
18
+ function tableViewModel(table) {
19
+ return {
20
+ qualifiedName: table.qualifiedName,
21
+ label: table.label,
22
+ primaryKey: table.primaryKey,
23
+ columns: table.columns.map((c) => ({
24
+ name: c.name,
25
+ label: c.label,
26
+ widget: c.widget,
27
+ enumValues: c.enumValues ?? [],
28
+ nullable: c.nullable,
29
+ readonly: c.readonly || c.isPrimaryKey,
30
+ isPrimaryKey: c.isPrimaryKey
31
+ }))
32
+ };
33
+ }
34
+ var load = async ({ params, locals }) => {
35
+ const table = findTable(locals.schema.tables, params.table);
36
+ if (!table) throw error(404, `Unknown table: ${params.table}`);
37
+ const form = await superValidate(await getAdapter().get(table.qualifiedName, params.id), zod(zodFromTable(table)));
38
+ return {
39
+ table: tableViewModel(table),
40
+ form,
41
+ id: params.id
42
+ };
43
+ };
44
+ var actions = { default: async ({ request, params, locals }) => {
45
+ const table = findTable(locals.schema.tables, params.table);
46
+ if (!table) throw error(404, `Unknown table: ${params.table}`);
47
+ const form = await superValidate(request, zod(zodFromTable(table)));
48
+ if (!form.valid) return fail(400, { form });
49
+ const payload = Object.fromEntries(Object.entries(form.data));
50
+ await getAdapter().update(table.qualifiedName, params.id, payload);
51
+ throw redirect(303, `/tables/${table.qualifiedName}/${params.id}`);
52
+ } };
53
+
54
+ var _page_server_ts = /*#__PURE__*/Object.freeze({
55
+ __proto__: null,
56
+ actions: actions,
57
+ load: load
58
+ });
59
+
60
+ const index = 5;
61
+ let component_cache;
62
+ const component = async () => component_cache ??= (await import('./_page.svelte-69okwN_x.js')).default;
63
+ const server_id = "src/routes/tables/[table]/[id]/edit/+page.server.ts";
64
+ const imports = ["_app/immutable/nodes/5.U1CG0AZz.js","_app/immutable/chunks/BpIM_fT8.js","_app/immutable/chunks/Dq0SIjgq.js","_app/immutable/chunks/D4orYVgu.js","_app/immutable/chunks/DdEzykkf.js","_app/immutable/chunks/xihTtKlq.js"];
65
+ const stylesheets = [];
66
+ const fonts = [];
67
+
68
+ export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
69
+ //# sourceMappingURL=5-CKRn1yVS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"5-CKRn1yVS.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/tables/_table_/_id_/edit/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/5.js"],"sourcesContent":["import { t as getAdapter } from \"../../../../../../chunks/adapter.js\";\nimport { t as superValidate } from \"../../../../../../chunks/dist.js\";\nimport { n as zod, t as zodFromTable } from \"../../../../../../chunks/zod-from-table.js\";\nimport { error, fail, redirect } from \"@sveltejs/kit\";\n//#region src/routes/tables/[table]/[id]/edit/+page.server.ts\nfunction findTable(tables, slug) {\n\treturn tables.find((t) => t.qualifiedName === slug) ?? null;\n}\nfunction tableViewModel(table) {\n\treturn {\n\t\tqualifiedName: table.qualifiedName,\n\t\tlabel: table.label,\n\t\tprimaryKey: table.primaryKey,\n\t\tcolumns: table.columns.map((c) => ({\n\t\t\tname: c.name,\n\t\t\tlabel: c.label,\n\t\t\twidget: c.widget,\n\t\t\tenumValues: c.enumValues ?? [],\n\t\t\tnullable: c.nullable,\n\t\t\treadonly: c.readonly || c.isPrimaryKey,\n\t\t\tisPrimaryKey: c.isPrimaryKey\n\t\t}))\n\t};\n}\nvar load = async ({ params, locals }) => {\n\tconst table = findTable(locals.schema.tables, params.table);\n\tif (!table) throw error(404, `Unknown table: ${params.table}`);\n\tconst form = await superValidate(await getAdapter().get(table.qualifiedName, params.id), zod(zodFromTable(table)));\n\treturn {\n\t\ttable: tableViewModel(table),\n\t\tform,\n\t\tid: params.id\n\t};\n};\nvar actions = { default: async ({ request, params, locals }) => {\n\tconst table = findTable(locals.schema.tables, params.table);\n\tif (!table) throw error(404, `Unknown table: ${params.table}`);\n\tconst form = await superValidate(request, zod(zodFromTable(table)));\n\tif (!form.valid) return fail(400, { form });\n\tconst payload = Object.fromEntries(Object.entries(form.data));\n\tawait getAdapter().update(table.qualifiedName, params.id, payload);\n\tthrow redirect(303, `/tables/${table.qualifiedName}/${params.id}`);\n} };\n//#endregion\nexport { actions, load };\n","import * as server from '../entries/pages/tables/_table_/_id_/edit/_page.server.ts.js';\n\nexport const index = 5;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/tables/_table_/_id_/edit/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/tables/[table]/[id]/edit/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/5.U1CG0AZz.js\",\"_app/immutable/chunks/BpIM_fT8.js\",\"_app/immutable/chunks/Dq0SIjgq.js\",\"_app/immutable/chunks/D4orYVgu.js\",\"_app/immutable/chunks/DdEzykkf.js\",\"_app/immutable/chunks/xihTtKlq.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;;;;;;;;;AAIA;AACA,SAAS,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE;AACjC,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,IAAI;AAC5D;AACA,SAAS,cAAc,CAAC,KAAK,EAAE;AAC/B,CAAC,OAAO;AACR,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa;AACpC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK;AACpB,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU;AAC9B,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;AACrC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI;AACf,GAAG,KAAK,EAAE,CAAC,CAAC,KAAK;AACjB,GAAG,MAAM,EAAE,CAAC,CAAC,MAAM;AACnB,GAAG,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,EAAE;AACjC,GAAG,QAAQ,EAAE,CAAC,CAAC,QAAQ;AACvB,GAAG,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY;AACzC,GAAG,YAAY,EAAE,CAAC,CAAC;AACnB,GAAG,CAAC;AACJ,EAAE;AACF;AACA,IAAI,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AACzC,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;AAC5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