@devvit/protos 0.12.10-next-2026-01-21-17-40-42-3d921c2c6.0 → 0.12.10-next-2026-01-21-18-29-37-ff3afef42.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/json/devvit/runtime/orchestrator.d.ts +16 -0
- package/json/devvit/runtime/orchestrator.d.ts.map +1 -0
- package/json/devvit/runtime/orchestrator.js +8 -0
- package/package.json +4 -4
- package/schema/devvit/runtime/orchestrator.proto +27 -0
- package/schema/snootobuf.lock +0 -0
- package/schema/snootobuf.redditapi.lock +0 -0
- package/types/devvit/runtime/orchestrator.d.ts +143 -0
- package/types/devvit/runtime/orchestrator.d.ts.map +1 -0
- package/types/devvit/runtime/orchestrator.js +251 -0
- package/types/devvit/runtime/orchestrator.twirp-client.d.ts +22 -0
- package/types/devvit/runtime/orchestrator.twirp-client.d.ts.map +1 -0
- package/types/devvit/runtime/orchestrator.twirp-client.js +35 -0
- package/types/devvit/runtime/orchestrator.twirp.d.ts +13 -0
- package/types/devvit/runtime/orchestrator.twirp.d.ts.map +1 -0
- package/types/devvit/runtime/orchestrator.twirp.js +156 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #orchestrator.ts
|
|
3
|
+
*
|
|
4
|
+
* Code generated by ts-proto. DO NOT EDIT.
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
export type SetDeploymentRequest = {
|
|
8
|
+
installationId: string;
|
|
9
|
+
appVersionId: string;
|
|
10
|
+
};
|
|
11
|
+
export type SetDeploymentResponse = {};
|
|
12
|
+
export type DeleteDeploymentRequest = {
|
|
13
|
+
installationId: string;
|
|
14
|
+
};
|
|
15
|
+
export type DeleteDeploymentResponse = {};
|
|
16
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../../src/json/devvit/runtime/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,EACnC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,EACtC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/protos",
|
|
3
|
-
"version": "0.12.10-next-2026-01-21-
|
|
3
|
+
"version": "0.12.10-next-2026-01-21-18-29-37-ff3afef42.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@ampproject/filesize": "4.3.0",
|
|
68
|
-
"@devvit/repo-tools": "0.12.10-next-2026-01-21-
|
|
69
|
-
"@devvit/tsconfig": "0.12.10-next-2026-01-21-
|
|
68
|
+
"@devvit/repo-tools": "0.12.10-next-2026-01-21-18-29-37-ff3afef42.0",
|
|
69
|
+
"@devvit/tsconfig": "0.12.10-next-2026-01-21-18-29-37-ff3afef42.0",
|
|
70
70
|
"@protobuf-ts/plugin": "2.9.3",
|
|
71
71
|
"chokidar-cli": "3.0.0",
|
|
72
72
|
"esbuild": "0.25.9",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "9104a0a136475268fa6fbd16cccb2f518953b4c3"
|
|
100
100
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package devvit.runtime;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.snooguts.net/reddit/reddit-devplatform-monorepo/go-common/generated/protos/types/devvit/runtime";
|
|
6
|
+
option java_package = "com.reddit.devvit.runtime";
|
|
7
|
+
|
|
8
|
+
message SetDeploymentRequest {
|
|
9
|
+
string installation_id = 1;
|
|
10
|
+
string app_version_id = 2;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message SetDeploymentResponse {}
|
|
14
|
+
|
|
15
|
+
message DeleteDeploymentRequest {
|
|
16
|
+
string installation_id = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message DeleteDeploymentResponse {}
|
|
20
|
+
|
|
21
|
+
// Orchestrator service is for preparing a Devvit app to serve requests for a given installation.
|
|
22
|
+
// Orchestrators should be one-to-one with hosting environments, and should manage what apps exist
|
|
23
|
+
// in that environment.
|
|
24
|
+
service Orchestrator {
|
|
25
|
+
rpc SetDeployment(SetDeploymentRequest) returns (SetDeploymentResponse);
|
|
26
|
+
rpc DeleteDeployment(DeleteDeploymentRequest) returns (DeleteDeploymentResponse);
|
|
27
|
+
}
|
package/schema/snootobuf.lock
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #orchestrator.ts
|
|
3
|
+
*
|
|
4
|
+
* Code generated by ts-proto. DO NOT EDIT.
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import _m0 from "protobufjs/minimal.js";
|
|
8
|
+
import { Metadata } from "../../../lib/Types.js";
|
|
9
|
+
export interface SetDeploymentRequest {
|
|
10
|
+
installationId: string;
|
|
11
|
+
appVersionId: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SetDeploymentResponse {
|
|
14
|
+
}
|
|
15
|
+
export interface DeleteDeploymentRequest {
|
|
16
|
+
installationId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DeleteDeploymentResponse {
|
|
19
|
+
}
|
|
20
|
+
export declare const SetDeploymentRequest: {
|
|
21
|
+
$type: "devvit.runtime.SetDeploymentRequest";
|
|
22
|
+
encode(message: SetDeploymentRequest, writer?: _m0.Writer): _m0.Writer;
|
|
23
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SetDeploymentRequest;
|
|
24
|
+
fromJSON(object: any): SetDeploymentRequest;
|
|
25
|
+
toJSON(message: SetDeploymentRequest): unknown;
|
|
26
|
+
create(base?: DeepPartial<SetDeploymentRequest>): SetDeploymentRequest;
|
|
27
|
+
fromPartial(object: DeepPartial<SetDeploymentRequest>): SetDeploymentRequest;
|
|
28
|
+
};
|
|
29
|
+
export declare const SetDeploymentResponse: {
|
|
30
|
+
$type: "devvit.runtime.SetDeploymentResponse";
|
|
31
|
+
encode(_: SetDeploymentResponse, writer?: _m0.Writer): _m0.Writer;
|
|
32
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SetDeploymentResponse;
|
|
33
|
+
fromJSON(_: any): SetDeploymentResponse;
|
|
34
|
+
toJSON(_: SetDeploymentResponse): unknown;
|
|
35
|
+
create(base?: DeepPartial<SetDeploymentResponse>): SetDeploymentResponse;
|
|
36
|
+
fromPartial(_: DeepPartial<SetDeploymentResponse>): SetDeploymentResponse;
|
|
37
|
+
};
|
|
38
|
+
export declare const DeleteDeploymentRequest: {
|
|
39
|
+
$type: "devvit.runtime.DeleteDeploymentRequest";
|
|
40
|
+
encode(message: DeleteDeploymentRequest, writer?: _m0.Writer): _m0.Writer;
|
|
41
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteDeploymentRequest;
|
|
42
|
+
fromJSON(object: any): DeleteDeploymentRequest;
|
|
43
|
+
toJSON(message: DeleteDeploymentRequest): unknown;
|
|
44
|
+
create(base?: DeepPartial<DeleteDeploymentRequest>): DeleteDeploymentRequest;
|
|
45
|
+
fromPartial(object: DeepPartial<DeleteDeploymentRequest>): DeleteDeploymentRequest;
|
|
46
|
+
};
|
|
47
|
+
export declare const DeleteDeploymentResponse: {
|
|
48
|
+
$type: "devvit.runtime.DeleteDeploymentResponse";
|
|
49
|
+
encode(_: DeleteDeploymentResponse, writer?: _m0.Writer): _m0.Writer;
|
|
50
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteDeploymentResponse;
|
|
51
|
+
fromJSON(_: any): DeleteDeploymentResponse;
|
|
52
|
+
toJSON(_: DeleteDeploymentResponse): unknown;
|
|
53
|
+
create(base?: DeepPartial<DeleteDeploymentResponse>): DeleteDeploymentResponse;
|
|
54
|
+
fromPartial(_: DeepPartial<DeleteDeploymentResponse>): DeleteDeploymentResponse;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Orchestrator service is for preparing a Devvit app to serve requests for a given installation.
|
|
58
|
+
* Orchestrators should be one-to-one with hosting environments, and should manage what apps exist
|
|
59
|
+
* in that environment.
|
|
60
|
+
*/
|
|
61
|
+
export interface Orchestrator {
|
|
62
|
+
SetDeployment(request: SetDeploymentRequest, metadata?: Metadata): Promise<SetDeploymentResponse>;
|
|
63
|
+
DeleteDeployment(request: DeleteDeploymentRequest, metadata?: Metadata): Promise<DeleteDeploymentResponse>;
|
|
64
|
+
}
|
|
65
|
+
export declare const OrchestratorServiceName = "devvit.runtime.Orchestrator";
|
|
66
|
+
export declare class OrchestratorClientImpl implements Orchestrator {
|
|
67
|
+
private readonly rpc;
|
|
68
|
+
private readonly service;
|
|
69
|
+
constructor(rpc: Rpc, opts?: {
|
|
70
|
+
service?: string;
|
|
71
|
+
});
|
|
72
|
+
SetDeployment(request: SetDeploymentRequest, metadata?: Metadata): Promise<SetDeploymentResponse>;
|
|
73
|
+
DeleteDeployment(request: DeleteDeploymentRequest, metadata?: Metadata): Promise<DeleteDeploymentResponse>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Orchestrator service is for preparing a Devvit app to serve requests for a given installation.
|
|
77
|
+
* Orchestrators should be one-to-one with hosting environments, and should manage what apps exist
|
|
78
|
+
* in that environment.
|
|
79
|
+
*/
|
|
80
|
+
export type OrchestratorDefinition = typeof OrchestratorDefinition;
|
|
81
|
+
export declare const OrchestratorDefinition: {
|
|
82
|
+
readonly name: "Orchestrator";
|
|
83
|
+
readonly fullName: "devvit.runtime.Orchestrator";
|
|
84
|
+
readonly methods: {
|
|
85
|
+
readonly setDeployment: {
|
|
86
|
+
readonly name: "SetDeployment";
|
|
87
|
+
readonly requestType: {
|
|
88
|
+
$type: "devvit.runtime.SetDeploymentRequest";
|
|
89
|
+
encode(message: SetDeploymentRequest, writer?: _m0.Writer): _m0.Writer;
|
|
90
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SetDeploymentRequest;
|
|
91
|
+
fromJSON(object: any): SetDeploymentRequest;
|
|
92
|
+
toJSON(message: SetDeploymentRequest): unknown;
|
|
93
|
+
create(base?: DeepPartial<SetDeploymentRequest>): SetDeploymentRequest;
|
|
94
|
+
fromPartial(object: DeepPartial<SetDeploymentRequest>): SetDeploymentRequest;
|
|
95
|
+
};
|
|
96
|
+
readonly requestStream: false;
|
|
97
|
+
readonly responseType: {
|
|
98
|
+
$type: "devvit.runtime.SetDeploymentResponse";
|
|
99
|
+
encode(_: SetDeploymentResponse, writer?: _m0.Writer): _m0.Writer;
|
|
100
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): SetDeploymentResponse;
|
|
101
|
+
fromJSON(_: any): SetDeploymentResponse;
|
|
102
|
+
toJSON(_: SetDeploymentResponse): unknown;
|
|
103
|
+
create(base?: DeepPartial<SetDeploymentResponse>): SetDeploymentResponse;
|
|
104
|
+
fromPartial(_: DeepPartial<SetDeploymentResponse>): SetDeploymentResponse;
|
|
105
|
+
};
|
|
106
|
+
readonly responseStream: false;
|
|
107
|
+
readonly options: {};
|
|
108
|
+
};
|
|
109
|
+
readonly deleteDeployment: {
|
|
110
|
+
readonly name: "DeleteDeployment";
|
|
111
|
+
readonly requestType: {
|
|
112
|
+
$type: "devvit.runtime.DeleteDeploymentRequest";
|
|
113
|
+
encode(message: DeleteDeploymentRequest, writer?: _m0.Writer): _m0.Writer;
|
|
114
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteDeploymentRequest;
|
|
115
|
+
fromJSON(object: any): DeleteDeploymentRequest;
|
|
116
|
+
toJSON(message: DeleteDeploymentRequest): unknown;
|
|
117
|
+
create(base?: DeepPartial<DeleteDeploymentRequest>): DeleteDeploymentRequest;
|
|
118
|
+
fromPartial(object: DeepPartial<DeleteDeploymentRequest>): DeleteDeploymentRequest;
|
|
119
|
+
};
|
|
120
|
+
readonly requestStream: false;
|
|
121
|
+
readonly responseType: {
|
|
122
|
+
$type: "devvit.runtime.DeleteDeploymentResponse";
|
|
123
|
+
encode(_: DeleteDeploymentResponse, writer?: _m0.Writer): _m0.Writer;
|
|
124
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteDeploymentResponse;
|
|
125
|
+
fromJSON(_: any): DeleteDeploymentResponse;
|
|
126
|
+
toJSON(_: DeleteDeploymentResponse): unknown;
|
|
127
|
+
create(base?: DeepPartial<DeleteDeploymentResponse>): DeleteDeploymentResponse;
|
|
128
|
+
fromPartial(_: DeepPartial<DeleteDeploymentResponse>): DeleteDeploymentResponse;
|
|
129
|
+
};
|
|
130
|
+
readonly responseStream: false;
|
|
131
|
+
readonly options: {};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
interface Rpc {
|
|
136
|
+
request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
|
|
137
|
+
}
|
|
138
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
139
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
140
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
141
|
+
} : Partial<T>;
|
|
142
|
+
export {};
|
|
143
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 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C,GAAG,wBAAwB;+BAG/D,WAAW,CAAC,wBAAwB,CAAC,GAAG,wBAAwB;;;;;;CAoEvE,CAAC;AAEX,UAAU,GAAG;IACX,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtG;AAED,KAAK,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,GACvC,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACrD,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #orchestrator.ts
|
|
3
|
+
*
|
|
4
|
+
* Code generated by ts-proto. DO NOT EDIT.
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import _m0 from "protobufjs/minimal.js";
|
|
9
|
+
import { messageTypeRegistry } from "../../typeRegistry.js";
|
|
10
|
+
function createBaseSetDeploymentRequest() {
|
|
11
|
+
return { installationId: "", appVersionId: "" };
|
|
12
|
+
}
|
|
13
|
+
export const SetDeploymentRequest = {
|
|
14
|
+
$type: "devvit.runtime.SetDeploymentRequest",
|
|
15
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
16
|
+
if (message.installationId !== "") {
|
|
17
|
+
writer.uint32(10).string(message.installationId);
|
|
18
|
+
}
|
|
19
|
+
if (message.appVersionId !== "") {
|
|
20
|
+
writer.uint32(18).string(message.appVersionId);
|
|
21
|
+
}
|
|
22
|
+
return writer;
|
|
23
|
+
},
|
|
24
|
+
decode(input, length) {
|
|
25
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
26
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
27
|
+
const message = createBaseSetDeploymentRequest();
|
|
28
|
+
while (reader.pos < end) {
|
|
29
|
+
const tag = reader.uint32();
|
|
30
|
+
switch (tag >>> 3) {
|
|
31
|
+
case 1:
|
|
32
|
+
if (tag !== 10) {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
message.installationId = reader.string();
|
|
36
|
+
continue;
|
|
37
|
+
case 2:
|
|
38
|
+
if (tag !== 18) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
message.appVersionId = reader.string();
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
reader.skipType(tag & 7);
|
|
48
|
+
}
|
|
49
|
+
return message;
|
|
50
|
+
},
|
|
51
|
+
fromJSON(object) {
|
|
52
|
+
return {
|
|
53
|
+
installationId: isSet(object.installationId) ? globalThis.String(object.installationId) : "",
|
|
54
|
+
appVersionId: isSet(object.appVersionId) ? globalThis.String(object.appVersionId) : "",
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
toJSON(message) {
|
|
58
|
+
const obj = {};
|
|
59
|
+
if (message.installationId !== "") {
|
|
60
|
+
obj.installationId = message.installationId;
|
|
61
|
+
}
|
|
62
|
+
if (message.appVersionId !== "") {
|
|
63
|
+
obj.appVersionId = message.appVersionId;
|
|
64
|
+
}
|
|
65
|
+
return obj;
|
|
66
|
+
},
|
|
67
|
+
create(base) {
|
|
68
|
+
return SetDeploymentRequest.fromPartial(base ?? {});
|
|
69
|
+
},
|
|
70
|
+
fromPartial(object) {
|
|
71
|
+
const message = createBaseSetDeploymentRequest();
|
|
72
|
+
message.installationId = object.installationId ?? "";
|
|
73
|
+
message.appVersionId = object.appVersionId ?? "";
|
|
74
|
+
return message;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
messageTypeRegistry.set(SetDeploymentRequest.$type, SetDeploymentRequest);
|
|
78
|
+
function createBaseSetDeploymentResponse() {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
export const SetDeploymentResponse = {
|
|
82
|
+
$type: "devvit.runtime.SetDeploymentResponse",
|
|
83
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
84
|
+
return writer;
|
|
85
|
+
},
|
|
86
|
+
decode(input, length) {
|
|
87
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
88
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
89
|
+
const message = createBaseSetDeploymentResponse();
|
|
90
|
+
while (reader.pos < end) {
|
|
91
|
+
const tag = reader.uint32();
|
|
92
|
+
switch (tag >>> 3) {
|
|
93
|
+
}
|
|
94
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
reader.skipType(tag & 7);
|
|
98
|
+
}
|
|
99
|
+
return message;
|
|
100
|
+
},
|
|
101
|
+
fromJSON(_) {
|
|
102
|
+
return {};
|
|
103
|
+
},
|
|
104
|
+
toJSON(_) {
|
|
105
|
+
const obj = {};
|
|
106
|
+
return obj;
|
|
107
|
+
},
|
|
108
|
+
create(base) {
|
|
109
|
+
return SetDeploymentResponse.fromPartial(base ?? {});
|
|
110
|
+
},
|
|
111
|
+
fromPartial(_) {
|
|
112
|
+
const message = createBaseSetDeploymentResponse();
|
|
113
|
+
return message;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
messageTypeRegistry.set(SetDeploymentResponse.$type, SetDeploymentResponse);
|
|
117
|
+
function createBaseDeleteDeploymentRequest() {
|
|
118
|
+
return { installationId: "" };
|
|
119
|
+
}
|
|
120
|
+
export const DeleteDeploymentRequest = {
|
|
121
|
+
$type: "devvit.runtime.DeleteDeploymentRequest",
|
|
122
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
123
|
+
if (message.installationId !== "") {
|
|
124
|
+
writer.uint32(10).string(message.installationId);
|
|
125
|
+
}
|
|
126
|
+
return writer;
|
|
127
|
+
},
|
|
128
|
+
decode(input, length) {
|
|
129
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
130
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
131
|
+
const message = createBaseDeleteDeploymentRequest();
|
|
132
|
+
while (reader.pos < end) {
|
|
133
|
+
const tag = reader.uint32();
|
|
134
|
+
switch (tag >>> 3) {
|
|
135
|
+
case 1:
|
|
136
|
+
if (tag !== 10) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
message.installationId = reader.string();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
reader.skipType(tag & 7);
|
|
146
|
+
}
|
|
147
|
+
return message;
|
|
148
|
+
},
|
|
149
|
+
fromJSON(object) {
|
|
150
|
+
return { installationId: isSet(object.installationId) ? globalThis.String(object.installationId) : "" };
|
|
151
|
+
},
|
|
152
|
+
toJSON(message) {
|
|
153
|
+
const obj = {};
|
|
154
|
+
if (message.installationId !== "") {
|
|
155
|
+
obj.installationId = message.installationId;
|
|
156
|
+
}
|
|
157
|
+
return obj;
|
|
158
|
+
},
|
|
159
|
+
create(base) {
|
|
160
|
+
return DeleteDeploymentRequest.fromPartial(base ?? {});
|
|
161
|
+
},
|
|
162
|
+
fromPartial(object) {
|
|
163
|
+
const message = createBaseDeleteDeploymentRequest();
|
|
164
|
+
message.installationId = object.installationId ?? "";
|
|
165
|
+
return message;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
messageTypeRegistry.set(DeleteDeploymentRequest.$type, DeleteDeploymentRequest);
|
|
169
|
+
function createBaseDeleteDeploymentResponse() {
|
|
170
|
+
return {};
|
|
171
|
+
}
|
|
172
|
+
export const DeleteDeploymentResponse = {
|
|
173
|
+
$type: "devvit.runtime.DeleteDeploymentResponse",
|
|
174
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
175
|
+
return writer;
|
|
176
|
+
},
|
|
177
|
+
decode(input, length) {
|
|
178
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
179
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
180
|
+
const message = createBaseDeleteDeploymentResponse();
|
|
181
|
+
while (reader.pos < end) {
|
|
182
|
+
const tag = reader.uint32();
|
|
183
|
+
switch (tag >>> 3) {
|
|
184
|
+
}
|
|
185
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
reader.skipType(tag & 7);
|
|
189
|
+
}
|
|
190
|
+
return message;
|
|
191
|
+
},
|
|
192
|
+
fromJSON(_) {
|
|
193
|
+
return {};
|
|
194
|
+
},
|
|
195
|
+
toJSON(_) {
|
|
196
|
+
const obj = {};
|
|
197
|
+
return obj;
|
|
198
|
+
},
|
|
199
|
+
create(base) {
|
|
200
|
+
return DeleteDeploymentResponse.fromPartial(base ?? {});
|
|
201
|
+
},
|
|
202
|
+
fromPartial(_) {
|
|
203
|
+
const message = createBaseDeleteDeploymentResponse();
|
|
204
|
+
return message;
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
messageTypeRegistry.set(DeleteDeploymentResponse.$type, DeleteDeploymentResponse);
|
|
208
|
+
export const OrchestratorServiceName = "devvit.runtime.Orchestrator";
|
|
209
|
+
export class OrchestratorClientImpl {
|
|
210
|
+
constructor(rpc, opts) {
|
|
211
|
+
this.service = opts?.service || OrchestratorServiceName;
|
|
212
|
+
this.rpc = rpc;
|
|
213
|
+
this.SetDeployment = this.SetDeployment.bind(this);
|
|
214
|
+
this.DeleteDeployment = this.DeleteDeployment.bind(this);
|
|
215
|
+
}
|
|
216
|
+
SetDeployment(request, metadata) {
|
|
217
|
+
const data = SetDeploymentRequest.encode(request).finish();
|
|
218
|
+
const promise = this.rpc.request(this.service, "SetDeployment", data, metadata);
|
|
219
|
+
return promise.then((data) => SetDeploymentResponse.decode(_m0.Reader.create(data)));
|
|
220
|
+
}
|
|
221
|
+
DeleteDeployment(request, metadata) {
|
|
222
|
+
const data = DeleteDeploymentRequest.encode(request).finish();
|
|
223
|
+
const promise = this.rpc.request(this.service, "DeleteDeployment", data, metadata);
|
|
224
|
+
return promise.then((data) => DeleteDeploymentResponse.decode(_m0.Reader.create(data)));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
export const OrchestratorDefinition = {
|
|
228
|
+
name: "Orchestrator",
|
|
229
|
+
fullName: "devvit.runtime.Orchestrator",
|
|
230
|
+
methods: {
|
|
231
|
+
setDeployment: {
|
|
232
|
+
name: "SetDeployment",
|
|
233
|
+
requestType: SetDeploymentRequest,
|
|
234
|
+
requestStream: false,
|
|
235
|
+
responseType: SetDeploymentResponse,
|
|
236
|
+
responseStream: false,
|
|
237
|
+
options: {},
|
|
238
|
+
},
|
|
239
|
+
deleteDeployment: {
|
|
240
|
+
name: "DeleteDeployment",
|
|
241
|
+
requestType: DeleteDeploymentRequest,
|
|
242
|
+
requestStream: false,
|
|
243
|
+
responseType: DeleteDeploymentResponse,
|
|
244
|
+
responseStream: false,
|
|
245
|
+
options: {},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
function isSet(value) {
|
|
250
|
+
return value !== null && value !== undefined;
|
|
251
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SetDeploymentRequest, SetDeploymentResponse, DeleteDeploymentRequest, DeleteDeploymentResponse } from './orchestrator.js';
|
|
2
|
+
interface Rpc {
|
|
3
|
+
request(service: string, method: string, contentType: 'application/json' | 'application/protobuf', data: object | Uint8Array): Promise<object | Uint8Array>;
|
|
4
|
+
}
|
|
5
|
+
export interface OrchestratorClient {
|
|
6
|
+
SetDeployment(request: SetDeploymentRequest): Promise<SetDeploymentResponse>;
|
|
7
|
+
DeleteDeployment(request: DeleteDeploymentRequest): Promise<DeleteDeploymentResponse>;
|
|
8
|
+
}
|
|
9
|
+
export declare class OrchestratorClientJSON implements OrchestratorClient {
|
|
10
|
+
private readonly rpc;
|
|
11
|
+
constructor(rpc: Rpc);
|
|
12
|
+
SetDeployment(request: SetDeploymentRequest): Promise<SetDeploymentResponse>;
|
|
13
|
+
DeleteDeployment(request: DeleteDeploymentRequest): Promise<DeleteDeploymentResponse>;
|
|
14
|
+
}
|
|
15
|
+
export declare class OrchestratorClientProtobuf implements OrchestratorClient {
|
|
16
|
+
private readonly rpc;
|
|
17
|
+
constructor(rpc: Rpc);
|
|
18
|
+
SetDeployment(request: SetDeploymentRequest): Promise<SetDeploymentResponse>;
|
|
19
|
+
DeleteDeployment(request: DeleteDeploymentRequest): Promise<DeleteDeploymentResponse>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=orchestrator.twirp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.twirp-client.d.ts","sourceRoot":"","sources":["../../../../src/types/devvit/runtime/orchestrator.twirp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAM3B,UAAU,GAAG;IACX,OAAO,CACL,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,GAAG,sBAAsB,EACxD,IAAI,EAAE,MAAM,GAAG,UAAU,GACxB,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7E,gBAAgB,CACd,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtC;AAED,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAKpB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAW5E,gBAAgB,CACd,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAYrC;AAED,qBAAa,0BAA2B,YAAW,kBAAkB;IACnE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAKpB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAa5E,gBAAgB,CACd,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAYrC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SetDeploymentRequest, SetDeploymentResponse, DeleteDeploymentRequest, DeleteDeploymentResponse, } from './orchestrator.js';
|
|
2
|
+
export class OrchestratorClientJSON {
|
|
3
|
+
constructor(rpc) {
|
|
4
|
+
this.rpc = rpc;
|
|
5
|
+
this.SetDeployment.bind(this);
|
|
6
|
+
this.DeleteDeployment.bind(this);
|
|
7
|
+
}
|
|
8
|
+
SetDeployment(request) {
|
|
9
|
+
const data = SetDeploymentRequest.toJSON(request);
|
|
10
|
+
const promise = this.rpc.request('devvit.runtime.Orchestrator', 'SetDeployment', 'application/json', data);
|
|
11
|
+
return promise.then((data) => SetDeploymentResponse.fromJSON(data));
|
|
12
|
+
}
|
|
13
|
+
DeleteDeployment(request) {
|
|
14
|
+
const data = DeleteDeploymentRequest.toJSON(request);
|
|
15
|
+
const promise = this.rpc.request('devvit.runtime.Orchestrator', 'DeleteDeployment', 'application/json', data);
|
|
16
|
+
return promise.then((data) => DeleteDeploymentResponse.fromJSON(data));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class OrchestratorClientProtobuf {
|
|
20
|
+
constructor(rpc) {
|
|
21
|
+
this.rpc = rpc;
|
|
22
|
+
this.SetDeployment.bind(this);
|
|
23
|
+
this.DeleteDeployment.bind(this);
|
|
24
|
+
}
|
|
25
|
+
SetDeployment(request) {
|
|
26
|
+
const data = SetDeploymentRequest.encode(request).finish();
|
|
27
|
+
const promise = this.rpc.request('devvit.runtime.Orchestrator', 'SetDeployment', 'application/protobuf', data);
|
|
28
|
+
return promise.then((data) => SetDeploymentResponse.decode(data));
|
|
29
|
+
}
|
|
30
|
+
DeleteDeployment(request) {
|
|
31
|
+
const data = DeleteDeploymentRequest.encode(request).finish();
|
|
32
|
+
const promise = this.rpc.request('devvit.runtime.Orchestrator', 'DeleteDeployment', 'application/protobuf', data);
|
|
33
|
+
return promise.then((data) => DeleteDeploymentResponse.decode(data));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TwirpContext, TwirpServer } from 'twirp-ts';
|
|
2
|
+
import { SetDeploymentRequest, SetDeploymentResponse, DeleteDeploymentRequest, DeleteDeploymentResponse } from './orchestrator.js';
|
|
3
|
+
export interface OrchestratorTwirp<T extends TwirpContext = TwirpContext> {
|
|
4
|
+
SetDeployment(ctx: T, request: SetDeploymentRequest): Promise<SetDeploymentResponse>;
|
|
5
|
+
DeleteDeployment(ctx: T, request: DeleteDeploymentRequest): Promise<DeleteDeploymentResponse>;
|
|
6
|
+
}
|
|
7
|
+
export declare enum OrchestratorMethod {
|
|
8
|
+
SetDeployment = "SetDeployment",
|
|
9
|
+
DeleteDeployment = "DeleteDeployment"
|
|
10
|
+
}
|
|
11
|
+
export declare const OrchestratorMethodList: OrchestratorMethod[];
|
|
12
|
+
export declare function createOrchestratorServer<T extends TwirpContext = TwirpContext>(service: OrchestratorTwirp<T>): TwirpServer<OrchestratorTwirp<TwirpContext<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>>>, T>;
|
|
13
|
+
//# sourceMappingURL=orchestrator.twirp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.twirp.d.ts","sourceRoot":"","sources":["../../../../src/types/devvit/runtime/orchestrator.twirp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACtE,aAAa,CACX,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClC,gBAAgB,CACd,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtC;AAED,oBAAY,kBAAkB;IAC5B,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;CACtC;AAED,eAAO,MAAM,sBAAsB,sBAGlC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAC5E,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,kJAS9B"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { TwirpServer, TwirpError, TwirpErrorCode, TwirpContentType, chainInterceptors, } from 'twirp-ts';
|
|
2
|
+
import { SetDeploymentRequest, SetDeploymentResponse, DeleteDeploymentRequest, DeleteDeploymentResponse, } from './orchestrator.js';
|
|
3
|
+
export var OrchestratorMethod;
|
|
4
|
+
(function (OrchestratorMethod) {
|
|
5
|
+
OrchestratorMethod["SetDeployment"] = "SetDeployment";
|
|
6
|
+
OrchestratorMethod["DeleteDeployment"] = "DeleteDeployment";
|
|
7
|
+
})(OrchestratorMethod || (OrchestratorMethod = {}));
|
|
8
|
+
export const OrchestratorMethodList = [
|
|
9
|
+
OrchestratorMethod.SetDeployment,
|
|
10
|
+
OrchestratorMethod.DeleteDeployment,
|
|
11
|
+
];
|
|
12
|
+
export function createOrchestratorServer(service) {
|
|
13
|
+
return new TwirpServer({
|
|
14
|
+
service,
|
|
15
|
+
packageName: 'devvit.runtime',
|
|
16
|
+
serviceName: 'Orchestrator',
|
|
17
|
+
methodList: OrchestratorMethodList,
|
|
18
|
+
matchRoute: matchOrchestratorRoute,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function matchOrchestratorRoute(method, events) {
|
|
22
|
+
switch (method) {
|
|
23
|
+
case 'SetDeployment':
|
|
24
|
+
return async (ctx, service, data, interceptors) => {
|
|
25
|
+
ctx = { ...ctx, methodName: 'SetDeployment' };
|
|
26
|
+
await events.onMatch(ctx);
|
|
27
|
+
return handleOrchestratorSetDeploymentRequest(ctx, service, data, interceptors);
|
|
28
|
+
};
|
|
29
|
+
case 'DeleteDeployment':
|
|
30
|
+
return async (ctx, service, data, interceptors) => {
|
|
31
|
+
ctx = { ...ctx, methodName: 'DeleteDeployment' };
|
|
32
|
+
await events.onMatch(ctx);
|
|
33
|
+
return handleOrchestratorDeleteDeploymentRequest(ctx, service, data, interceptors);
|
|
34
|
+
};
|
|
35
|
+
default:
|
|
36
|
+
events.onNotFound();
|
|
37
|
+
const msg = `no handler found`;
|
|
38
|
+
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function handleOrchestratorSetDeploymentRequest(ctx, service, data, interceptors) {
|
|
42
|
+
switch (ctx.contentType) {
|
|
43
|
+
case TwirpContentType.JSON:
|
|
44
|
+
return handleOrchestratorSetDeploymentJSON(ctx, service, data, interceptors);
|
|
45
|
+
case TwirpContentType.Protobuf:
|
|
46
|
+
return handleOrchestratorSetDeploymentProtobuf(ctx, service, data, interceptors);
|
|
47
|
+
default:
|
|
48
|
+
const msg = 'unexpected Content-Type';
|
|
49
|
+
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function handleOrchestratorDeleteDeploymentRequest(ctx, service, data, interceptors) {
|
|
53
|
+
switch (ctx.contentType) {
|
|
54
|
+
case TwirpContentType.JSON:
|
|
55
|
+
return handleOrchestratorDeleteDeploymentJSON(ctx, service, data, interceptors);
|
|
56
|
+
case TwirpContentType.Protobuf:
|
|
57
|
+
return handleOrchestratorDeleteDeploymentProtobuf(ctx, service, data, interceptors);
|
|
58
|
+
default:
|
|
59
|
+
const msg = 'unexpected Content-Type';
|
|
60
|
+
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function handleOrchestratorSetDeploymentJSON(ctx, service, data, interceptors) {
|
|
64
|
+
let request;
|
|
65
|
+
let response;
|
|
66
|
+
try {
|
|
67
|
+
const body = JSON.parse(data.toString() || '{}');
|
|
68
|
+
request = SetDeploymentRequest.fromJSON(body);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
if (e instanceof Error) {
|
|
72
|
+
const msg = 'the json request could not be decoded';
|
|
73
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (interceptors && interceptors.length > 0) {
|
|
77
|
+
const interceptor = chainInterceptors(...interceptors);
|
|
78
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
|
79
|
+
return service.SetDeployment(ctx, inputReq);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
response = await service.SetDeployment(ctx, request);
|
|
84
|
+
}
|
|
85
|
+
return JSON.stringify(SetDeploymentResponse.toJSON(response));
|
|
86
|
+
}
|
|
87
|
+
async function handleOrchestratorDeleteDeploymentJSON(ctx, service, data, interceptors) {
|
|
88
|
+
let request;
|
|
89
|
+
let response;
|
|
90
|
+
try {
|
|
91
|
+
const body = JSON.parse(data.toString() || '{}');
|
|
92
|
+
request = DeleteDeploymentRequest.fromJSON(body);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
if (e instanceof Error) {
|
|
96
|
+
const msg = 'the json request could not be decoded';
|
|
97
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (interceptors && interceptors.length > 0) {
|
|
101
|
+
const interceptor = chainInterceptors(...interceptors);
|
|
102
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
|
103
|
+
return service.DeleteDeployment(ctx, inputReq);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
response = await service.DeleteDeployment(ctx, request);
|
|
108
|
+
}
|
|
109
|
+
return JSON.stringify(DeleteDeploymentResponse.toJSON(response));
|
|
110
|
+
}
|
|
111
|
+
async function handleOrchestratorSetDeploymentProtobuf(ctx, service, data, interceptors) {
|
|
112
|
+
let request;
|
|
113
|
+
let response;
|
|
114
|
+
try {
|
|
115
|
+
request = SetDeploymentRequest.decode(data);
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
if (e instanceof Error) {
|
|
119
|
+
const msg = 'the protobuf request could not be decoded';
|
|
120
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (interceptors && interceptors.length > 0) {
|
|
124
|
+
const interceptor = chainInterceptors(...interceptors);
|
|
125
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
|
126
|
+
return service.SetDeployment(ctx, inputReq);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
response = await service.SetDeployment(ctx, request);
|
|
131
|
+
}
|
|
132
|
+
return Buffer.from(SetDeploymentResponse.encode(response).finish());
|
|
133
|
+
}
|
|
134
|
+
async function handleOrchestratorDeleteDeploymentProtobuf(ctx, service, data, interceptors) {
|
|
135
|
+
let request;
|
|
136
|
+
let response;
|
|
137
|
+
try {
|
|
138
|
+
request = DeleteDeploymentRequest.decode(data);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
if (e instanceof Error) {
|
|
142
|
+
const msg = 'the protobuf request could not be decoded';
|
|
143
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (interceptors && interceptors.length > 0) {
|
|
147
|
+
const interceptor = chainInterceptors(...interceptors);
|
|
148
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
|
149
|
+
return service.DeleteDeployment(ctx, inputReq);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
response = await service.DeleteDeployment(ctx, request);
|
|
154
|
+
}
|
|
155
|
+
return Buffer.from(DeleteDeploymentResponse.encode(response).finish());
|
|
156
|
+
}
|