@lage-run/rpc 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@lage-run/rpc",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 06 Sep 2024 20:02:51 GMT",
5
+ "date": "Fri, 27 Sep 2024 20:03:27 GMT",
6
+ "version": "1.2.1",
7
+ "tag": "@lage-run/rpc_v1.2.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/rpc",
13
+ "commit": "2919f9041f931dc6ef65017f7aedb9fef9dab66d",
14
+ "comment": "Simulate file access for lage server"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Fri, 13 Sep 2024 18:05:04 GMT",
21
+ "version": "1.2.0",
22
+ "tag": "@lage-run/rpc_v1.2.0",
23
+ "comments": {
24
+ "minor": [
25
+ {
26
+ "author": "kchau@microsoft.com",
27
+ "package": "@lage-run/rpc",
28
+ "commit": "924b93e66ae3cc60effa7cfc1f5254e1e59e9969",
29
+ "comment": "modified to allow for lage-server"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Fri, 06 Sep 2024 20:03:01 GMT",
6
36
  "version": "1.1.0",
7
37
  "tag": "@lage-run/rpc_v1.1.0",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @lage-run/rpc
2
2
 
3
- This log was last generated on Fri, 06 Sep 2024 20:02:51 GMT and should not be manually modified.
3
+ <!-- This log was last generated on Fri, 27 Sep 2024 20:03:27 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.2.1
8
+
9
+ Fri, 27 Sep 2024 20:03:27 GMT
10
+
11
+ ### Patches
12
+
13
+ - Simulate file access for lage server (kchau@microsoft.com)
14
+
15
+ ## 1.2.0
16
+
17
+ Fri, 13 Sep 2024 18:05:04 GMT
18
+
19
+ ### Minor changes
20
+
21
+ - modified to allow for lage-server (kchau@microsoft.com)
22
+
7
23
  ## 1.1.0
8
24
 
9
- Fri, 06 Sep 2024 20:02:51 GMT
25
+ Fri, 06 Sep 2024 20:03:01 GMT
10
26
 
11
27
  ### Minor changes
12
28
 
@@ -2,6 +2,7 @@ export interface CreateClientOptions {
2
2
  baseUrl: string;
3
3
  httpVersion: "1.1" | "2";
4
4
  }
5
+ export type LageClient = ReturnType<typeof createClient>;
5
6
  export declare function createClient({ baseUrl, httpVersion }: CreateClientOptions): import("@connectrpc/connect").PromiseClient<{
6
7
  readonly typeName: "connectrpc.lage.v1.LageService";
7
8
  readonly methods: {
@@ -11,5 +12,11 @@ export declare function createClient({ baseUrl, httpVersion }: CreateClientOptio
11
12
  readonly O: typeof import("./gen/lage/v1/lage_pb.js").RunTargetResponse;
12
13
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
13
14
  };
15
+ readonly ping: {
16
+ readonly name: "Ping";
17
+ readonly I: typeof import("./gen/lage/v1/lage_pb.js").PingRequest;
18
+ readonly O: typeof import("./gen/lage/v1/lage_pb.js").PingResponse;
19
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
20
+ };
14
21
  };
15
22
  }>;
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { ILageService } from "./types/ILageService.js";
3
- export declare function createServer(lageService: ILageService): Promise<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
4
+ export declare function createServer(lageService: ILageService, abortController: AbortController): Promise<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
@@ -11,10 +11,12 @@ Object.defineProperty(exports, "createServer", {
11
11
  const _fastify = require("fastify");
12
12
  const _connectfastify = require("@connectrpc/connect-fastify");
13
13
  const _createRoutes = require("./createRoutes.js");
14
- async function createServer(lageService) {
14
+ async function createServer(lageService, abortController) {
15
15
  const server = (0, _fastify.fastify)();
16
16
  await server.register(_connectfastify.fastifyConnectPlugin, {
17
- routes: (0, _createRoutes.createRoutes)(lageService)
17
+ routes: (0, _createRoutes.createRoutes)(lageService),
18
+ shutdownSignal: abortController.signal,
19
+ compressMinBytes: 512
18
20
  });
19
21
  server.get("/", (_, reply)=>{
20
22
  reply.type("text/plain");
@@ -1,4 +1,4 @@
1
- import { RunTargetRequest, RunTargetResponse } from "./lage_pb.js";
1
+ import { PingRequest, PingResponse, RunTargetRequest, RunTargetResponse } from "./lage_pb.js";
2
2
  import { MethodKind } from "@bufbuild/protobuf";
3
3
  /**
4
4
  * @generated from service connectrpc.lage.v1.LageService
@@ -15,5 +15,16 @@ export declare const LageService: {
15
15
  readonly O: typeof RunTargetResponse;
16
16
  readonly kind: MethodKind.Unary;
17
17
  };
18
+ /**
19
+ * a ping function to check if the server is up
20
+ *
21
+ * @generated from rpc connectrpc.lage.v1.LageService.Ping
22
+ */
23
+ readonly ping: {
24
+ readonly name: "Ping";
25
+ readonly I: typeof PingRequest;
26
+ readonly O: typeof PingResponse;
27
+ readonly kind: MethodKind.Unary;
28
+ };
18
29
  };
19
30
  };
@@ -23,6 +23,16 @@ const LageService = {
23
23
  I: _lage_pb.RunTargetRequest,
24
24
  O: _lage_pb.RunTargetResponse,
25
25
  kind: _protobuf.MethodKind.Unary
26
+ },
27
+ /**
28
+ * a ping function to check if the server is up
29
+ *
30
+ * @generated from rpc connectrpc.lage.v1.LageService.Ping
31
+ */ ping: {
32
+ name: "Ping",
33
+ I: _lage_pb.PingRequest,
34
+ O: _lage_pb.PingResponse,
35
+ kind: _protobuf.MethodKind.Unary
26
36
  }
27
37
  }
28
38
  };
@@ -38,17 +38,29 @@ export declare class RunTargetRequest extends Message<RunTargetRequest> {
38
38
  */
39
39
  export declare class RunTargetResponse extends Message<RunTargetResponse> {
40
40
  /**
41
- * @generated from field: optional string package_name = 1;
41
+ * @generated from field: string id = 1;
42
+ */
43
+ id: string;
44
+ /**
45
+ * @generated from field: optional string package_name = 2;
42
46
  */
43
47
  packageName?: string;
44
48
  /**
45
- * @generated from field: string task = 2;
49
+ * @generated from field: string task = 3;
46
50
  */
47
51
  task: string;
48
52
  /**
49
- * @generated from field: int32 exit_code = 5;
53
+ * @generated from field: int32 exit_code = 4;
50
54
  */
51
55
  exitCode: number;
56
+ /**
57
+ * @generated from field: repeated string inputs = 5;
58
+ */
59
+ inputs: string[];
60
+ /**
61
+ * @generated from field: repeated string outputs = 6;
62
+ */
63
+ outputs: string[];
52
64
  constructor(data?: PartialMessage<RunTargetResponse>);
53
65
  static readonly runtime: typeof proto3;
54
66
  static readonly typeName = "connectrpc.lage.v1.RunTargetResponse";
@@ -58,3 +70,33 @@ export declare class RunTargetResponse extends Message<RunTargetResponse> {
58
70
  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RunTargetResponse;
59
71
  static equals(a: RunTargetResponse | PlainMessage<RunTargetResponse> | undefined, b: RunTargetResponse | PlainMessage<RunTargetResponse> | undefined): boolean;
60
72
  }
73
+ /**
74
+ * @generated from message connectrpc.lage.v1.PingRequest
75
+ */
76
+ export declare class PingRequest extends Message<PingRequest> {
77
+ constructor(data?: PartialMessage<PingRequest>);
78
+ static readonly runtime: typeof proto3;
79
+ static readonly typeName = "connectrpc.lage.v1.PingRequest";
80
+ static readonly fields: FieldList;
81
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingRequest;
82
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingRequest;
83
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingRequest;
84
+ static equals(a: PingRequest | PlainMessage<PingRequest> | undefined, b: PingRequest | PlainMessage<PingRequest> | undefined): boolean;
85
+ }
86
+ /**
87
+ * @generated from message connectrpc.lage.v1.PingResponse
88
+ */
89
+ export declare class PingResponse extends Message<PingResponse> {
90
+ /**
91
+ * @generated from field: bool pong = 1;
92
+ */
93
+ pong: boolean;
94
+ constructor(data?: PartialMessage<PingResponse>);
95
+ static readonly runtime: typeof proto3;
96
+ static readonly typeName = "connectrpc.lage.v1.PingResponse";
97
+ static readonly fields: FieldList;
98
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingResponse;
99
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingResponse;
100
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingResponse;
101
+ static equals(a: PingResponse | PlainMessage<PingResponse> | undefined, b: PingResponse | PlainMessage<PingResponse> | undefined): boolean;
102
+ }
@@ -17,6 +17,12 @@ _export(exports, {
17
17
  },
18
18
  RunTargetResponse: function() {
19
19
  return RunTargetResponse;
20
+ },
21
+ PingRequest: function() {
22
+ return PingRequest;
23
+ },
24
+ PingResponse: function() {
25
+ return PingResponse;
20
26
  }
21
27
  });
22
28
  const _protobuf = require("@bufbuild/protobuf");
@@ -118,14 +124,23 @@ class RunTargetResponse extends _protobuf.Message {
118
124
  constructor(data){
119
125
  super();
120
126
  /**
121
- * @generated from field: optional string package_name = 1;
127
+ * @generated from field: string id = 1;
128
+ */ _define_property(this, "id", "");
129
+ /**
130
+ * @generated from field: optional string package_name = 2;
122
131
  */ _define_property(this, "packageName", void 0);
123
132
  /**
124
- * @generated from field: string task = 2;
133
+ * @generated from field: string task = 3;
125
134
  */ _define_property(this, "task", "");
126
135
  /**
127
- * @generated from field: int32 exit_code = 5;
136
+ * @generated from field: int32 exit_code = 4;
128
137
  */ _define_property(this, "exitCode", 0);
138
+ /**
139
+ * @generated from field: repeated string inputs = 5;
140
+ */ _define_property(this, "inputs", []);
141
+ /**
142
+ * @generated from field: repeated string outputs = 6;
143
+ */ _define_property(this, "outputs", []);
129
144
  _protobuf.proto3.util.initPartial(data, this);
130
145
  }
131
146
  }
@@ -134,21 +149,93 @@ _define_property(RunTargetResponse, "typeName", "connectrpc.lage.v1.RunTargetRes
134
149
  _define_property(RunTargetResponse, "fields", _protobuf.proto3.util.newFieldList(()=>[
135
150
  {
136
151
  no: 1,
152
+ name: "id",
153
+ kind: "scalar",
154
+ T: 9 /* ScalarType.STRING */
155
+ },
156
+ {
157
+ no: 2,
137
158
  name: "package_name",
138
159
  kind: "scalar",
139
160
  T: 9 /* ScalarType.STRING */ ,
140
161
  opt: true
141
162
  },
142
163
  {
143
- no: 2,
164
+ no: 3,
144
165
  name: "task",
145
166
  kind: "scalar",
146
167
  T: 9 /* ScalarType.STRING */
147
168
  },
148
169
  {
149
- no: 5,
170
+ no: 4,
150
171
  name: "exit_code",
151
172
  kind: "scalar",
152
173
  T: 5 /* ScalarType.INT32 */
174
+ },
175
+ {
176
+ no: 5,
177
+ name: "inputs",
178
+ kind: "scalar",
179
+ T: 9 /* ScalarType.STRING */ ,
180
+ repeated: true
181
+ },
182
+ {
183
+ no: 6,
184
+ name: "outputs",
185
+ kind: "scalar",
186
+ T: 9 /* ScalarType.STRING */ ,
187
+ repeated: true
188
+ }
189
+ ]));
190
+ class PingRequest extends _protobuf.Message {
191
+ static fromBinary(bytes, options) {
192
+ return new PingRequest().fromBinary(bytes, options);
193
+ }
194
+ static fromJson(jsonValue, options) {
195
+ return new PingRequest().fromJson(jsonValue, options);
196
+ }
197
+ static fromJsonString(jsonString, options) {
198
+ return new PingRequest().fromJsonString(jsonString, options);
199
+ }
200
+ static equals(a, b) {
201
+ return _protobuf.proto3.util.equals(PingRequest, a, b);
202
+ }
203
+ constructor(data){
204
+ super();
205
+ _protobuf.proto3.util.initPartial(data, this);
206
+ }
207
+ }
208
+ _define_property(PingRequest, "runtime", _protobuf.proto3);
209
+ _define_property(PingRequest, "typeName", "connectrpc.lage.v1.PingRequest");
210
+ _define_property(PingRequest, "fields", _protobuf.proto3.util.newFieldList(()=>[]));
211
+ class PingResponse extends _protobuf.Message {
212
+ static fromBinary(bytes, options) {
213
+ return new PingResponse().fromBinary(bytes, options);
214
+ }
215
+ static fromJson(jsonValue, options) {
216
+ return new PingResponse().fromJson(jsonValue, options);
217
+ }
218
+ static fromJsonString(jsonString, options) {
219
+ return new PingResponse().fromJsonString(jsonString, options);
220
+ }
221
+ static equals(a, b) {
222
+ return _protobuf.proto3.util.equals(PingResponse, a, b);
223
+ }
224
+ constructor(data){
225
+ super();
226
+ /**
227
+ * @generated from field: bool pong = 1;
228
+ */ _define_property(this, "pong", false);
229
+ _protobuf.proto3.util.initPartial(data, this);
230
+ }
231
+ }
232
+ _define_property(PingResponse, "runtime", _protobuf.proto3);
233
+ _define_property(PingResponse, "typeName", "connectrpc.lage.v1.PingResponse");
234
+ _define_property(PingResponse, "fields", _protobuf.proto3.util.newFieldList(()=>[
235
+ {
236
+ no: 1,
237
+ name: "pong",
238
+ kind: "scalar",
239
+ T: 8 /* ScalarType.BOOL */
153
240
  }
154
241
  ]));
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createServer } from "./createServer.js";
2
- export { createClient } from "./createClient.js";
2
+ export { createClient, type LageClient } from "./createClient.js";
3
3
  export type { ILageService } from "./types/ILageService.js";
4
+ export { ConnectError } from "@connectrpc/connect";
package/lib/index.js CHANGED
@@ -14,7 +14,11 @@ _export(exports, {
14
14
  },
15
15
  createClient: function() {
16
16
  return _createClient.createClient;
17
+ },
18
+ ConnectError: function() {
19
+ return _connect.ConnectError;
17
20
  }
18
21
  });
19
22
  const _createServer = require("./createServer.js");
20
23
  const _createClient = require("./createClient.js");
24
+ const _connect = require("@connectrpc/connect");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/rpc",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "RPC server and client for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,11 +11,23 @@ message RunTargetRequest {
11
11
  }
12
12
 
13
13
  message RunTargetResponse {
14
- optional string package_name = 1;
15
- string task = 2;
16
- int32 exit_code = 5;
14
+ string id = 1;
15
+ optional string package_name = 2;
16
+ string task = 3;
17
+ int32 exit_code = 4;
18
+ repeated string inputs = 5;
19
+ repeated string outputs = 6;
20
+ }
21
+
22
+ message PingRequest {}
23
+ message PingResponse {
24
+ bool pong = 1;
17
25
  }
18
26
 
27
+
19
28
  service LageService {
20
29
  rpc RunTarget(RunTargetRequest) returns (RunTargetResponse) {}
30
+
31
+ // a ping function to check if the server is up
32
+ rpc Ping(PingRequest) returns (PingResponse) {}
21
33
  }