likec4 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LikeC4Model } from '@likec4/core/model';
2
2
  import { UnknownLayouted } from './model/index.mjs';
3
- import { W as WorkspaceFolder, a as LikeC4Services, L as LikeC4LanguageServices, b as LikeC4Views, R as Range } from './shared/likec4.Pysz93eX.mjs';
3
+ import { W as WorkspaceFolder, a as LikeC4Services, L as LikeC4LanguageServices, b as LikeC4Views, R as Range } from './shared/likec4.C6HFkgux.mjs';
4
4
  import { ProjectId, NonEmptyArray } from '@likec4/core';
5
5
  import { DiagramView } from '@likec4/core/types';
6
6
  export * from '@likec4/core/types';
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{LikeC4Model as o}from"@likec4/core/model";export{L as LikeC4}from"./shared/likec4.Bo8Klpk_.mjs";import"node:fs";import"node:path";import"node:url";import"./shared/likec4.BeWJWU7_.mjs";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"@hpcc-js/wasm-graphviz";import"buffer";import"@likec4/core/compute-view";import"@likec4/core/utils";
1
+ import{LikeC4Model as o}from"@likec4/core/model";export{L as LikeC4}from"./shared/likec4.Dgr2oMAn.mjs";import"node:fs";import"node:path";import"node:url";import"./shared/likec4.BeWJWU7_.mjs";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"@hpcc-js/wasm-graphviz";import"buffer";import"@likec4/core/compute-view";import"@likec4/core/utils";
2
2
  import"node:process";import"boxen";import"node:child_process";import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:readline/promises";import"node:os";import"fs/promises";function t(r){return o.create(r)}export{t as createLikeC4Model};
