miolo 2.0.5 → 2.1.0-beta.1

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.
@@ -1,21 +1,55 @@
1
1
 
2
2
  import {xeiraBundle} from 'xeira'
3
- //import { cleanFolder } from './util.mjs'
3
+ import { cleanFolder, copyFileSync, getAppName, isFileExistingSync } from './util.mjs'
4
4
 
5
5
  process.env.NODE_ENV = 'production'
6
6
 
7
- export default async function(appName, entry, dest) {
7
+ const BUNDLE_SUFFIX = 'iife.bundle.min'
8
+
9
+ function _addCssLinkToHead(htmlString) {
10
+ const linkTag = ` <link href="/dist/cli/${getAppName()}.${BUNDLE_SUFFIX}.css" rel="stylesheet" media="all">`
11
+
12
+ // Expresión regular para encontrar la etiqueta </head> de cierre.
13
+ // Usamos un grupo de captura para mantener el contenido antes de </head>.
14
+ const headCloseTagRegex = /(<\/head>)/i;
15
+
16
+ // Busca la etiqueta </head> en el HTML.
17
+ const match = htmlString.match(headCloseTagRegex);
18
+
19
+ if (match) {
20
+ // Si se encuentra </head>, inserta la etiqueta <link> justo antes de ella.
21
+ return htmlString.replace(headCloseTagRegex, `${linkTag}\n$&`);
22
+ } else {
23
+ // Si no se encuentra </head>, devuelve el HTML original sin modificar.
24
+ console.warn(`[miolo] No se encontró la etiqueta <head> en el HTML proporcionado.`);
25
+ return htmlString;
26
+ }
27
+ }
28
+
29
+
30
+ export default async function(appName, entry, htmlFile, dest) {
8
31
  console.log(`[${appName}][prod] Building client from entry ${entry}`)
9
- //cleanFolder(dest)
10
32
 
11
- // fs.copyFileSync(proot('./cli/index.html'), proot('./build/cli/index.html'))
33
+ cleanFolder(dest)
34
+
12
35
  await xeiraBundle({
13
36
  source_index: entry,
14
37
  target: 'browser',
15
38
  bundle_folder: dest,
16
39
  bundle_name: appName,
17
- bundle_extension: 'iife.bundle.min',
40
+ bundle_extension: BUNDLE_SUFFIX,
18
41
  bundler: 'rollup',
19
42
  bundle_node_polyfill: true
20
43
  })
44
+
45
+ const destCssFile = `${dest}/${appName}.${BUNDLE_SUFFIX}.css`
46
+ const destCssFileExists = isFileExistingSync(destCssFile)
47
+
48
+ copyFileSync(htmlFile, `${dest}/index.html`, (content) => {
49
+ if (destCssFileExists) {
50
+ content = _addCssLinkToHead(content)
51
+ }
52
+ return content
53
+ })
54
+
21
55
  }
@@ -3,7 +3,7 @@ import path from 'node:path'
3
3
  import { readFile, writeFile} from 'node:fs/promises'
4
4
  import { build } from 'vite'
5
5
  import {xeiraBundle} from 'xeira'
6
- //import { cleanFolder } from './util.mjs'
6
+ import { cleanFolder } from './util.mjs'
7
7
 
8
8
  process.env.NODE_ENV = 'production'
9
9
 
@@ -22,7 +22,7 @@ export async function _fixProdBuild(appName, filePath) {
22
22
  }
23
23
 
24
24
  export default async function(appName, ssrEntry, ssrDest, entry, dest) {
25
- //cleanFolder(dest)
25
+ cleanFolder(dest)
26
26
 
27
27
  console.log(`[${appName}][prod] Building first the SSR entry ${ssrEntry}`)
28
28
  await build({
@@ -30,7 +30,16 @@ export default async function(appName, ssrEntry, ssrDest, entry, dest) {
30
30
  outDir: path.resolve(process.cwd(), ssrDest),
31
31
  ssr: path.resolve(process.cwd(), ssrEntry),
32
32
  rollupOptions: {
33
- //
33
+ /*
34
+ external: ['react', 'react-dom'],
35
+ output: {
36
+ globals: {
37
+ react: 'React',
38
+ 'react-dom': 'ReactDOM'
39
+ }
40
+ }
41
+ */
42
+
34
43
  },
35
44
  },
36
45
  // server ssr's entry must bundle externals
package/bin/dev.mjs CHANGED
@@ -62,16 +62,7 @@ async function startDevServerProcess({ appName, entry }) {
62
62
  }
63
63
 
64
64
 
65
- export default async function(appName, entry, serverName) {
66
- console.log(`[${appName}][dev] Running DEV server ${serverName} from entry ${entry}`)
65
+ export default async function(appName, entry) {
66
+ console.log(`[${appName}][dev] Running DEV server from entry ${entry}`)
67
67
  await startDevServerProcess({ appName, entry })
68
68
  }
69
-
70
-
71
-
72
- // export default async function({ appName, entry, serverName }) {
73
- // console.log(`[${appName}][dev] Running DEV server ${serverName} from entry ${entry}`)
74
- // const srv_module = await import(path.join(process.cwd(), entry))
75
- // const server = srv_module[serverName]
76
- // await server()
77
- // }
package/bin/index.mjs CHANGED
@@ -7,21 +7,22 @@ async function main() {
7
7
  const command = args._[0]
8
8
 
9
9
  try {
10
- const appName = await getAppName()
10
+ const appName = getAppName()
11
11
  const serverName = args['server-name'] || 'miolo_server'
12
12
 
13
13
  switch (command) {
14
14
  case 'dev':
15
15
  const devHandler = (await import ('./dev.mjs')).default
16
16
  const devEntry = args.entry || './src/server/server-dev.mjs'
17
- await devHandler(appName, /*entry*/ devEntry, serverName)
17
+ await devHandler(appName, /*entry*/ devEntry)
18
18
  break
19
19
 
20
20
  case 'build-client':
21
21
  const buildClientHandler = (await import ('./build-client.mjs')).default
22
22
  const clientEntry = args.entry || './cli/entry-cli.jsx'
23
+ const htmlFile = args['html-file'] || './cli/index.html'
23
24
  const clientDest = args.dest || './dist/cli'
24
- await buildClientHandler(appName, /*entry*/ clientEntry, /*dest*/ clientDest)
25
+ await buildClientHandler(appName, /*entry*/ clientEntry, htmlFile, /*dest*/ clientDest)
25
26
  break
26
27
 
27
28
  case 'build-server':
package/bin/util.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  import {readdirSync, rmSync, writeFileSync, readFileSync} from 'node:fs'
2
- import { readFile } from 'node:fs/promises'
3
2
  import path from 'node:path'
4
3
 
5
4
 
6
- export async function getAppName() {
5
+ export function getAppName() {
7
6
  try {
8
7
  const packageJsonPath = path.join(process.cwd(), 'package.json')
9
- const content = await readFile(packageJsonPath, 'utf8')
8
+ const content = readFileSync(packageJsonPath, 'utf8')
10
9
  const packageData = JSON.parse(content)
11
10
  return packageData.name
12
11
  } catch (error) {
@@ -34,4 +33,27 @@ export function pidFileRead(appName) {
34
33
  return pid
35
34
  }
36
35
 
36
+ export function copyFileSync(src, dest, modifier= undefined) {
37
+ const srcPath = path.join(process.cwd(), src)
38
+ const destPath = path.join(process.cwd(), dest)
39
+ try {
40
+ let content = readFileSync(srcPath, 'utf8')
41
+ if (modifier) {
42
+ content = modifier(content)
43
+ }
44
+ writeFileSync(destPath, content, {encoding:'utf8',flag:'w'})
45
+ console.log(`[miolo] Copied file from ${srcPath} to ${destPath}`)
46
+ } catch (error) {
47
+ console.error(`[miolo] Error copying file from ${srcPath} to ${destPath}:`, error)
48
+ }
49
+ }
37
50
 
51
+ export function isFileExistingSync(filePath) {
52
+ try {
53
+ const fullPath = path.join(process.cwd(), filePath)
54
+ return readdirSync(path.dirname(fullPath)).includes(path.basename(fullPath))
55
+ } catch (error) {
56
+ console.error(`[miolo] Error checking if file exists: ${filePath}`, error)
57
+ return false
58
+ }
59
+ }
@@ -0,0 +1,492 @@
1
+ /**
2
+ * miolo v2.1.0-beta.1
3
+ *
4
+ * https://www.afialapis.com/os/miolo
5
+ *
6
+ * Copyright (c) Donato Lorenzo <donato@afialapis.com>
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE.md file in the root directory of this source tree.
10
+ *
11
+ * @license MIT
12
+ */
13
+ /* eslint-disable */
14
+ function init_catcher(catcher_url, fetcher) {
15
+ if (typeof window == "undefined") {
16
+ return;
17
+ }
18
+ if (window.miolo_listeners === true) {
19
+ return;
20
+ }
21
+
22
+ // window.onerror = function(msg, file, line, col, error) {
23
+ // try {
24
+ // const params= {
25
+ // 'error': {
26
+ // msg, file, line, col, error
27
+ // },
28
+ // 'path' : window.location.pathname,
29
+ // 'agent': 'UserAgent' + navigator.userAgent
30
+ // }
31
+ //
32
+ // fetcher.post(catcher_url, params)
33
+ // } catch(e) {
34
+ // console.error(e)
35
+ // }
36
+ // }
37
+
38
+ window.addEventListener("error", event => {
39
+ // https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent
40
+
41
+ try {
42
+ var params = {
43
+ 'error': {
44
+ msg: (event === null || event === void 0 ? void 0 : event.message) || 'Client error',
45
+ file: event === null || event === void 0 ? void 0 : event.filename,
46
+ line: event === null || event === void 0 ? void 0 : event.lineno,
47
+ col: event === null || event === void 0 ? void 0 : event.colno,
48
+ error: event === null || event === void 0 ? void 0 : event.error
49
+ },
50
+ 'path': window.location.pathname,
51
+ 'agent': 'UserAgent' + navigator.userAgent
52
+ };
53
+ fetcher.post(catcher_url, params);
54
+ } catch (e) {
55
+ console.error(e);
56
+ }
57
+ });
58
+ window.addEventListener("unhandledrejection", event => {
59
+ // https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
60
+
61
+ try {
62
+ var params = {
63
+ 'warning': {
64
+ msg: (event === null || event === void 0 ? void 0 : event.reason) || 'Client Unhandled rejection',
65
+ file: undefined,
66
+ line: undefined,
67
+ col: undefined,
68
+ error: event === null || event === void 0 ? void 0 : event.reason
69
+ },
70
+ 'path': window.location.pathname,
71
+ 'agent': 'UserAgent' + navigator.userAgent
72
+ };
73
+ fetcher.post(catcher_url, params);
74
+ } catch (e) {
75
+ console.error(e);
76
+ }
77
+ });
78
+ window.miolo_listeners = true;
79
+ }
80
+
81
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
82
+ try {
83
+ var i = n[a](c),
84
+ u = i.value;
85
+ } catch (n) {
86
+ return void e(n);
87
+ }
88
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
89
+ }
90
+ function _asyncToGenerator(n) {
91
+ return function () {
92
+ var t = this,
93
+ e = arguments;
94
+ return new Promise(function (r, o) {
95
+ var a = n.apply(t, e);
96
+ function _next(n) {
97
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
98
+ }
99
+ function _throw(n) {
100
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
101
+ }
102
+ _next(void 0);
103
+ });
104
+ };
105
+ }
106
+ function _defineProperty(e, r, t) {
107
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
108
+ value: t,
109
+ enumerable: true,
110
+ configurable: true,
111
+ writable: true
112
+ }) : e[r] = t, e;
113
+ }
114
+ function ownKeys(e, r) {
115
+ var t = Object.keys(e);
116
+ if (Object.getOwnPropertySymbols) {
117
+ var o = Object.getOwnPropertySymbols(e);
118
+ r && (o = o.filter(function (r) {
119
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
120
+ })), t.push.apply(t, o);
121
+ }
122
+ return t;
123
+ }
124
+ function _objectSpread2(e) {
125
+ for (var r = 1; r < arguments.length; r++) {
126
+ var t = null != arguments[r] ? arguments[r] : {};
127
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
128
+ _defineProperty(e, r, t[r]);
129
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
130
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
131
+ });
132
+ }
133
+ return e;
134
+ }
135
+ function _toPrimitive(t, r) {
136
+ if ("object" != typeof t || !t) return t;
137
+ var e = t[Symbol.toPrimitive];
138
+ if (void 0 !== e) {
139
+ var i = e.call(t, r);
140
+ if ("object" != typeof i) return i;
141
+ throw new TypeError("@@toPrimitive must return a primitive value.");
142
+ }
143
+ return ("string" === r ? String : Number)(t);
144
+ }
145
+ function _toPropertyKey(t) {
146
+ var i = _toPrimitive(t, "string");
147
+ return "symbol" == typeof i ? i : i + "";
148
+ }
149
+
150
+ /**
151
+ * Transform an JSON object to a query string
152
+ */
153
+ var _parse_value = value => {
154
+ try {
155
+ return value.replace(/\+/g, '%2B');
156
+ } catch (e) {
157
+ return value;
158
+ }
159
+ };
160
+ function json_to_query_string(obj) {
161
+ if (obj && Object.keys(obj).length > 0) {
162
+ var uparams = new URLSearchParams();
163
+ var _loop = function _loop(key) {
164
+ if (Object.hasOwn(obj, key)) {
165
+ var value = obj[key];
166
+ if (Array.isArray(value)) {
167
+ value.forEach(item => uparams.append(key, _parse_value(item)));
168
+ } else if (value !== undefined && value !== null) {
169
+ uparams.append(key, _parse_value(value));
170
+ }
171
+ }
172
+ };
173
+ for (var key in obj) {
174
+ _loop(key);
175
+ }
176
+ return "?".concat(uparams.toString());
177
+ }
178
+ return '';
179
+ }
180
+ function trim_left(str, what) {
181
+ return str.replace(new RegExp("^".concat(what, "+")), '');
182
+ }
183
+ function omit_nil(obj) {
184
+ if (typeof obj !== 'object') return obj;
185
+ return Object.keys(obj).reduce((acc, v) => {
186
+ if (obj[v] !== undefined) acc[v] = obj[v];
187
+ return acc;
188
+ }, {});
189
+ }
190
+ function parse_login_cookie(response) {
191
+ if (typeof window !== 'object') {
192
+ return undefined;
193
+ }
194
+ try {
195
+ var raw = response.headers.raw()['set-cookie'];
196
+ return raw.map(entry => {
197
+ var parts = entry.split(';');
198
+ var cookiePart = parts[0];
199
+ return cookiePart;
200
+ }).join(';');
201
+ } catch (e) {
202
+ console.log('[miolo-cli] Could not get the set-cookie after login');
203
+ return undefined;
204
+ }
205
+ }
206
+
207
+ class Fetcher {
208
+ /**
209
+ * @param {*} config {hostname, port, force_hostname, silent_fail: false}
210
+ */
211
+ constructor(config) {
212
+ this.config = config;
213
+ this.auth = undefined;
214
+ this.cookie = undefined;
215
+ }
216
+ set_auth(auth) {
217
+ if (auth) {
218
+ var {
219
+ username,
220
+ password
221
+ } = auth;
222
+ this.auth = {
223
+ username,
224
+ password
225
+ };
226
+ }
227
+ }
228
+ get_headers() {
229
+ var headers = {};
230
+ if (this.auth) {
231
+ var {
232
+ username,
233
+ password
234
+ } = this.auth;
235
+ username = username || '';
236
+ password = password || '';
237
+ var sauth;
238
+ try {
239
+ sauth = 'Basic ' + Buffer.from(username + ":" + password).toString('base64');
240
+ } catch (_) {
241
+ sauth = 'Basic ' + btoa(username + ":" + password);
242
+ }
243
+ headers['Authorization'] = sauth;
244
+ }
245
+ if (this.cookie) {
246
+ headers['Cookie'] = this.cookie;
247
+ }
248
+ return headers;
249
+ }
250
+ _prepare_url(url) {
251
+ var endpoint = '/' + trim_left(url, '/');
252
+ var {
253
+ hostname,
254
+ port,
255
+ force_hostname
256
+ } = this.config || {};
257
+ if (hostname && force_hostname) {
258
+ return "http://".concat(hostname, ":").concat(port).concat(endpoint);
259
+ }
260
+ return endpoint;
261
+ }
262
+ _fetch(method, url, params) {
263
+ var _arguments = arguments,
264
+ _this = this;
265
+ return _asyncToGenerator(function* () {
266
+ var auth = _arguments.length > 3 && _arguments[3] !== undefined ? _arguments[3] : undefined;
267
+ _this.set_auth(auth);
268
+ var request = {
269
+ method,
270
+ mode: 'cors',
271
+ credentials: 'include',
272
+ headers: _objectSpread2({
273
+ 'content-type': 'application/json'
274
+ }, _this.get_headers() || {})
275
+ };
276
+ var wurl = _this._prepare_url(url);
277
+ if (method === 'POST') {
278
+ request.body = JSON.stringify(params || {}, (k, v) => v === undefined ? null : v);
279
+ } else if (method === 'GET') {
280
+ if (params) {
281
+ wurl += json_to_query_string(params);
282
+ }
283
+ }
284
+ var response = yield fetch(wurl, request);
285
+ if (response.redirected) {
286
+ var isBrowser = typeof window == 'object';
287
+ if (isBrowser) {
288
+ // JSDOM does not support navigation, so lets skip it for tests
289
+ var isTest = typeof navigator !== "undefined" && navigator.userAgent.includes("Node.js");
290
+ if (!isTest) {
291
+ window.location.replace(response.url);
292
+ return Promise.resolve(response);
293
+ } else {
294
+ console.error("Response for ".concat(wurl, " is a redirect to ").concat(response.url, ". But you are in a test environment, where redirects cannot be done. Unexpected results are coming..."));
295
+ }
296
+ }
297
+ }
298
+ if (response.headers.get('content-type').indexOf('json') >= 0) {
299
+ var _data = yield response.json();
300
+ return {
301
+ data: _data,
302
+ status: response.status,
303
+ response
304
+ };
305
+ }
306
+ var data = yield response.text();
307
+ return {
308
+ data,
309
+ status: response.status,
310
+ response
311
+ };
312
+ })();
313
+ }
314
+ get(url, params) {
315
+ var _arguments2 = arguments,
316
+ _this2 = this;
317
+ return _asyncToGenerator(function* () {
318
+ var auth = _arguments2.length > 2 && _arguments2[2] !== undefined ? _arguments2[2] : undefined;
319
+ /* eslint no-unused-vars:0 */
320
+ try {
321
+ var resp = yield _this2._fetch('GET', url, omit_nil(params), auth);
322
+ return resp;
323
+ } catch (e) {
324
+ var _this2$config;
325
+ if (((_this2$config = _this2.config) === null || _this2$config === void 0 ? void 0 : _this2$config.silent_fail) !== true) {
326
+ console.error("Error on GET ".concat(url));
327
+ console.error(e);
328
+ }
329
+ return {
330
+ data: e,
331
+ status: -1
332
+ };
333
+ }
334
+ })();
335
+ }
336
+ post(url, data) {
337
+ var _arguments3 = arguments,
338
+ _this3 = this;
339
+ return _asyncToGenerator(function* () {
340
+ var auth = _arguments3.length > 2 && _arguments3[2] !== undefined ? _arguments3[2] : undefined;
341
+ try {
342
+ var resp = yield _this3._fetch('POST', url, data, auth);
343
+ return resp;
344
+ } catch (e) {
345
+ var _this3$config;
346
+ if (((_this3$config = _this3.config) === null || _this3$config === void 0 ? void 0 : _this3$config.silent_fail) !== true) {
347
+ console.error("Error on POST ".concat(url));
348
+ console.error(e);
349
+ }
350
+ return {
351
+ data: e,
352
+ status: -1
353
+ };
354
+ }
355
+ })();
356
+ }
357
+ login(url, _ref) {
358
+ var _this4 = this;
359
+ return _asyncToGenerator(function* () {
360
+ var {
361
+ username,
362
+ password
363
+ } = _ref;
364
+ var res = yield _this4._fetch('POST', url || '/login', {
365
+ username,
366
+ password
367
+ });
368
+ _this4.cookie = parse_login_cookie(res.response);
369
+ return res;
370
+ })();
371
+ }
372
+ logout(url) {
373
+ var _this5 = this;
374
+ return _asyncToGenerator(function* () {
375
+ _this5.cookie = undefined;
376
+ var res = yield _this5._fetch('POST', url || '/logout', {});
377
+ return res;
378
+ })();
379
+ }
380
+ read(url, params) {
381
+ var _arguments4 = arguments,
382
+ _this6 = this;
383
+ return _asyncToGenerator(function* () {
384
+ var auth = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : undefined;
385
+ var result = yield _this6.get("".concat(url, "/read"), params, auth);
386
+ return result.data;
387
+ })();
388
+ }
389
+ key_list(url, params) {
390
+ var _arguments5 = arguments,
391
+ _this7 = this;
392
+ return _asyncToGenerator(function* () {
393
+ var auth = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : undefined;
394
+ var result = yield _this7.get("".concat(url, "/key_list"), params, auth);
395
+ return result.data;
396
+ })();
397
+ }
398
+ name_list(url, params) {
399
+ var _arguments6 = arguments,
400
+ _this8 = this;
401
+ return _asyncToGenerator(function* () {
402
+ var auth = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : undefined;
403
+ var result = yield _this8.key_list(url, params, auth);
404
+ return Object.values(result);
405
+ })();
406
+ }
407
+ find(url, id) {
408
+ var _arguments7 = arguments,
409
+ _this9 = this;
410
+ return _asyncToGenerator(function* () {
411
+ var auth = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : undefined;
412
+ var result = yield _this9.get("".concat(url, "/find"), {
413
+ id: id
414
+ }, auth);
415
+ return result.data;
416
+ })();
417
+ }
418
+ distinct(url, field, params) {
419
+ var _arguments8 = arguments,
420
+ _this0 = this;
421
+ return _asyncToGenerator(function* () {
422
+ var auth = _arguments8.length > 3 && _arguments8[3] !== undefined ? _arguments8[3] : undefined;
423
+ var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
424
+ distinct_field: field
425
+ });
426
+ var result = yield _this0.get("".concat(url, "/distinct"), nparams, auth);
427
+ return result.data;
428
+ })();
429
+ }
430
+ upsave(url, data) {
431
+ var _arguments9 = arguments,
432
+ _this1 = this;
433
+ return _asyncToGenerator(function* () {
434
+ var auth = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : undefined;
435
+ var result;
436
+ if (data.id == undefined) {
437
+ delete data.id;
438
+ result = yield _this1.post("".concat(url, "/save"), data, auth);
439
+ } else {
440
+ result = yield _this1.post("".concat(url, "/update"), data, auth);
441
+ }
442
+ return result.data;
443
+ })();
444
+ }
445
+ remove(url, id) {
446
+ var _arguments0 = arguments,
447
+ _this10 = this;
448
+ return _asyncToGenerator(function* () {
449
+ var auth = _arguments0.length > 2 && _arguments0[2] !== undefined ? _arguments0[2] : undefined;
450
+ var data = {
451
+ id: id
452
+ };
453
+ var result = yield _this10.post("".concat(url, "/delete"), data, auth);
454
+ return result.data;
455
+ })();
456
+ }
457
+ }
458
+ Fetcher.keyList = Fetcher.key_list;
459
+ Fetcher.nameList = Fetcher.name_list;
460
+
461
+ function init_fetcher(config) {
462
+ var fetcher = new Fetcher(config);
463
+ return fetcher;
464
+ }
465
+
466
+ // import {init_socket} from './socket/index.mjs'
467
+
468
+ function miolo_client(context) {
469
+ var {
470
+ config
471
+ } = context;
472
+ var fetcher = init_fetcher(config);
473
+ if (config !== null && config !== void 0 && config.catcher_url) {
474
+ init_catcher(config === null || config === void 0 ? void 0 : config.catcher_url, fetcher);
475
+ }
476
+
477
+ // let socket
478
+ // if (config?.socket?.enabled===true) {
479
+ // const domain = config?.socket?.domain
480
+ // const options = config?.socket?.options
481
+ // socket = init_socket(domain, options)
482
+ // }
483
+
484
+ var miolo_obj = {
485
+ fetcher
486
+ //socket
487
+ };
488
+ return miolo_obj;
489
+ }
490
+
491
+ export { miolo_client };
492
+ //# sourceMappingURL=miolo.cli.mjs.map