@semiont/frontend 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/standalone/apps/frontend/.next/BUILD_ID +1 -1
- package/standalone/apps/frontend/.next/app-path-routes-manifest.json +2 -2
- package/standalone/apps/frontend/.next/build-manifest.json +3 -3
- package/standalone/apps/frontend/.next/prerender-manifest.json +3 -3
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js +100 -100
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.html +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.html +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js +2022 -12
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app-paths-manifest.json +2 -2
- package/standalone/apps/frontend/.next/server/chunks/3144.js +277 -1835
- package/standalone/apps/frontend/.next/server/chunks/{5781.js → 5056.js} +66 -7214
- package/standalone/apps/frontend/.next/server/chunks/{4741.js → 5866.js} +1311 -7254
- package/standalone/apps/frontend/.next/server/chunks/730.js +2 -2458
- package/standalone/apps/frontend/.next/server/middleware-build-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/pages/404.html +1 -1
- package/standalone/apps/frontend/.next/server/pages/500.html +1 -1
- package/standalone/apps/frontend/.next/server/server-reference-manifest.json +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/compose/{page-94f946fb3aaf0917.js → page-8c09eaae74b2bfd1.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/resource/[id]/{page-a4b644af750844d5.js → page-78dff169b8aa5aff.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/common-5a07de4e988dc9b9.js +63 -0
- package/standalone/apps/frontend/package.json +8 -8
- package/standalone/package.json +10 -1
- package/standalone/packages/core/package.json +12 -4
- package/standalone/apps/frontend/.next/static/chunks/common-42653c14d34c8864.js +0 -69
- /package/standalone/apps/frontend/.next/static/{I_XveRdyStDMqYJPcAAy5 → ewuXcO4pOVeGlYuR_3hkh}/_buildManifest.js +0 -0
- /package/standalone/apps/frontend/.next/static/{I_XveRdyStDMqYJPcAAy5 → ewuXcO4pOVeGlYuR_3hkh}/_ssgManifest.js +0 -0
|
@@ -230,14 +230,7 @@ function _interopRequireWildcard(e, r) {
|
|
|
230
230
|
|
|
231
231
|
/***/ }),
|
|
232
232
|
|
|
233
|
-
/***/
|
|
234
|
-
/***/ ((module) => {
|
|
235
|
-
|
|
236
|
-
module.exports = require("events");
|
|
237
|
-
|
|
238
|
-
/***/ }),
|
|
239
|
-
|
|
240
|
-
/***/ 94943:
|
|
233
|
+
/***/ 94251:
|
|
241
234
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
242
235
|
|
|
243
236
|
// ESM COMPAT FLAG
|
|
@@ -302,8 +295,2018 @@ var next_auth = __webpack_require__(61388);
|
|
|
302
295
|
var auth = __webpack_require__(63986);
|
|
303
296
|
// EXTERNAL MODULE: ./src/lib/env.ts
|
|
304
297
|
var env = __webpack_require__(62100);
|
|
305
|
-
// EXTERNAL MODULE:
|
|
306
|
-
var
|
|
298
|
+
// EXTERNAL MODULE: external "crypto"
|
|
299
|
+
var external_crypto_ = __webpack_require__(55511);
|
|
300
|
+
;// ../../node_modules/smol-toml/dist/error.js
|
|
301
|
+
/*!
|
|
302
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
303
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
304
|
+
*
|
|
305
|
+
* Redistribution and use in source and binary forms, with or without
|
|
306
|
+
* modification, are permitted provided that the following conditions are met:
|
|
307
|
+
*
|
|
308
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
309
|
+
* list of conditions and the following disclaimer.
|
|
310
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
311
|
+
* this list of conditions and the following disclaimer in the
|
|
312
|
+
* documentation and/or other materials provided with the distribution.
|
|
313
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
314
|
+
* may be used to endorse or promote products derived from this software without
|
|
315
|
+
* specific prior written permission.
|
|
316
|
+
*
|
|
317
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
318
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
319
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
320
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
321
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
322
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
323
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
324
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
325
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
326
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
327
|
+
*/
|
|
328
|
+
function getLineColFromPtr(string, ptr) {
|
|
329
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
330
|
+
return [lines.length, lines.pop().length + 1];
|
|
331
|
+
}
|
|
332
|
+
function makeCodeBlock(string, line, column) {
|
|
333
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
334
|
+
let codeblock = '';
|
|
335
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
336
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
337
|
+
let l = lines[i - 1];
|
|
338
|
+
if (!l)
|
|
339
|
+
continue;
|
|
340
|
+
codeblock += i.toString().padEnd(numberLen, ' ');
|
|
341
|
+
codeblock += ': ';
|
|
342
|
+
codeblock += l;
|
|
343
|
+
codeblock += '\n';
|
|
344
|
+
if (i === line) {
|
|
345
|
+
codeblock += ' '.repeat(numberLen + column + 2);
|
|
346
|
+
codeblock += '^\n';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return codeblock;
|
|
350
|
+
}
|
|
351
|
+
class TomlError extends Error {
|
|
352
|
+
line;
|
|
353
|
+
column;
|
|
354
|
+
codeblock;
|
|
355
|
+
constructor(message, options) {
|
|
356
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
357
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
358
|
+
super(`Invalid TOML document: ${message}\n\n${codeblock}`, options);
|
|
359
|
+
this.line = line;
|
|
360
|
+
this.column = column;
|
|
361
|
+
this.codeblock = codeblock;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
;// ../../node_modules/smol-toml/dist/util.js
|
|
366
|
+
/*!
|
|
367
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
368
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
369
|
+
*
|
|
370
|
+
* Redistribution and use in source and binary forms, with or without
|
|
371
|
+
* modification, are permitted provided that the following conditions are met:
|
|
372
|
+
*
|
|
373
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
374
|
+
* list of conditions and the following disclaimer.
|
|
375
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
376
|
+
* this list of conditions and the following disclaimer in the
|
|
377
|
+
* documentation and/or other materials provided with the distribution.
|
|
378
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
379
|
+
* may be used to endorse or promote products derived from this software without
|
|
380
|
+
* specific prior written permission.
|
|
381
|
+
*
|
|
382
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
383
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
384
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
385
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
386
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
387
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
388
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
389
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
390
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
391
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
function isEscaped(str, ptr) {
|
|
395
|
+
let i = 0;
|
|
396
|
+
while (str[ptr - ++i] === '\\')
|
|
397
|
+
;
|
|
398
|
+
return --i && (i % 2);
|
|
399
|
+
}
|
|
400
|
+
function indexOfNewline(str, start = 0, end = str.length) {
|
|
401
|
+
let idx = str.indexOf('\n', start);
|
|
402
|
+
if (str[idx - 1] === '\r')
|
|
403
|
+
idx--;
|
|
404
|
+
return idx <= end ? idx : -1;
|
|
405
|
+
}
|
|
406
|
+
function skipComment(str, ptr) {
|
|
407
|
+
for (let i = ptr; i < str.length; i++) {
|
|
408
|
+
let c = str[i];
|
|
409
|
+
if (c === '\n')
|
|
410
|
+
return i;
|
|
411
|
+
if (c === '\r' && str[i + 1] === '\n')
|
|
412
|
+
return i + 1;
|
|
413
|
+
if ((c < '\x20' && c !== '\t') || c === '\x7f') {
|
|
414
|
+
throw new TomlError('control characters are not allowed in comments', {
|
|
415
|
+
toml: str,
|
|
416
|
+
ptr: ptr,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return str.length;
|
|
421
|
+
}
|
|
422
|
+
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
423
|
+
let c;
|
|
424
|
+
while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || c === '\r' && str[ptr + 1] === '\n')))
|
|
425
|
+
ptr++;
|
|
426
|
+
return banComments || c !== '#'
|
|
427
|
+
? ptr
|
|
428
|
+
: skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
429
|
+
}
|
|
430
|
+
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
431
|
+
if (!end) {
|
|
432
|
+
ptr = indexOfNewline(str, ptr);
|
|
433
|
+
return ptr < 0 ? str.length : ptr;
|
|
434
|
+
}
|
|
435
|
+
for (let i = ptr; i < str.length; i++) {
|
|
436
|
+
let c = str[i];
|
|
437
|
+
if (c === '#') {
|
|
438
|
+
i = indexOfNewline(str, i);
|
|
439
|
+
}
|
|
440
|
+
else if (c === sep) {
|
|
441
|
+
return i + 1;
|
|
442
|
+
}
|
|
443
|
+
else if (c === end || (banNewLines && (c === '\n' || (c === '\r' && str[i + 1] === '\n')))) {
|
|
444
|
+
return i;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
throw new TomlError('cannot find end of structure', {
|
|
448
|
+
toml: str,
|
|
449
|
+
ptr: ptr
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function getStringEnd(str, seek) {
|
|
453
|
+
let first = str[seek];
|
|
454
|
+
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2]
|
|
455
|
+
? str.slice(seek, seek + 3)
|
|
456
|
+
: first;
|
|
457
|
+
seek += target.length - 1;
|
|
458
|
+
do
|
|
459
|
+
seek = str.indexOf(target, ++seek);
|
|
460
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
461
|
+
if (seek > -1) {
|
|
462
|
+
seek += target.length;
|
|
463
|
+
if (target.length > 1) {
|
|
464
|
+
if (str[seek] === first)
|
|
465
|
+
seek++;
|
|
466
|
+
if (str[seek] === first)
|
|
467
|
+
seek++;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return seek;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
;// ../../node_modules/smol-toml/dist/date.js
|
|
474
|
+
/*!
|
|
475
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
476
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
477
|
+
*
|
|
478
|
+
* Redistribution and use in source and binary forms, with or without
|
|
479
|
+
* modification, are permitted provided that the following conditions are met:
|
|
480
|
+
*
|
|
481
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
482
|
+
* list of conditions and the following disclaimer.
|
|
483
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
484
|
+
* this list of conditions and the following disclaimer in the
|
|
485
|
+
* documentation and/or other materials provided with the distribution.
|
|
486
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
487
|
+
* may be used to endorse or promote products derived from this software without
|
|
488
|
+
* specific prior written permission.
|
|
489
|
+
*
|
|
490
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
491
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
492
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
493
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
494
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
495
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
496
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
497
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
498
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
499
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
500
|
+
*/
|
|
501
|
+
let DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
502
|
+
class TomlDate extends Date {
|
|
503
|
+
#hasDate = false;
|
|
504
|
+
#hasTime = false;
|
|
505
|
+
#offset = null;
|
|
506
|
+
constructor(date) {
|
|
507
|
+
let hasDate = true;
|
|
508
|
+
let hasTime = true;
|
|
509
|
+
let offset = 'Z';
|
|
510
|
+
if (typeof date === 'string') {
|
|
511
|
+
let match = date.match(DATE_TIME_RE);
|
|
512
|
+
if (match) {
|
|
513
|
+
if (!match[1]) {
|
|
514
|
+
hasDate = false;
|
|
515
|
+
date = `0000-01-01T${date}`;
|
|
516
|
+
}
|
|
517
|
+
hasTime = !!match[2];
|
|
518
|
+
// Make sure to use T instead of a space. Breaks in case of extreme values otherwise.
|
|
519
|
+
hasTime && date[10] === ' ' && (date = date.replace(' ', 'T'));
|
|
520
|
+
// Do not allow rollover hours.
|
|
521
|
+
if (match[2] && +match[2] > 23) {
|
|
522
|
+
date = '';
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
offset = match[3] || null;
|
|
526
|
+
date = date.toUpperCase();
|
|
527
|
+
if (!offset && hasTime)
|
|
528
|
+
date += 'Z';
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
date = '';
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
super(date);
|
|
536
|
+
if (!isNaN(this.getTime())) {
|
|
537
|
+
this.#hasDate = hasDate;
|
|
538
|
+
this.#hasTime = hasTime;
|
|
539
|
+
this.#offset = offset;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
isDateTime() {
|
|
543
|
+
return this.#hasDate && this.#hasTime;
|
|
544
|
+
}
|
|
545
|
+
isLocal() {
|
|
546
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
547
|
+
}
|
|
548
|
+
isDate() {
|
|
549
|
+
return this.#hasDate && !this.#hasTime;
|
|
550
|
+
}
|
|
551
|
+
isTime() {
|
|
552
|
+
return this.#hasTime && !this.#hasDate;
|
|
553
|
+
}
|
|
554
|
+
isValid() {
|
|
555
|
+
return this.#hasDate || this.#hasTime;
|
|
556
|
+
}
|
|
557
|
+
toISOString() {
|
|
558
|
+
let iso = super.toISOString();
|
|
559
|
+
// Local Date
|
|
560
|
+
if (this.isDate())
|
|
561
|
+
return iso.slice(0, 10);
|
|
562
|
+
// Local Time
|
|
563
|
+
if (this.isTime())
|
|
564
|
+
return iso.slice(11, 23);
|
|
565
|
+
// Local DateTime
|
|
566
|
+
if (this.#offset === null)
|
|
567
|
+
return iso.slice(0, -1);
|
|
568
|
+
// Offset DateTime
|
|
569
|
+
if (this.#offset === 'Z')
|
|
570
|
+
return iso;
|
|
571
|
+
// This part is quite annoying: JS strips the original timezone from the ISO string representation
|
|
572
|
+
// Instead of using a "modified" date and "Z", we restore the representation "as authored"
|
|
573
|
+
let offset = (+(this.#offset.slice(1, 3)) * 60) + +(this.#offset.slice(4, 6));
|
|
574
|
+
offset = this.#offset[0] === '-' ? offset : -offset;
|
|
575
|
+
let offsetDate = new Date(this.getTime() - (offset * 60e3));
|
|
576
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
577
|
+
}
|
|
578
|
+
static wrapAsOffsetDateTime(jsDate, offset = 'Z') {
|
|
579
|
+
let date = new TomlDate(jsDate);
|
|
580
|
+
date.#offset = offset;
|
|
581
|
+
return date;
|
|
582
|
+
}
|
|
583
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
584
|
+
let date = new TomlDate(jsDate);
|
|
585
|
+
date.#offset = null;
|
|
586
|
+
return date;
|
|
587
|
+
}
|
|
588
|
+
static wrapAsLocalDate(jsDate) {
|
|
589
|
+
let date = new TomlDate(jsDate);
|
|
590
|
+
date.#hasTime = false;
|
|
591
|
+
date.#offset = null;
|
|
592
|
+
return date;
|
|
593
|
+
}
|
|
594
|
+
static wrapAsLocalTime(jsDate) {
|
|
595
|
+
let date = new TomlDate(jsDate);
|
|
596
|
+
date.#hasDate = false;
|
|
597
|
+
date.#offset = null;
|
|
598
|
+
return date;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
;// ../../node_modules/smol-toml/dist/primitive.js
|
|
603
|
+
/*!
|
|
604
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
605
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
606
|
+
*
|
|
607
|
+
* Redistribution and use in source and binary forms, with or without
|
|
608
|
+
* modification, are permitted provided that the following conditions are met:
|
|
609
|
+
*
|
|
610
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
611
|
+
* list of conditions and the following disclaimer.
|
|
612
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
613
|
+
* this list of conditions and the following disclaimer in the
|
|
614
|
+
* documentation and/or other materials provided with the distribution.
|
|
615
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
616
|
+
* may be used to endorse or promote products derived from this software without
|
|
617
|
+
* specific prior written permission.
|
|
618
|
+
*
|
|
619
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
620
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
621
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
622
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
623
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
624
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
625
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
626
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
627
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
628
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
629
|
+
*/
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
let INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
634
|
+
let FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
635
|
+
let LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
636
|
+
let ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
|
|
637
|
+
let ESC_MAP = {
|
|
638
|
+
b: '\b',
|
|
639
|
+
t: '\t',
|
|
640
|
+
n: '\n',
|
|
641
|
+
f: '\f',
|
|
642
|
+
r: '\r',
|
|
643
|
+
e: '\x1b',
|
|
644
|
+
'"': '"',
|
|
645
|
+
'\\': '\\',
|
|
646
|
+
};
|
|
647
|
+
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
648
|
+
let isLiteral = str[ptr] === '\'';
|
|
649
|
+
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
650
|
+
if (isMultiline) {
|
|
651
|
+
endPtr -= 2;
|
|
652
|
+
if (str[ptr += 2] === '\r')
|
|
653
|
+
ptr++;
|
|
654
|
+
if (str[ptr] === '\n')
|
|
655
|
+
ptr++;
|
|
656
|
+
}
|
|
657
|
+
let tmp = 0;
|
|
658
|
+
let isEscape;
|
|
659
|
+
let parsed = '';
|
|
660
|
+
let sliceStart = ptr;
|
|
661
|
+
while (ptr < endPtr - 1) {
|
|
662
|
+
let c = str[ptr++];
|
|
663
|
+
if (c === '\n' || (c === '\r' && str[ptr] === '\n')) {
|
|
664
|
+
if (!isMultiline) {
|
|
665
|
+
throw new TomlError('newlines are not allowed in strings', {
|
|
666
|
+
toml: str,
|
|
667
|
+
ptr: ptr - 1,
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
else if ((c < '\x20' && c !== '\t') || c === '\x7f') {
|
|
672
|
+
throw new TomlError('control characters are not allowed in strings', {
|
|
673
|
+
toml: str,
|
|
674
|
+
ptr: ptr - 1,
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
if (isEscape) {
|
|
678
|
+
isEscape = false;
|
|
679
|
+
if (c === 'x' || c === 'u' || c === 'U') {
|
|
680
|
+
// Unicode escape
|
|
681
|
+
let code = str.slice(ptr, (ptr += (c === 'x' ? 2 : c === 'u' ? 4 : 8)));
|
|
682
|
+
if (!ESCAPE_REGEX.test(code)) {
|
|
683
|
+
throw new TomlError('invalid unicode escape', {
|
|
684
|
+
toml: str,
|
|
685
|
+
ptr: tmp,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
try {
|
|
689
|
+
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
690
|
+
}
|
|
691
|
+
catch {
|
|
692
|
+
throw new TomlError('invalid unicode escape', {
|
|
693
|
+
toml: str,
|
|
694
|
+
ptr: tmp,
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
else if (isMultiline && (c === '\n' || c === ' ' || c === '\t' || c === '\r')) {
|
|
699
|
+
// Multiline escape
|
|
700
|
+
ptr = skipVoid(str, ptr - 1, true);
|
|
701
|
+
if (str[ptr] !== '\n' && str[ptr] !== '\r') {
|
|
702
|
+
throw new TomlError('invalid escape: only line-ending whitespace may be escaped', {
|
|
703
|
+
toml: str,
|
|
704
|
+
ptr: tmp,
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
ptr = skipVoid(str, ptr);
|
|
708
|
+
}
|
|
709
|
+
else if (c in ESC_MAP) {
|
|
710
|
+
// Classic escape
|
|
711
|
+
parsed += ESC_MAP[c];
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
throw new TomlError('unrecognized escape sequence', {
|
|
715
|
+
toml: str,
|
|
716
|
+
ptr: tmp,
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
sliceStart = ptr;
|
|
720
|
+
}
|
|
721
|
+
else if (!isLiteral && c === '\\') {
|
|
722
|
+
tmp = ptr - 1;
|
|
723
|
+
isEscape = true;
|
|
724
|
+
parsed += str.slice(sliceStart, tmp);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
728
|
+
}
|
|
729
|
+
function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
730
|
+
// Constant values
|
|
731
|
+
if (value === 'true')
|
|
732
|
+
return true;
|
|
733
|
+
if (value === 'false')
|
|
734
|
+
return false;
|
|
735
|
+
if (value === '-inf')
|
|
736
|
+
return -Infinity;
|
|
737
|
+
if (value === 'inf' || value === '+inf')
|
|
738
|
+
return Infinity;
|
|
739
|
+
if (value === 'nan' || value === '+nan' || value === '-nan')
|
|
740
|
+
return NaN;
|
|
741
|
+
// Avoid FP representation of -0
|
|
742
|
+
if (value === '-0')
|
|
743
|
+
return integersAsBigInt ? 0n : 0;
|
|
744
|
+
// Numbers
|
|
745
|
+
let isInt = INT_REGEX.test(value);
|
|
746
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
747
|
+
if (LEADING_ZERO.test(value)) {
|
|
748
|
+
throw new TomlError('leading zeroes are not allowed', {
|
|
749
|
+
toml: toml,
|
|
750
|
+
ptr: ptr,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
value = value.replace(/_/g, '');
|
|
754
|
+
let numeric = +value;
|
|
755
|
+
if (isNaN(numeric)) {
|
|
756
|
+
throw new TomlError('invalid number', {
|
|
757
|
+
toml: toml,
|
|
758
|
+
ptr: ptr,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
if (isInt) {
|
|
762
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
763
|
+
throw new TomlError('integer value cannot be represented losslessly', {
|
|
764
|
+
toml: toml,
|
|
765
|
+
ptr: ptr,
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
if (isInt || integersAsBigInt === true)
|
|
769
|
+
numeric = BigInt(value);
|
|
770
|
+
}
|
|
771
|
+
return numeric;
|
|
772
|
+
}
|
|
773
|
+
const date = new TomlDate(value);
|
|
774
|
+
if (!date.isValid()) {
|
|
775
|
+
throw new TomlError('invalid value', {
|
|
776
|
+
toml: toml,
|
|
777
|
+
ptr: ptr,
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
return date;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
;// ../../node_modules/smol-toml/dist/extract.js
|
|
784
|
+
/*!
|
|
785
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
786
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
787
|
+
*
|
|
788
|
+
* Redistribution and use in source and binary forms, with or without
|
|
789
|
+
* modification, are permitted provided that the following conditions are met:
|
|
790
|
+
*
|
|
791
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
792
|
+
* list of conditions and the following disclaimer.
|
|
793
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
794
|
+
* this list of conditions and the following disclaimer in the
|
|
795
|
+
* documentation and/or other materials provided with the distribution.
|
|
796
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
797
|
+
* may be used to endorse or promote products derived from this software without
|
|
798
|
+
* specific prior written permission.
|
|
799
|
+
*
|
|
800
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
801
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
802
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
803
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
804
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
805
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
806
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
807
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
808
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
809
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
810
|
+
*/
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
function sliceAndTrimEndOf(str, startPtr, endPtr) {
|
|
816
|
+
let value = str.slice(startPtr, endPtr);
|
|
817
|
+
let commentIdx = value.indexOf('#');
|
|
818
|
+
if (commentIdx > -1) {
|
|
819
|
+
// The call to skipComment allows to "validate" the comment
|
|
820
|
+
// (absence of control characters)
|
|
821
|
+
skipComment(str, commentIdx);
|
|
822
|
+
value = value.slice(0, commentIdx);
|
|
823
|
+
}
|
|
824
|
+
return [value.trimEnd(), commentIdx];
|
|
825
|
+
}
|
|
826
|
+
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
827
|
+
if (depth === 0) {
|
|
828
|
+
throw new TomlError('document contains excessively nested structures. aborting.', {
|
|
829
|
+
toml: str,
|
|
830
|
+
ptr: ptr
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
let c = str[ptr];
|
|
834
|
+
if (c === '[' || c === '{') {
|
|
835
|
+
let [value, endPtr] = c === '['
|
|
836
|
+
? parseArray(str, ptr, depth, integersAsBigInt)
|
|
837
|
+
: parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
838
|
+
if (end) {
|
|
839
|
+
endPtr = skipVoid(str, endPtr);
|
|
840
|
+
if (str[endPtr] === ',')
|
|
841
|
+
endPtr++;
|
|
842
|
+
else if (str[endPtr] !== end) {
|
|
843
|
+
throw new TomlError('expected comma or end of structure', {
|
|
844
|
+
toml: str,
|
|
845
|
+
ptr: endPtr,
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return [value, endPtr];
|
|
850
|
+
}
|
|
851
|
+
let endPtr;
|
|
852
|
+
if (c === '"' || c === "'") {
|
|
853
|
+
endPtr = getStringEnd(str, ptr);
|
|
854
|
+
let parsed = parseString(str, ptr, endPtr);
|
|
855
|
+
if (end) {
|
|
856
|
+
endPtr = skipVoid(str, endPtr);
|
|
857
|
+
if (str[endPtr] && str[endPtr] !== ',' && str[endPtr] !== end && str[endPtr] !== '\n' && str[endPtr] !== '\r') {
|
|
858
|
+
throw new TomlError('unexpected character encountered', {
|
|
859
|
+
toml: str,
|
|
860
|
+
ptr: endPtr,
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
endPtr += (+(str[endPtr] === ','));
|
|
864
|
+
}
|
|
865
|
+
return [parsed, endPtr];
|
|
866
|
+
}
|
|
867
|
+
endPtr = skipUntil(str, ptr, ',', end);
|
|
868
|
+
let slice = sliceAndTrimEndOf(str, ptr, endPtr - (+(str[endPtr - 1] === ',')));
|
|
869
|
+
if (!slice[0]) {
|
|
870
|
+
throw new TomlError('incomplete key-value declaration: no value specified', {
|
|
871
|
+
toml: str,
|
|
872
|
+
ptr: ptr
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
if (end && slice[1] > -1) {
|
|
876
|
+
endPtr = skipVoid(str, ptr + slice[1]);
|
|
877
|
+
endPtr += +(str[endPtr] === ',');
|
|
878
|
+
}
|
|
879
|
+
return [
|
|
880
|
+
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
881
|
+
endPtr,
|
|
882
|
+
];
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
;// ../../node_modules/smol-toml/dist/struct.js
|
|
886
|
+
/*!
|
|
887
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
888
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
889
|
+
*
|
|
890
|
+
* Redistribution and use in source and binary forms, with or without
|
|
891
|
+
* modification, are permitted provided that the following conditions are met:
|
|
892
|
+
*
|
|
893
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
894
|
+
* list of conditions and the following disclaimer.
|
|
895
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
896
|
+
* this list of conditions and the following disclaimer in the
|
|
897
|
+
* documentation and/or other materials provided with the distribution.
|
|
898
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
899
|
+
* may be used to endorse or promote products derived from this software without
|
|
900
|
+
* specific prior written permission.
|
|
901
|
+
*
|
|
902
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
903
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
904
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
905
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
906
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
907
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
908
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
909
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
910
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
911
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
912
|
+
*/
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
let KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
918
|
+
function parseKey(str, ptr, end = '=') {
|
|
919
|
+
let dot = ptr - 1;
|
|
920
|
+
let parsed = [];
|
|
921
|
+
let endPtr = str.indexOf(end, ptr);
|
|
922
|
+
if (endPtr < 0) {
|
|
923
|
+
throw new TomlError('incomplete key-value: cannot find end of key', {
|
|
924
|
+
toml: str,
|
|
925
|
+
ptr: ptr,
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
do {
|
|
929
|
+
let c = str[ptr = ++dot];
|
|
930
|
+
// If it's whitespace, ignore
|
|
931
|
+
if (c !== ' ' && c !== '\t') {
|
|
932
|
+
// If it's a string
|
|
933
|
+
if (c === '"' || c === '\'') {
|
|
934
|
+
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
935
|
+
throw new TomlError('multiline strings are not allowed in keys', {
|
|
936
|
+
toml: str,
|
|
937
|
+
ptr: ptr,
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
let eos = getStringEnd(str, ptr);
|
|
941
|
+
if (eos < 0) {
|
|
942
|
+
throw new TomlError('unfinished string encountered', {
|
|
943
|
+
toml: str,
|
|
944
|
+
ptr: ptr,
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
dot = str.indexOf('.', eos);
|
|
948
|
+
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
949
|
+
let newLine = indexOfNewline(strEnd);
|
|
950
|
+
if (newLine > -1) {
|
|
951
|
+
throw new TomlError('newlines are not allowed in keys', {
|
|
952
|
+
toml: str,
|
|
953
|
+
ptr: ptr + dot + newLine,
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
if (strEnd.trimStart()) {
|
|
957
|
+
throw new TomlError('found extra tokens after the string part', {
|
|
958
|
+
toml: str,
|
|
959
|
+
ptr: eos,
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
if (endPtr < eos) {
|
|
963
|
+
endPtr = str.indexOf(end, eos);
|
|
964
|
+
if (endPtr < 0) {
|
|
965
|
+
throw new TomlError('incomplete key-value: cannot find end of key', {
|
|
966
|
+
toml: str,
|
|
967
|
+
ptr: ptr,
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
parsed.push(parseString(str, ptr, eos));
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
// Normal raw key part consumption and validation
|
|
975
|
+
dot = str.indexOf('.', ptr);
|
|
976
|
+
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
977
|
+
if (!KEY_PART_RE.test(part)) {
|
|
978
|
+
throw new TomlError('only letter, numbers, dashes and underscores are allowed in keys', {
|
|
979
|
+
toml: str,
|
|
980
|
+
ptr: ptr,
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
parsed.push(part.trimEnd());
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
// Until there's no more dot
|
|
987
|
+
} while (dot + 1 && dot < endPtr);
|
|
988
|
+
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
989
|
+
}
|
|
990
|
+
function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
991
|
+
let res = {};
|
|
992
|
+
let seen = new Set();
|
|
993
|
+
let c;
|
|
994
|
+
ptr++;
|
|
995
|
+
while ((c = str[ptr++]) !== '}' && c) {
|
|
996
|
+
if (c === ',') {
|
|
997
|
+
throw new TomlError('expected value, found comma', {
|
|
998
|
+
toml: str,
|
|
999
|
+
ptr: ptr - 1,
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
else if (c === '#')
|
|
1003
|
+
ptr = skipComment(str, ptr);
|
|
1004
|
+
else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
|
|
1005
|
+
let k;
|
|
1006
|
+
let t = res;
|
|
1007
|
+
let hasOwn = false;
|
|
1008
|
+
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
1009
|
+
for (let i = 0; i < key.length; i++) {
|
|
1010
|
+
if (i)
|
|
1011
|
+
t = hasOwn ? t[k] : (t[k] = {});
|
|
1012
|
+
k = key[i];
|
|
1013
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
|
|
1014
|
+
throw new TomlError('trying to redefine an already defined value', {
|
|
1015
|
+
toml: str,
|
|
1016
|
+
ptr: ptr,
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
if (!hasOwn && k === '__proto__') {
|
|
1020
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
if (hasOwn) {
|
|
1024
|
+
throw new TomlError('trying to redefine an already defined value', {
|
|
1025
|
+
toml: str,
|
|
1026
|
+
ptr: ptr,
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
let [value, valueEndPtr] = extractValue(str, keyEndPtr, '}', depth - 1, integersAsBigInt);
|
|
1030
|
+
seen.add(value);
|
|
1031
|
+
t[k] = value;
|
|
1032
|
+
ptr = valueEndPtr;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (!c) {
|
|
1036
|
+
throw new TomlError('unfinished table encountered', {
|
|
1037
|
+
toml: str,
|
|
1038
|
+
ptr: ptr,
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
return [res, ptr];
|
|
1042
|
+
}
|
|
1043
|
+
function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
1044
|
+
let res = [];
|
|
1045
|
+
let c;
|
|
1046
|
+
ptr++;
|
|
1047
|
+
while ((c = str[ptr++]) !== ']' && c) {
|
|
1048
|
+
if (c === ',') {
|
|
1049
|
+
throw new TomlError('expected value, found comma', {
|
|
1050
|
+
toml: str,
|
|
1051
|
+
ptr: ptr - 1,
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
else if (c === '#')
|
|
1055
|
+
ptr = skipComment(str, ptr);
|
|
1056
|
+
else if (c !== ' ' && c !== '\t' && c !== '\n' && c !== '\r') {
|
|
1057
|
+
let e = extractValue(str, ptr - 1, ']', depth - 1, integersAsBigInt);
|
|
1058
|
+
res.push(e[0]);
|
|
1059
|
+
ptr = e[1];
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
if (!c) {
|
|
1063
|
+
throw new TomlError('unfinished array encountered', {
|
|
1064
|
+
toml: str,
|
|
1065
|
+
ptr: ptr,
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
return [res, ptr];
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
;// ../../node_modules/smol-toml/dist/parse.js
|
|
1072
|
+
/*!
|
|
1073
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1074
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1075
|
+
*
|
|
1076
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1077
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1078
|
+
*
|
|
1079
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1080
|
+
* list of conditions and the following disclaimer.
|
|
1081
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1082
|
+
* this list of conditions and the following disclaimer in the
|
|
1083
|
+
* documentation and/or other materials provided with the distribution.
|
|
1084
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1085
|
+
* may be used to endorse or promote products derived from this software without
|
|
1086
|
+
* specific prior written permission.
|
|
1087
|
+
*
|
|
1088
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1089
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1090
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1091
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1092
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1093
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1094
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1095
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1096
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1097
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1098
|
+
*/
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
function peekTable(key, table, meta, type) {
|
|
1104
|
+
let t = table;
|
|
1105
|
+
let m = meta;
|
|
1106
|
+
let k;
|
|
1107
|
+
let hasOwn = false;
|
|
1108
|
+
let state;
|
|
1109
|
+
for (let i = 0; i < key.length; i++) {
|
|
1110
|
+
if (i) {
|
|
1111
|
+
t = hasOwn ? t[k] : (t[k] = {});
|
|
1112
|
+
m = (state = m[k]).c;
|
|
1113
|
+
if (type === 0 /* Type.DOTTED */ && (state.t === 1 /* Type.EXPLICIT */ || state.t === 2 /* Type.ARRAY */)) {
|
|
1114
|
+
return null;
|
|
1115
|
+
}
|
|
1116
|
+
if (state.t === 2 /* Type.ARRAY */) {
|
|
1117
|
+
let l = t.length - 1;
|
|
1118
|
+
t = t[l];
|
|
1119
|
+
m = m[l].c;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
k = key[i];
|
|
1123
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 /* Type.DOTTED */ && m[k]?.d) {
|
|
1124
|
+
return null;
|
|
1125
|
+
}
|
|
1126
|
+
if (!hasOwn) {
|
|
1127
|
+
if (k === '__proto__') {
|
|
1128
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
1129
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
1130
|
+
}
|
|
1131
|
+
m[k] = {
|
|
1132
|
+
t: i < key.length - 1 && type === 2 /* Type.ARRAY */
|
|
1133
|
+
? 3 /* Type.ARRAY_DOTTED */
|
|
1134
|
+
: type,
|
|
1135
|
+
d: false,
|
|
1136
|
+
i: 0,
|
|
1137
|
+
c: {},
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
state = m[k];
|
|
1142
|
+
if (state.t !== type && !(type === 1 /* Type.EXPLICIT */ && state.t === 3 /* Type.ARRAY_DOTTED */)) {
|
|
1143
|
+
// Bad key type!
|
|
1144
|
+
return null;
|
|
1145
|
+
}
|
|
1146
|
+
if (type === 2 /* Type.ARRAY */) {
|
|
1147
|
+
if (!state.d) {
|
|
1148
|
+
state.d = true;
|
|
1149
|
+
t[k] = [];
|
|
1150
|
+
}
|
|
1151
|
+
t[k].push(t = {});
|
|
1152
|
+
state.c[state.i++] = (state = { t: 1 /* Type.EXPLICIT */, d: false, i: 0, c: {} });
|
|
1153
|
+
}
|
|
1154
|
+
if (state.d) {
|
|
1155
|
+
// Redefining a table!
|
|
1156
|
+
return null;
|
|
1157
|
+
}
|
|
1158
|
+
state.d = true;
|
|
1159
|
+
if (type === 1 /* Type.EXPLICIT */) {
|
|
1160
|
+
t = hasOwn ? t[k] : (t[k] = {});
|
|
1161
|
+
}
|
|
1162
|
+
else if (type === 0 /* Type.DOTTED */ && hasOwn) {
|
|
1163
|
+
return null;
|
|
1164
|
+
}
|
|
1165
|
+
return [k, t, state.c];
|
|
1166
|
+
}
|
|
1167
|
+
function parse_parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
1168
|
+
let res = {};
|
|
1169
|
+
let meta = {};
|
|
1170
|
+
let tbl = res;
|
|
1171
|
+
let m = meta;
|
|
1172
|
+
for (let ptr = skipVoid(toml, 0); ptr < toml.length;) {
|
|
1173
|
+
if (toml[ptr] === '[') {
|
|
1174
|
+
let isTableArray = toml[++ptr] === '[';
|
|
1175
|
+
let k = parseKey(toml, ptr += +isTableArray, ']');
|
|
1176
|
+
if (isTableArray) {
|
|
1177
|
+
if (toml[k[1] - 1] !== ']') {
|
|
1178
|
+
throw new TomlError('expected end of table declaration', {
|
|
1179
|
+
toml: toml,
|
|
1180
|
+
ptr: k[1] - 1,
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
k[1]++;
|
|
1184
|
+
}
|
|
1185
|
+
let p = peekTable(k[0], res, meta, isTableArray ? 2 /* Type.ARRAY */ : 1 /* Type.EXPLICIT */);
|
|
1186
|
+
if (!p) {
|
|
1187
|
+
throw new TomlError('trying to redefine an already defined table or value', {
|
|
1188
|
+
toml: toml,
|
|
1189
|
+
ptr: ptr,
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
m = p[2];
|
|
1193
|
+
tbl = p[1];
|
|
1194
|
+
ptr = k[1];
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
let k = parseKey(toml, ptr);
|
|
1198
|
+
let p = peekTable(k[0], tbl, m, 0 /* Type.DOTTED */);
|
|
1199
|
+
if (!p) {
|
|
1200
|
+
throw new TomlError('trying to redefine an already defined table or value', {
|
|
1201
|
+
toml: toml,
|
|
1202
|
+
ptr: ptr,
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
|
|
1206
|
+
p[1][p[0]] = v[0];
|
|
1207
|
+
ptr = v[1];
|
|
1208
|
+
}
|
|
1209
|
+
ptr = skipVoid(toml, ptr, true);
|
|
1210
|
+
if (toml[ptr] && toml[ptr] !== '\n' && toml[ptr] !== '\r') {
|
|
1211
|
+
throw new TomlError('each key-value declaration must be followed by an end-of-line', {
|
|
1212
|
+
toml: toml,
|
|
1213
|
+
ptr: ptr
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
ptr = skipVoid(toml, ptr);
|
|
1217
|
+
}
|
|
1218
|
+
return res;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
;// ../../node_modules/smol-toml/dist/stringify.js
|
|
1222
|
+
/*!
|
|
1223
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1224
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1225
|
+
*
|
|
1226
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1227
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1228
|
+
*
|
|
1229
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1230
|
+
* list of conditions and the following disclaimer.
|
|
1231
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1232
|
+
* this list of conditions and the following disclaimer in the
|
|
1233
|
+
* documentation and/or other materials provided with the distribution.
|
|
1234
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1235
|
+
* may be used to endorse or promote products derived from this software without
|
|
1236
|
+
* specific prior written permission.
|
|
1237
|
+
*
|
|
1238
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1239
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1240
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1241
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1242
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1243
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1244
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1245
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1246
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1247
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1248
|
+
*/
|
|
1249
|
+
let BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
1250
|
+
function extendedTypeOf(obj) {
|
|
1251
|
+
let type = typeof obj;
|
|
1252
|
+
if (type === 'object') {
|
|
1253
|
+
if (Array.isArray(obj))
|
|
1254
|
+
return 'array';
|
|
1255
|
+
if (obj instanceof Date)
|
|
1256
|
+
return 'date';
|
|
1257
|
+
}
|
|
1258
|
+
return type;
|
|
1259
|
+
}
|
|
1260
|
+
function isArrayOfTables(obj) {
|
|
1261
|
+
for (let i = 0; i < obj.length; i++) {
|
|
1262
|
+
if (extendedTypeOf(obj[i]) !== 'object')
|
|
1263
|
+
return false;
|
|
1264
|
+
}
|
|
1265
|
+
return obj.length != 0;
|
|
1266
|
+
}
|
|
1267
|
+
function formatString(s) {
|
|
1268
|
+
return JSON.stringify(s).replace(/\x7f/g, '\\u007f');
|
|
1269
|
+
}
|
|
1270
|
+
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
1271
|
+
if (depth === 0) {
|
|
1272
|
+
throw new Error('Could not stringify the object: maximum object depth exceeded');
|
|
1273
|
+
}
|
|
1274
|
+
if (type === 'number') {
|
|
1275
|
+
if (isNaN(val))
|
|
1276
|
+
return 'nan';
|
|
1277
|
+
if (val === Infinity)
|
|
1278
|
+
return 'inf';
|
|
1279
|
+
if (val === -Infinity)
|
|
1280
|
+
return '-inf';
|
|
1281
|
+
if (numberAsFloat && Number.isInteger(val))
|
|
1282
|
+
return val.toFixed(1);
|
|
1283
|
+
return val.toString();
|
|
1284
|
+
}
|
|
1285
|
+
if (type === 'bigint' || type === 'boolean') {
|
|
1286
|
+
return val.toString();
|
|
1287
|
+
}
|
|
1288
|
+
if (type === 'string') {
|
|
1289
|
+
return formatString(val);
|
|
1290
|
+
}
|
|
1291
|
+
if (type === 'date') {
|
|
1292
|
+
if (isNaN(val.getTime())) {
|
|
1293
|
+
throw new TypeError('cannot serialize invalid date');
|
|
1294
|
+
}
|
|
1295
|
+
return val.toISOString();
|
|
1296
|
+
}
|
|
1297
|
+
if (type === 'object') {
|
|
1298
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
1299
|
+
}
|
|
1300
|
+
if (type === 'array') {
|
|
1301
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
1305
|
+
let keys = Object.keys(obj);
|
|
1306
|
+
if (keys.length === 0)
|
|
1307
|
+
return '{}';
|
|
1308
|
+
let res = '{ ';
|
|
1309
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1310
|
+
let k = keys[i];
|
|
1311
|
+
if (i)
|
|
1312
|
+
res += ', ';
|
|
1313
|
+
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
1314
|
+
res += ' = ';
|
|
1315
|
+
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
1316
|
+
}
|
|
1317
|
+
return res + ' }';
|
|
1318
|
+
}
|
|
1319
|
+
function stringifyArray(array, depth, numberAsFloat) {
|
|
1320
|
+
if (array.length === 0)
|
|
1321
|
+
return '[]';
|
|
1322
|
+
let res = '[ ';
|
|
1323
|
+
for (let i = 0; i < array.length; i++) {
|
|
1324
|
+
if (i)
|
|
1325
|
+
res += ', ';
|
|
1326
|
+
if (array[i] === null || array[i] === void 0) {
|
|
1327
|
+
throw new TypeError('arrays cannot contain null or undefined values');
|
|
1328
|
+
}
|
|
1329
|
+
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
|
|
1330
|
+
}
|
|
1331
|
+
return res + ' ]';
|
|
1332
|
+
}
|
|
1333
|
+
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
1334
|
+
if (depth === 0) {
|
|
1335
|
+
throw new Error('Could not stringify the object: maximum object depth exceeded');
|
|
1336
|
+
}
|
|
1337
|
+
let res = '';
|
|
1338
|
+
for (let i = 0; i < array.length; i++) {
|
|
1339
|
+
res += `${res && '\n'}[[${key}]]\n`;
|
|
1340
|
+
res += stringifyTable(0, array[i], key, depth, numberAsFloat);
|
|
1341
|
+
}
|
|
1342
|
+
return res;
|
|
1343
|
+
}
|
|
1344
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
1345
|
+
if (depth === 0) {
|
|
1346
|
+
throw new Error('Could not stringify the object: maximum object depth exceeded');
|
|
1347
|
+
}
|
|
1348
|
+
let preamble = '';
|
|
1349
|
+
let tables = '';
|
|
1350
|
+
let keys = Object.keys(obj);
|
|
1351
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1352
|
+
let k = keys[i];
|
|
1353
|
+
if (obj[k] !== null && obj[k] !== void 0) {
|
|
1354
|
+
let type = extendedTypeOf(obj[k]);
|
|
1355
|
+
if (type === 'symbol' || type === 'function') {
|
|
1356
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
1357
|
+
}
|
|
1358
|
+
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
1359
|
+
if (type === 'array' && isArrayOfTables(obj[k])) {
|
|
1360
|
+
tables += (tables && '\n') + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
1361
|
+
}
|
|
1362
|
+
else if (type === 'object') {
|
|
1363
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
1364
|
+
tables += (tables && '\n') + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
preamble += key;
|
|
1368
|
+
preamble += ' = ';
|
|
1369
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
1370
|
+
preamble += '\n';
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
if (tableKey && (preamble || !tables)) // Create table only if necessary
|
|
1375
|
+
preamble = preamble ? `[${tableKey}]\n${preamble}` : `[${tableKey}]`;
|
|
1376
|
+
return preamble && tables
|
|
1377
|
+
? `${preamble}\n${tables}`
|
|
1378
|
+
: preamble || tables;
|
|
1379
|
+
}
|
|
1380
|
+
function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
|
|
1381
|
+
if (extendedTypeOf(obj) !== 'object') {
|
|
1382
|
+
throw new TypeError('stringify can only be called with an object');
|
|
1383
|
+
}
|
|
1384
|
+
let str = stringifyTable(0, obj, '', maxDepth, numbersAsFloat);
|
|
1385
|
+
if (str[str.length - 1] !== '\n')
|
|
1386
|
+
return str + '\n';
|
|
1387
|
+
return str;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
;// ../../node_modules/smol-toml/dist/index.js
|
|
1391
|
+
/*!
|
|
1392
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1393
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1394
|
+
*
|
|
1395
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1396
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1397
|
+
*
|
|
1398
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1399
|
+
* list of conditions and the following disclaimer.
|
|
1400
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1401
|
+
* this list of conditions and the following disclaimer in the
|
|
1402
|
+
* documentation and/or other materials provided with the distribution.
|
|
1403
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1404
|
+
* may be used to endorse or promote products derived from this software without
|
|
1405
|
+
* specific prior written permission.
|
|
1406
|
+
*
|
|
1407
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1408
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1409
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1410
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1411
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1412
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1413
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1414
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1415
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1416
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
/* harmony default export */ const dist = ({ parse: parse_parse, stringify: stringify, TomlDate: TomlDate, TomlError: TomlError });
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
;// ../../packages/core/dist/index.js
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
// src/branded-types.ts
|
|
1430
|
+
function email(value) {
|
|
1431
|
+
return value;
|
|
1432
|
+
}
|
|
1433
|
+
function authCode(value) {
|
|
1434
|
+
return value;
|
|
1435
|
+
}
|
|
1436
|
+
function googleCredential(value) {
|
|
1437
|
+
return value;
|
|
1438
|
+
}
|
|
1439
|
+
function accessToken(value) {
|
|
1440
|
+
return value;
|
|
1441
|
+
}
|
|
1442
|
+
function refreshToken(value) {
|
|
1443
|
+
return value;
|
|
1444
|
+
}
|
|
1445
|
+
function mcpToken(value) {
|
|
1446
|
+
return value;
|
|
1447
|
+
}
|
|
1448
|
+
function cloneToken(value) {
|
|
1449
|
+
return value;
|
|
1450
|
+
}
|
|
1451
|
+
function jobId(value) {
|
|
1452
|
+
return value;
|
|
1453
|
+
}
|
|
1454
|
+
function userDID(value) {
|
|
1455
|
+
return value;
|
|
1456
|
+
}
|
|
1457
|
+
function entityType(value) {
|
|
1458
|
+
return value;
|
|
1459
|
+
}
|
|
1460
|
+
function searchQuery(value) {
|
|
1461
|
+
return value;
|
|
1462
|
+
}
|
|
1463
|
+
function baseUrl(value) {
|
|
1464
|
+
return value;
|
|
1465
|
+
}
|
|
1466
|
+
function resourceUri(uri) {
|
|
1467
|
+
if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
|
|
1468
|
+
throw new TypeError(`Expected ResourceUri, got: ${uri}`);
|
|
1469
|
+
}
|
|
1470
|
+
return uri;
|
|
1471
|
+
}
|
|
1472
|
+
function annotationUri(uri) {
|
|
1473
|
+
if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
|
|
1474
|
+
throw new TypeError(`Expected AnnotationUri, got: ${uri}`);
|
|
1475
|
+
}
|
|
1476
|
+
return uri;
|
|
1477
|
+
}
|
|
1478
|
+
function resourceAnnotationUri(uri) {
|
|
1479
|
+
if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
|
|
1480
|
+
throw new TypeError(`Expected ResourceAnnotationUri, got: ${uri}`);
|
|
1481
|
+
}
|
|
1482
|
+
if (!uri.includes("/resources/") || !uri.includes("/annotations/")) {
|
|
1483
|
+
throw new TypeError(`Expected nested ResourceAnnotationUri format, got: ${uri}`);
|
|
1484
|
+
}
|
|
1485
|
+
return uri;
|
|
1486
|
+
}
|
|
1487
|
+
// src/creation-methods.ts
|
|
1488
|
+
var CREATION_METHODS = {
|
|
1489
|
+
API: "api",
|
|
1490
|
+
UPLOAD: "upload",
|
|
1491
|
+
UI: "ui",
|
|
1492
|
+
REFERENCE: "reference",
|
|
1493
|
+
CLONE: "clone",
|
|
1494
|
+
GENERATED: "generated"
|
|
1495
|
+
};
|
|
1496
|
+
// src/identifiers.ts
|
|
1497
|
+
function isResourceId(value) {
|
|
1498
|
+
return !value.includes("/");
|
|
1499
|
+
}
|
|
1500
|
+
function isAnnotationId(value) {
|
|
1501
|
+
return !value.includes("/");
|
|
1502
|
+
}
|
|
1503
|
+
function resourceId(id) {
|
|
1504
|
+
if (id.includes("/")) {
|
|
1505
|
+
throw new TypeError(`Expected ResourceId, got URI: ${id}`);
|
|
1506
|
+
}
|
|
1507
|
+
return id;
|
|
1508
|
+
}
|
|
1509
|
+
function annotationId(id) {
|
|
1510
|
+
if (id.includes("/")) {
|
|
1511
|
+
throw new TypeError(`Expected AnnotationId, got URI: ${id}`);
|
|
1512
|
+
}
|
|
1513
|
+
return id;
|
|
1514
|
+
}
|
|
1515
|
+
function userId(id) {
|
|
1516
|
+
return id;
|
|
1517
|
+
}
|
|
1518
|
+
// src/events.ts
|
|
1519
|
+
function isResourceEvent(event) {
|
|
1520
|
+
return event && typeof event.id === "string" && typeof event.timestamp === "string" && (event.resourceId === void 0 || typeof event.resourceId === "string") && // resourceId now optional
|
|
1521
|
+
typeof event.type === "string" && event.type.includes(".");
|
|
1522
|
+
}
|
|
1523
|
+
function isSystemEvent(event) {
|
|
1524
|
+
return event.type === "entitytype.added";
|
|
1525
|
+
}
|
|
1526
|
+
function isResourceScopedEvent(event) {
|
|
1527
|
+
return !isSystemEvent(event);
|
|
1528
|
+
}
|
|
1529
|
+
function getEventType(event) {
|
|
1530
|
+
return event.type;
|
|
1531
|
+
}
|
|
1532
|
+
// src/event-utils.ts
|
|
1533
|
+
function getAnnotationUriFromEvent(event) {
|
|
1534
|
+
const eventData = event.event;
|
|
1535
|
+
if (eventData.type === "annotation.added") {
|
|
1536
|
+
return eventData.payload.annotation.id || null;
|
|
1537
|
+
}
|
|
1538
|
+
if (eventData.type === "annotation.removed" || eventData.type === "annotation.body.updated") {
|
|
1539
|
+
if (eventData.payload.annotationId && eventData.resourceId) {
|
|
1540
|
+
try {
|
|
1541
|
+
const resourceUri2 = eventData.resourceId;
|
|
1542
|
+
const baseUrl2 = resourceUri2.substring(0, resourceUri2.lastIndexOf("/resources/"));
|
|
1543
|
+
return `${baseUrl2}/annotations/${eventData.payload.annotationId}`;
|
|
1544
|
+
} catch (e) {
|
|
1545
|
+
return null;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1551
|
+
function isEventRelatedToAnnotation(event, annotationUri2) {
|
|
1552
|
+
const eventAnnotationUri = getAnnotationUriFromEvent(event);
|
|
1553
|
+
return eventAnnotationUri === annotationUri2;
|
|
1554
|
+
}
|
|
1555
|
+
function isResourceEvent2(event) {
|
|
1556
|
+
return event && typeof event.event === "object" && typeof event.event.id === "string" && typeof event.event.timestamp === "string" && typeof event.event.resourceId === "string" && typeof event.event.type === "string" && typeof event.metadata === "object" && typeof event.metadata.sequenceNumber === "number";
|
|
1557
|
+
}
|
|
1558
|
+
var EventBus = class {
|
|
1559
|
+
constructor(){
|
|
1560
|
+
this.subjects = /* @__PURE__ */ new Map();
|
|
1561
|
+
this.isDestroyed = false;
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Get the RxJS Subject for an event
|
|
1565
|
+
*
|
|
1566
|
+
* Returns a typed Subject that can be used with all RxJS operators.
|
|
1567
|
+
* Subjects are created lazily on first access.
|
|
1568
|
+
*
|
|
1569
|
+
* @param eventName - The event name
|
|
1570
|
+
* @returns The RxJS Subject for this event
|
|
1571
|
+
*
|
|
1572
|
+
* @example
|
|
1573
|
+
* ```typescript
|
|
1574
|
+
* // Emit
|
|
1575
|
+
* eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });
|
|
1576
|
+
*
|
|
1577
|
+
* // Subscribe
|
|
1578
|
+
* const sub = eventBus.get('beckon:hover').subscribe(handleHover);
|
|
1579
|
+
*
|
|
1580
|
+
* // With operators
|
|
1581
|
+
* eventBus.get('beckon:hover')
|
|
1582
|
+
* .pipe(debounceTime(100), distinctUntilChanged())
|
|
1583
|
+
* .subscribe(handleHover);
|
|
1584
|
+
* ```
|
|
1585
|
+
*/ get(eventName) {
|
|
1586
|
+
if (this.isDestroyed) {
|
|
1587
|
+
throw new Error(`Cannot access event '${String(eventName)}' on destroyed bus`);
|
|
1588
|
+
}
|
|
1589
|
+
if (!this.subjects.has(eventName)) {
|
|
1590
|
+
this.subjects.set(eventName, new Subject());
|
|
1591
|
+
}
|
|
1592
|
+
return this.subjects.get(eventName);
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Destroy the event bus and complete all subjects
|
|
1596
|
+
*
|
|
1597
|
+
* After calling destroy(), no new events can be emitted or subscribed to.
|
|
1598
|
+
* All active subscriptions will be completed.
|
|
1599
|
+
*/ destroy() {
|
|
1600
|
+
if (this.isDestroyed) {
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
for (const subject of this.subjects.values()){
|
|
1604
|
+
subject.complete();
|
|
1605
|
+
}
|
|
1606
|
+
this.subjects.clear();
|
|
1607
|
+
this.isDestroyed = true;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Check if the event bus has been destroyed
|
|
1611
|
+
*/ get destroyed() {
|
|
1612
|
+
return this.isDestroyed;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Create a resource-scoped event bus
|
|
1616
|
+
*
|
|
1617
|
+
* Events emitted or subscribed through the scoped bus are isolated to that resource.
|
|
1618
|
+
* Internally, events are namespaced but the API remains identical to the parent bus.
|
|
1619
|
+
*
|
|
1620
|
+
* @param resourceId - Resource identifier to scope events to
|
|
1621
|
+
* @returns A scoped event bus for this resource
|
|
1622
|
+
*
|
|
1623
|
+
* @example
|
|
1624
|
+
* ```typescript
|
|
1625
|
+
* const eventBus = new EventBus();
|
|
1626
|
+
* const resource1 = eventBus.scope('resource-1');
|
|
1627
|
+
* const resource2 = eventBus.scope('resource-2');
|
|
1628
|
+
*
|
|
1629
|
+
* // These are isolated - only resource1 subscribers will fire
|
|
1630
|
+
* resource1.get('detection:progress').next({ status: 'started' });
|
|
1631
|
+
* ```
|
|
1632
|
+
*/ scope(resourceId2) {
|
|
1633
|
+
return new ScopedEventBus(this, resourceId2);
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
var ScopedEventBus = class _ScopedEventBus {
|
|
1637
|
+
constructor(parent, scopePrefix){
|
|
1638
|
+
this.parent = parent;
|
|
1639
|
+
this.scopePrefix = scopePrefix;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Get the RxJS Subject for a scoped event
|
|
1643
|
+
*
|
|
1644
|
+
* Returns the same type as the parent bus, but events are isolated to this scope.
|
|
1645
|
+
* Internally uses namespaced keys but preserves type safety.
|
|
1646
|
+
*
|
|
1647
|
+
* @param event - The event name
|
|
1648
|
+
* @returns The RxJS Subject for this scoped event
|
|
1649
|
+
*/ get(event) {
|
|
1650
|
+
const scopedKey = `${this.scopePrefix}:${event}`;
|
|
1651
|
+
const parentSubjects = this.parent.subjects;
|
|
1652
|
+
if (!parentSubjects.has(scopedKey)) {
|
|
1653
|
+
parentSubjects.set(scopedKey, new Subject());
|
|
1654
|
+
}
|
|
1655
|
+
return parentSubjects.get(scopedKey);
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Create a nested scope
|
|
1659
|
+
*
|
|
1660
|
+
* Allows hierarchical scoping like `resource-1:subsystem-a`
|
|
1661
|
+
*
|
|
1662
|
+
* @param subScope - Additional scope level
|
|
1663
|
+
* @returns A nested scoped event bus
|
|
1664
|
+
*/ scope(subScope) {
|
|
1665
|
+
return new _ScopedEventBus(this.parent, `${this.scopePrefix}:${subScope}`);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
function burstBuffer(options) {
|
|
1669
|
+
const { burstWindowMs, maxBatchSize, idleTimeoutMs } = options;
|
|
1670
|
+
return (source)=>new Observable((subscriber)=>{
|
|
1671
|
+
let mode = "passthrough";
|
|
1672
|
+
let buffer = [];
|
|
1673
|
+
let burstTimer = null;
|
|
1674
|
+
let idleTimer = null;
|
|
1675
|
+
function clearBurstTimer() {
|
|
1676
|
+
if (burstTimer !== null) {
|
|
1677
|
+
clearTimeout(burstTimer);
|
|
1678
|
+
burstTimer = null;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
function clearIdleTimer() {
|
|
1682
|
+
if (idleTimer !== null) {
|
|
1683
|
+
clearTimeout(idleTimer);
|
|
1684
|
+
idleTimer = null;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function flush() {
|
|
1688
|
+
if (buffer.length === 0) return;
|
|
1689
|
+
const batch = buffer;
|
|
1690
|
+
buffer = [];
|
|
1691
|
+
subscriber.next(batch);
|
|
1692
|
+
}
|
|
1693
|
+
function startIdleTimer() {
|
|
1694
|
+
clearIdleTimer();
|
|
1695
|
+
idleTimer = setTimeout(()=>{
|
|
1696
|
+
idleTimer = null;
|
|
1697
|
+
mode = "passthrough";
|
|
1698
|
+
}, idleTimeoutMs);
|
|
1699
|
+
}
|
|
1700
|
+
const subscription = source.subscribe({
|
|
1701
|
+
next (value) {
|
|
1702
|
+
clearIdleTimer();
|
|
1703
|
+
if (mode === "passthrough") {
|
|
1704
|
+
subscriber.next(value);
|
|
1705
|
+
mode = "accumulating";
|
|
1706
|
+
burstTimer = setTimeout(()=>{
|
|
1707
|
+
burstTimer = null;
|
|
1708
|
+
flush();
|
|
1709
|
+
startIdleTimer();
|
|
1710
|
+
}, burstWindowMs);
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
buffer.push(value);
|
|
1714
|
+
clearBurstTimer();
|
|
1715
|
+
if (buffer.length >= maxBatchSize) {
|
|
1716
|
+
flush();
|
|
1717
|
+
startIdleTimer();
|
|
1718
|
+
} else {
|
|
1719
|
+
burstTimer = setTimeout(()=>{
|
|
1720
|
+
burstTimer = null;
|
|
1721
|
+
flush();
|
|
1722
|
+
startIdleTimer();
|
|
1723
|
+
}, burstWindowMs);
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
error (err) {
|
|
1727
|
+
clearBurstTimer();
|
|
1728
|
+
clearIdleTimer();
|
|
1729
|
+
flush();
|
|
1730
|
+
subscriber.error(err);
|
|
1731
|
+
},
|
|
1732
|
+
complete () {
|
|
1733
|
+
clearBurstTimer();
|
|
1734
|
+
clearIdleTimer();
|
|
1735
|
+
flush();
|
|
1736
|
+
subscriber.complete();
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
return ()=>{
|
|
1740
|
+
clearBurstTimer();
|
|
1741
|
+
clearIdleTimer();
|
|
1742
|
+
subscription.unsubscribe();
|
|
1743
|
+
};
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
// src/annotation-utils.ts
|
|
1747
|
+
function findBodyItem(body, targetItem) {
|
|
1748
|
+
if (!Array.isArray(body)) {
|
|
1749
|
+
return -1;
|
|
1750
|
+
}
|
|
1751
|
+
for(let i = 0; i < body.length; i++){
|
|
1752
|
+
const item = body[i];
|
|
1753
|
+
if (typeof item === "object" && item !== null && "type" in item && "purpose" in item) {
|
|
1754
|
+
const itemType = item.type;
|
|
1755
|
+
const itemPurpose = item.purpose;
|
|
1756
|
+
if (itemType !== targetItem.type || itemPurpose !== targetItem.purpose) {
|
|
1757
|
+
continue;
|
|
1758
|
+
}
|
|
1759
|
+
if (targetItem.type === "TextualBody" && "value" in item) {
|
|
1760
|
+
const itemValue = item.value;
|
|
1761
|
+
if (itemValue === targetItem.value) {
|
|
1762
|
+
return i;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (targetItem.type === "SpecificResource" && "source" in item) {
|
|
1766
|
+
const itemSource = item.source;
|
|
1767
|
+
if (itemSource === targetItem.source) {
|
|
1768
|
+
return i;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
return -1;
|
|
1774
|
+
}
|
|
1775
|
+
function generateUuid() {
|
|
1776
|
+
return randomBytes(16).toString("hex");
|
|
1777
|
+
}
|
|
1778
|
+
// src/annotation-assembly.ts
|
|
1779
|
+
function getTextPositionSelector(selector) {
|
|
1780
|
+
if (!selector) return null;
|
|
1781
|
+
const selectors = Array.isArray(selector) ? selector : [
|
|
1782
|
+
selector
|
|
1783
|
+
];
|
|
1784
|
+
const found = selectors.find((s)=>s.type === "TextPositionSelector");
|
|
1785
|
+
if (!found) return null;
|
|
1786
|
+
return found.type === "TextPositionSelector" ? found : null;
|
|
1787
|
+
}
|
|
1788
|
+
function getSvgSelector(selector) {
|
|
1789
|
+
if (!selector) return null;
|
|
1790
|
+
const selectors = Array.isArray(selector) ? selector : [
|
|
1791
|
+
selector
|
|
1792
|
+
];
|
|
1793
|
+
const found = selectors.find((s)=>s.type === "SvgSelector");
|
|
1794
|
+
if (!found) return null;
|
|
1795
|
+
return found.type === "SvgSelector" ? found : null;
|
|
1796
|
+
}
|
|
1797
|
+
function getFragmentSelector(selector) {
|
|
1798
|
+
if (!selector) return null;
|
|
1799
|
+
const selectors = Array.isArray(selector) ? selector : [
|
|
1800
|
+
selector
|
|
1801
|
+
];
|
|
1802
|
+
const found = selectors.find((s)=>s.type === "FragmentSelector");
|
|
1803
|
+
if (!found) return null;
|
|
1804
|
+
return found.type === "FragmentSelector" ? found : null;
|
|
1805
|
+
}
|
|
1806
|
+
function validateSvgMarkup(svg) {
|
|
1807
|
+
if (!svg.includes('xmlns="http://www.w3.org/2000/svg"')) {
|
|
1808
|
+
return 'SVG must include xmlns="http://www.w3.org/2000/svg" attribute';
|
|
1809
|
+
}
|
|
1810
|
+
if (!svg.includes("<svg") || !svg.includes("</svg>")) {
|
|
1811
|
+
return "SVG must have opening and closing tags";
|
|
1812
|
+
}
|
|
1813
|
+
const shapeElements = [
|
|
1814
|
+
"rect",
|
|
1815
|
+
"circle",
|
|
1816
|
+
"ellipse",
|
|
1817
|
+
"polygon",
|
|
1818
|
+
"polyline",
|
|
1819
|
+
"path",
|
|
1820
|
+
"line"
|
|
1821
|
+
];
|
|
1822
|
+
const hasShape = shapeElements.some((shape)=>svg.includes(`<${shape}`) || svg.includes(`<${shape} `));
|
|
1823
|
+
if (!hasShape) {
|
|
1824
|
+
return "SVG must contain at least one shape element (rect, circle, ellipse, polygon, polyline, path, or line)";
|
|
1825
|
+
}
|
|
1826
|
+
return null;
|
|
1827
|
+
}
|
|
1828
|
+
function assembleAnnotation(request, creator) {
|
|
1829
|
+
const newAnnotationId = generateUuid();
|
|
1830
|
+
const posSelector = getTextPositionSelector(request.target.selector);
|
|
1831
|
+
const svgSelector = getSvgSelector(request.target.selector);
|
|
1832
|
+
const fragmentSelector = getFragmentSelector(request.target.selector);
|
|
1833
|
+
if (!posSelector && !svgSelector && !fragmentSelector) {
|
|
1834
|
+
throw new Error("Either TextPositionSelector, SvgSelector, or FragmentSelector is required for creating annotations");
|
|
1835
|
+
}
|
|
1836
|
+
if (svgSelector) {
|
|
1837
|
+
const svgError = validateSvgMarkup(svgSelector.value);
|
|
1838
|
+
if (svgError) {
|
|
1839
|
+
throw new Error(`Invalid SVG markup: ${svgError}`);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (!request.motivation) {
|
|
1843
|
+
throw new Error("motivation is required");
|
|
1844
|
+
}
|
|
1845
|
+
const now = /* @__PURE__ */ new Date().toISOString();
|
|
1846
|
+
const annotation = {
|
|
1847
|
+
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1848
|
+
"type": "Annotation",
|
|
1849
|
+
id: newAnnotationId,
|
|
1850
|
+
motivation: request.motivation,
|
|
1851
|
+
target: request.target,
|
|
1852
|
+
body: request.body,
|
|
1853
|
+
creator,
|
|
1854
|
+
created: now,
|
|
1855
|
+
modified: now
|
|
1856
|
+
};
|
|
1857
|
+
const bodyArray = Array.isArray(request.body) ? request.body : request.body ? [
|
|
1858
|
+
request.body
|
|
1859
|
+
] : [];
|
|
1860
|
+
return {
|
|
1861
|
+
annotation,
|
|
1862
|
+
bodyArray
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
function applyBodyOperations(body, operations) {
|
|
1866
|
+
const bodyArray = Array.isArray(body) ? [
|
|
1867
|
+
...body
|
|
1868
|
+
] : [];
|
|
1869
|
+
for (const op of operations){
|
|
1870
|
+
if (op.op === "add") {
|
|
1871
|
+
const exists = bodyArray.some((item)=>JSON.stringify(item) === JSON.stringify(op.item));
|
|
1872
|
+
if (!exists) {
|
|
1873
|
+
bodyArray.push(op.item);
|
|
1874
|
+
}
|
|
1875
|
+
} else if (op.op === "remove") {
|
|
1876
|
+
const index = bodyArray.findIndex((item)=>JSON.stringify(item) === JSON.stringify(op.item));
|
|
1877
|
+
if (index !== -1) {
|
|
1878
|
+
bodyArray.splice(index, 1);
|
|
1879
|
+
}
|
|
1880
|
+
} else if (op.op === "replace") {
|
|
1881
|
+
const index = bodyArray.findIndex((item)=>JSON.stringify(item) === JSON.stringify(op.oldItem));
|
|
1882
|
+
if (index !== -1) {
|
|
1883
|
+
bodyArray[index] = op.newItem;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
return bodyArray;
|
|
1888
|
+
}
|
|
1889
|
+
// src/type-guards.ts
|
|
1890
|
+
function isString(value) {
|
|
1891
|
+
return typeof value === "string";
|
|
1892
|
+
}
|
|
1893
|
+
function isNumber(value) {
|
|
1894
|
+
return typeof value === "number" && !isNaN(value);
|
|
1895
|
+
}
|
|
1896
|
+
function isObject(value) {
|
|
1897
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1898
|
+
}
|
|
1899
|
+
function isArray(value) {
|
|
1900
|
+
return Array.isArray(value);
|
|
1901
|
+
}
|
|
1902
|
+
function isBoolean(value) {
|
|
1903
|
+
return typeof value === "boolean";
|
|
1904
|
+
}
|
|
1905
|
+
function isFunction(value) {
|
|
1906
|
+
return typeof value === "function";
|
|
1907
|
+
}
|
|
1908
|
+
function isNull(value) {
|
|
1909
|
+
return value === null;
|
|
1910
|
+
}
|
|
1911
|
+
function isUndefined(value) {
|
|
1912
|
+
return value === void 0;
|
|
1913
|
+
}
|
|
1914
|
+
function isNullish(value) {
|
|
1915
|
+
return value === null || value === void 0;
|
|
1916
|
+
}
|
|
1917
|
+
function isDefined(value) {
|
|
1918
|
+
return value !== null && value !== void 0;
|
|
1919
|
+
}
|
|
1920
|
+
// src/errors.ts
|
|
1921
|
+
var SemiontError = class extends Error {
|
|
1922
|
+
constructor(message, code, details){
|
|
1923
|
+
super(message);
|
|
1924
|
+
this.code = code;
|
|
1925
|
+
this.details = details;
|
|
1926
|
+
this.name = "SemiontError";
|
|
1927
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
var ValidationError = class extends SemiontError {
|
|
1931
|
+
constructor(message, details){
|
|
1932
|
+
super(message, "VALIDATION_ERROR", details);
|
|
1933
|
+
this.name = "ValidationError";
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
var ScriptError = class extends SemiontError {
|
|
1937
|
+
constructor(message, code = "SCRIPT_ERROR", details){
|
|
1938
|
+
super(message, code, details);
|
|
1939
|
+
this.name = "ScriptError";
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1942
|
+
var NotFoundError = class extends SemiontError {
|
|
1943
|
+
constructor(resource, id){
|
|
1944
|
+
const message = id ? `${resource} with id '${id}' not found` : `${resource} not found`;
|
|
1945
|
+
super(message, "NOT_FOUND", {
|
|
1946
|
+
resource,
|
|
1947
|
+
id
|
|
1948
|
+
});
|
|
1949
|
+
this.name = "NotFoundError";
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
var UnauthorizedError = class extends SemiontError {
|
|
1953
|
+
constructor(message = "Unauthorized", details){
|
|
1954
|
+
super(message, "UNAUTHORIZED", details);
|
|
1955
|
+
this.name = "UnauthorizedError";
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
var ConflictError = class extends SemiontError {
|
|
1959
|
+
constructor(message, details){
|
|
1960
|
+
super(message, "CONFLICT", details);
|
|
1961
|
+
this.name = "ConflictError";
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
var APIError = class extends Error {
|
|
1965
|
+
constructor(status, data, message){
|
|
1966
|
+
super(message || `API Error: ${status}`);
|
|
1967
|
+
this.status = status;
|
|
1968
|
+
this.data = data;
|
|
1969
|
+
this.name = "APIError";
|
|
1970
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
// src/did-utils.ts
|
|
1974
|
+
function userToDid(user) {
|
|
1975
|
+
return `did:web:${user.domain}:users:${user.id}`;
|
|
1976
|
+
}
|
|
1977
|
+
function userToAgent(user) {
|
|
1978
|
+
return {
|
|
1979
|
+
type: "Person",
|
|
1980
|
+
id: userToDid(user),
|
|
1981
|
+
name: user.name || user.email
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
function didToAgent(did) {
|
|
1985
|
+
const parts = did.split(":");
|
|
1986
|
+
const userId2 = parts[parts.length - 1] || "unknown";
|
|
1987
|
+
return {
|
|
1988
|
+
type: "Person",
|
|
1989
|
+
id: did,
|
|
1990
|
+
name: userId2
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
function deepMerge(base, override) {
|
|
1994
|
+
const result = {
|
|
1995
|
+
...base
|
|
1996
|
+
};
|
|
1997
|
+
for (const key of Object.keys(override)){
|
|
1998
|
+
const b = base[key];
|
|
1999
|
+
const o = override[key];
|
|
2000
|
+
if (o !== void 0 && o !== null && typeof o === "object" && !Array.isArray(o) && b !== void 0 && b !== null && typeof b === "object" && !Array.isArray(b)) {
|
|
2001
|
+
result[key] = deepMerge(b, o);
|
|
2002
|
+
} else if (o !== void 0) {
|
|
2003
|
+
result[key] = o;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
return result;
|
|
2007
|
+
}
|
|
2008
|
+
function resolveEnvVars(obj, env) {
|
|
2009
|
+
if (typeof obj === "string") {
|
|
2010
|
+
return obj.replace(/\$\{([^}]+)\}/g, (match, varName)=>{
|
|
2011
|
+
if (env[varName] === void 0) {
|
|
2012
|
+
throw new Error(`Environment variable ${varName} is not set (referenced in config as ${match})`);
|
|
2013
|
+
}
|
|
2014
|
+
return env[varName];
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
if (Array.isArray(obj)) {
|
|
2018
|
+
return obj.map((item)=>resolveEnvVars(item, env));
|
|
2019
|
+
}
|
|
2020
|
+
if (obj !== null && typeof obj === "object") {
|
|
2021
|
+
const resolved = {};
|
|
2022
|
+
for(const key in obj){
|
|
2023
|
+
resolved[key] = resolveEnvVars(obj[key], env);
|
|
2024
|
+
}
|
|
2025
|
+
return resolved;
|
|
2026
|
+
}
|
|
2027
|
+
return obj;
|
|
2028
|
+
}
|
|
2029
|
+
function requirePlatform(value, serviceName) {
|
|
2030
|
+
if (!value) {
|
|
2031
|
+
throw new Error(`platform is required for service '${serviceName}' \u2014 add 'platform = "posix"|"container"|"external"' to its config section`);
|
|
2032
|
+
}
|
|
2033
|
+
return value;
|
|
2034
|
+
}
|
|
2035
|
+
function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env) {
|
|
2036
|
+
const projectConfigContent = reader.readIfExists(`${projectRoot}/.semiont/config`);
|
|
2037
|
+
let projectName = "semiont-project";
|
|
2038
|
+
let projectSite;
|
|
2039
|
+
let projectEnvSection = {};
|
|
2040
|
+
if (projectConfigContent) {
|
|
2041
|
+
const projectConfig = parse(projectConfigContent);
|
|
2042
|
+
projectName = projectConfig.project?.name ?? projectName;
|
|
2043
|
+
projectSite = projectConfig.site;
|
|
2044
|
+
projectEnvSection = projectConfig.environments?.[environment] ?? {};
|
|
2045
|
+
}
|
|
2046
|
+
const globalContent = reader.readIfExists(globalConfigPath);
|
|
2047
|
+
const raw = globalContent ? parse(globalContent) : {};
|
|
2048
|
+
const userEnvSection = raw.environments?.[environment] ?? {};
|
|
2049
|
+
const envSection = deepMerge(projectEnvSection, userEnvSection);
|
|
2050
|
+
const resolved = resolveEnvVars(envSection, env);
|
|
2051
|
+
const flatInference = resolved.inference;
|
|
2052
|
+
const makeMeaningSection = resolved["make-meaning"];
|
|
2053
|
+
const workersSection = resolved.workers ?? {};
|
|
2054
|
+
const actorsSection = resolved.actors ?? {};
|
|
2055
|
+
const defaultWorkerInference = workersSection["default"]?.inference;
|
|
2056
|
+
const defaultMakeMeaningInference = makeMeaningSection?.default?.inference;
|
|
2057
|
+
function mergeWithFlatInference(specific) {
|
|
2058
|
+
if (!flatInference) return specific;
|
|
2059
|
+
return {
|
|
2060
|
+
apiKey: flatInference.apiKey,
|
|
2061
|
+
maxTokens: flatInference.maxTokens,
|
|
2062
|
+
endpoint: flatInference.endpoint,
|
|
2063
|
+
baseURL: flatInference.baseURL,
|
|
2064
|
+
...specific
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
function resolveActorInference(fromMakeMeaning, fromActors) {
|
|
2068
|
+
const base = fromMakeMeaning ?? fromActors ?? defaultMakeMeaningInference;
|
|
2069
|
+
if (!base) return void 0;
|
|
2070
|
+
return mergeWithFlatInference(base);
|
|
2071
|
+
}
|
|
2072
|
+
const actors = {};
|
|
2073
|
+
const gathererInference = resolveActorInference(makeMeaningSection?.actors?.gatherer?.inference, actorsSection["gatherer"]?.inference);
|
|
2074
|
+
if (gathererInference) actors.gatherer = gathererInference;
|
|
2075
|
+
const matcherInference = resolveActorInference(makeMeaningSection?.actors?.matcher?.inference, actorsSection["matcher"]?.inference);
|
|
2076
|
+
if (matcherInference) actors.matcher = matcherInference;
|
|
2077
|
+
const workers = {};
|
|
2078
|
+
const workerTypes = [
|
|
2079
|
+
"reference-annotation",
|
|
2080
|
+
"highlight-annotation",
|
|
2081
|
+
"assessment-annotation",
|
|
2082
|
+
"comment-annotation",
|
|
2083
|
+
"tag-annotation",
|
|
2084
|
+
"generation"
|
|
2085
|
+
];
|
|
2086
|
+
if (defaultWorkerInference) {
|
|
2087
|
+
workers.default = mergeWithFlatInference(defaultWorkerInference);
|
|
2088
|
+
}
|
|
2089
|
+
for (const wt of workerTypes){
|
|
2090
|
+
const specific = workersSection[wt]?.inference;
|
|
2091
|
+
if (specific) {
|
|
2092
|
+
workers[wt] = mergeWithFlatInference(specific);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
const backend = resolved.backend;
|
|
2096
|
+
const site = resolved.site ?? projectSite;
|
|
2097
|
+
const inferenceSection = resolved.inference;
|
|
2098
|
+
let inferenceProviders;
|
|
2099
|
+
if (inferenceSection) {
|
|
2100
|
+
inferenceProviders = {};
|
|
2101
|
+
if (inferenceSection.type === "anthropic") {
|
|
2102
|
+
inferenceProviders.anthropic = {
|
|
2103
|
+
platform: requirePlatform(inferenceSection.platform, "inference"),
|
|
2104
|
+
endpoint: inferenceSection.endpoint ?? "https://api.anthropic.com",
|
|
2105
|
+
apiKey: inferenceSection.apiKey ?? ""
|
|
2106
|
+
};
|
|
2107
|
+
} else if (inferenceSection.type === "ollama") {
|
|
2108
|
+
inferenceProviders.ollama = {
|
|
2109
|
+
platform: {
|
|
2110
|
+
type: requirePlatform(inferenceSection.platform, "inference")
|
|
2111
|
+
},
|
|
2112
|
+
baseURL: inferenceSection.baseURL,
|
|
2113
|
+
port: inferenceSection.baseURL ? void 0 : 11434
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
const topLevelWorkers = {};
|
|
2118
|
+
for (const [name, w] of Object.entries(workersSection)){
|
|
2119
|
+
if (w.inference) {
|
|
2120
|
+
topLevelWorkers[name] = {
|
|
2121
|
+
inference: {
|
|
2122
|
+
type: w.inference.type,
|
|
2123
|
+
model: w.inference.model
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
const topLevelActors = {};
|
|
2129
|
+
for (const [name, a] of Object.entries(actorsSection)){
|
|
2130
|
+
if (a.inference) {
|
|
2131
|
+
topLevelActors[name] = {
|
|
2132
|
+
inference: {
|
|
2133
|
+
type: a.inference.type,
|
|
2134
|
+
model: a.inference.model
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if (makeMeaningSection?.actors?.gatherer?.inference) {
|
|
2140
|
+
topLevelActors["gatherer"] = {
|
|
2141
|
+
inference: {
|
|
2142
|
+
type: makeMeaningSection.actors.gatherer.inference.type,
|
|
2143
|
+
model: makeMeaningSection.actors.gatherer.inference.model
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
if (makeMeaningSection?.actors?.matcher?.inference) {
|
|
2148
|
+
topLevelActors["matcher"] = {
|
|
2149
|
+
inference: {
|
|
2150
|
+
type: makeMeaningSection.actors.matcher.inference.type,
|
|
2151
|
+
model: makeMeaningSection.actors.matcher.inference.model
|
|
2152
|
+
}
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const frontend = resolved.frontend;
|
|
2156
|
+
const proxy = resolved.proxy;
|
|
2157
|
+
const config = {
|
|
2158
|
+
services: {
|
|
2159
|
+
backend: backend ? {
|
|
2160
|
+
platform: {
|
|
2161
|
+
type: requirePlatform(backend.platform, "backend")
|
|
2162
|
+
},
|
|
2163
|
+
port: backend.port ?? 4e3,
|
|
2164
|
+
publicURL: backend.publicURL ?? `http://localhost:${backend.port ?? 4e3}`,
|
|
2165
|
+
corsOrigin: backend.corsOrigin ?? backend.frontendURL ?? "http://localhost:3000"
|
|
2166
|
+
} : void 0,
|
|
2167
|
+
frontend: frontend ? {
|
|
2168
|
+
platform: {
|
|
2169
|
+
type: requirePlatform(frontend.platform, "frontend")
|
|
2170
|
+
},
|
|
2171
|
+
port: frontend.port ?? 3e3,
|
|
2172
|
+
siteName: site?.siteName ?? "Semiont",
|
|
2173
|
+
publicURL: frontend.publicURL
|
|
2174
|
+
} : void 0,
|
|
2175
|
+
proxy: proxy ? {
|
|
2176
|
+
platform: {
|
|
2177
|
+
type: requirePlatform(proxy.platform, "proxy")
|
|
2178
|
+
},
|
|
2179
|
+
type: "envoy",
|
|
2180
|
+
port: proxy.port ?? 8080,
|
|
2181
|
+
adminPort: proxy.adminPort ?? 9901,
|
|
2182
|
+
backendPort: backend?.port ?? 4e3,
|
|
2183
|
+
frontendPort: frontend?.port ?? 3e3
|
|
2184
|
+
} : void 0,
|
|
2185
|
+
graph: resolved.graph ? {
|
|
2186
|
+
...resolved.graph,
|
|
2187
|
+
platform: {
|
|
2188
|
+
type: requirePlatform(resolved.graph.platform, "graph")
|
|
2189
|
+
},
|
|
2190
|
+
type: resolved.graph.type ?? "neo4j"
|
|
2191
|
+
} : makeMeaningSection?.graph,
|
|
2192
|
+
database: resolved.database ? {
|
|
2193
|
+
platform: {
|
|
2194
|
+
type: requirePlatform(resolved.database.platform, "database")
|
|
2195
|
+
},
|
|
2196
|
+
type: "postgres",
|
|
2197
|
+
image: resolved.database.image,
|
|
2198
|
+
host: resolved.database.host ?? "localhost",
|
|
2199
|
+
port: resolved.database.port ?? 5432,
|
|
2200
|
+
name: resolved.database.name,
|
|
2201
|
+
user: resolved.database.user,
|
|
2202
|
+
password: resolved.database.password
|
|
2203
|
+
} : void 0
|
|
2204
|
+
},
|
|
2205
|
+
...inferenceProviders ? {
|
|
2206
|
+
inference: inferenceProviders
|
|
2207
|
+
} : {},
|
|
2208
|
+
...Object.keys(topLevelWorkers).length > 0 ? {
|
|
2209
|
+
workers: topLevelWorkers
|
|
2210
|
+
} : {},
|
|
2211
|
+
...Object.keys(topLevelActors).length > 0 ? {
|
|
2212
|
+
actors: topLevelActors
|
|
2213
|
+
} : {},
|
|
2214
|
+
site: site ? {
|
|
2215
|
+
domain: site.domain ?? "localhost",
|
|
2216
|
+
siteName: site.siteName,
|
|
2217
|
+
adminEmail: site.adminEmail,
|
|
2218
|
+
oauthAllowedDomains: site.oauthAllowedDomains
|
|
2219
|
+
} : void 0,
|
|
2220
|
+
logLevel: resolved.logLevel,
|
|
2221
|
+
_metadata: {
|
|
2222
|
+
environment,
|
|
2223
|
+
projectRoot,
|
|
2224
|
+
projectName,
|
|
2225
|
+
...Object.keys(actors).length > 0 ? {
|
|
2226
|
+
actors
|
|
2227
|
+
} : {},
|
|
2228
|
+
...Object.keys(workers).length > 0 ? {
|
|
2229
|
+
workers
|
|
2230
|
+
} : {}
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
return config;
|
|
2234
|
+
}
|
|
2235
|
+
function createTomlConfigLoader(reader, globalConfigPath, env) {
|
|
2236
|
+
return (projectRoot, environment)=>{
|
|
2237
|
+
return loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env);
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
// src/config/environment-validator.ts
|
|
2241
|
+
function isValidEnvironment(value, availableEnvironments) {
|
|
2242
|
+
if (!value) return false;
|
|
2243
|
+
return availableEnvironments.includes(value);
|
|
2244
|
+
}
|
|
2245
|
+
function parseEnvironment(value, availableEnvironments) {
|
|
2246
|
+
if (!value) {
|
|
2247
|
+
throw new Error("Environment is required");
|
|
2248
|
+
}
|
|
2249
|
+
if (!isValidEnvironment(value, availableEnvironments)) {
|
|
2250
|
+
throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvironments.join(", ")}`);
|
|
2251
|
+
}
|
|
2252
|
+
return value;
|
|
2253
|
+
}
|
|
2254
|
+
function validateEnvironment(value, availableEnvironments) {
|
|
2255
|
+
if (!value) {
|
|
2256
|
+
throw new Error("Environment is required");
|
|
2257
|
+
}
|
|
2258
|
+
if (!isValidEnvironment(value, availableEnvironments)) {
|
|
2259
|
+
throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvironments.join(", ")}`);
|
|
2260
|
+
}
|
|
2261
|
+
return value;
|
|
2262
|
+
}
|
|
2263
|
+
// src/config/configuration-error.ts
|
|
2264
|
+
var ConfigurationError = class extends Error {
|
|
2265
|
+
constructor(message, environment, suggestion, cause){
|
|
2266
|
+
super(message);
|
|
2267
|
+
this.environment = environment;
|
|
2268
|
+
this.suggestion = suggestion;
|
|
2269
|
+
this.name = "ConfigurationError";
|
|
2270
|
+
this.cause = cause;
|
|
2271
|
+
}
|
|
2272
|
+
/**
|
|
2273
|
+
* Format the error nicely for CLI output
|
|
2274
|
+
*/ toString() {
|
|
2275
|
+
let output = `\u274C ${this.message}`;
|
|
2276
|
+
if (this.environment) {
|
|
2277
|
+
output += `
|
|
2278
|
+
Environment: ${this.environment}`;
|
|
2279
|
+
}
|
|
2280
|
+
if (this.suggestion) {
|
|
2281
|
+
output += `
|
|
2282
|
+
\u{1F4A1} Suggestion: ${this.suggestion}`;
|
|
2283
|
+
}
|
|
2284
|
+
return output;
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
// src/config/platform-types.ts
|
|
2288
|
+
function isValidPlatformType(value) {
|
|
2289
|
+
return [
|
|
2290
|
+
"aws",
|
|
2291
|
+
"container",
|
|
2292
|
+
"posix",
|
|
2293
|
+
"external"
|
|
2294
|
+
].includes(value);
|
|
2295
|
+
}
|
|
2296
|
+
function getAllPlatformTypes() {
|
|
2297
|
+
return [
|
|
2298
|
+
"aws",
|
|
2299
|
+
"container",
|
|
2300
|
+
"posix",
|
|
2301
|
+
"external"
|
|
2302
|
+
];
|
|
2303
|
+
}
|
|
2304
|
+
// src/index.ts
|
|
2305
|
+
var CORE_TYPES_VERSION = "0.1.0";
|
|
2306
|
+
var SDK_VERSION = "0.1.0";
|
|
2307
|
+
//# sourceMappingURL=index.js.map
|
|
2308
|
+
//# sourceMappingURL=index.js.map
|
|
2309
|
+
|
|
307
2310
|
// EXTERNAL MODULE: __barrel_optimize__?names=SemiontApiClient!=!../../packages/api-client/dist/index.js
|
|
308
2311
|
var api_client_dist = __webpack_require__(78431);
|
|
309
2312
|
;// ./src/app/api/resources/[id]/route.ts
|
|
@@ -342,7 +2345,7 @@ async function GET(request, { params }) {
|
|
|
342
2345
|
baseUrl: backendUrl
|
|
343
2346
|
});
|
|
344
2347
|
// Get resource representation as stream
|
|
345
|
-
const rId =
|
|
2348
|
+
const rId = resourceId(id);
|
|
346
2349
|
const { stream, contentType } = await client.getResourceRepresentationStream(rId, {
|
|
347
2350
|
accept: acceptHeader,
|
|
348
2351
|
auth: session.backendToken
|
|
@@ -722,6 +2725,13 @@ async function handler(req, res, ctx) {
|
|
|
722
2725
|
//# sourceMappingURL=app-route.js.map
|
|
723
2726
|
|
|
724
2727
|
|
|
2728
|
+
/***/ }),
|
|
2729
|
+
|
|
2730
|
+
/***/ 94735:
|
|
2731
|
+
/***/ ((module) => {
|
|
2732
|
+
|
|
2733
|
+
module.exports = require("events");
|
|
2734
|
+
|
|
725
2735
|
/***/ })
|
|
726
2736
|
|
|
727
2737
|
};
|
|
@@ -731,7 +2741,7 @@ async function handler(req, res, ctx) {
|
|
|
731
2741
|
var __webpack_require__ = require("../../../../webpack-runtime.js");
|
|
732
2742
|
__webpack_require__.C(exports);
|
|
733
2743
|
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
|
734
|
-
var __webpack_exports__ = __webpack_require__.X(0, [8569,
|
|
2744
|
+
var __webpack_exports__ = __webpack_require__.X(0, [8569,5866,5056,7873,3144,730], () => (__webpack_exec__(94251)));
|
|
735
2745
|
module.exports = __webpack_exports__;
|
|
736
2746
|
|
|
737
2747
|
})();
|