@@ -17383,6 +17383,8 @@ declare const DocumentParserFromMixins: {
17383
17383
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17384
17384
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17385
17385
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17386
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17387
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17386
17388
  isValid: IsValidFn;
17387
17389
  readonly services: LikeC4Services;
17388
17390
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17474,6 +17476,8 @@ declare const DocumentParserFromMixins: {
17474
17476
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17475
17477
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17476
17478
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17479
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17480
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17477
17481
  isValid: IsValidFn;
17478
17482
  readonly services: LikeC4Services;
17479
17483
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17596,6 +17600,8 @@ declare const DocumentParserFromMixins: {
17596
17600
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17597
17601
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17598
17602
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17603
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17604
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17599
17605
  isValid: IsValidFn;
17600
17606
  readonly services: LikeC4Services;
17601
17607
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17656,6 +17662,8 @@ declare const DocumentParserFromMixins: {
17656
17662
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17657
17663
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17658
17664
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17665
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17666
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17659
17667
  isValid: IsValidFn;
17660
17668
  readonly services: LikeC4Services;
17661
17669
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17724,6 +17732,8 @@ declare const DocumentParserFromMixins: {
17724
17732
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17725
17733
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17726
17734
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17735
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17736
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17727
17737
  isValid: IsValidFn;
17728
17738
  readonly services: LikeC4Services;
17729
17739
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17785,6 +17795,8 @@ declare const DocumentParserFromMixins: {
17785
17795
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17786
17796
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17787
17797
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17798
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17799
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17788
17800
  isValid: IsValidFn;
17789
17801
  readonly services: LikeC4Services;
17790
17802
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17884,6 +17896,8 @@ declare const DocumentParserFromMixins: {
17884
17896
  parseRelationExprOrWhere(astNode: RelationExprOrWhere): ProjectId;
17885
17897
  parseRelationExprWhere(astNode: RelationExprWhere): ProjectId;
17886
17898
  parseRelationExpr(astNode: RelationExpr): ProjectId;
17899
+ parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
17900
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
17887
17901
  isValid: IsValidFn;
17888
17902
  readonly services: LikeC4Services;
17889
17903
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -17941,6 +17955,19 @@ declare class LikeC4ValueConverter extends DefaultValueConverter {
17941
17955
  protected runConverter(rule: any, input: string, cstNode: CstNode): ValueType;
17942
17956
  }
17943
17957
 
17958
+ /**
17959
+ * When server requests to open a likec4 preview panel
17960
+ * (available only in the editor).
17961
+ * (not the best place, but seems to be working)
17962
+ */
17963
+ declare namespace DidRequestOpenViewNotification {
17964
+ type Params = {
17965
+ viewId: ViewId;
17966
+ projectId: ProjectId;
17967
+ };
17968
+ const type: NotificationType<Params>;
17969
+ type Type = typeof type;
17970
+ }
17944
17971
  /**
17945
17972
  * Request to locate an element, relation, deployment or view.
17946
17973
  * If LSP has multiple projects, the projectId is required.
@@ -17996,6 +18023,7 @@ interface LikeC4Views {
17996
18023
  layoutView(viewId: ViewId, projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut | null>;
17997
18024
  diagrams(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<DiagramView>>;
17998
18025
  viewsAsGraphvizOut(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<GraphvizSvgOut>>;
18026
+ openView(viewId: ViewId, projectId?: ProjectId | undefined): Promise<void>;
17999
18027
  }
18000
18028
 
18001
18029
  interface LikeC4LanguageServices {
@@ -19248,6 +19276,38 @@ declare enum ZodFirstPartyTypeKind {
19248
19276
  ZodReadonly = "ZodReadonly"
19249
19277
  }
19250
19278
 
19279
+ /**
19280
+ * Information about a validated access token, provided to request handlers.
19281
+ */
19282
+ interface AuthInfo {
19283
+ /**
19284
+ * The access token.
19285
+ */
19286
+ token: string;
19287
+ /**
19288
+ * The client ID associated with this token.
19289
+ */
19290
+ clientId: string;
19291
+ /**
19292
+ * Scopes associated with this token.
19293
+ */
19294
+ scopes: string[];
19295
+ /**
19296
+ * When the token expires (in seconds since epoch).
19297
+ */
19298
+ expiresAt?: number;
19299
+ /**
19300
+ * The RFC 8707 resource server identifier for which this token is valid.
19301
+ * If set, this MUST match the MCP server's resource identifier (minus hash fragment).
19302
+ */
19303
+ resource?: URL;
19304
+ /**
19305
+ * Additional data associated with the token.
19306
+ * This field should be used for any additional data that needs to be attached to the auth info.
19307
+ */
19308
+ extra?: Record<string, unknown>;
19309
+ }
19310
+
19251
19311
  declare const RequestMetaSchema: ZodObject<{
19252
19312
  /**
19253
19313
  * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
@@ -46641,6 +46701,32 @@ type Flatten<T> = T extends Primitive ? T : T extends Array<infer U> ? Array<Fla
46641
46701
  [K in keyof T]: Flatten<T[K]>;
46642
46702
  } : T;
46643
46703
  type Infer<Schema extends ZodTypeAny> = Flatten<TypeOf<Schema>>;
46704
+ /**
46705
+ * Headers that are compatible with both Node.js and the browser.
46706
+ */
46707
+ type IsomorphicHeaders = Record<string, string | string[] | undefined>;
46708
+ /**
46709
+ * Information about the incoming request.
46710
+ */
46711
+ interface RequestInfo {
46712
+ /**
46713
+ * The headers of the request.
46714
+ */
46715
+ headers: IsomorphicHeaders;
46716
+ }
46717
+ /**
46718
+ * Extra information about a message.
46719
+ */
46720
+ interface MessageExtraInfo {
46721
+ /**
46722
+ * The request information.
46723
+ */
46724
+ requestInfo?: RequestInfo;
46725
+ /**
46726
+ * The authentication information.
46727
+ */
46728
+ authInfo?: AuthInfo;
46729
+ }
46644
46730
  type Request = Infer<typeof RequestSchema>;
46645
46731
  type RequestMeta = Infer<typeof RequestMetaSchema>;
46646
46732
  type Notification = Infer<typeof NotificationSchema>;
@@ -46667,38 +46753,6 @@ type ServerRequest = Infer<typeof ServerRequestSchema>;
46667
46753
  type ServerNotification = Infer<typeof ServerNotificationSchema>;
46668
46754
  type ServerResult = Infer<typeof ServerResultSchema>;
46669
46755
 
46670
- /**
46671
- * Information about a validated access token, provided to request handlers.
46672
- */
46673
- interface AuthInfo {
46674
- /**
46675
- * The access token.
46676
- */
46677
- token: string;
46678
- /**
46679
- * The client ID associated with this token.
46680
- */
46681
- clientId: string;
46682
- /**
46683
- * Scopes associated with this token.
46684
- */
46685
- scopes: string[];
46686
- /**
46687
- * When the token expires (in seconds since epoch).
46688
- */
46689
- expiresAt?: number;
46690
- /**
46691
- * The RFC 8707 resource server identifier for which this token is valid.
46692
- * If set, this MUST match the MCP server's resource identifier (minus hash fragment).
46693
- */
46694
- resource?: URL;
46695
- /**
46696
- * Additional data associated with the token.
46697
- * This field should be used for any additional data that needs to be attached to the auth info.
46698
- */
46699
- extra?: Record<string, unknown>;
46700
- }
46701
-
46702
46756
  /**
46703
46757
  * Options for sending a JSON-RPC message.
46704
46758
  */
@@ -46757,12 +46811,11 @@ interface Transport {
46757
46811
  /**
46758
46812
  * Callback for when a message (request or response) is received over the connection.
46759
46813
  *
46760
- * Includes the authInfo if the transport is authenticated.
46814
+ * Includes the requestInfo and authInfo if the transport is authenticated.
46761
46815
  *
46816
+ * The requestInfo can be used to get the original request information (headers, etc.)
46762
46817
  */
46763
- onmessage?: (message: JSONRPCMessage, extra?: {
46764
- authInfo?: AuthInfo;
46765
- }) => void;
46818
+ onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
46766
46819
  /**
46767
46820
  * The session ID generated for this connection.
46768
46821
  */
@@ -46855,6 +46908,10 @@ type RequestHandlerExtra<SendRequestT extends Request, SendNotificationT extends
46855
46908
  * This can be useful for tracking or logging purposes.
46856
46909
  */
46857
46910
  requestId: RequestId;
46911
+ /**
46912
+ * The original HTTP request.
46913
+ */
46914
+ requestInfo?: RequestInfo;
46858
46915
  /**
46859
46916
  * Sends a notification that relates to the current request being handled.
46860
46917
  *
@@ -47453,82 +47510,6 @@ interface LikeC4MCPServerFactory {
47453
47510
  create(options?: ServerOptions): McpServer;
47454
47511
  }
47455
47512
 
47456
- declare namespace LikeC4MCPTools {
47457
- const instructions = "This server provides access to LikeC4 model.\n\nKey capabilities:\n- List all available LikeC4 projects in the workspace\n- Search for LikeC4 project and return its summary, that includes specifications, all elements and views\n- Search for LikeC4 element by title\n- Read details about LikeC4 element by id\n- Read details about LikeC4 view by id\n\n";
47458
- const listProjects: {
47459
- name: string;
47460
- description: string;
47461
- };
47462
- const readProjectSummary: {
47463
- name: string;
47464
- description: string;
47465
- paramsSchema: {
47466
- project: ZodOptional<ZodString>;
47467
- };
47468
- };
47469
- const searchElement: {
47470
- name: string;
47471
- description: string;
47472
- paramsSchema: {
47473
- search: ZodString;
47474
- };
47475
- };
47476
- const readElement: {
47477
- name: string;
47478
- description: string;
47479
- paramsSchema: {
47480
- id: ZodString;
47481
- project: ZodOptional<ZodString>;
47482
- };
47483
- };
47484
- const readView: {
47485
- name: string;
47486
- description: string;
47487
- paramsSchema: {
47488
- id: ZodString;
47489
- project: ZodOptional<ZodString>;
47490
- };
47491
- };
47492
- }
47493
- interface LikeC4MCPTools {
47494
- listProjects(): Promise<string>;
47495
- /**
47496
- * Searches for LikeC4 project and returns its summary, specifications, elements and views
47497
- *
47498
- * @param project Project name (optional, will use default project if not specified)
47499
- */
47500
- readProjectSummary(project?: string): Promise<string>;
47501
- /**
47502
- * Searches for LikeC4 elements that have the search string in their names
47503
- * Can be used to resolve projects for further requests (like read-element or read-project-summary)
47504
- *
47505
- * @param params.search non-empty string
47506
- */
47507
- searchElement(params: {
47508
- search: string;
47509
- }): Promise<string>;
47510
- /**
47511
- * Read details about LikeC4 element.
47512
- *
47513
- * @param params.id Element id (FQN)
47514
- * @param params.project Project name (optional, will use default project if not specified)
47515
- */
47516
- readElement(params: {
47517
- id: string;
47518
- project?: string | undefined;
47519
- }): Promise<string>;
47520
- /**
47521
- * Read details about LikeC4 view.
47522
- *
47523
- * @param params.id View id (FQN)
47524
- * @param params.project Project name (optional, will use default project if not specified)
47525
- */
47526
- readView(params: {
47527
- id: string;
47528
- project?: string | undefined;
47529
- }): Promise<string>;
47530
- }
47531
-
47532
47513
  declare class LikeC4ModelChanges {
47533
47514
  private services;
47534
47515
  private locator;
@@ -47545,6 +47526,7 @@ declare class Rpc extends ADisposable {
47545
47526
  private services;
47546
47527
  constructor(services: LikeC4Services);
47547
47528
  init(): void;
47529
+ openView(params: DidRequestOpenViewNotification.Params): Promise<void>;
47548
47530
  }
47549
47531
 
47550
47532
  declare class NodeKindProvider implements NodeKindProvider$1 {
@@ -47586,7 +47568,6 @@ interface LikeC4AddedServices {
47586
47568
  ValidatedWorkspaceCache: WorkspaceCache<string, any>;
47587
47569
  Rpc: Rpc;
47588
47570
  mcp: {
47589
- Tools: LikeC4MCPTools;
47590
47571
  Server: LikeC4MCPServer;
47591
47572
  ServerFactory: LikeC4MCPServerFactory;
47592
47573
  };
@@ -1,4 +1,4 @@
1
- import{relative as de}from"node:path";import{f as ce,g as J,T as le,N as V,i as pe,n as x,j as U,u as N,l as ue,C as fe,m as ge,a as he,b as me,c as we,d as W,e as Ie,p as Ne,h as G,L as ye}from"./likec4.Bo8Klpk_.mjs";import{compareNatural as ve}from"@likec4/core/utils";import{RichText as ke}from"@likec4/core/types";function Le(n){var e,i;if(n){if("astNode"in n)return Se(n);if(Array.isArray(n))return n.reduce(z,void 0);{const t=n,r=$e(t)?je((i=(e=t?.root)===null||e===void 0?void 0:e.astNode)!==null&&
1
+ import{relative as de}from"node:path";import{f as ce,g as J,T as le,N as V,i as pe,n as x,j as U,u as N,l as ue,C as fe,m as ge,a as he,b as me,c as we,d as W,e as Ie,p as Ne,h as G,L as ye}from"./likec4.Dgr2oMAn.mjs";import{compareNatural as ve}from"@likec4/core/utils";import{RichText as ke}from"@likec4/core/types";function Le(n){var e,i;if(n){if("astNode"in n)return Se(n);if(Array.isArray(n))return n.reduce(z,void 0);{const t=n,r=$e(t)?je((i=(e=t?.root)===null||e===void 0?void 0:e.astNode)!==null&&
2
2
  i!==void 0?i:t?.astNode):void 0;return C(t,r)}}else return}function $e(n){return typeof n<"u"&&"element"in n&&"text"in n}function je(n){try{return J(n).uri.toString()}catch{return}}function Se(n){var e,i;const{astNode:t,property:r,index:a}=n??{},s=(e=t?.$cstNode)!==null&&e!==void 0?e:t?.$textRegion;if(!(t===void 0||s===void 0)){if(r===void 0)return C(s,O(t));{const o=c=>a!==void 0&&a>-1&&Array.isArray(t[r])?a<c.length?c[a]:void 0:c.reduce(z,void 0);if(!((i=s.assignments)===null||i===void 0)&&i[r]){
3
3
  const c=o(s.assignments[r]);return c&&C(c,O(t))}else if(t.$cstNode){const c=o(ce(t.$cstNode,r));return c&&C(c,O(t))}else return}}}function O(n){var e,i,t,r;return n.$cstNode?(i=(e=J(n))===null||e===void 0?void 0:e.uri)===null||i===void 0?void 0:i.toString():n.$textRegion?n.$textRegion.documentURI||((r=(t=new le(n,a=>a.$container?[a.$container]:[]).find(a=>{var s;return(s=a.$textRegion)===null||s===void 0?void 0:s.documentURI}))===null||t===void 0?void 0:t.$textRegion)===null||r===void 0?void 0:r.
4
4
  documentURI):void 0}function C(n,e){var i,t;const r={offset:n.offset,end:(i=n.end)!==null&&i!==void 0?i:n.offset+n.length,length:(t=n.length)!==null&&t!==void 0?t:n.end-n.offset};return n.range&&(r.range=n.range),e??(e=n.fileURI),e&&(r.fileURI=e),r}function z(n,e){var i,t;if(n){if(!e)return n&&C(n)}else return e&&C(e);const r=(i=n.end)!==null&&i!==void 0?i:n.offset+n.length,a=(t=e.end)!==null&&t!==void 0?t:e.offset+e.length,s=Math.min(n.offset,e.offset),o=Math.max(r,a),c=o-s,p={offset:s,end:o,length:c};