@devvit/protos 0.12.0-next-2025-03-31-81fa43e0f.0 → 0.12.0-next-2025-04-10-a27f59c35.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.
Files changed (39) hide show
  1. package/index.d.ts +2 -0
  2. package/index.d.ts.map +1 -1
  3. package/index.js +1 -0
  4. package/meta.min.json +35 -5
  5. package/package.json +5 -5
  6. package/protos.min.js +1 -1
  7. package/protos.min.js.map +4 -4
  8. package/schema/devvit/actor/webbit/webbit.proto +34 -0
  9. package/schema/devvit/dev_portal/nutrition/nutrition.proto +2 -0
  10. package/schema/devvit/plugin/useractions/useractions.proto +18 -0
  11. package/schema/devvit/ui/effects/web_view/v1alpha/post_message.proto +19 -1
  12. package/schema/snootobuf.devenv.lock +1390 -91
  13. package/schema/snootobuf.lock +1394 -91
  14. package/schema/snootobuf.redditapi.lock +1386 -91
  15. package/schema/snootobuf.ts.lock +1392 -91
  16. package/types/devvit/actor/webbit/webbit.d.ts +131 -0
  17. package/types/devvit/actor/webbit/webbit.d.ts.map +1 -0
  18. package/types/devvit/actor/webbit/webbit.js +485 -0
  19. package/types/devvit/actor/webbit/webbit.twirp-client.d.ts +19 -0
  20. package/types/devvit/actor/webbit/webbit.twirp-client.d.ts.map +1 -0
  21. package/types/devvit/actor/webbit/webbit.twirp-client.js +23 -0
  22. package/types/devvit/actor/webbit/webbit.twirp.d.ts +12 -0
  23. package/types/devvit/actor/webbit/webbit.twirp.d.ts.map +1 -0
  24. package/types/devvit/actor/webbit/webbit.twirp.js +88 -0
  25. package/types/devvit/dev_portal/nutrition/nutrition.d.ts +2 -0
  26. package/types/devvit/dev_portal/nutrition/nutrition.d.ts.map +1 -1
  27. package/types/devvit/dev_portal/nutrition/nutrition.js +7 -0
  28. package/types/devvit/plugin/useractions/useractions.d.ts +576 -0
  29. package/types/devvit/plugin/useractions/useractions.d.ts.map +1 -0
  30. package/types/devvit/plugin/useractions/useractions.js +66 -0
  31. package/types/devvit/plugin/useractions/useractions.twirp-client.d.ts +25 -0
  32. package/types/devvit/plugin/useractions/useractions.twirp-client.d.ts.map +1 -0
  33. package/types/devvit/plugin/useractions/useractions.twirp-client.js +47 -0
  34. package/types/devvit/plugin/useractions/useractions.twirp.d.ts +16 -0
  35. package/types/devvit/plugin/useractions/useractions.twirp.d.ts.map +1 -0
  36. package/types/devvit/plugin/useractions/useractions.twirp.js +222 -0
  37. package/types/devvit/ui/effects/web_view/v1alpha/post_message.d.ts +29 -0
  38. package/types/devvit/ui/effects/web_view/v1alpha/post_message.d.ts.map +1 -1
  39. package/types/devvit/ui/effects/web_view/v1alpha/post_message.js +108 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * #webbit.ts
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import _m0 from "protobufjs/minimal.js";
7
+ import { Metadata } from "../../../../lib/Types.js";
8
+ export declare enum HttpMethod {
9
+ HTTP_METHOD_UNSPECIFIED = 0,
10
+ POST = 1,
11
+ GET = 2,
12
+ HEAD = 3,
13
+ PUT = 4,
14
+ DELETE = 5,
15
+ PATCH = 6,
16
+ OPTIONS = 7,
17
+ UNRECOGNIZED = -1
18
+ }
19
+ export declare function httpMethodFromJSON(object: any): HttpMethod;
20
+ export declare function httpMethodToJSON(object: HttpMethod): number;
21
+ export interface WebbitHttpRequest {
22
+ method: HttpMethod;
23
+ path: string;
24
+ headers: {
25
+ [key: string]: string;
26
+ };
27
+ body: Uint8Array;
28
+ }
29
+ export interface WebbitHttpRequest_HeadersEntry {
30
+ key: string;
31
+ value: string;
32
+ }
33
+ export interface WebbitHttpResponse {
34
+ statusCode: number;
35
+ headers: {
36
+ [key: string]: string;
37
+ };
38
+ body: Uint8Array;
39
+ }
40
+ export interface WebbitHttpResponse_HeadersEntry {
41
+ key: string;
42
+ value: string;
43
+ }
44
+ export declare const WebbitHttpRequest: {
45
+ $type: "devvit.actor.webbit.WebbitHttpRequest";
46
+ encode(message: WebbitHttpRequest, writer?: _m0.Writer): _m0.Writer;
47
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpRequest;
48
+ fromJSON(object: any): WebbitHttpRequest;
49
+ toJSON(message: WebbitHttpRequest): unknown;
50
+ create(base?: DeepPartial<WebbitHttpRequest>): WebbitHttpRequest;
51
+ fromPartial(object: DeepPartial<WebbitHttpRequest>): WebbitHttpRequest;
52
+ };
53
+ export declare const WebbitHttpRequest_HeadersEntry: {
54
+ $type: "devvit.actor.webbit.WebbitHttpRequest.HeadersEntry";
55
+ encode(message: WebbitHttpRequest_HeadersEntry, writer?: _m0.Writer): _m0.Writer;
56
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpRequest_HeadersEntry;
57
+ fromJSON(object: any): WebbitHttpRequest_HeadersEntry;
58
+ toJSON(message: WebbitHttpRequest_HeadersEntry): unknown;
59
+ create(base?: DeepPartial<WebbitHttpRequest_HeadersEntry>): WebbitHttpRequest_HeadersEntry;
60
+ fromPartial(object: DeepPartial<WebbitHttpRequest_HeadersEntry>): WebbitHttpRequest_HeadersEntry;
61
+ };
62
+ export declare const WebbitHttpResponse: {
63
+ $type: "devvit.actor.webbit.WebbitHttpResponse";
64
+ encode(message: WebbitHttpResponse, writer?: _m0.Writer): _m0.Writer;
65
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpResponse;
66
+ fromJSON(object: any): WebbitHttpResponse;
67
+ toJSON(message: WebbitHttpResponse): unknown;
68
+ create(base?: DeepPartial<WebbitHttpResponse>): WebbitHttpResponse;
69
+ fromPartial(object: DeepPartial<WebbitHttpResponse>): WebbitHttpResponse;
70
+ };
71
+ export declare const WebbitHttpResponse_HeadersEntry: {
72
+ $type: "devvit.actor.webbit.WebbitHttpResponse.HeadersEntry";
73
+ encode(message: WebbitHttpResponse_HeadersEntry, writer?: _m0.Writer): _m0.Writer;
74
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpResponse_HeadersEntry;
75
+ fromJSON(object: any): WebbitHttpResponse_HeadersEntry;
76
+ toJSON(message: WebbitHttpResponse_HeadersEntry): unknown;
77
+ create(base?: DeepPartial<WebbitHttpResponse_HeadersEntry>): WebbitHttpResponse_HeadersEntry;
78
+ fromPartial(object: DeepPartial<WebbitHttpResponse_HeadersEntry>): WebbitHttpResponse_HeadersEntry;
79
+ };
80
+ export interface WebbitServer {
81
+ Request(request: WebbitHttpRequest, metadata?: Metadata): Promise<WebbitHttpResponse>;
82
+ }
83
+ export declare const WebbitServerServiceName = "devvit.actor.webbit.WebbitServer";
84
+ export declare class WebbitServerClientImpl implements WebbitServer {
85
+ private readonly rpc;
86
+ private readonly service;
87
+ constructor(rpc: Rpc, opts?: {
88
+ service?: string;
89
+ });
90
+ Request(request: WebbitHttpRequest, metadata?: Metadata): Promise<WebbitHttpResponse>;
91
+ }
92
+ export type WebbitServerDefinition = typeof WebbitServerDefinition;
93
+ export declare const WebbitServerDefinition: {
94
+ readonly name: "WebbitServer";
95
+ readonly fullName: "devvit.actor.webbit.WebbitServer";
96
+ readonly methods: {
97
+ readonly request: {
98
+ readonly name: "Request";
99
+ readonly requestType: {
100
+ $type: "devvit.actor.webbit.WebbitHttpRequest";
101
+ encode(message: WebbitHttpRequest, writer?: _m0.Writer): _m0.Writer;
102
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpRequest;
103
+ fromJSON(object: any): WebbitHttpRequest;
104
+ toJSON(message: WebbitHttpRequest): unknown;
105
+ create(base?: DeepPartial<WebbitHttpRequest>): WebbitHttpRequest;
106
+ fromPartial(object: DeepPartial<WebbitHttpRequest>): WebbitHttpRequest;
107
+ };
108
+ readonly requestStream: false;
109
+ readonly responseType: {
110
+ $type: "devvit.actor.webbit.WebbitHttpResponse";
111
+ encode(message: WebbitHttpResponse, writer?: _m0.Writer): _m0.Writer;
112
+ decode(input: _m0.Reader | Uint8Array, length?: number): WebbitHttpResponse;
113
+ fromJSON(object: any): WebbitHttpResponse;
114
+ toJSON(message: WebbitHttpResponse): unknown;
115
+ create(base?: DeepPartial<WebbitHttpResponse>): WebbitHttpResponse;
116
+ fromPartial(object: DeepPartial<WebbitHttpResponse>): WebbitHttpResponse;
117
+ };
118
+ readonly responseStream: false;
119
+ readonly options: {};
120
+ };
121
+ };
122
+ };
123
+ interface Rpc {
124
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
125
+ }
126
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
127
+ 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 {} ? {
128
+ [K in keyof T]?: DeepPartial<T[K]>;
129
+ } : Partial<T>;
130
+ export {};
131
+ //# sourceMappingURL=webbit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webbit.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/actor/webbit/webbit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,GAAG,MAAM,uBAAuB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,oBAAY,UAAU;IACpB,uBAAuB,IAAI;IAC3B,IAAI,IAAI;IACR,GAAG,IAAI;IACP,IAAI,IAAI;IACR,GAAG,IAAI;IACP,MAAM,IAAI;IACV,KAAK,IAAI;IACT,OAAO,IAAI;IACX,YAAY,KAAK;CAClB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,UAAU,CA+B1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAsB3D;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACnC,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM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,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,kBAAkB;iCAwC1D,GAAG,GAAG,kBAAkB;gCAazB,kBAAkB,GAAG,OAAO;8BAoB9B,YAAY,kBAAkB,CAAC,GAAG,kBAAkB;oCAG9C,YAAY,kBAAkB,CAAC,GAAG,kBAAkB;;;;;;CAgIhE,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;AA2BD,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,485 @@
1
+ /**
2
+ * #webbit.ts
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /* eslint-disable */
7
+ import _m0 from "protobufjs/minimal.js";
8
+ import { messageTypeRegistry } from "../../../typeRegistry.js";
9
+ export var HttpMethod;
10
+ (function (HttpMethod) {
11
+ HttpMethod[HttpMethod["HTTP_METHOD_UNSPECIFIED"] = 0] = "HTTP_METHOD_UNSPECIFIED";
12
+ HttpMethod[HttpMethod["POST"] = 1] = "POST";
13
+ HttpMethod[HttpMethod["GET"] = 2] = "GET";
14
+ HttpMethod[HttpMethod["HEAD"] = 3] = "HEAD";
15
+ HttpMethod[HttpMethod["PUT"] = 4] = "PUT";
16
+ HttpMethod[HttpMethod["DELETE"] = 5] = "DELETE";
17
+ HttpMethod[HttpMethod["PATCH"] = 6] = "PATCH";
18
+ HttpMethod[HttpMethod["OPTIONS"] = 7] = "OPTIONS";
19
+ HttpMethod[HttpMethod["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
+ })(HttpMethod || (HttpMethod = {}));
21
+ export function httpMethodFromJSON(object) {
22
+ switch (object) {
23
+ case 0:
24
+ case "HTTP_METHOD_UNSPECIFIED":
25
+ return HttpMethod.HTTP_METHOD_UNSPECIFIED;
26
+ case 1:
27
+ case "POST":
28
+ return HttpMethod.POST;
29
+ case 2:
30
+ case "GET":
31
+ return HttpMethod.GET;
32
+ case 3:
33
+ case "HEAD":
34
+ return HttpMethod.HEAD;
35
+ case 4:
36
+ case "PUT":
37
+ return HttpMethod.PUT;
38
+ case 5:
39
+ case "DELETE":
40
+ return HttpMethod.DELETE;
41
+ case 6:
42
+ case "PATCH":
43
+ return HttpMethod.PATCH;
44
+ case 7:
45
+ case "OPTIONS":
46
+ return HttpMethod.OPTIONS;
47
+ case -1:
48
+ case "UNRECOGNIZED":
49
+ default:
50
+ return HttpMethod.UNRECOGNIZED;
51
+ }
52
+ }
53
+ export function httpMethodToJSON(object) {
54
+ switch (object) {
55
+ case HttpMethod.HTTP_METHOD_UNSPECIFIED:
56
+ return 0;
57
+ case HttpMethod.POST:
58
+ return 1;
59
+ case HttpMethod.GET:
60
+ return 2;
61
+ case HttpMethod.HEAD:
62
+ return 3;
63
+ case HttpMethod.PUT:
64
+ return 4;
65
+ case HttpMethod.DELETE:
66
+ return 5;
67
+ case HttpMethod.PATCH:
68
+ return 6;
69
+ case HttpMethod.OPTIONS:
70
+ return 7;
71
+ case HttpMethod.UNRECOGNIZED:
72
+ default:
73
+ return -1;
74
+ }
75
+ }
76
+ function createBaseWebbitHttpRequest() {
77
+ return { method: 0, path: "", headers: {}, body: new Uint8Array(0) };
78
+ }
79
+ export const WebbitHttpRequest = {
80
+ $type: "devvit.actor.webbit.WebbitHttpRequest",
81
+ encode(message, writer = _m0.Writer.create()) {
82
+ if (message.method !== 0) {
83
+ writer.uint32(8).int32(message.method);
84
+ }
85
+ if (message.path !== "") {
86
+ writer.uint32(18).string(message.path);
87
+ }
88
+ Object.entries(message.headers).forEach(([key, value]) => {
89
+ WebbitHttpRequest_HeadersEntry.encode({ key: key, value }, writer.uint32(26).fork()).ldelim();
90
+ });
91
+ if (message.body.length !== 0) {
92
+ writer.uint32(34).bytes(message.body);
93
+ }
94
+ return writer;
95
+ },
96
+ decode(input, length) {
97
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
98
+ let end = length === undefined ? reader.len : reader.pos + length;
99
+ const message = createBaseWebbitHttpRequest();
100
+ while (reader.pos < end) {
101
+ const tag = reader.uint32();
102
+ switch (tag >>> 3) {
103
+ case 1:
104
+ if (tag !== 8) {
105
+ break;
106
+ }
107
+ message.method = reader.int32();
108
+ continue;
109
+ case 2:
110
+ if (tag !== 18) {
111
+ break;
112
+ }
113
+ message.path = reader.string();
114
+ continue;
115
+ case 3:
116
+ if (tag !== 26) {
117
+ break;
118
+ }
119
+ const entry3 = WebbitHttpRequest_HeadersEntry.decode(reader, reader.uint32());
120
+ if (entry3.value !== undefined) {
121
+ message.headers[entry3.key] = entry3.value;
122
+ }
123
+ continue;
124
+ case 4:
125
+ if (tag !== 34) {
126
+ break;
127
+ }
128
+ message.body = reader.bytes();
129
+ continue;
130
+ }
131
+ if ((tag & 7) === 4 || tag === 0) {
132
+ break;
133
+ }
134
+ reader.skipType(tag & 7);
135
+ }
136
+ return message;
137
+ },
138
+ fromJSON(object) {
139
+ return {
140
+ method: isSet(object.method) ? httpMethodFromJSON(object.method) : 0,
141
+ path: isSet(object.path) ? globalThis.String(object.path) : "",
142
+ headers: isObject(object.headers)
143
+ ? Object.entries(object.headers).reduce((acc, [key, value]) => {
144
+ acc[key] = String(value);
145
+ return acc;
146
+ }, {})
147
+ : {},
148
+ body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(0),
149
+ };
150
+ },
151
+ toJSON(message) {
152
+ const obj = {};
153
+ if (message.method !== 0) {
154
+ obj.method = httpMethodToJSON(message.method);
155
+ }
156
+ if (message.path !== "") {
157
+ obj.path = message.path;
158
+ }
159
+ if (message.headers) {
160
+ const entries = Object.entries(message.headers);
161
+ if (entries.length > 0) {
162
+ obj.headers = {};
163
+ entries.forEach(([k, v]) => {
164
+ obj.headers[k] = v;
165
+ });
166
+ }
167
+ }
168
+ if (message.body.length !== 0) {
169
+ obj.body = base64FromBytes(message.body);
170
+ }
171
+ return obj;
172
+ },
173
+ create(base) {
174
+ return WebbitHttpRequest.fromPartial(base ?? {});
175
+ },
176
+ fromPartial(object) {
177
+ const message = createBaseWebbitHttpRequest();
178
+ message.method = object.method ?? 0;
179
+ message.path = object.path ?? "";
180
+ message.headers = Object.entries(object.headers ?? {}).reduce((acc, [key, value]) => {
181
+ if (value !== undefined) {
182
+ acc[key] = globalThis.String(value);
183
+ }
184
+ return acc;
185
+ }, {});
186
+ message.body = object.body ?? new Uint8Array(0);
187
+ return message;
188
+ },
189
+ };
190
+ messageTypeRegistry.set(WebbitHttpRequest.$type, WebbitHttpRequest);
191
+ function createBaseWebbitHttpRequest_HeadersEntry() {
192
+ return { key: "", value: "" };
193
+ }
194
+ export const WebbitHttpRequest_HeadersEntry = {
195
+ $type: "devvit.actor.webbit.WebbitHttpRequest.HeadersEntry",
196
+ encode(message, writer = _m0.Writer.create()) {
197
+ if (message.key !== "") {
198
+ writer.uint32(10).string(message.key);
199
+ }
200
+ if (message.value !== "") {
201
+ writer.uint32(18).string(message.value);
202
+ }
203
+ return writer;
204
+ },
205
+ decode(input, length) {
206
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
207
+ let end = length === undefined ? reader.len : reader.pos + length;
208
+ const message = createBaseWebbitHttpRequest_HeadersEntry();
209
+ while (reader.pos < end) {
210
+ const tag = reader.uint32();
211
+ switch (tag >>> 3) {
212
+ case 1:
213
+ if (tag !== 10) {
214
+ break;
215
+ }
216
+ message.key = reader.string();
217
+ continue;
218
+ case 2:
219
+ if (tag !== 18) {
220
+ break;
221
+ }
222
+ message.value = reader.string();
223
+ continue;
224
+ }
225
+ if ((tag & 7) === 4 || tag === 0) {
226
+ break;
227
+ }
228
+ reader.skipType(tag & 7);
229
+ }
230
+ return message;
231
+ },
232
+ fromJSON(object) {
233
+ return {
234
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
235
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
236
+ };
237
+ },
238
+ toJSON(message) {
239
+ const obj = {};
240
+ if (message.key !== "") {
241
+ obj.key = message.key;
242
+ }
243
+ if (message.value !== "") {
244
+ obj.value = message.value;
245
+ }
246
+ return obj;
247
+ },
248
+ create(base) {
249
+ return WebbitHttpRequest_HeadersEntry.fromPartial(base ?? {});
250
+ },
251
+ fromPartial(object) {
252
+ const message = createBaseWebbitHttpRequest_HeadersEntry();
253
+ message.key = object.key ?? "";
254
+ message.value = object.value ?? "";
255
+ return message;
256
+ },
257
+ };
258
+ messageTypeRegistry.set(WebbitHttpRequest_HeadersEntry.$type, WebbitHttpRequest_HeadersEntry);
259
+ function createBaseWebbitHttpResponse() {
260
+ return { statusCode: 0, headers: {}, body: new Uint8Array(0) };
261
+ }
262
+ export const WebbitHttpResponse = {
263
+ $type: "devvit.actor.webbit.WebbitHttpResponse",
264
+ encode(message, writer = _m0.Writer.create()) {
265
+ if (message.statusCode !== 0) {
266
+ writer.uint32(8).int32(message.statusCode);
267
+ }
268
+ Object.entries(message.headers).forEach(([key, value]) => {
269
+ WebbitHttpResponse_HeadersEntry.encode({ key: key, value }, writer.uint32(18).fork()).ldelim();
270
+ });
271
+ if (message.body.length !== 0) {
272
+ writer.uint32(26).bytes(message.body);
273
+ }
274
+ return writer;
275
+ },
276
+ decode(input, length) {
277
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
278
+ let end = length === undefined ? reader.len : reader.pos + length;
279
+ const message = createBaseWebbitHttpResponse();
280
+ while (reader.pos < end) {
281
+ const tag = reader.uint32();
282
+ switch (tag >>> 3) {
283
+ case 1:
284
+ if (tag !== 8) {
285
+ break;
286
+ }
287
+ message.statusCode = reader.int32();
288
+ continue;
289
+ case 2:
290
+ if (tag !== 18) {
291
+ break;
292
+ }
293
+ const entry2 = WebbitHttpResponse_HeadersEntry.decode(reader, reader.uint32());
294
+ if (entry2.value !== undefined) {
295
+ message.headers[entry2.key] = entry2.value;
296
+ }
297
+ continue;
298
+ case 3:
299
+ if (tag !== 26) {
300
+ break;
301
+ }
302
+ message.body = reader.bytes();
303
+ continue;
304
+ }
305
+ if ((tag & 7) === 4 || tag === 0) {
306
+ break;
307
+ }
308
+ reader.skipType(tag & 7);
309
+ }
310
+ return message;
311
+ },
312
+ fromJSON(object) {
313
+ return {
314
+ statusCode: isSet(object.statusCode) ? globalThis.Number(object.statusCode) : 0,
315
+ headers: isObject(object.headers)
316
+ ? Object.entries(object.headers).reduce((acc, [key, value]) => {
317
+ acc[key] = String(value);
318
+ return acc;
319
+ }, {})
320
+ : {},
321
+ body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(0),
322
+ };
323
+ },
324
+ toJSON(message) {
325
+ const obj = {};
326
+ if (message.statusCode !== 0) {
327
+ obj.statusCode = Math.round(message.statusCode);
328
+ }
329
+ if (message.headers) {
330
+ const entries = Object.entries(message.headers);
331
+ if (entries.length > 0) {
332
+ obj.headers = {};
333
+ entries.forEach(([k, v]) => {
334
+ obj.headers[k] = v;
335
+ });
336
+ }
337
+ }
338
+ if (message.body.length !== 0) {
339
+ obj.body = base64FromBytes(message.body);
340
+ }
341
+ return obj;
342
+ },
343
+ create(base) {
344
+ return WebbitHttpResponse.fromPartial(base ?? {});
345
+ },
346
+ fromPartial(object) {
347
+ const message = createBaseWebbitHttpResponse();
348
+ message.statusCode = object.statusCode ?? 0;
349
+ message.headers = Object.entries(object.headers ?? {}).reduce((acc, [key, value]) => {
350
+ if (value !== undefined) {
351
+ acc[key] = globalThis.String(value);
352
+ }
353
+ return acc;
354
+ }, {});
355
+ message.body = object.body ?? new Uint8Array(0);
356
+ return message;
357
+ },
358
+ };
359
+ messageTypeRegistry.set(WebbitHttpResponse.$type, WebbitHttpResponse);
360
+ function createBaseWebbitHttpResponse_HeadersEntry() {
361
+ return { key: "", value: "" };
362
+ }
363
+ export const WebbitHttpResponse_HeadersEntry = {
364
+ $type: "devvit.actor.webbit.WebbitHttpResponse.HeadersEntry",
365
+ encode(message, writer = _m0.Writer.create()) {
366
+ if (message.key !== "") {
367
+ writer.uint32(10).string(message.key);
368
+ }
369
+ if (message.value !== "") {
370
+ writer.uint32(18).string(message.value);
371
+ }
372
+ return writer;
373
+ },
374
+ decode(input, length) {
375
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
376
+ let end = length === undefined ? reader.len : reader.pos + length;
377
+ const message = createBaseWebbitHttpResponse_HeadersEntry();
378
+ while (reader.pos < end) {
379
+ const tag = reader.uint32();
380
+ switch (tag >>> 3) {
381
+ case 1:
382
+ if (tag !== 10) {
383
+ break;
384
+ }
385
+ message.key = reader.string();
386
+ continue;
387
+ case 2:
388
+ if (tag !== 18) {
389
+ break;
390
+ }
391
+ message.value = reader.string();
392
+ continue;
393
+ }
394
+ if ((tag & 7) === 4 || tag === 0) {
395
+ break;
396
+ }
397
+ reader.skipType(tag & 7);
398
+ }
399
+ return message;
400
+ },
401
+ fromJSON(object) {
402
+ return {
403
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
404
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
405
+ };
406
+ },
407
+ toJSON(message) {
408
+ const obj = {};
409
+ if (message.key !== "") {
410
+ obj.key = message.key;
411
+ }
412
+ if (message.value !== "") {
413
+ obj.value = message.value;
414
+ }
415
+ return obj;
416
+ },
417
+ create(base) {
418
+ return WebbitHttpResponse_HeadersEntry.fromPartial(base ?? {});
419
+ },
420
+ fromPartial(object) {
421
+ const message = createBaseWebbitHttpResponse_HeadersEntry();
422
+ message.key = object.key ?? "";
423
+ message.value = object.value ?? "";
424
+ return message;
425
+ },
426
+ };
427
+ messageTypeRegistry.set(WebbitHttpResponse_HeadersEntry.$type, WebbitHttpResponse_HeadersEntry);
428
+ export const WebbitServerServiceName = "devvit.actor.webbit.WebbitServer";
429
+ export class WebbitServerClientImpl {
430
+ constructor(rpc, opts) {
431
+ this.service = opts?.service || WebbitServerServiceName;
432
+ this.rpc = rpc;
433
+ this.Request = this.Request.bind(this);
434
+ }
435
+ Request(request, metadata) {
436
+ const data = WebbitHttpRequest.encode(request).finish();
437
+ const promise = this.rpc.request(this.service, "Request", data, metadata);
438
+ return promise.then((data) => WebbitHttpResponse.decode(_m0.Reader.create(data)));
439
+ }
440
+ }
441
+ export const WebbitServerDefinition = {
442
+ name: "WebbitServer",
443
+ fullName: "devvit.actor.webbit.WebbitServer",
444
+ methods: {
445
+ request: {
446
+ name: "Request",
447
+ requestType: WebbitHttpRequest,
448
+ requestStream: false,
449
+ responseType: WebbitHttpResponse,
450
+ responseStream: false,
451
+ options: {},
452
+ },
453
+ },
454
+ };
455
+ function bytesFromBase64(b64) {
456
+ if (globalThis.Buffer) {
457
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
458
+ }
459
+ else {
460
+ const bin = globalThis.atob(b64);
461
+ const arr = new Uint8Array(bin.length);
462
+ for (let i = 0; i < bin.length; ++i) {
463
+ arr[i] = bin.charCodeAt(i);
464
+ }
465
+ return arr;
466
+ }
467
+ }
468
+ function base64FromBytes(arr) {
469
+ if (globalThis.Buffer) {
470
+ return globalThis.Buffer.from(arr).toString("base64");
471
+ }
472
+ else {
473
+ const bin = [];
474
+ arr.forEach((byte) => {
475
+ bin.push(globalThis.String.fromCharCode(byte));
476
+ });
477
+ return globalThis.btoa(bin.join(""));
478
+ }
479
+ }
480
+ function isObject(value) {
481
+ return typeof value === "object" && value !== null;
482
+ }
483
+ function isSet(value) {
484
+ return value !== null && value !== undefined;
485
+ }
@@ -0,0 +1,19 @@
1
+ import { WebbitHttpRequest, WebbitHttpResponse } from './webbit.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 WebbitServerClient {
6
+ Request(request: WebbitHttpRequest): Promise<WebbitHttpResponse>;
7
+ }
8
+ export declare class WebbitServerClientJSON implements WebbitServerClient {
9
+ private readonly rpc;
10
+ constructor(rpc: Rpc);
11
+ Request(request: WebbitHttpRequest): Promise<WebbitHttpResponse>;
12
+ }
13
+ export declare class WebbitServerClientProtobuf implements WebbitServerClient {
14
+ private readonly rpc;
15
+ constructor(rpc: Rpc);
16
+ Request(request: WebbitHttpRequest): Promise<WebbitHttpResponse>;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=webbit.twirp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webbit.twirp-client.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/actor/webbit/webbit.twirp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMpE,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,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClE;AAED,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAIpB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAUjE;AAED,qBAAa,0BAA2B,YAAW,kBAAkB;IACnE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;gBACd,GAAG,EAAE,GAAG;IAIpB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAYjE"}
@@ -0,0 +1,23 @@
1
+ import { WebbitHttpRequest, WebbitHttpResponse } from './webbit.js';
2
+ export class WebbitServerClientJSON {
3
+ constructor(rpc) {
4
+ this.rpc = rpc;
5
+ this.Request.bind(this);
6
+ }
7
+ Request(request) {
8
+ const data = WebbitHttpRequest.toJSON(request);
9
+ const promise = this.rpc.request('devvit.actor.webbit.WebbitServer', 'Request', 'application/json', data);
10
+ return promise.then((data) => WebbitHttpResponse.fromJSON(data));
11
+ }
12
+ }
13
+ export class WebbitServerClientProtobuf {
14
+ constructor(rpc) {
15
+ this.rpc = rpc;
16
+ this.Request.bind(this);
17
+ }
18
+ Request(request) {
19
+ const data = WebbitHttpRequest.encode(request).finish();
20
+ const promise = this.rpc.request('devvit.actor.webbit.WebbitServer', 'Request', 'application/protobuf', data);
21
+ return promise.then((data) => WebbitHttpResponse.decode(data));
22
+ }
23
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { TwirpContext, TwirpServer } from 'twirp-ts';
3
+ import { WebbitHttpRequest, WebbitHttpResponse } from './webbit.js';
4
+ export interface WebbitServerTwirp<T extends TwirpContext = TwirpContext> {
5
+ Request(ctx: T, request: WebbitHttpRequest): Promise<WebbitHttpResponse>;
6
+ }
7
+ export declare enum WebbitServerMethod {
8
+ Request = "Request"
9
+ }
10
+ export declare const WebbitServerMethodList: WebbitServerMethod[];
11
+ export declare function createWebbitServerServer<T extends TwirpContext = TwirpContext>(service: WebbitServerTwirp<T>): TwirpServer<WebbitServerTwirp<TwirpContext<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>>>, T>;
12
+ //# sourceMappingURL=webbit.twirp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webbit.twirp.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/actor/webbit/webbit.twirp.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMpE,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACtE,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC1E;AAED,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,sBAAsB,sBAA+B,CAAC;AAEnE,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAC5E,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,kJAS9B"}