@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.
Files changed (117) hide show
  1. package/package.json +1 -1
  2. package/standalone/apps/frontend/.next/BUILD_ID +1 -1
  3. package/standalone/apps/frontend/.next/app-path-routes-manifest.json +2 -2
  4. package/standalone/apps/frontend/.next/build-manifest.json +3 -3
  5. package/standalone/apps/frontend/.next/prerender-manifest.json +3 -3
  6. package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js +1 -1
  7. package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js.nft.json +1 -1
  8. package/standalone/apps/frontend/.next/server/app/[locale]/about/page_client-reference-manifest.js +1 -1
  9. package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js +1 -1
  10. package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js.nft.json +1 -1
  11. package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page_client-reference-manifest.js +1 -1
  12. package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js +1 -1
  13. package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js.nft.json +1 -1
  14. package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page_client-reference-manifest.js +1 -1
  15. package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js +1 -1
  16. package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js.nft.json +1 -1
  17. package/standalone/apps/frontend/.next/server/app/[locale]/admin/page_client-reference-manifest.js +1 -1
  18. package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js +1 -1
  19. package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js.nft.json +1 -1
  20. package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page_client-reference-manifest.js +1 -1
  21. package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js +1 -1
  22. package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js.nft.json +1 -1
  23. package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page_client-reference-manifest.js +1 -1
  24. package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js +100 -100
  25. package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js.nft.json +1 -1
  26. package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page_client-reference-manifest.js +1 -1
  27. package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js +1 -1
  28. package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js.nft.json +1 -1
  29. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js +1 -1
  30. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js.nft.json +1 -1
  31. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page_client-reference-manifest.js +1 -1
  32. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js +1 -1
  33. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js.nft.json +1 -1
  34. package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page_client-reference-manifest.js +1 -1
  35. package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js +1 -1
  36. package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js.nft.json +1 -1
  37. package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page_client-reference-manifest.js +1 -1
  38. package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js +1 -1
  39. package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js.nft.json +1 -1
  40. package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page_client-reference-manifest.js +1 -1
  41. package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js +1 -1
  42. package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js.nft.json +1 -1
  43. package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page_client-reference-manifest.js +1 -1
  44. package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js +1 -1
  45. package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js.nft.json +1 -1
  46. package/standalone/apps/frontend/.next/server/app/[locale]/know/page_client-reference-manifest.js +1 -1
  47. package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js +1 -1
  48. package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js.nft.json +1 -1
  49. package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page_client-reference-manifest.js +1 -1
  50. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js +1 -1
  51. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js.nft.json +1 -1
  52. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page_client-reference-manifest.js +1 -1
  53. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js +1 -1
  54. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js.nft.json +1 -1
  55. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page_client-reference-manifest.js +1 -1
  56. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js +1 -1
  57. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js.nft.json +1 -1
  58. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page_client-reference-manifest.js +1 -1
  59. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js +1 -1
  60. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js.nft.json +1 -1
  61. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page_client-reference-manifest.js +1 -1
  62. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js +1 -1
  63. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js.nft.json +1 -1
  64. package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page_client-reference-manifest.js +1 -1
  65. package/standalone/apps/frontend/.next/server/app/[locale]/page.js +1 -1
  66. package/standalone/apps/frontend/.next/server/app/[locale]/page.js.nft.json +1 -1
  67. package/standalone/apps/frontend/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
  68. package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js +1 -1
  69. package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js.nft.json +1 -1
  70. package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page_client-reference-manifest.js +1 -1
  71. package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js +1 -1
  72. package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js.nft.json +1 -1
  73. package/standalone/apps/frontend/.next/server/app/[locale]/terms/page_client-reference-manifest.js +1 -1
  74. package/standalone/apps/frontend/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  75. package/standalone/apps/frontend/.next/server/app/_global-error.html +1 -1
  76. package/standalone/apps/frontend/.next/server/app/_global-error.rsc +1 -1
  77. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  78. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  79. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  80. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  81. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  82. package/standalone/apps/frontend/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  83. package/standalone/apps/frontend/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  84. package/standalone/apps/frontend/.next/server/app/_not-found.html +1 -1
  85. package/standalone/apps/frontend/.next/server/app/_not-found.rsc +1 -1
  86. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  87. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  88. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  89. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  90. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  91. package/standalone/apps/frontend/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  92. package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js +1 -1
  93. package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  94. package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js +1 -1
  95. package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js.nft.json +1 -1
  96. package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js +1 -1
  97. package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js.nft.json +1 -1
  98. package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js +2022 -12
  99. package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js.nft.json +1 -1
  100. package/standalone/apps/frontend/.next/server/app-paths-manifest.json +2 -2
  101. package/standalone/apps/frontend/.next/server/chunks/3144.js +277 -1835
  102. package/standalone/apps/frontend/.next/server/chunks/{5781.js → 5056.js} +66 -7214
  103. package/standalone/apps/frontend/.next/server/chunks/{4741.js → 5866.js} +1311 -7254
  104. package/standalone/apps/frontend/.next/server/chunks/730.js +2 -2458
  105. package/standalone/apps/frontend/.next/server/middleware-build-manifest.js +1 -1
  106. package/standalone/apps/frontend/.next/server/pages/404.html +1 -1
  107. package/standalone/apps/frontend/.next/server/pages/500.html +1 -1
  108. package/standalone/apps/frontend/.next/server/server-reference-manifest.json +1 -1
  109. package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/compose/{page-94f946fb3aaf0917.js → page-8c09eaae74b2bfd1.js} +1 -1
  110. package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/resource/[id]/{page-a4b644af750844d5.js → page-78dff169b8aa5aff.js} +1 -1
  111. package/standalone/apps/frontend/.next/static/chunks/common-5a07de4e988dc9b9.js +63 -0
  112. package/standalone/apps/frontend/package.json +8 -8
  113. package/standalone/package.json +10 -1
  114. package/standalone/packages/core/package.json +12 -4
  115. package/standalone/apps/frontend/.next/static/chunks/common-42653c14d34c8864.js +0 -69
  116. /package/standalone/apps/frontend/.next/static/{I_XveRdyStDMqYJPcAAy5 → ewuXcO4pOVeGlYuR_3hkh}/_buildManifest.js +0 -0
  117. /package/standalone/apps/frontend/.next/static/{I_XveRdyStDMqYJPcAAy5 → ewuXcO4pOVeGlYuR_3hkh}/_ssgManifest.js +0 -0
@@ -12,8 +12,7 @@ exports.modules = {
12
12
  /* harmony export */ lv: () => (/* binding */ validateData)
13
13
  /* harmony export */ });
14
14
  /* unused harmony exports APIError, EventBusClient, LOCALES, SSEClient, SSE_STREAM_CONNECTED, buildContentCache, createCircleSvg, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findTextWithContext, formatLocaleDisplay, getAllLocaleCodes, getAnnotationExactText, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getExtensionForMimeType, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getMimeCategory, getNodeEncoding, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getTargetSelector, getTargetSource, getTextQuoteSelector, hasTargetSelector, isArchived, isAssessment, isBodyResolved, isComment, isDraft, isHighlight, isImageMimeType, isPdfMimeType, isReference, isResolvedReference, isStubReference, isTag, isTextMimeType, isValidEmail, normalizeCoordinates, normalizeText, parseSvgSelector, scaleSvgToNative, validateAndCorrectOffsets, verifyPosition */
15
- /* harmony import */ var ky__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30766);
16
- /* harmony import */ var _semiont_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74992);
15
+ /* harmony import */ var ky__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30766);
17
16
 
18
17
 
19
18
 
