@lace-cloud/proto 0.18.0 → 0.19.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
@@ -2,6 +2,7 @@ import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
2
 
3
3
  type ProtoDiagnosticLike = {
4
4
  severity: number;
5
+ code?: string;
5
6
  message: string;
6
7
  file: string;
7
8
  line: number;
@@ -13,6 +14,11 @@ type ProtoDiagnosticLike = {
13
14
  };
14
15
 
15
16
  interface Bundle {
17
+ /**
18
+ * The format of this encoding: "2.0", at which every Expression carries
19
+ * the module references the engine read from it. The engine writes every
20
+ * Bundle at it; an encoding of an earlier version carries none.
21
+ */
16
22
  schema_version: string;
17
23
  kind: string;
18
24
  entry: string;
@@ -165,8 +171,33 @@ declare const OutputRef: MessageFns$1<OutputRef>;
165
171
  interface Expression {
166
172
  lang: string;
167
173
  value: string;
174
+ /**
175
+ * The module calls `value` reads, in source order: what the engine's
176
+ * one reader of references reads from the parse of `value`. The engine
177
+ * fills them each time it encodes an Expression and reads none back, so
178
+ * a consumer takes a reference from here and never from `value`.
179
+ */
180
+ module_references: ModuleReference[];
168
181
  }
169
182
  declare const Expression: MessageFns$1<Expression>;
183
+ /** ModuleReference is one module.<call> an expression reads. */
184
+ interface ModuleReference {
185
+ /** The call read: module.<call>. */
186
+ call: string;
187
+ /**
188
+ * The output read off the call: the first attribute after the call and
189
+ * any instance key in the text, module.<call>.<output> or
190
+ * module.<call>[0].<output>. Unset when the reference reads the whole
191
+ * call: module.<call> alone, through a splat, or by a key an expression
192
+ * computes.
193
+ */
194
+ output?: string | undefined;
195
+ /** An instance key follows the call: [0], ["k"] or [<expression>]. */
196
+ instance_key: boolean;
197
+ /** A splat follows the call or its instance key: [*] or .*. */
198
+ splat: boolean;
199
+ }
200
+ declare const ModuleReference: MessageFns$1<ModuleReference>;
170
201
  interface TerraformBlock {
171
202
  required_version: string;
172
203
  required_providers: {
@@ -253,6 +284,7 @@ type RenderNode$1 = {
253
284
  };
254
285
  inputs: NodePin$1[];
255
286
  outputs: NodePin$1[];
287
+ call_wired?: boolean;
256
288
  };
257
289
  type NodePin$1 = {
258
290
  name: string;
@@ -354,6 +386,7 @@ type SettingsConfig = {
354
386
  };
355
387
  type Diagnostic = {
356
388
  severity: 'error' | 'warning' | 'info';
389
+ code?: string;
357
390
  message: string;
358
391
  module_key?: string;
359
392
  instance_id?: string;
@@ -377,11 +410,13 @@ type ViewportIntent = {
377
410
 
378
411
  declare function convertDiagnostic(d: ProtoDiagnosticLike): Diagnostic;
379
412
 
380
- declare const ENGINE_METHODS: readonly ["Initialize", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "CancelInvoke"];
413
+ declare const ENGINE_METHODS: readonly ["Initialize", "ReadCredential", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "ReadWiringCandidates", "CancelInvoke"];
381
414
  declare const ENGINE_STREAM_METHODS: readonly ["Subscribe", "Invoke"];
382
415
  type EngineMethod = (typeof ENGINE_METHODS)[number];
383
416
  type EngineStreamMethod = (typeof ENGINE_STREAM_METHODS)[number];
384
- type BridgeMethod = Exclude<EngineMethod, 'TestSessionOpen'>;
417
+ declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen", "ReadCredential"];
418
+ type HostOnlyMethod = (typeof HOST_ONLY_METHODS)[number];
419
+ type BridgeMethod = Exclude<EngineMethod, HostOnlyMethod>;
385
420
  declare const BRIDGE_METHODS: BridgeMethod[];
386
421
  type BridgeRequest = {
387
422
  kind: 'unary';
@@ -413,7 +448,10 @@ type BridgeResponse = {
413
448
  id: string;
414
449
  code: string;
415
450
  message: string;
451
+ reason: string;
452
+ apiCode?: string;
416
453
  };
454
+ declare const CONNECT_CODE_NAMES: readonly ["ok", "canceled", "unknown", "invalid_argument", "deadline_exceeded", "not_found", "already_exists", "permission_denied", "resource_exhausted", "failed_precondition", "aborted", "out_of_range", "unimplemented", "internal", "unavailable", "data_loss", "unauthenticated"];
417
455
  type MessageBridge = {
418
456
  post(m: BridgeRequest | BridgeResponse): void;
419
457
  onMessage(f: (m: unknown) => void): () => void;
@@ -463,12 +501,34 @@ type LayoutEdge = {
463
501
  target_instance: string;
464
502
  };
465
503
 
504
+ declare function splitPath(canvasPath: string): {
505
+ parentPath: string;
506
+ localId: string;
507
+ };
508
+ declare function callText(sourcePath: string): string;
509
+
466
510
  type ParsedModuleKey = {
467
511
  id: string;
468
512
  version: string;
469
513
  };
470
514
  declare function parseModuleKey(key: string): ParsedModuleKey;
471
515
 
516
+ type InstanceChild = {
517
+ id: string;
518
+ use?: Use;
519
+ resource?: Resource;
520
+ };
521
+ type ScopedInstance = {
522
+ scopeKey: string;
523
+ scope: Module;
524
+ child: InstanceChild;
525
+ };
526
+ declare function resolveInstance(bundle: Bundle, id: string): ScopedInstance | null;
527
+ type InstanceAddress = {
528
+ scope: string;
529
+ id: string;
530
+ };
531
+ declare function instanceAddress(bundle: Bundle, id: string): InstanceAddress;
472
532
  declare function resolveScopePath(bundle: Bundle, path: string): string | null;
473
533
 
474
534
  declare enum NodeKind {
@@ -596,4 +656,33 @@ interface MessageFns<T> {
596
656
 
597
657
  declare const CanvasViewProto: MessageFns<CanvasView>;
598
658
 
599
- export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_STREAM_METHODS, type EngineMethod, type EngineStreamMethod, type GeneratePhase, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type SettingsConfig, type ViewportIntent, type XY, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveScopePath, resolveScopePositions, resolveScopePositionsByDepth };
659
+ declare const ENGINE_PROTOCOL_VERSION: string;
660
+ /**
661
+ * The engine names another protocol version than these libraries speak. It
662
+ * carries the engine's own version and both protocol versions;
663
+ * `engineTooOld` says which side is behind. What a host shows for it, and
664
+ * what it offers, is the host's.
665
+ */
666
+ declare class EngineProtocolMismatchError extends Error {
667
+ readonly engineVersion: string;
668
+ readonly engineProtocol: string;
669
+ readonly requiredProtocol: string;
670
+ constructor(engineVersion: string, engineProtocol: string, requiredProtocol: string);
671
+ /**
672
+ * The engine is the side that is behind: a newer Lace CLI speaks this
673
+ * host's protocol. False when the engine is ahead of the host.
674
+ */
675
+ get engineTooOld(): boolean;
676
+ }
677
+ /**
678
+ * The one check of the protocol version an engine names — on its handshake
679
+ * line, or in its `Initialize` answer — against `ENGINE_PROTOCOL_VERSION`:
680
+ * another version, or none, throws `EngineProtocolMismatchError`. The
681
+ * host's `ServerManager` checks the handshake before any RPC and the
682
+ * canvas's engine mapping checks `Initialize`'s answer before any other
683
+ * call, so an engine speaking another protocol is refused once, clearly,
684
+ * instead of misreading every later message.
685
+ */
686
+ declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
687
+
688
+ export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type ViewportIntent, type XY, callText, checkEngineProtocol, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, instanceAddress, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveInstance, resolveScopePath, resolveScopePositions, resolveScopePositionsByDepth, splitPath };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
2
 
3
3
  type ProtoDiagnosticLike = {
4
4
  severity: number;
5
+ code?: string;
5
6
  message: string;
6
7
  file: string;
7
8
  line: number;
@@ -13,6 +14,11 @@ type ProtoDiagnosticLike = {
13
14
  };
14
15
 
15
16
  interface Bundle {
17
+ /**
18
+ * The format of this encoding: "2.0", at which every Expression carries
19
+ * the module references the engine read from it. The engine writes every
20
+ * Bundle at it; an encoding of an earlier version carries none.
21
+ */
16
22
  schema_version: string;
17
23
  kind: string;
18
24
  entry: string;
@@ -165,8 +171,33 @@ declare const OutputRef: MessageFns$1<OutputRef>;
165
171
  interface Expression {
166
172
  lang: string;
167
173
  value: string;
174
+ /**
175
+ * The module calls `value` reads, in source order: what the engine's
176
+ * one reader of references reads from the parse of `value`. The engine
177
+ * fills them each time it encodes an Expression and reads none back, so
178
+ * a consumer takes a reference from here and never from `value`.
179
+ */
180
+ module_references: ModuleReference[];
168
181
  }
169
182
  declare const Expression: MessageFns$1<Expression>;
183
+ /** ModuleReference is one module.<call> an expression reads. */
184
+ interface ModuleReference {
185
+ /** The call read: module.<call>. */
186
+ call: string;
187
+ /**
188
+ * The output read off the call: the first attribute after the call and
189
+ * any instance key in the text, module.<call>.<output> or
190
+ * module.<call>[0].<output>. Unset when the reference reads the whole
191
+ * call: module.<call> alone, through a splat, or by a key an expression
192
+ * computes.
193
+ */
194
+ output?: string | undefined;
195
+ /** An instance key follows the call: [0], ["k"] or [<expression>]. */
196
+ instance_key: boolean;
197
+ /** A splat follows the call or its instance key: [*] or .*. */
198
+ splat: boolean;
199
+ }
200
+ declare const ModuleReference: MessageFns$1<ModuleReference>;
170
201
  interface TerraformBlock {
171
202
  required_version: string;
172
203
  required_providers: {
@@ -253,6 +284,7 @@ type RenderNode$1 = {
253
284
  };
254
285
  inputs: NodePin$1[];
255
286
  outputs: NodePin$1[];
287
+ call_wired?: boolean;
256
288
  };
257
289
  type NodePin$1 = {
258
290
  name: string;
@@ -354,6 +386,7 @@ type SettingsConfig = {
354
386
  };
355
387
  type Diagnostic = {
356
388
  severity: 'error' | 'warning' | 'info';
389
+ code?: string;
357
390
  message: string;
358
391
  module_key?: string;
359
392
  instance_id?: string;
@@ -377,11 +410,13 @@ type ViewportIntent = {
377
410
 
378
411
  declare function convertDiagnostic(d: ProtoDiagnosticLike): Diagnostic;
379
412
 
380
- declare const ENGINE_METHODS: readonly ["Initialize", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "CancelInvoke"];
413
+ declare const ENGINE_METHODS: readonly ["Initialize", "ReadCredential", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "ReadWiringCandidates", "CancelInvoke"];
381
414
  declare const ENGINE_STREAM_METHODS: readonly ["Subscribe", "Invoke"];
382
415
  type EngineMethod = (typeof ENGINE_METHODS)[number];
383
416
  type EngineStreamMethod = (typeof ENGINE_STREAM_METHODS)[number];
384
- type BridgeMethod = Exclude<EngineMethod, 'TestSessionOpen'>;
417
+ declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen", "ReadCredential"];
418
+ type HostOnlyMethod = (typeof HOST_ONLY_METHODS)[number];
419
+ type BridgeMethod = Exclude<EngineMethod, HostOnlyMethod>;
385
420
  declare const BRIDGE_METHODS: BridgeMethod[];
386
421
  type BridgeRequest = {
387
422
  kind: 'unary';
@@ -413,7 +448,10 @@ type BridgeResponse = {
413
448
  id: string;
414
449
  code: string;
415
450
  message: string;
451
+ reason: string;
452
+ apiCode?: string;
416
453
  };
454
+ declare const CONNECT_CODE_NAMES: readonly ["ok", "canceled", "unknown", "invalid_argument", "deadline_exceeded", "not_found", "already_exists", "permission_denied", "resource_exhausted", "failed_precondition", "aborted", "out_of_range", "unimplemented", "internal", "unavailable", "data_loss", "unauthenticated"];
417
455
  type MessageBridge = {
418
456
  post(m: BridgeRequest | BridgeResponse): void;
419
457
  onMessage(f: (m: unknown) => void): () => void;
@@ -463,12 +501,34 @@ type LayoutEdge = {
463
501
  target_instance: string;
464
502
  };
465
503
 
504
+ declare function splitPath(canvasPath: string): {
505
+ parentPath: string;
506
+ localId: string;
507
+ };
508
+ declare function callText(sourcePath: string): string;
509
+
466
510
  type ParsedModuleKey = {
467
511
  id: string;
468
512
  version: string;
469
513
  };
470
514
  declare function parseModuleKey(key: string): ParsedModuleKey;
471
515
 
516
+ type InstanceChild = {
517
+ id: string;
518
+ use?: Use;
519
+ resource?: Resource;
520
+ };
521
+ type ScopedInstance = {
522
+ scopeKey: string;
523
+ scope: Module;
524
+ child: InstanceChild;
525
+ };
526
+ declare function resolveInstance(bundle: Bundle, id: string): ScopedInstance | null;
527
+ type InstanceAddress = {
528
+ scope: string;
529
+ id: string;
530
+ };
531
+ declare function instanceAddress(bundle: Bundle, id: string): InstanceAddress;
472
532
  declare function resolveScopePath(bundle: Bundle, path: string): string | null;
473
533
 
474
534
  declare enum NodeKind {
@@ -596,4 +656,33 @@ interface MessageFns<T> {
596
656
 
597
657
  declare const CanvasViewProto: MessageFns<CanvasView>;
598
658
 
599
- export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_STREAM_METHODS, type EngineMethod, type EngineStreamMethod, type GeneratePhase, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type SettingsConfig, type ViewportIntent, type XY, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveScopePath, resolveScopePositions, resolveScopePositionsByDepth };
659
+ declare const ENGINE_PROTOCOL_VERSION: string;
660
+ /**
661
+ * The engine names another protocol version than these libraries speak. It
662
+ * carries the engine's own version and both protocol versions;
663
+ * `engineTooOld` says which side is behind. What a host shows for it, and
664
+ * what it offers, is the host's.
665
+ */
666
+ declare class EngineProtocolMismatchError extends Error {
667
+ readonly engineVersion: string;
668
+ readonly engineProtocol: string;
669
+ readonly requiredProtocol: string;
670
+ constructor(engineVersion: string, engineProtocol: string, requiredProtocol: string);
671
+ /**
672
+ * The engine is the side that is behind: a newer Lace CLI speaks this
673
+ * host's protocol. False when the engine is ahead of the host.
674
+ */
675
+ get engineTooOld(): boolean;
676
+ }
677
+ /**
678
+ * The one check of the protocol version an engine names — on its handshake
679
+ * line, or in its `Initialize` answer — against `ENGINE_PROTOCOL_VERSION`:
680
+ * another version, or none, throws `EngineProtocolMismatchError`. The
681
+ * host's `ServerManager` checks the handshake before any RPC and the
682
+ * canvas's engine mapping checks `Initialize`'s answer before any other
683
+ * call, so an engine speaking another protocol is refused once, clearly,
684
+ * instead of misreading every later message.
685
+ */
686
+ declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
687
+
688
+ export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type ViewportIntent, type XY, callText, checkEngineProtocol, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, instanceAddress, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveInstance, resolveScopePath, resolveScopePositions, resolveScopePositionsByDepth, splitPath };