@lage-run/rpc 1.1.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/CHANGELOG.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@lage-run/rpc",
3
+ "entries": [
4
+ {
5
+ "date": "Fri, 06 Sep 2024 20:02:51 GMT",
6
+ "version": "1.1.0",
7
+ "tag": "@lage-run/rpc_v1.1.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/rpc",
13
+ "commit": "0d2a6f936b7250959f5a42f3c79908b8a475d28d",
14
+ "comment": "remote execution RPC server and client for Lage"
15
+ }
16
+ ]
17
+ }
18
+ }
19
+ ]
20
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Change Log - @lage-run/rpc
2
+
3
+ This log was last generated on Fri, 06 Sep 2024 20:02:51 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## 1.1.0
8
+
9
+ Fri, 06 Sep 2024 20:02:51 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - remote execution RPC server and client for Lage (kchau@microsoft.com)
package/buf.gen.yaml ADDED
@@ -0,0 +1,9 @@
1
+ version: v2
2
+ clean: true
3
+ plugins:
4
+ - local: protoc-gen-es
5
+ out: src/gen
6
+ opt: target=ts
7
+ - local: protoc-gen-connect-es
8
+ out: src/gen
9
+ opt: target=ts
package/buf.yaml ADDED
@@ -0,0 +1,9 @@
1
+ version: v2
2
+ modules:
3
+ - path: proto
4
+ lint:
5
+ use:
6
+ - DEFAULT
7
+ breaking:
8
+ use:
9
+ - FILE
@@ -0,0 +1,15 @@
1
+ export interface CreateClientOptions {
2
+ baseUrl: string;
3
+ httpVersion: "1.1" | "2";
4
+ }
5
+ export declare function createClient({ baseUrl, httpVersion }: CreateClientOptions): import("@connectrpc/connect").PromiseClient<{
6
+ readonly typeName: "connectrpc.lage.v1.LageService";
7
+ readonly methods: {
8
+ readonly runTarget: {
9
+ readonly name: "RunTarget";
10
+ readonly I: typeof import("./gen/lage/v1/lage_pb.js").RunTargetRequest;
11
+ readonly O: typeof import("./gen/lage/v1/lage_pb.js").RunTargetResponse;
12
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
13
+ };
14
+ };
15
+ }>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createClient", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createClient;
9
+ }
10
+ });
11
+ const _connect = require("@connectrpc/connect");
12
+ const _connectnode = require("@connectrpc/connect-node");
13
+ const _lage_connect = require("./gen/lage/v1/lage_connect.js");
14
+ function createClient({ baseUrl , httpVersion }) {
15
+ const transport = (0, _connectnode.createConnectTransport)({
16
+ httpVersion,
17
+ baseUrl
18
+ });
19
+ return (0, _connect.createPromiseClient)(_lage_connect.LageService, transport);
20
+ }
@@ -0,0 +1,3 @@
1
+ import { type ConnectRouter } from "@connectrpc/connect";
2
+ import { type ILageService } from "./types/ILageService.js";
3
+ export declare function createRoutes(serviceImpl: ILageService): (router: ConnectRouter) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createRoutes", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createRoutes;
9
+ }
10
+ });
11
+ const _lage_connect = require("./gen/lage/v1/lage_connect.js");
12
+ function createRoutes(serviceImpl) {
13
+ return (router)=>{
14
+ router.service(_lage_connect.LageService, serviceImpl);
15
+ };
16
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ 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>>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createServer", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createServer;
9
+ }
10
+ });
11
+ const _fastify = require("fastify");
12
+ const _connectfastify = require("@connectrpc/connect-fastify");
13
+ const _createRoutes = require("./createRoutes.js");
14
+ async function createServer(lageService) {
15
+ const server = (0, _fastify.fastify)();
16
+ await server.register(_connectfastify.fastifyConnectPlugin, {
17
+ routes: (0, _createRoutes.createRoutes)(lageService)
18
+ });
19
+ server.get("/", (_, reply)=>{
20
+ reply.type("text/plain");
21
+ reply.send("lage service");
22
+ });
23
+ return server;
24
+ }
@@ -0,0 +1,19 @@
1
+ import { RunTargetRequest, RunTargetResponse } from "./lage_pb.js";
2
+ import { MethodKind } from "@bufbuild/protobuf";
3
+ /**
4
+ * @generated from service connectrpc.lage.v1.LageService
5
+ */
6
+ export declare const LageService: {
7
+ readonly typeName: "connectrpc.lage.v1.LageService";
8
+ readonly methods: {
9
+ /**
10
+ * @generated from rpc connectrpc.lage.v1.LageService.RunTarget
11
+ */
12
+ readonly runTarget: {
13
+ readonly name: "RunTarget";
14
+ readonly I: typeof RunTargetRequest;
15
+ readonly O: typeof RunTargetResponse;
16
+ readonly kind: MethodKind.Unary;
17
+ };
18
+ };
19
+ };
@@ -0,0 +1,28 @@
1
+ // @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
2
+ // @generated from file lage/v1/lage.proto (package connectrpc.lage.v1, syntax proto3)
3
+ /* eslint-disable */ // @ts-nocheck
4
+ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "LageService", {
9
+ enumerable: true,
10
+ get: function() {
11
+ return LageService;
12
+ }
13
+ });
14
+ const _lage_pb = require("./lage_pb.js");
15
+ const _protobuf = require("@bufbuild/protobuf");
16
+ const LageService = {
17
+ typeName: "connectrpc.lage.v1.LageService",
18
+ methods: {
19
+ /**
20
+ * @generated from rpc connectrpc.lage.v1.LageService.RunTarget
21
+ */ runTarget: {
22
+ name: "RunTarget",
23
+ I: _lage_pb.RunTargetRequest,
24
+ O: _lage_pb.RunTargetResponse,
25
+ kind: _protobuf.MethodKind.Unary
26
+ }
27
+ }
28
+ };
@@ -0,0 +1,60 @@
1
+ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
2
+ import { Message, proto3 } from "@bufbuild/protobuf";
3
+ /**
4
+ * @generated from message connectrpc.lage.v1.RunTargetRequest
5
+ */
6
+ export declare class RunTargetRequest extends Message<RunTargetRequest> {
7
+ /**
8
+ * @generated from field: optional string package_name = 1;
9
+ */
10
+ packageName?: string;
11
+ /**
12
+ * @generated from field: string task = 2;
13
+ */
14
+ task: string;
15
+ /**
16
+ * @generated from field: repeated string taskArgs = 3;
17
+ */
18
+ taskArgs: string[];
19
+ /**
20
+ * @generated from field: string nodeOptions = 4;
21
+ */
22
+ nodeOptions: string;
23
+ /**
24
+ * @generated from field: string npmClient = 5;
25
+ */
26
+ npmClient: string;
27
+ constructor(data?: PartialMessage<RunTargetRequest>);
28
+ static readonly runtime: typeof proto3;
29
+ static readonly typeName = "connectrpc.lage.v1.RunTargetRequest";
30
+ static readonly fields: FieldList;
31
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RunTargetRequest;
32
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RunTargetRequest;
33
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RunTargetRequest;
34
+ static equals(a: RunTargetRequest | PlainMessage<RunTargetRequest> | undefined, b: RunTargetRequest | PlainMessage<RunTargetRequest> | undefined): boolean;
35
+ }
36
+ /**
37
+ * @generated from message connectrpc.lage.v1.RunTargetResponse
38
+ */
39
+ export declare class RunTargetResponse extends Message<RunTargetResponse> {
40
+ /**
41
+ * @generated from field: optional string package_name = 1;
42
+ */
43
+ packageName?: string;
44
+ /**
45
+ * @generated from field: string task = 2;
46
+ */
47
+ task: string;
48
+ /**
49
+ * @generated from field: int32 exit_code = 5;
50
+ */
51
+ exitCode: number;
52
+ constructor(data?: PartialMessage<RunTargetResponse>);
53
+ static readonly runtime: typeof proto3;
54
+ static readonly typeName = "connectrpc.lage.v1.RunTargetResponse";
55
+ static readonly fields: FieldList;
56
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RunTargetResponse;
57
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RunTargetResponse;
58
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RunTargetResponse;
59
+ static equals(a: RunTargetResponse | PlainMessage<RunTargetResponse> | undefined, b: RunTargetResponse | PlainMessage<RunTargetResponse> | undefined): boolean;
60
+ }
@@ -0,0 +1,154 @@
1
+ // @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
2
+ // @generated from file lage/v1/lage.proto (package connectrpc.lage.v1, syntax proto3)
3
+ /* eslint-disable */ // @ts-nocheck
4
+ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: all[name]
12
+ });
13
+ }
14
+ _export(exports, {
15
+ RunTargetRequest: function() {
16
+ return RunTargetRequest;
17
+ },
18
+ RunTargetResponse: function() {
19
+ return RunTargetResponse;
20
+ }
21
+ });
22
+ const _protobuf = require("@bufbuild/protobuf");
23
+ function _define_property(obj, key, value) {
24
+ if (key in obj) {
25
+ Object.defineProperty(obj, key, {
26
+ value: value,
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true
30
+ });
31
+ } else {
32
+ obj[key] = value;
33
+ }
34
+ return obj;
35
+ }
36
+ class RunTargetRequest extends _protobuf.Message {
37
+ static fromBinary(bytes, options) {
38
+ return new RunTargetRequest().fromBinary(bytes, options);
39
+ }
40
+ static fromJson(jsonValue, options) {
41
+ return new RunTargetRequest().fromJson(jsonValue, options);
42
+ }
43
+ static fromJsonString(jsonString, options) {
44
+ return new RunTargetRequest().fromJsonString(jsonString, options);
45
+ }
46
+ static equals(a, b) {
47
+ return _protobuf.proto3.util.equals(RunTargetRequest, a, b);
48
+ }
49
+ constructor(data){
50
+ super();
51
+ /**
52
+ * @generated from field: optional string package_name = 1;
53
+ */ _define_property(this, "packageName", void 0);
54
+ /**
55
+ * @generated from field: string task = 2;
56
+ */ _define_property(this, "task", "");
57
+ /**
58
+ * @generated from field: repeated string taskArgs = 3;
59
+ */ _define_property(this, "taskArgs", []);
60
+ /**
61
+ * @generated from field: string nodeOptions = 4;
62
+ */ _define_property(this, "nodeOptions", "");
63
+ /**
64
+ * @generated from field: string npmClient = 5;
65
+ */ _define_property(this, "npmClient", "");
66
+ _protobuf.proto3.util.initPartial(data, this);
67
+ }
68
+ }
69
+ _define_property(RunTargetRequest, "runtime", _protobuf.proto3);
70
+ _define_property(RunTargetRequest, "typeName", "connectrpc.lage.v1.RunTargetRequest");
71
+ _define_property(RunTargetRequest, "fields", _protobuf.proto3.util.newFieldList(()=>[
72
+ {
73
+ no: 1,
74
+ name: "package_name",
75
+ kind: "scalar",
76
+ T: 9 /* ScalarType.STRING */ ,
77
+ opt: true
78
+ },
79
+ {
80
+ no: 2,
81
+ name: "task",
82
+ kind: "scalar",
83
+ T: 9 /* ScalarType.STRING */
84
+ },
85
+ {
86
+ no: 3,
87
+ name: "taskArgs",
88
+ kind: "scalar",
89
+ T: 9 /* ScalarType.STRING */ ,
90
+ repeated: true
91
+ },
92
+ {
93
+ no: 4,
94
+ name: "nodeOptions",
95
+ kind: "scalar",
96
+ T: 9 /* ScalarType.STRING */
97
+ },
98
+ {
99
+ no: 5,
100
+ name: "npmClient",
101
+ kind: "scalar",
102
+ T: 9 /* ScalarType.STRING */
103
+ }
104
+ ]));
105
+ class RunTargetResponse extends _protobuf.Message {
106
+ static fromBinary(bytes, options) {
107
+ return new RunTargetResponse().fromBinary(bytes, options);
108
+ }
109
+ static fromJson(jsonValue, options) {
110
+ return new RunTargetResponse().fromJson(jsonValue, options);
111
+ }
112
+ static fromJsonString(jsonString, options) {
113
+ return new RunTargetResponse().fromJsonString(jsonString, options);
114
+ }
115
+ static equals(a, b) {
116
+ return _protobuf.proto3.util.equals(RunTargetResponse, a, b);
117
+ }
118
+ constructor(data){
119
+ super();
120
+ /**
121
+ * @generated from field: optional string package_name = 1;
122
+ */ _define_property(this, "packageName", void 0);
123
+ /**
124
+ * @generated from field: string task = 2;
125
+ */ _define_property(this, "task", "");
126
+ /**
127
+ * @generated from field: int32 exit_code = 5;
128
+ */ _define_property(this, "exitCode", 0);
129
+ _protobuf.proto3.util.initPartial(data, this);
130
+ }
131
+ }
132
+ _define_property(RunTargetResponse, "runtime", _protobuf.proto3);
133
+ _define_property(RunTargetResponse, "typeName", "connectrpc.lage.v1.RunTargetResponse");
134
+ _define_property(RunTargetResponse, "fields", _protobuf.proto3.util.newFieldList(()=>[
135
+ {
136
+ no: 1,
137
+ name: "package_name",
138
+ kind: "scalar",
139
+ T: 9 /* ScalarType.STRING */ ,
140
+ opt: true
141
+ },
142
+ {
143
+ no: 2,
144
+ name: "task",
145
+ kind: "scalar",
146
+ T: 9 /* ScalarType.STRING */
147
+ },
148
+ {
149
+ no: 5,
150
+ name: "exit_code",
151
+ kind: "scalar",
152
+ T: 5 /* ScalarType.INT32 */
153
+ }
154
+ ]));
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { createServer } from "./createServer.js";
2
+ export { createClient } from "./createClient.js";
3
+ export type { ILageService } from "./types/ILageService.js";
package/lib/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ createServer: function() {
13
+ return _createServer.createServer;
14
+ },
15
+ createClient: function() {
16
+ return _createClient.createClient;
17
+ }
18
+ });
19
+ const _createServer = require("./createServer.js");
20
+ const _createClient = require("./createClient.js");
@@ -0,0 +1,3 @@
1
+ import type { ServiceImpl } from "@connectrpc/connect";
2
+ import type { LageService } from "../gen/lage/v1/lage_connect.js";
3
+ export type ILageService = Partial<ServiceImpl<typeof LageService>>;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@lage-run/rpc",
3
+ "version": "1.1.0",
4
+ "description": "RPC server and client for Lage",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/lage"
8
+ },
9
+ "homepage": "https://microsoft.github.io/lage/",
10
+ "license": "MIT",
11
+ "main": "lib/index.js",
12
+ "types": "lib/index.d.ts",
13
+ "scripts": {
14
+ "lint": "buf lint",
15
+ "generate": "buf generate",
16
+ "build": "tsc"
17
+ },
18
+ "dependencies": {
19
+ "@bufbuild/protobuf": "^1.10.0",
20
+ "@connectrpc/connect": "^1.4.0",
21
+ "@connectrpc/connect-fastify": "^1.4.0",
22
+ "@connectrpc/connect-node": "^1.4.0",
23
+ "fastify": "^4.28.1"
24
+ },
25
+ "devDependencies": {
26
+ "@bufbuild/buf": "^1.39.0",
27
+ "@bufbuild/protoc-gen-es": "^1.10.0",
28
+ "@connectrpc/protoc-gen-connect-es": "^1.4.0",
29
+ "@lage-run/monorepo-scripts": "*"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }
@@ -0,0 +1,21 @@
1
+ syntax = "proto3";
2
+
3
+ package connectrpc.lage.v1;
4
+
5
+ message RunTargetRequest {
6
+ optional string package_name = 1;
7
+ string task = 2;
8
+ repeated string taskArgs = 3;
9
+ string nodeOptions = 4;
10
+ string npmClient = 5;
11
+ }
12
+
13
+ message RunTargetResponse {
14
+ optional string package_name = 1;
15
+ string task = 2;
16
+ int32 exit_code = 5;
17
+ }
18
+
19
+ service LageService {
20
+ rpc RunTarget(RunTargetRequest) returns (RunTargetResponse) {}
21
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.lage2.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib"
5
+ },
6
+ "include": ["src"]
7
+ }