@@ -630,7 +629,7 @@ var SemiontApiClient = class {
630
629
  const { baseUrl, timeout: timeout2 = 3e4, retry = 2, logger } = config;
631
630
  this.logger = logger;
632
631
  this.baseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
633
- this.http = ky__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Ay.create({
632
+ this.http = ky__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Ay.create({
634
633
  timeout: timeout2,
635
634
  retry,
636
635
  hooks: {
@@ -2580,2461 +2579,6 @@ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_re
2580
2579
  Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 54736));
2581
2580
 
2582
2581
 
2583
- /***/ }),
2584
-
2585
- /***/ 74992:
2586
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2587
-
2588
- "use strict";
2589
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2590
- /* harmony export */ a: () => (/* binding */ resourceId)
2591
- /* harmony export */ });
2592
- /* unused harmony exports APIError, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, EventBus, NotFoundError, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, findBodyItem, formatErrors, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getNodeEnvForEnvironment, getSvgSelector, getTextPositionSelector, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent, isResourceId, isResourceScopedEvent, isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, parseAndMergeConfigs, parseEnvironment, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig, validateSvgMarkup */
2593
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55511);
2594
- /* harmony import */ var ajv__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(54780);
2595
- /* harmony import */ var ajv_formats__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66788);
2596
-
2597
-
2598
-
2599
-
2600
- // src/branded-types.ts
2601
- function email(value) {
2602
- return value;
2603
- }
2604
- function authCode(value) {
2605
- return value;
2606
- }
2607
- function googleCredential(value) {
2608
- return value;
2609
- }
2610
- function accessToken(value) {
2611
- return value;
2612
- }
2613
- function refreshToken(value) {
2614
- return value;
2615
- }
2616
- function mcpToken(value) {
2617
- return value;
2618
- }
2619
- function cloneToken(value) {
2620
- return value;
2621
- }
2622
- function jobId(value) {
2623
- return value;
2624
- }
2625
- function userDID(value) {
2626
- return value;
2627
- }
2628
- function entityType(value) {
2629
- return value;
2630
- }
2631
- function searchQuery(value) {
2632
- return value;
2633
- }
2634
- function baseUrl(value) {
2635
- return value;
2636
- }
2637
- function resourceUri(uri) {
2638
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
2639
- throw new TypeError(`Expected ResourceUri, got: ${uri}`);
2640
- }
2641
- return uri;
2642
- }
2643
- function annotationUri(uri) {
2644
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
2645
- throw new TypeError(`Expected AnnotationUri, got: ${uri}`);
2646
- }
2647
- return uri;
2648
- }
2649
- function resourceAnnotationUri(uri) {
2650
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
2651
- throw new TypeError(`Expected ResourceAnnotationUri, got: ${uri}`);
2652
- }
2653
- if (!uri.includes("/resources/") || !uri.includes("/annotations/")) {
2654
- throw new TypeError(`Expected nested ResourceAnnotationUri format, got: ${uri}`);
2655
- }
2656
- return uri;
2657
- }
2658
- // src/creation-methods.ts
2659
- var CREATION_METHODS = {
2660
- API: "api",
2661
- UPLOAD: "upload",
2662
- UI: "ui",
2663
- REFERENCE: "reference",
2664
- CLONE: "clone",
2665
- GENERATED: "generated"
2666
- };
2667
- // src/identifiers.ts
2668
- function isResourceId(value) {
2669
- return !value.includes("/");
2670
- }
2671
- function isAnnotationId(value) {
2672
- return !value.includes("/");
2673
- }
2674
- function resourceId(id) {
2675
- if (id.includes("/")) {
2676
- throw new TypeError(`Expected ResourceId, got URI: ${id}`);
2677
- }
2678
- return id;
2679
- }
2680
- function annotationId(id) {
2681
- if (id.includes("/")) {
2682
- throw new TypeError(`Expected AnnotationId, got URI: ${id}`);
2683
- }
2684
- return id;
2685
- }
2686
- function userId(id) {
2687
- return id;
2688
- }
2689
- // src/events.ts
2690
- function isResourceEvent(event) {
2691
- return event && typeof event.id === "string" && typeof event.timestamp === "string" && (event.resourceId === void 0 || typeof event.resourceId === "string") && // resourceId now optional
2692
- typeof event.type === "string" && event.type.includes(".");
2693
- }
2694
- function isSystemEvent(event) {
2695
- return event.type === "entitytype.added";
2696
- }
2697
- function isResourceScopedEvent(event) {
2698
- return !isSystemEvent(event);
2699
- }
2700
- function getEventType(event) {
2701
- return event.type;
2702
- }
2703
- // src/event-utils.ts
2704
- function getAnnotationUriFromEvent(event) {
2705
- const eventData = event.event;
2706
- if (eventData.type === "annotation.added") {
2707
- return eventData.payload.annotation.id || null;
2708
- }
2709
- if (eventData.type === "annotation.removed" || eventData.type === "annotation.body.updated") {
2710
- if (eventData.payload.annotationId && eventData.resourceId) {
2711
- try {
2712
- const resourceUri2 = eventData.resourceId;
2713
- const baseUrl2 = resourceUri2.substring(0, resourceUri2.lastIndexOf("/resources/"));
2714
- return `${baseUrl2}/annotations/${eventData.payload.annotationId}`;
2715
- } catch (e) {
2716
- return null;
2717
- }
2718
- }
2719
- }
2720
- return null;
2721
- }
2722
- function isEventRelatedToAnnotation(event, annotationUri2) {
2723
- const eventAnnotationUri = getAnnotationUriFromEvent(event);
2724
- return eventAnnotationUri === annotationUri2;
2725
- }
2726
- function isResourceEvent2(event) {
2727
- 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";
2728
- }
2729
- var EventBus = class {
2730
- constructor(){
2731
- this.subjects = /* @__PURE__ */ new Map();
2732
- this.isDestroyed = false;
2733
- }
2734
- /**
2735
- * Get the RxJS Subject for an event
2736
- *
2737
- * Returns a typed Subject that can be used with all RxJS operators.
2738
- * Subjects are created lazily on first access.
2739
- *
2740
- * @param eventName - The event name
2741
- * @returns The RxJS Subject for this event
2742
- *
2743
- * @example
2744
- * ```typescript
2745
- * // Emit
2746
- * eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });
2747
- *
2748
- * // Subscribe
2749
- * const sub = eventBus.get('beckon:hover').subscribe(handleHover);
2750
- *
2751
- * // With operators
2752
- * eventBus.get('beckon:hover')
2753
- * .pipe(debounceTime(100), distinctUntilChanged())
2754
- * .subscribe(handleHover);
2755
- * ```
2756
- */ get(eventName) {
2757
- if (this.isDestroyed) {
2758
- throw new Error(`Cannot access event '${String(eventName)}' on destroyed bus`);
2759
- }
2760
- if (!this.subjects.has(eventName)) {
2761
- this.subjects.set(eventName, new Subject());
2762
- }
2763
- return this.subjects.get(eventName);
2764
- }
2765
- /**
2766
- * Destroy the event bus and complete all subjects
2767
- *
2768
- * After calling destroy(), no new events can be emitted or subscribed to.
2769
- * All active subscriptions will be completed.
2770
- */ destroy() {
2771
- if (this.isDestroyed) {
2772
- return;
2773
- }
2774
- for (const subject of this.subjects.values()){
2775
- subject.complete();
2776
- }
2777
- this.subjects.clear();
2778
- this.isDestroyed = true;
2779
- }
2780
- /**
2781
- * Check if the event bus has been destroyed
2782
- */ get destroyed() {
2783
- return this.isDestroyed;
2784
- }
2785
- /**
2786
- * Create a resource-scoped event bus
2787
- *
2788
- * Events emitted or subscribed through the scoped bus are isolated to that resource.
2789
- * Internally, events are namespaced but the API remains identical to the parent bus.
2790
- *
2791
- * @param resourceId - Resource identifier to scope events to
2792
- * @returns A scoped event bus for this resource
2793
- *
2794
- * @example
2795
- * ```typescript
2796
- * const eventBus = new EventBus();
2797
- * const resource1 = eventBus.scope('resource-1');
2798
- * const resource2 = eventBus.scope('resource-2');
2799
- *
2800
- * // These are isolated - only resource1 subscribers will fire
2801
- * resource1.get('detection:progress').next({ status: 'started' });
2802
- * ```
2803
- */ scope(resourceId2) {
2804
- return new ScopedEventBus(this, resourceId2);
2805
- }
2806
- };
2807
- var ScopedEventBus = class _ScopedEventBus {
2808
- constructor(parent, scopePrefix){
2809
- this.parent = parent;
2810
- this.scopePrefix = scopePrefix;
2811
- }
2812
- /**
2813
- * Get the RxJS Subject for a scoped event
2814
- *
2815
- * Returns the same type as the parent bus, but events are isolated to this scope.
2816
- * Internally uses namespaced keys but preserves type safety.
2817
- *
2818
- * @param event - The event name
2819
- * @returns The RxJS Subject for this scoped event
2820
- */ get(event) {
2821
- const scopedKey = `${this.scopePrefix}:${event}`;
2822
- const parentSubjects = this.parent.subjects;
2823
- if (!parentSubjects.has(scopedKey)) {
2824
- parentSubjects.set(scopedKey, new Subject());
2825
- }
2826
- return parentSubjects.get(scopedKey);
2827
- }
2828
- /**
2829
- * Create a nested scope
2830
- *
2831
- * Allows hierarchical scoping like `resource-1:subsystem-a`
2832
- *
2833
- * @param subScope - Additional scope level
2834
- * @returns A nested scoped event bus
2835
- */ scope(subScope) {
2836
- return new _ScopedEventBus(this.parent, `${this.scopePrefix}:${subScope}`);
2837
- }
2838
- };
2839
- function burstBuffer(options) {
2840
- const { burstWindowMs, maxBatchSize, idleTimeoutMs } = options;
2841
- return (source)=>new Observable((subscriber)=>{
2842
- let mode = "passthrough";
2843
- let buffer = [];
2844
- let burstTimer = null;
2845
- let idleTimer = null;
2846
- function clearBurstTimer() {
2847
- if (burstTimer !== null) {
2848
- clearTimeout(burstTimer);
2849
- burstTimer = null;
2850
- }
2851
- }
2852
- function clearIdleTimer() {
2853
- if (idleTimer !== null) {
2854
- clearTimeout(idleTimer);
2855
- idleTimer = null;
2856
- }
2857
- }
2858
- function flush() {
2859
- if (buffer.length === 0) return;
2860
- const batch = buffer;
2861
- buffer = [];
2862
- subscriber.next(batch);
2863
- }
2864
- function startIdleTimer() {
2865
- clearIdleTimer();
2866
- idleTimer = setTimeout(()=>{
2867
- idleTimer = null;
2868
- mode = "passthrough";
2869
- }, idleTimeoutMs);
2870
- }
2871
- const subscription = source.subscribe({
2872
- next (value) {
2873
- clearIdleTimer();
2874
- if (mode === "passthrough") {
2875
- subscriber.next(value);
2876
- mode = "accumulating";
2877
- burstTimer = setTimeout(()=>{
2878
- burstTimer = null;
2879
- flush();
2880
- startIdleTimer();
2881
- }, burstWindowMs);
2882
- return;
2883
- }
2884
- buffer.push(value);
2885
- clearBurstTimer();
2886
- if (buffer.length >= maxBatchSize) {
2887
- flush();
2888
- startIdleTimer();
2889
- } else {
2890
- burstTimer = setTimeout(()=>{
2891
- burstTimer = null;
2892
- flush();
2893
- startIdleTimer();
2894
- }, burstWindowMs);
2895
- }
2896
- },
2897
- error (err) {
2898
- clearBurstTimer();
2899
- clearIdleTimer();
2900
- flush();
2901
- subscriber.error(err);
2902
- },
2903
- complete () {
2904
- clearBurstTimer();
2905
- clearIdleTimer();
2906
- flush();
2907
- subscriber.complete();
2908
- }
2909
- });
2910
- return ()=>{
2911
- clearBurstTimer();
2912
- clearIdleTimer();
2913
- subscription.unsubscribe();
2914
- };
2915
- });
2916
- }
2917
- // src/annotation-utils.ts
2918
- function findBodyItem(body, targetItem) {
2919
- if (!Array.isArray(body)) {
2920
- return -1;
2921
- }
2922
- for(let i = 0; i < body.length; i++){
2923
- const item = body[i];
2924
- if (typeof item === "object" && item !== null && "type" in item && "purpose" in item) {
2925
- const itemType = item.type;
2926
- const itemPurpose = item.purpose;
2927
- if (itemType !== targetItem.type || itemPurpose !== targetItem.purpose) {
2928
- continue;
2929
- }
2930
- if (targetItem.type === "TextualBody" && "value" in item) {
2931
- const itemValue = item.value;
2932
- if (itemValue === targetItem.value) {
2933
- return i;
2934
- }
2935
- }
2936
- if (targetItem.type === "SpecificResource" && "source" in item) {
2937
- const itemSource = item.source;
2938
- if (itemSource === targetItem.source) {
2939
- return i;
2940
- }
2941
- }
2942
- }
2943
- }
2944
- return -1;
2945
- }
2946
- function generateUuid() {
2947
- return randomBytes(16).toString("hex");
2948
- }
2949
- // src/annotation-assembly.ts
2950
- function getTextPositionSelector(selector) {
2951
- if (!selector) return null;
2952
- const selectors = Array.isArray(selector) ? selector : [
2953
- selector
2954
- ];
2955
- const found = selectors.find((s)=>s.type === "TextPositionSelector");
2956
- if (!found) return null;
2957
- return found.type === "TextPositionSelector" ? found : null;
2958
- }
2959
- function getSvgSelector(selector) {
2960
- if (!selector) return null;
2961
- const selectors = Array.isArray(selector) ? selector : [
2962
- selector
2963
- ];
2964
- const found = selectors.find((s)=>s.type === "SvgSelector");
2965
- if (!found) return null;
2966
- return found.type === "SvgSelector" ? found : null;
2967
- }
2968
- function getFragmentSelector(selector) {
2969
- if (!selector) return null;
2970
- const selectors = Array.isArray(selector) ? selector : [
2971
- selector
2972
- ];
2973
- const found = selectors.find((s)=>s.type === "FragmentSelector");
2974
- if (!found) return null;
2975
- return found.type === "FragmentSelector" ? found : null;
2976
- }
2977
- function validateSvgMarkup(svg) {
2978
- if (!svg.includes('xmlns="http://www.w3.org/2000/svg"')) {
2979
- return 'SVG must include xmlns="http://www.w3.org/2000/svg" attribute';
2980
- }
2981
- if (!svg.includes("<svg") || !svg.includes("</svg>")) {
2982
- return "SVG must have opening and closing tags";
2983
- }
2984
- const shapeElements = [
2985
- "rect",
2986
- "circle",
2987
- "ellipse",
2988
- "polygon",
2989
- "polyline",
2990
- "path",
2991
- "line"
2992
- ];
2993
- const hasShape = shapeElements.some((shape)=>svg.includes(`<${shape}`) || svg.includes(`<${shape} `));
2994
- if (!hasShape) {
2995
- return "SVG must contain at least one shape element (rect, circle, ellipse, polygon, polyline, path, or line)";
2996
- }
2997
- return null;
2998
- }
2999
- function assembleAnnotation(request, creator) {
3000
- const newAnnotationId = generateUuid();
3001
- const posSelector = getTextPositionSelector(request.target.selector);
3002
- const svgSelector = getSvgSelector(request.target.selector);
3003
- const fragmentSelector = getFragmentSelector(request.target.selector);
3004
- if (!posSelector && !svgSelector && !fragmentSelector) {
3005
- throw new Error("Either TextPositionSelector, SvgSelector, or FragmentSelector is required for creating annotations");
3006
- }
3007
- if (svgSelector) {
3008
- const svgError = validateSvgMarkup(svgSelector.value);
3009
- if (svgError) {
3010
- throw new Error(`Invalid SVG markup: ${svgError}`);
3011
- }
3012
- }
3013
- if (!request.motivation) {
3014
- throw new Error("motivation is required");
3015
- }
3016
- const now = /* @__PURE__ */ new Date().toISOString();
3017
- const annotation = {
3018
- "@context": "http://www.w3.org/ns/anno.jsonld",
3019
- "type": "Annotation",
3020
- id: newAnnotationId,
3021
- motivation: request.motivation,
3022
- target: request.target,
3023
- body: request.body,
3024
- creator,
3025
- created: now,
3026
- modified: now
3027
- };
3028
- const bodyArray = Array.isArray(request.body) ? request.body : request.body ? [
3029
- request.body
3030
- ] : [];
3031
- return {
3032
- annotation,
3033
- bodyArray
3034
- };
3035
- }
3036
- function applyBodyOperations(body, operations) {
3037
- const bodyArray = Array.isArray(body) ? [
3038
- ...body
3039
- ] : [];
3040
- for (const op of operations){
3041
- if (op.op === "add") {
3042
- const exists = bodyArray.some((item)=>JSON.stringify(item) === JSON.stringify(op.item));
3043
- if (!exists) {
3044
- bodyArray.push(op.item);
3045
- }
3046
- } else if (op.op === "remove") {
3047
- const index = bodyArray.findIndex((item)=>JSON.stringify(item) === JSON.stringify(op.item));
3048
- if (index !== -1) {
3049
- bodyArray.splice(index, 1);
3050
- }
3051
- } else if (op.op === "replace") {
3052
- const index = bodyArray.findIndex((item)=>JSON.stringify(item) === JSON.stringify(op.oldItem));
3053
- if (index !== -1) {
3054
- bodyArray[index] = op.newItem;
3055
- }
3056
- }
3057
- }
3058
- return bodyArray;
3059
- }
3060
- // src/type-guards.ts
3061
- function isString(value) {
3062
- return typeof value === "string";
3063
- }
3064
- function isNumber(value) {
3065
- return typeof value === "number" && !isNaN(value);
3066
- }
3067
- function isObject(value) {
3068
- return typeof value === "object" && value !== null && !Array.isArray(value);
3069
- }
3070
- function isArray(value) {
3071
- return Array.isArray(value);
3072
- }
3073
- function isBoolean(value) {
3074
- return typeof value === "boolean";
3075
- }
3076
- function isFunction(value) {
3077
- return typeof value === "function";
3078
- }
3079
- function isNull(value) {
3080
- return value === null;
3081
- }
3082
- function isUndefined(value) {
3083
- return value === void 0;
3084
- }
3085
- function isNullish(value) {
3086
- return value === null || value === void 0;
3087
- }
3088
- function isDefined(value) {
3089
- return value !== null && value !== void 0;
3090
- }
3091
- // src/errors.ts
3092
- var SemiontError = class extends Error {
3093
- constructor(message, code, details){
3094
- super(message);
3095
- this.code = code;
3096
- this.details = details;
3097
- this.name = "SemiontError";
3098
- Error.captureStackTrace(this, this.constructor);
3099
- }
3100
- };
3101
- var ValidationError = class extends SemiontError {
3102
- constructor(message, details){
3103
- super(message, "VALIDATION_ERROR", details);
3104
- this.name = "ValidationError";
3105
- }
3106
- };
3107
- var ScriptError = class extends SemiontError {
3108
- constructor(message, code = "SCRIPT_ERROR", details){
3109
- super(message, code, details);
3110
- this.name = "ScriptError";
3111
- }
3112
- };
3113
- var NotFoundError = class extends SemiontError {
3114
- constructor(resource, id){
3115
- const message = id ? `${resource} with id '${id}' not found` : `${resource} not found`;
3116
- super(message, "NOT_FOUND", {
3117
- resource,
3118
- id
3119
- });
3120
- this.name = "NotFoundError";
3121
- }
3122
- };
3123
- var UnauthorizedError = class extends SemiontError {
3124
- constructor(message = "Unauthorized", details){
3125
- super(message, "UNAUTHORIZED", details);
3126
- this.name = "UnauthorizedError";
3127
- }
3128
- };
3129
- var ConflictError = class extends SemiontError {
3130
- constructor(message, details){
3131
- super(message, "CONFLICT", details);
3132
- this.name = "ConflictError";
3133
- }
3134
- };
3135
- var APIError = class extends Error {
3136
- constructor(status, data, message){
3137
- super(message || `API Error: ${status}`);
3138
- this.status = status;
3139
- this.data = data;
3140
- this.name = "APIError";
3141
- Error.captureStackTrace(this, this.constructor);
3142
- }
3143
- };
3144
- // src/did-utils.ts
3145
- function userToDid(user) {
3146
- return `did:web:${user.domain}:users:${user.id}`;
3147
- }
3148
- function userToAgent(user) {
3149
- return {
3150
- type: "Person",
3151
- id: userToDid(user),
3152
- name: user.name || user.email
3153
- };
3154
- }
3155
- function didToAgent(did) {
3156
- const parts = did.split(":");
3157
- const userId2 = parts[parts.length - 1] || "unknown";
3158
- return {
3159
- type: "Person",
3160
- id: did,
3161
- name: userId2
3162
- };
3163
- }
3164
- // src/config/configuration-error.ts
3165
- var ConfigurationError = class extends Error {
3166
- constructor(message, environment, suggestion, cause){
3167
- super(message);
3168
- this.environment = environment;
3169
- this.suggestion = suggestion;
3170
- this.name = "ConfigurationError";
3171
- this.cause = cause;
3172
- }
3173
- /**
3174
- * Format the error nicely for CLI output
3175
- */ toString() {
3176
- let output = `\u274C ${this.message}`;
3177
- if (this.environment) {
3178
- output += `
3179
- Environment: ${this.environment}`;
3180
- }
3181
- if (this.suggestion) {
3182
- output += `
3183
- \u{1F4A1} Suggestion: ${this.suggestion}`;
3184
- }
3185
- return output;
3186
- }
3187
- };
3188
- // src/config/config.schema.json
3189
- var config_schema_default = {
3190
- $schema: "http://json-schema.org/draft-07/schema#",
3191
- $id: "https://semiont.org/schemas/config.json",
3192
- definitions: {
3193
- PlatformType: {
3194
- type: "string",
3195
- enum: [
3196
- "posix",
3197
- "container",
3198
- "aws",
3199
- "external"
3200
- ]
3201
- },
3202
- ServicePlatformConfig: {
3203
- type: "object",
3204
- properties: {
3205
- type: {
3206
- $ref: "#/definitions/PlatformType"
3207
- }
3208
- },
3209
- required: [
3210
- "type"
3211
- ]
3212
- },
3213
- ResourceRequirements: {
3214
- type: "object",
3215
- properties: {
3216
- cpu: {
3217
- type: "string"
3218
- },
3219
- memory: {
3220
- type: "string"
3221
- },
3222
- gpu: {
3223
- type: "integer"
3224
- },
3225
- gpus: {
3226
- type: "integer"
3227
- },
3228
- replicas: {
3229
- type: "integer"
3230
- },
3231
- ephemeralStorage: {
3232
- type: "string"
3233
- },
3234
- memoryReservation: {
3235
- type: "string"
3236
- }
3237
- },
3238
- additionalProperties: false
3239
- },
3240
- SecurityRequirements: {
3241
- type: "object",
3242
- properties: {
3243
- readOnlyRootFilesystem: {
3244
- type: "boolean"
3245
- },
3246
- runAsNonRoot: {
3247
- type: "boolean"
3248
- },
3249
- runAsUser: {
3250
- type: "integer"
3251
- },
3252
- runAsGroup: {
3253
- type: "integer"
3254
- },
3255
- capabilities: {
3256
- oneOf: [
3257
- {
3258
- type: "array",
3259
- items: {
3260
- type: "string"
3261
- }
3262
- },
3263
- {
3264
- type: "object",
3265
- properties: {
3266
- add: {
3267
- type: "array",
3268
- items: {
3269
- type: "string"
3270
- }
3271
- },
3272
- drop: {
3273
- type: "array",
3274
- items: {
3275
- type: "string"
3276
- }
3277
- }
3278
- }
3279
- }
3280
- ]
3281
- },
3282
- privileged: {
3283
- type: "boolean"
3284
- },
3285
- allowPrivilegeEscalation: {
3286
- type: "boolean"
3287
- }
3288
- },
3289
- additionalProperties: false
3290
- },
3291
- BuildRequirements: {
3292
- type: "object",
3293
- properties: {
3294
- dockerfile: {
3295
- type: "string"
3296
- },
3297
- buildContext: {
3298
- type: "string"
3299
- },
3300
- buildArgs: {
3301
- type: "object",
3302
- additionalProperties: {
3303
- type: "string"
3304
- }
3305
- },
3306
- buildTarget: {
3307
- type: "string"
3308
- },
3309
- prebuilt: {
3310
- type: "boolean"
3311
- },
3312
- noCache: {
3313
- type: "boolean"
3314
- }
3315
- },
3316
- additionalProperties: false
3317
- },
3318
- BackendServiceConfig: {
3319
- type: "object",
3320
- properties: {
3321
- platform: {
3322
- $ref: "#/definitions/ServicePlatformConfig"
3323
- },
3324
- devMode: {
3325
- type: "boolean"
3326
- },
3327
- command: {
3328
- type: "string"
3329
- },
3330
- port: {
3331
- type: "integer"
3332
- },
3333
- publicURL: {
3334
- type: "string"
3335
- },
3336
- corsOrigin: {
3337
- type: "string"
3338
- },
3339
- image: {
3340
- type: "string"
3341
- },
3342
- cpu: {
3343
- type: "string"
3344
- },
3345
- memory: {
3346
- type: "string"
3347
- },
3348
- semiontRepo: {
3349
- type: "string"
3350
- },
3351
- databaseUrl: {
3352
- type: "string"
3353
- },
3354
- projectRoot: {
3355
- type: "string"
3356
- },
3357
- timeout: {
3358
- type: "integer"
3359
- },
3360
- wait: {
3361
- type: "integer"
3362
- },
3363
- logsEndpoint: {
3364
- type: "string"
3365
- },
3366
- tag: {
3367
- type: "string"
3368
- },
3369
- resources: {
3370
- $ref: "#/definitions/ResourceRequirements"
3371
- },
3372
- security: {
3373
- $ref: "#/definitions/SecurityRequirements"
3374
- },
3375
- build: {
3376
- oneOf: [
3377
- {
3378
- type: "boolean"
3379
- },
3380
- {
3381
- $ref: "#/definitions/BuildRequirements"
3382
- }
3383
- ]
3384
- },
3385
- dockerfile: {
3386
- type: "string"
3387
- },
3388
- buildContext: {
3389
- type: "string"
3390
- },
3391
- buildArgs: {
3392
- type: "object",
3393
- additionalProperties: {
3394
- type: "string"
3395
- }
3396
- },
3397
- buildTarget: {
3398
- type: "string"
3399
- },
3400
- prebuilt: {
3401
- type: "boolean"
3402
- },
3403
- noCache: {
3404
- type: "boolean"
3405
- },
3406
- secrets: {
3407
- type: "array",
3408
- items: {
3409
- type: "string"
3410
- }
3411
- },
3412
- labels: {
3413
- type: "object",
3414
- additionalProperties: {
3415
- type: "string"
3416
- }
3417
- },
3418
- annotations: {
3419
- type: "object",
3420
- additionalProperties: {
3421
- type: "string"
3422
- }
3423
- },
3424
- dependencies: {
3425
- type: "array",
3426
- items: {
3427
- type: "string"
3428
- }
3429
- },
3430
- externalDependencies: {
3431
- type: "array",
3432
- items: {
3433
- oneOf: [
3434
- {
3435
- type: "string"
3436
- },
3437
- {
3438
- type: "object",
3439
- properties: {
3440
- name: {
3441
- type: "string"
3442
- },
3443
- url: {
3444
- type: "string"
3445
- },
3446
- required: {
3447
- type: "boolean"
3448
- },
3449
- healthCheck: {
3450
- type: "string"
3451
- }
3452
- }
3453
- }
3454
- ]
3455
- }
3456
- },
3457
- redisUrl: {
3458
- type: "string"
3459
- },
3460
- environment: {
3461
- type: "object",
3462
- additionalProperties: {
3463
- type: "string"
3464
- }
3465
- },
3466
- env: {
3467
- type: "object",
3468
- additionalProperties: {
3469
- type: "string"
3470
- }
3471
- }
3472
- },
3473
- required: [
3474
- "platform",
3475
- "port",
3476
- "publicURL",
3477
- "corsOrigin"
3478
- ],
3479
- additionalProperties: false
3480
- },
3481
- FrontendServiceConfig: {
3482
- type: "object",
3483
- properties: {
3484
- platform: {
3485
- $ref: "#/definitions/ServicePlatformConfig"
3486
- },
3487
- devMode: {
3488
- type: "boolean"
3489
- },
3490
- command: {
3491
- type: "string"
3492
- },
3493
- port: {
3494
- type: "integer"
3495
- },
3496
- siteName: {
3497
- type: "string"
3498
- },
3499
- image: {
3500
- type: "string"
3501
- },
3502
- semiontRepo: {
3503
- type: "string"
3504
- },
3505
- projectRoot: {
3506
- type: "string"
3507
- },
3508
- databaseUrl: {
3509
- type: "string"
3510
- },
3511
- timeout: {
3512
- type: "integer"
3513
- },
3514
- wait: {
3515
- type: "integer"
3516
- },
3517
- logsEndpoint: {
3518
- type: "string"
3519
- },
3520
- tag: {
3521
- type: "string"
3522
- },
3523
- resources: {
3524
- $ref: "#/definitions/ResourceRequirements"
3525
- },
3526
- security: {
3527
- $ref: "#/definitions/SecurityRequirements"
3528
- },
3529
- build: {
3530
- oneOf: [
3531
- {
3532
- type: "boolean"
3533
- },
3534
- {
3535
- $ref: "#/definitions/BuildRequirements"
3536
- }
3537
- ]
3538
- },
3539
- dockerfile: {
3540
- type: "string"
3541
- },
3542
- buildContext: {
3543
- type: "string"
3544
- },
3545
- buildArgs: {
3546
- type: "object",
3547
- additionalProperties: {
3548
- type: "string"
3549
- }
3550
- },
3551
- buildTarget: {
3552
- type: "string"
3553
- },
3554
- prebuilt: {
3555
- type: "boolean"
3556
- },
3557
- noCache: {
3558
- type: "boolean"
3559
- },
3560
- secrets: {
3561
- type: "array",
3562
- items: {
3563
- type: "string"
3564
- }
3565
- },
3566
- labels: {
3567
- type: "object",
3568
- additionalProperties: {
3569
- type: "string"
3570
- }
3571
- },
3572
- annotations: {
3573
- type: "object",
3574
- additionalProperties: {
3575
- type: "string"
3576
- }
3577
- },
3578
- dependencies: {
3579
- type: "array",
3580
- items: {
3581
- type: "string"
3582
- }
3583
- },
3584
- externalDependencies: {
3585
- type: "array",
3586
- items: {
3587
- oneOf: [
3588
- {
3589
- type: "string"
3590
- },
3591
- {
3592
- type: "object",
3593
- properties: {
3594
- name: {
3595
- type: "string"
3596
- },
3597
- url: {
3598
- type: "string"
3599
- },
3600
- required: {
3601
- type: "boolean"
3602
- },
3603
- healthCheck: {
3604
- type: "string"
3605
- }
3606
- }
3607
- }
3608
- ]
3609
- }
3610
- },
3611
- environment: {
3612
- type: "object",
3613
- additionalProperties: {
3614
- type: "string"
3615
- }
3616
- },
3617
- env: {
3618
- type: "object",
3619
- additionalProperties: {
3620
- type: "string"
3621
- }
3622
- },
3623
- publicURL: {
3624
- type: "string"
3625
- },
3626
- allowedOrigins: {
3627
- type: "array",
3628
- items: {
3629
- type: "string"
3630
- }
3631
- }
3632
- },
3633
- required: [
3634
- "platform",
3635
- "port",
3636
- "siteName"
3637
- ],
3638
- additionalProperties: false
3639
- },
3640
- ProxyServiceConfig: {
3641
- type: "object",
3642
- properties: {
3643
- platform: {
3644
- $ref: "#/definitions/ServicePlatformConfig"
3645
- },
3646
- type: {
3647
- type: "string",
3648
- enum: [
3649
- "envoy",
3650
- "nginx",
3651
- "haproxy"
3652
- ],
3653
- default: "envoy"
3654
- },
3655
- port: {
3656
- type: "integer",
3657
- default: 8080
3658
- },
3659
- adminPort: {
3660
- type: "integer",
3661
- default: 9901
3662
- },
3663
- backendPort: {
3664
- type: "integer",
3665
- default: 4e3
3666
- },
3667
- frontendPort: {
3668
- type: "integer",
3669
- default: 3e3
3670
- },
3671
- image: {
3672
- type: "string",
3673
- default: "envoyproxy/envoy:v1.28-latest"
3674
- },
3675
- configPath: {
3676
- type: "string"
3677
- },
3678
- timeout: {
3679
- type: "integer"
3680
- },
3681
- wait: {
3682
- type: "integer"
3683
- },
3684
- logsEndpoint: {
3685
- type: "string"
3686
- },
3687
- tag: {
3688
- type: "string"
3689
- },
3690
- resources: {
3691
- $ref: "#/definitions/ResourceRequirements"
3692
- },
3693
- security: {
3694
- $ref: "#/definitions/SecurityRequirements"
3695
- },
3696
- environment: {
3697
- type: "object",
3698
- additionalProperties: {
3699
- type: "string"
3700
- }
3701
- },
3702
- env: {
3703
- type: "object",
3704
- additionalProperties: {
3705
- type: "string"
3706
- }
3707
- }
3708
- },
3709
- required: [
3710
- "platform",
3711
- "type",
3712
- "port"
3713
- ],
3714
- additionalProperties: false
3715
- },
3716
- DatabaseServiceConfig: {
3717
- type: "object",
3718
- properties: {
3719
- platform: {
3720
- $ref: "#/definitions/ServicePlatformConfig"
3721
- },
3722
- type: {
3723
- type: "string"
3724
- },
3725
- name: {
3726
- type: "string"
3727
- },
3728
- host: {
3729
- type: "string"
3730
- },
3731
- port: {
3732
- type: "integer"
3733
- },
3734
- environment: {
3735
- type: "object",
3736
- additionalProperties: {
3737
- type: "string"
3738
- }
3739
- },
3740
- env: {
3741
- type: "object",
3742
- additionalProperties: {
3743
- type: "string"
3744
- }
3745
- },
3746
- description: {
3747
- type: "string"
3748
- },
3749
- command: {
3750
- type: "string"
3751
- },
3752
- image: {
3753
- type: "string"
3754
- },
3755
- user: {
3756
- type: "string"
3757
- },
3758
- username: {
3759
- type: "string"
3760
- },
3761
- password: {
3762
- type: "string"
3763
- },
3764
- database: {
3765
- type: "string"
3766
- },
3767
- storageSize: {
3768
- type: "string"
3769
- },
3770
- timeout: {
3771
- type: "integer"
3772
- },
3773
- wait: {
3774
- type: "integer"
3775
- },
3776
- logsEndpoint: {
3777
- type: "string"
3778
- },
3779
- tag: {
3780
- type: "string"
3781
- },
3782
- resources: {
3783
- $ref: "#/definitions/ResourceRequirements"
3784
- },
3785
- security: {
3786
- $ref: "#/definitions/SecurityRequirements"
3787
- },
3788
- build: {
3789
- oneOf: [
3790
- {
3791
- type: "boolean"
3792
- },
3793
- {
3794
- $ref: "#/definitions/BuildRequirements"
3795
- }
3796
- ]
3797
- },
3798
- dockerfile: {
3799
- type: "string"
3800
- },
3801
- buildContext: {
3802
- type: "string"
3803
- },
3804
- buildArgs: {
3805
- type: "object",
3806
- additionalProperties: {
3807
- type: "string"
3808
- }
3809
- },
3810
- buildTarget: {
3811
- type: "string"
3812
- },
3813
- prebuilt: {
3814
- type: "boolean"
3815
- },
3816
- noCache: {
3817
- type: "boolean"
3818
- },
3819
- secrets: {
3820
- type: "array",
3821
- items: {
3822
- type: "string"
3823
- }
3824
- },
3825
- labels: {
3826
- type: "object",
3827
- additionalProperties: {
3828
- type: "string"
3829
- }
3830
- },
3831
- annotations: {
3832
- type: "object",
3833
- additionalProperties: {
3834
- type: "string"
3835
- }
3836
- },
3837
- dependencies: {
3838
- type: "array",
3839
- items: {
3840
- type: "string"
3841
- }
3842
- },
3843
- externalDependencies: {
3844
- type: "array",
3845
- items: {
3846
- oneOf: [
3847
- {
3848
- type: "string"
3849
- },
3850
- {
3851
- type: "object",
3852
- properties: {
3853
- name: {
3854
- type: "string"
3855
- },
3856
- url: {
3857
- type: "string"
3858
- },
3859
- required: {
3860
- type: "boolean"
3861
- },
3862
- healthCheck: {
3863
- type: "string"
3864
- }
3865
- }
3866
- }
3867
- ]
3868
- }
3869
- }
3870
- },
3871
- required: [
3872
- "platform",
3873
- "type",
3874
- "host",
3875
- "port"
3876
- ],
3877
- additionalProperties: false
3878
- },
3879
- GraphDatabaseType: {
3880
- type: "string",
3881
- enum: [
3882
- "neo4j",
3883
- "janusgraph",
3884
- "neptune",
3885
- "memory"
3886
- ]
3887
- },
3888
- GraphServiceConfig: {
3889
- type: "object",
3890
- properties: {
3891
- platform: {
3892
- $ref: "#/definitions/ServicePlatformConfig"
3893
- },
3894
- type: {
3895
- $ref: "#/definitions/GraphDatabaseType"
3896
- },
3897
- name: {
3898
- type: "string"
3899
- },
3900
- uri: {
3901
- type: "string"
3902
- },
3903
- url: {
3904
- type: "string"
3905
- },
3906
- username: {
3907
- type: "string"
3908
- },
3909
- password: {
3910
- type: "string"
3911
- },
3912
- database: {
3913
- type: "string"
3914
- },
3915
- host: {
3916
- type: "string"
3917
- },
3918
- port: {
3919
- type: "integer"
3920
- },
3921
- storage: {
3922
- type: "string"
3923
- },
3924
- index: {
3925
- type: "string"
3926
- },
3927
- endpoint: {
3928
- type: "string"
3929
- },
3930
- region: {
3931
- type: "string"
3932
- },
3933
- command: {
3934
- type: "string"
3935
- },
3936
- image: {
3937
- type: "string"
3938
- },
3939
- janusgraphVersion: {
3940
- type: "string"
3941
- },
3942
- javaOptions: {
3943
- type: "string"
3944
- },
3945
- heapSize: {
3946
- type: "string"
3947
- },
3948
- pageCacheSize: {
3949
- type: "string"
3950
- },
3951
- noAuth: {
3952
- type: "boolean"
3953
- },
3954
- dataPath: {
3955
- type: "string"
3956
- },
3957
- timeout: {
3958
- type: "integer"
3959
- },
3960
- wait: {
3961
- type: "integer"
3962
- },
3963
- logsEndpoint: {
3964
- type: "string"
3965
- },
3966
- tag: {
3967
- type: "string"
3968
- },
3969
- resources: {
3970
- $ref: "#/definitions/ResourceRequirements"
3971
- },
3972
- security: {
3973
- $ref: "#/definitions/SecurityRequirements"
3974
- },
3975
- build: {
3976
- oneOf: [
3977
- {
3978
- type: "boolean"
3979
- },
3980
- {
3981
- $ref: "#/definitions/BuildRequirements"
3982
- }
3983
- ]
3984
- },
3985
- dockerfile: {
3986
- type: "string"
3987
- },
3988
- buildContext: {
3989
- type: "string"
3990
- },
3991
- buildArgs: {
3992
- type: "object",
3993
- additionalProperties: {
3994
- type: "string"
3995
- }
3996
- },
3997
- buildTarget: {
3998
- type: "string"
3999
- },
4000
- prebuilt: {
4001
- type: "boolean"
4002
- },
4003
- noCache: {
4004
- type: "boolean"
4005
- },
4006
- secrets: {
4007
- type: "array",
4008
- items: {
4009
- type: "string"
4010
- }
4011
- },
4012
- labels: {
4013
- type: "object",
4014
- additionalProperties: {
4015
- type: "string"
4016
- }
4017
- },
4018
- annotations: {
4019
- type: "object",
4020
- additionalProperties: {
4021
- type: "string"
4022
- }
4023
- },
4024
- dependencies: {
4025
- type: "array",
4026
- items: {
4027
- type: "string"
4028
- }
4029
- },
4030
- externalDependencies: {
4031
- type: "array",
4032
- items: {
4033
- oneOf: [
4034
- {
4035
- type: "string"
4036
- },
4037
- {
4038
- type: "object",
4039
- properties: {
4040
- name: {
4041
- type: "string"
4042
- },
4043
- url: {
4044
- type: "string"
4045
- },
4046
- required: {
4047
- type: "boolean"
4048
- },
4049
- healthCheck: {
4050
- type: "string"
4051
- }
4052
- }
4053
- }
4054
- ]
4055
- }
4056
- },
4057
- environment: {
4058
- type: "object",
4059
- additionalProperties: {
4060
- type: "string"
4061
- }
4062
- },
4063
- env: {
4064
- type: "object",
4065
- additionalProperties: {
4066
- type: "string"
4067
- }
4068
- }
4069
- },
4070
- required: [
4071
- "platform",
4072
- "type"
4073
- ],
4074
- allOf: [
4075
- {
4076
- if: {
4077
- properties: {
4078
- type: {
4079
- const: "neo4j"
4080
- }
4081
- }
4082
- },
4083
- then: {
4084
- required: [
4085
- "uri",
4086
- "username",
4087
- "password",
4088
- "database"
4089
- ]
4090
- }
4091
- }
4092
- ],
4093
- additionalProperties: false
4094
- },
4095
- FilesystemServiceConfig: {
4096
- type: "object",
4097
- properties: {
4098
- platform: {
4099
- $ref: "#/definitions/ServicePlatformConfig"
4100
- },
4101
- path: {
4102
- type: "string"
4103
- },
4104
- description: {
4105
- type: "string"
4106
- },
4107
- command: {
4108
- type: "string"
4109
- },
4110
- image: {
4111
- type: "string"
4112
- },
4113
- port: {
4114
- type: "integer"
4115
- },
4116
- timeout: {
4117
- type: "integer"
4118
- },
4119
- wait: {
4120
- type: "integer"
4121
- },
4122
- logsEndpoint: {
4123
- type: "string"
4124
- },
4125
- tag: {
4126
- type: "string"
4127
- },
4128
- resources: {
4129
- $ref: "#/definitions/ResourceRequirements"
4130
- },
4131
- security: {
4132
- $ref: "#/definitions/SecurityRequirements"
4133
- },
4134
- build: {
4135
- oneOf: [
4136
- {
4137
- type: "boolean"
4138
- },
4139
- {
4140
- $ref: "#/definitions/BuildRequirements"
4141
- }
4142
- ]
4143
- },
4144
- dockerfile: {
4145
- type: "string"
4146
- },
4147
- buildContext: {
4148
- type: "string"
4149
- },
4150
- buildArgs: {
4151
- type: "object",
4152
- additionalProperties: {
4153
- type: "string"
4154
- }
4155
- },
4156
- buildTarget: {
4157
- type: "string"
4158
- },
4159
- prebuilt: {
4160
- type: "boolean"
4161
- },
4162
- noCache: {
4163
- type: "boolean"
4164
- },
4165
- secrets: {
4166
- type: "array",
4167
- items: {
4168
- type: "string"
4169
- }
4170
- },
4171
- labels: {
4172
- type: "object",
4173
- additionalProperties: {
4174
- type: "string"
4175
- }
4176
- },
4177
- annotations: {
4178
- type: "object",
4179
- additionalProperties: {
4180
- type: "string"
4181
- }
4182
- },
4183
- dependencies: {
4184
- type: "array",
4185
- items: {
4186
- type: "string"
4187
- }
4188
- },
4189
- externalDependencies: {
4190
- type: "array",
4191
- items: {
4192
- oneOf: [
4193
- {
4194
- type: "string"
4195
- },
4196
- {
4197
- type: "object",
4198
- properties: {
4199
- name: {
4200
- type: "string"
4201
- },
4202
- url: {
4203
- type: "string"
4204
- },
4205
- required: {
4206
- type: "boolean"
4207
- },
4208
- healthCheck: {
4209
- type: "string"
4210
- }
4211
- }
4212
- }
4213
- ]
4214
- }
4215
- },
4216
- environment: {
4217
- type: "object",
4218
- additionalProperties: {
4219
- type: "string"
4220
- }
4221
- },
4222
- env: {
4223
- type: "object",
4224
- additionalProperties: {
4225
- type: "string"
4226
- }
4227
- }
4228
- },
4229
- required: [
4230
- "platform",
4231
- "path"
4232
- ],
4233
- additionalProperties: false
4234
- },
4235
- InferenceServiceConfig: {
4236
- type: "object",
4237
- properties: {
4238
- platform: {
4239
- $ref: "#/definitions/ServicePlatformConfig"
4240
- },
4241
- type: {
4242
- type: "string"
4243
- },
4244
- model: {
4245
- type: "string"
4246
- },
4247
- maxTokens: {
4248
- type: "integer"
4249
- },
4250
- endpoint: {
4251
- type: "string"
4252
- },
4253
- baseURL: {
4254
- type: "string"
4255
- },
4256
- apiKey: {
4257
- type: "string"
4258
- },
4259
- command: {
4260
- type: "string"
4261
- },
4262
- image: {
4263
- type: "string"
4264
- },
4265
- port: {
4266
- type: "integer"
4267
- },
4268
- organization: {
4269
- type: "string"
4270
- },
4271
- timeout: {
4272
- type: "integer"
4273
- },
4274
- wait: {
4275
- type: "integer"
4276
- },
4277
- logsEndpoint: {
4278
- type: "string"
4279
- },
4280
- tag: {
4281
- type: "string"
4282
- },
4283
- resources: {
4284
- $ref: "#/definitions/ResourceRequirements"
4285
- },
4286
- security: {
4287
- $ref: "#/definitions/SecurityRequirements"
4288
- },
4289
- build: {
4290
- oneOf: [
4291
- {
4292
- type: "boolean"
4293
- },
4294
- {
4295
- $ref: "#/definitions/BuildRequirements"
4296
- }
4297
- ]
4298
- },
4299
- dockerfile: {
4300
- type: "string"
4301
- },
4302
- buildContext: {
4303
- type: "string"
4304
- },
4305
- buildArgs: {
4306
- type: "object",
4307
- additionalProperties: {
4308
- type: "string"
4309
- }
4310
- },
4311
- buildTarget: {
4312
- type: "string"
4313
- },
4314
- prebuilt: {
4315
- type: "boolean"
4316
- },
4317
- noCache: {
4318
- type: "boolean"
4319
- },
4320
- secrets: {
4321
- type: "array",
4322
- items: {
4323
- type: "string"
4324
- }
4325
- },
4326
- labels: {
4327
- type: "object",
4328
- additionalProperties: {
4329
- type: "string"
4330
- }
4331
- },
4332
- annotations: {
4333
- type: "object",
4334
- additionalProperties: {
4335
- type: "string"
4336
- }
4337
- },
4338
- dependencies: {
4339
- type: "array",
4340
- items: {
4341
- type: "string"
4342
- }
4343
- },
4344
- externalDependencies: {
4345
- type: "array",
4346
- items: {
4347
- oneOf: [
4348
- {
4349
- type: "string"
4350
- },
4351
- {
4352
- type: "object",
4353
- properties: {
4354
- name: {
4355
- type: "string"
4356
- },
4357
- url: {
4358
- type: "string"
4359
- },
4360
- required: {
4361
- type: "boolean"
4362
- },
4363
- healthCheck: {
4364
- type: "string"
4365
- }
4366
- }
4367
- }
4368
- ]
4369
- }
4370
- },
4371
- environment: {
4372
- type: "object",
4373
- additionalProperties: {
4374
- type: "string"
4375
- }
4376
- },
4377
- env: {
4378
- type: "object",
4379
- additionalProperties: {
4380
- type: "string"
4381
- }
4382
- }
4383
- },
4384
- required: [
4385
- "platform",
4386
- "type",
4387
- "apiKey"
4388
- ],
4389
- additionalProperties: false
4390
- },
4391
- McpServiceConfig: {
4392
- type: "object",
4393
- properties: {
4394
- platform: {
4395
- $ref: "#/definitions/ServicePlatformConfig"
4396
- },
4397
- command: {
4398
- type: "string"
4399
- },
4400
- image: {
4401
- type: "string"
4402
- },
4403
- port: {
4404
- type: "integer"
4405
- },
4406
- dependsOn: {
4407
- type: "array",
4408
- items: {
4409
- type: "string"
4410
- }
4411
- },
4412
- timeout: {
4413
- type: "integer"
4414
- },
4415
- wait: {
4416
- type: "integer"
4417
- },
4418
- logsEndpoint: {
4419
- type: "string"
4420
- },
4421
- tag: {
4422
- type: "string"
4423
- },
4424
- resources: {
4425
- $ref: "#/definitions/ResourceRequirements"
4426
- },
4427
- security: {
4428
- $ref: "#/definitions/SecurityRequirements"
4429
- },
4430
- build: {
4431
- oneOf: [
4432
- {
4433
- type: "boolean"
4434
- },
4435
- {
4436
- $ref: "#/definitions/BuildRequirements"
4437
- }
4438
- ]
4439
- },
4440
- dockerfile: {
4441
- type: "string"
4442
- },
4443
- buildContext: {
4444
- type: "string"
4445
- },
4446
- buildArgs: {
4447
- type: "object",
4448
- additionalProperties: {
4449
- type: "string"
4450
- }
4451
- },
4452
- buildTarget: {
4453
- type: "string"
4454
- },
4455
- prebuilt: {
4456
- type: "boolean"
4457
- },
4458
- noCache: {
4459
- type: "boolean"
4460
- },
4461
- secrets: {
4462
- type: "array",
4463
- items: {
4464
- type: "string"
4465
- }
4466
- },
4467
- labels: {
4468
- type: "object",
4469
- additionalProperties: {
4470
- type: "string"
4471
- }
4472
- },
4473
- annotations: {
4474
- type: "object",
4475
- additionalProperties: {
4476
- type: "string"
4477
- }
4478
- },
4479
- dependencies: {
4480
- type: "array",
4481
- items: {
4482
- type: "string"
4483
- }
4484
- },
4485
- externalDependencies: {
4486
- type: "array",
4487
- items: {
4488
- oneOf: [
4489
- {
4490
- type: "string"
4491
- },
4492
- {
4493
- type: "object",
4494
- properties: {
4495
- name: {
4496
- type: "string"
4497
- },
4498
- url: {
4499
- type: "string"
4500
- },
4501
- required: {
4502
- type: "boolean"
4503
- },
4504
- healthCheck: {
4505
- type: "string"
4506
- }
4507
- }
4508
- }
4509
- ]
4510
- }
4511
- },
4512
- environment: {
4513
- type: "object",
4514
- additionalProperties: {
4515
- type: "string"
4516
- }
4517
- },
4518
- env: {
4519
- type: "object",
4520
- additionalProperties: {
4521
- type: "string"
4522
- }
4523
- }
4524
- },
4525
- required: [
4526
- "platform"
4527
- ],
4528
- additionalProperties: false
4529
- },
4530
- ServicesConfig: {
4531
- type: "object",
4532
- properties: {
4533
- backend: {
4534
- $ref: "#/definitions/BackendServiceConfig"
4535
- },
4536
- frontend: {
4537
- $ref: "#/definitions/FrontendServiceConfig"
4538
- },
4539
- database: {
4540
- $ref: "#/definitions/DatabaseServiceConfig"
4541
- },
4542
- graph: {
4543
- $ref: "#/definitions/GraphServiceConfig"
4544
- },
4545
- filesystem: {
4546
- $ref: "#/definitions/FilesystemServiceConfig"
4547
- },
4548
- inference: {
4549
- $ref: "#/definitions/InferenceServiceConfig"
4550
- },
4551
- mcp: {
4552
- $ref: "#/definitions/McpServiceConfig"
4553
- },
4554
- proxy: {
4555
- $ref: "#/definitions/ProxyServiceConfig"
4556
- }
4557
- },
4558
- additionalProperties: true
4559
- },
4560
- SiteConfig: {
4561
- type: "object",
4562
- properties: {
4563
- siteName: {
4564
- type: "string",
4565
- minLength: 1,
4566
- description: "Display name for the site"
4567
- },
4568
- domain: {
4569
- type: "string",
4570
- minLength: 1,
4571
- description: "Primary domain for the site"
4572
- },
4573
- adminEmail: {
4574
- type: "string",
4575
- format: "email",
4576
- description: "Administrator email address"
4577
- },
4578
- supportEmail: {
4579
- type: "string",
4580
- format: "email",
4581
- description: "Support email address (optional)"
4582
- },
4583
- oauthAllowedDomains: {
4584
- type: "array",
4585
- items: {
4586
- type: "string"
4587
- },
4588
- minItems: 1,
4589
- description: "Email domains allowed for OAuth authentication"
4590
- }
4591
- },
4592
- required: [
4593
- "domain"
4594
- ],
4595
- additionalProperties: false
4596
- },
4597
- AppConfig: {
4598
- type: "object",
4599
- properties: {
4600
- features: {
4601
- type: "object",
4602
- properties: {
4603
- enableAnalytics: {
4604
- type: "boolean"
4605
- },
4606
- enableMaintenanceMode: {
4607
- type: "boolean"
4608
- },
4609
- enableDebugLogging: {
4610
- type: "boolean"
4611
- }
4612
- },
4613
- additionalProperties: false
4614
- },
4615
- security: {
4616
- type: "object",
4617
- properties: {
4618
- sessionTimeout: {
4619
- type: "integer",
4620
- minimum: 60,
4621
- description: "Session timeout in seconds"
4622
- },
4623
- maxLoginAttempts: {
4624
- type: "integer",
4625
- minimum: 1,
4626
- description: "Maximum failed login attempts before lockout"
4627
- },
4628
- corsAllowedOrigins: {
4629
- type: "array",
4630
- items: {
4631
- type: "string"
4632
- }
4633
- },
4634
- enableLocalAuth: {
4635
- type: "boolean",
4636
- description: "Enable local username/password authentication"
4637
- },
4638
- jwtSecret: {
4639
- type: "string",
4640
- minLength: 32,
4641
- description: "JWT signing secret (base64 encoded, 32+ bytes)"
4642
- }
4643
- },
4644
- additionalProperties: false
4645
- },
4646
- performance: {
4647
- type: "object",
4648
- properties: {
4649
- enableCaching: {
4650
- type: "boolean"
4651
- },
4652
- cacheTimeout: {
4653
- type: "integer",
4654
- minimum: 0,
4655
- description: "Cache timeout in seconds"
4656
- },
4657
- maxRequestSize: {
4658
- type: "string",
4659
- pattern: "^[0-9]+(kb|mb|gb)$",
4660
- description: "Maximum request size (e.g., '10mb')"
4661
- }
4662
- },
4663
- additionalProperties: false
4664
- }
4665
- },
4666
- additionalProperties: false
4667
- },
4668
- EnvironmentConfig: {
4669
- type: "object",
4670
- properties: {
4671
- _comment: {
4672
- type: "string",
4673
- description: "Optional comment for documentation"
4674
- },
4675
- _metadata: {
4676
- type: "object",
4677
- properties: {
4678
- environment: {
4679
- type: "string"
4680
- },
4681
- projectRoot: {
4682
- type: "string"
4683
- }
4684
- },
4685
- required: [
4686
- "environment",
4687
- "projectRoot"
4688
- ]
4689
- },
4690
- name: {
4691
- type: "string",
4692
- description: "Environment name"
4693
- },
4694
- platform: {
4695
- type: "object",
4696
- properties: {
4697
- default: {
4698
- $ref: "#/definitions/PlatformType"
4699
- }
4700
- }
4701
- },
4702
- services: {
4703
- $ref: "#/definitions/ServicesConfig"
4704
- },
4705
- site: {
4706
- $ref: "#/definitions/SiteConfig"
4707
- },
4708
- app: {
4709
- $ref: "#/definitions/AppConfig"
4710
- },
4711
- env: {
4712
- type: "object",
4713
- properties: {
4714
- NODE_ENV: {
4715
- type: "string",
4716
- enum: [
4717
- "development",
4718
- "production",
4719
- "test"
4720
- ]
4721
- }
4722
- },
4723
- additionalProperties: true
4724
- },
4725
- logLevel: {
4726
- type: "string",
4727
- enum: [
4728
- "error",
4729
- "warn",
4730
- "info",
4731
- "http",
4732
- "debug"
4733
- ],
4734
- description: "Logging verbosity level"
4735
- },
4736
- deployment: {
4737
- type: "object",
4738
- properties: {
4739
- imageTagStrategy: {
4740
- type: "string",
4741
- enum: [
4742
- "mutable",
4743
- "immutable",
4744
- "git-hash"
4745
- ]
4746
- }
4747
- }
4748
- }
4749
- },
4750
- required: [
4751
- "services"
4752
- ],
4753
- additionalProperties: false
4754
- },
4755
- SemiontConfig: {
4756
- type: "object",
4757
- properties: {
4758
- version: {
4759
- type: "string",
4760
- pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
4761
- description: "Config file version (semver)"
4762
- },
4763
- project: {
4764
- type: "string",
4765
- minLength: 1,
4766
- description: "Project name"
4767
- },
4768
- site: {
4769
- $ref: "#/definitions/SiteConfig"
4770
- },
4771
- app: {
4772
- $ref: "#/definitions/AppConfig"
4773
- },
4774
- services: {
4775
- $ref: "#/definitions/ServicesConfig"
4776
- }
4777
- },
4778
- required: [
4779
- "version",
4780
- "project",
4781
- "site"
4782
- ],
4783
- additionalProperties: false
4784
- }
4785
- }
4786
- };
4787
- // src/config/config-validator.ts
4788
- var ajv = new ajv__WEBPACK_IMPORTED_MODULE_2__({
4789
- allErrors: true,
4790
- // Return all errors, not just the first one
4791
- coerceTypes: true,
4792
- // Coerce types (e.g., "123" -> 123)
4793
- removeAdditional: false,
4794
- // Don't remove additional properties
4795
- useDefaults: true,
4796
- // Apply default values from schema
4797
- strict: false
4798
- });
4799
- ajv_formats__WEBPACK_IMPORTED_MODULE_1__(ajv);
4800
- ajv.addSchema(config_schema_default, "config");
4801
- function validateSemiontConfig(data) {
4802
- const validate = ajv.getSchema("config#/definitions/SemiontConfig");
4803
- if (!validate) {
4804
- throw new Error("SemiontConfig schema not found");
4805
- }
4806
- const valid = validate(data);
4807
- if (!valid) {
4808
- return {
4809
- valid: false,
4810
- errors: validate.errors || null,
4811
- errorMessage: formatErrors(validate.errors || [])
4812
- };
4813
- }
4814
- return {
4815
- valid: true,
4816
- errors: null
4817
- };
4818
- }
4819
- function validateEnvironmentConfig(data) {
4820
- const validate = ajv.getSchema("config#/definitions/EnvironmentConfig");
4821
- if (!validate) {
4822
- throw new Error("EnvironmentConfig schema not found");
4823
- }
4824
- const valid = validate(data);
4825
- if (!valid) {
4826
- return {
4827
- valid: false,
4828
- errors: validate.errors || null,
4829
- errorMessage: formatErrors(validate.errors || [])
4830
- };
4831
- }
4832
- return {
4833
- valid: true,
4834
- errors: null
4835
- };
4836
- }
4837
- function validateSiteConfig(data) {
4838
- const validate = ajv.getSchema("config#/definitions/SiteConfig");
4839
- if (!validate) {
4840
- throw new Error("SiteConfig schema not found");
4841
- }
4842
- const valid = validate(data);
4843
- if (!valid) {
4844
- return {
4845
- valid: false,
4846
- errors: validate.errors || null,
4847
- errorMessage: formatErrors(validate.errors || [])
4848
- };
4849
- }
4850
- return {
4851
- valid: true,
4852
- errors: null
4853
- };
4854
- }
4855
- function formatErrors(errors) {
4856
- if (errors.length === 0) return "Validation failed";
4857
- const messages = errors.map((err)=>{
4858
- const path = err.instancePath || "root";
4859
- const message = err.message || "validation error";
4860
- if (err.keyword === "required" && "missingProperty" in err.params) {
4861
- return `Missing required property: ${err.params.missingProperty}`;
4862
- }
4863
- if (err.keyword === "type" && "type" in err.params) {
4864
- return `${path}: ${message} (expected ${err.params.type})`;
4865
- }
4866
- if (err.keyword === "enum" && "allowedValues" in err.params) {
4867
- return `${path}: must be one of [${err.params.allowedValues.join(", ")}]`;
4868
- }
4869
- if (err.keyword === "format") {
4870
- return `${path}: invalid format (${message})`;
4871
- }
4872
- if (err.keyword === "minLength" || err.keyword === "minItems") {
4873
- return `${path}: ${message}`;
4874
- }
4875
- return `${path}: ${message}`;
4876
- });
4877
- return messages.join("; ");
4878
- }
4879
- // src/config/environment-loader.ts
4880
- function deepMerge(target, ...sources) {
4881
- if (!sources.length) return target;
4882
- const source = sources.shift();
4883
- if (isObject(target) && isObject(source)) {
4884
- for(const key in source){
4885
- if (isObject(source[key])) {
4886
- if (!target[key]) Object.assign(target, {
4887
- [key]: {}
4888
- });
4889
- deepMerge(target[key], source[key]);
4890
- } else {
4891
- Object.assign(target, {
4892
- [key]: source[key]
4893
- });
4894
- }
4895
- }
4896
- }
4897
- return deepMerge(target, ...sources);
4898
- }
4899
- function resolveEnvVars(obj, env) {
4900
- if (typeof obj === "string") {
4901
- return obj.replace(/\$\{([^}]+)\}/g, (match, varName)=>{
4902
- return env[varName] || match;
4903
- });
4904
- }
4905
- if (Array.isArray(obj)) {
4906
- return obj.map((item)=>resolveEnvVars(item, env));
4907
- }
4908
- if (obj && typeof obj === "object") {
4909
- const resolved = {};
4910
- for(const key in obj){
4911
- resolved[key] = resolveEnvVars(obj[key], env);
4912
- }
4913
- return resolved;
4914
- }
4915
- return obj;
4916
- }
4917
- function parseAndMergeConfigs(baseContent, envContent, env, environment, projectRoot) {
4918
- try {
4919
- let baseConfig = {};
4920
- if (baseContent) {
4921
- baseConfig = JSON.parse(baseContent);
4922
- }
4923
- const envConfig = JSON.parse(envContent);
4924
- const merged = deepMerge({}, {
4925
- site: baseConfig.site
4926
- }, // Site config from semiont.json
4927
- baseConfig.defaults || {}, // Default config from semiont.json
4928
- envConfig);
4929
- const resolved = resolveEnvVars(merged, env);
4930
- if (!resolved.services) {
4931
- resolved.services = {};
4932
- }
4933
- if (resolved.env?.NODE_ENV) {
4934
- const validNodeEnv = [
4935
- "development",
4936
- "production",
4937
- "test"
4938
- ];
4939
- if (!validNodeEnv.includes(resolved.env.NODE_ENV)) {
4940
- throw new ConfigurationError(`Invalid NODE_ENV value: ${resolved.env.NODE_ENV}`, environment, `NODE_ENV must be one of: ${validNodeEnv.join(", ")}`);
4941
- }
4942
- }
4943
- const configWithMetadata = {
4944
- ...resolved,
4945
- _metadata: {
4946
- environment,
4947
- projectRoot
4948
- }
4949
- };
4950
- const validationResult = validateEnvironmentConfig(configWithMetadata);
4951
- if (!validationResult.valid) {
4952
- throw new ConfigurationError(`Invalid environment configuration: ${validationResult.errorMessage}`, environment, `Fix the validation errors in your environments/${environment}.json file`);
4953
- }
4954
- return configWithMetadata;
4955
- } catch (error) {
4956
- if (error instanceof ConfigurationError) {
4957
- throw error;
4958
- }
4959
- if (error instanceof SyntaxError && error.message.includes("JSON")) {
4960
- throw new ConfigurationError(`Invalid JSON syntax in configuration file`, environment, `Check for missing commas, quotes, or brackets. Use a JSON validator to verify syntax.`);
4961
- }
4962
- const message = error instanceof Error ? error.message : String(error);
4963
- throw new ConfigurationError(`Failed to parse environment configuration: ${message}`, environment, `Check the configuration files are valid JSON`);
4964
- }
4965
- }
4966
- function getNodeEnvForEnvironment(config) {
4967
- const nodeEnv = config.env?.NODE_ENV;
4968
- return nodeEnv || "development";
4969
- }
4970
- function listEnvironmentNames(files) {
4971
- return files.filter((file)=>file.endsWith(".json")).map((file)=>{
4972
- const lastSlash = Math.max(file.lastIndexOf("/"), file.lastIndexOf("\\"));
4973
- const filename = lastSlash >= 0 ? file.substring(lastSlash + 1) : file;
4974
- return filename.slice(0, -5);
4975
- }).sort();
4976
- }
4977
- function hasAWSConfig(config) {
4978
- return !!config.aws && !!config.aws.region;
4979
- }
4980
- function displayConfiguration(config) {
4981
- console.log("Environment Configuration:");
4982
- console.log(JSON.stringify(config, null, 2));
4983
- }
4984
- function createConfigLoader(reader) {
4985
- return (projectRoot, environment)=>{
4986
- const baseContent = reader.readIfExists(`${projectRoot}/semiont.json`);
4987
- const envContent = reader.readRequired(`${projectRoot}/environments/${environment}.json`);
4988
- return parseAndMergeConfigs(baseContent, envContent, process.env, environment, projectRoot);
4989
- };
4990
- }
4991
- // src/config/environment-validator.ts
4992
- function isValidEnvironment(value, availableEnvironments) {
4993
- if (!value) return false;
4994
- return availableEnvironments.includes(value);
4995
- }
4996
- function parseEnvironment(value, availableEnvironments) {
4997
- if (!value) {
4998
- throw new Error("Environment is required");
4999
- }
5000
- if (!isValidEnvironment(value, availableEnvironments)) {
5001
- throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvironments.join(", ")}`);
5002
- }
5003
- return value;
5004
- }
5005
- function validateEnvironment(value, availableEnvironments) {
5006
- if (!value) {
5007
- throw new Error("Environment is required");
5008
- }
5009
- if (!isValidEnvironment(value, availableEnvironments)) {
5010
- throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvironments.join(", ")}`);
5011
- }
5012
- return value;
5013
- }
5014
- // src/config/platform-types.ts
5015
- function isValidPlatformType(value) {
5016
- return [
5017
- "aws",
5018
- "container",
5019
- "posix",
5020
- "external"
5021
- ].includes(value);
5022
- }
5023
- function getAllPlatformTypes() {
5024
- return [
5025
- "aws",
5026
- "container",
5027
- "posix",
5028
- "external"
5029
- ];
5030
- }
5031
- // src/index.ts
5032
- var CORE_TYPES_VERSION = "0.1.0";
5033
- var SDK_VERSION = "0.1.0";
5034
- //# sourceMappingURL=index.js.map
5035
- //# sourceMappingURL=index.js.map
5036
-
5037
-
5038
2582
  /***/ })
5039
2583
 
5040
2584
  };