@devvit/protos 0.11.8-next-2025-02-12-e4a7d52e8.0 → 0.11.8-next-2025-02-13-b7bcacfd0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/meta.min.json +6 -5
- package/package.json +6 -6
- package/protos.min.js +1 -1
- package/protos.min.js.map +3 -3
- package/schema/devvit/plugin/redis/redisapi.proto +50 -0
- package/schema/snootobuf.devenv.lock +1892 -725
- package/schema/snootobuf.lock +1892 -725
- package/schema/snootobuf.redditapi.lock +1892 -725
- package/schema/snootobuf.ts.lock +1892 -725
- package/types/devvit/plugin/redis/redisapi.d.ts +132 -0
- package/types/devvit/plugin/redis/redisapi.d.ts.map +1 -1
- package/types/devvit/plugin/redis/redisapi.js +591 -0
- package/types/devvit/plugin/redis/redisapi.twirp-client.d.ts +4 -1
- package/types/devvit/plugin/redis/redisapi.twirp-client.d.ts.map +1 -1
- package/types/devvit/plugin/redis/redisapi.twirp-client.js +13 -1
- package/types/devvit/plugin/redis/redisapi.twirp.d.ts +4 -2
- package/types/devvit/plugin/redis/redisapi.twirp.d.ts.map +1 -1
- package/types/devvit/plugin/redis/redisapi.twirp.js +67 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse, } from './redisapi.js';
|
1
|
+
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse, BitfieldRequest, BitfieldResponse, } from './redisapi.js';
|
2
2
|
import { StringValue, Int64Value, DoubleValue, } from '../../../google/protobuf/wrappers.js';
|
3
3
|
import { Empty } from '../../../google/protobuf/empty.js';
|
4
4
|
export class RedisAPIClientJSON {
|
@@ -41,6 +41,7 @@ export class RedisAPIClientJSON {
|
|
41
41
|
this.ZRank.bind(this);
|
42
42
|
this.ZIncrBy.bind(this);
|
43
43
|
this.ZScan.bind(this);
|
44
|
+
this.Bitfield.bind(this);
|
44
45
|
}
|
45
46
|
Get(request) {
|
46
47
|
const data = KeyRequest.toJSON(request);
|
@@ -227,6 +228,11 @@ export class RedisAPIClientJSON {
|
|
227
228
|
const promise = this.rpc.request('devvit.plugin.redis.RedisAPI', 'ZScan', 'application/json', data);
|
228
229
|
return promise.then((data) => ZScanResponse.fromJSON(data));
|
229
230
|
}
|
231
|
+
Bitfield(request) {
|
232
|
+
const data = BitfieldRequest.toJSON(request);
|
233
|
+
const promise = this.rpc.request('devvit.plugin.redis.RedisAPI', 'Bitfield', 'application/json', data);
|
234
|
+
return promise.then((data) => BitfieldResponse.fromJSON(data));
|
235
|
+
}
|
230
236
|
}
|
231
237
|
export class RedisAPIClientProtobuf {
|
232
238
|
constructor(rpc) {
|
@@ -268,6 +274,7 @@ export class RedisAPIClientProtobuf {
|
|
268
274
|
this.ZRank.bind(this);
|
269
275
|
this.ZIncrBy.bind(this);
|
270
276
|
this.ZScan.bind(this);
|
277
|
+
this.Bitfield.bind(this);
|
271
278
|
}
|
272
279
|
Get(request) {
|
273
280
|
const data = KeyRequest.encode(request).finish();
|
@@ -454,4 +461,9 @@ export class RedisAPIClientProtobuf {
|
|
454
461
|
const promise = this.rpc.request('devvit.plugin.redis.RedisAPI', 'ZScan', 'application/protobuf', data);
|
455
462
|
return promise.then((data) => ZScanResponse.decode(data));
|
456
463
|
}
|
464
|
+
Bitfield(request) {
|
465
|
+
const data = BitfieldRequest.encode(request).finish();
|
466
|
+
const promise = this.rpc.request('devvit.plugin.redis.RedisAPI', 'Bitfield', 'application/protobuf', data);
|
467
|
+
return promise.then((data) => BitfieldResponse.decode(data));
|
468
|
+
}
|
457
469
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
2
|
import { TwirpContext, TwirpServer } from 'twirp-ts';
|
3
|
-
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse } from './redisapi.js';
|
3
|
+
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse, BitfieldRequest, BitfieldResponse } from './redisapi.js';
|
4
4
|
import { StringValue, Int64Value, DoubleValue } from '../../../google/protobuf/wrappers.js';
|
5
5
|
import { Empty } from '../../../google/protobuf/empty.js';
|
6
6
|
export interface RedisAPITwirp<T extends TwirpContext = TwirpContext> {
|
@@ -41,6 +41,7 @@ export interface RedisAPITwirp<T extends TwirpContext = TwirpContext> {
|
|
41
41
|
ZRank(ctx: T, request: ZRankRequest): Promise<Int64Value>;
|
42
42
|
ZIncrBy(ctx: T, request: ZIncrByRequest): Promise<DoubleValue>;
|
43
43
|
ZScan(ctx: T, request: ZScanRequest): Promise<ZScanResponse>;
|
44
|
+
Bitfield(ctx: T, request: BitfieldRequest): Promise<BitfieldResponse>;
|
44
45
|
}
|
45
46
|
export declare enum RedisAPIMethod {
|
46
47
|
Get = "Get",
|
@@ -79,7 +80,8 @@ export declare enum RedisAPIMethod {
|
|
79
80
|
ZScore = "ZScore",
|
80
81
|
ZRank = "ZRank",
|
81
82
|
ZIncrBy = "ZIncrBy",
|
82
|
-
ZScan = "ZScan"
|
83
|
+
ZScan = "ZScan",
|
84
|
+
Bitfield = "Bitfield"
|
83
85
|
}
|
84
86
|
export declare const RedisAPIMethodList: RedisAPIMethod[];
|
85
87
|
export declare function createRedisAPIServer<T extends TwirpContext = TwirpContext>(service: RedisAPITwirp<T>): TwirpServer<RedisAPITwirp<TwirpContext<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>>>, T>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"redisapi.twirp.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/plugin/redis/redisapi.twirp.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,aAAa,EACb,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,
|
1
|
+
{"version":3,"file":"redisapi.twirp.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/plugin/redis/redisapi.twirp.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,aAAa,EACb,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAM1D,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAClE,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACvD,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACvD,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,GA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B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED,eAAO,MAAM,kBAAkB,kBAuC9B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EACxE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,8IAS1B"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TwirpServer, TwirpError, TwirpErrorCode, TwirpContentType, chainInterceptors, } from 'twirp-ts';
|
2
|
-
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse, } from './redisapi.js';
|
2
|
+
import { KeyRequest, SetRequest, KeysRequest, IncrByRequest, HSetRequest, HGetRequest, HMGetRequest, RedisValues, RedisFieldValues, HDelRequest, HScanRequest, HScanResponse, KeysResponse, HIncrByRequest, TransactionId, TransactionResponses, WatchRequest, KeyRangeRequest, SetRangeRequest, KeyValuesRequest, ExpireRequest, ZAddRequest, ZRangeRequest, ZMembers, ZRemRequest, ZRemRangeByLexRequest, ZRemRangeByRankRequest, ZRemRangeByScoreRequest, ZScoreRequest, ZRankRequest, ZIncrByRequest, ZScanRequest, ZScanResponse, BitfieldRequest, BitfieldResponse, } from './redisapi.js';
|
3
3
|
import { StringValue, Int64Value, DoubleValue, } from '../../../google/protobuf/wrappers.js';
|
4
4
|
import { Empty } from '../../../google/protobuf/empty.js';
|
5
5
|
export var RedisAPIMethod;
|
@@ -41,6 +41,7 @@ export var RedisAPIMethod;
|
|
41
41
|
RedisAPIMethod["ZRank"] = "ZRank";
|
42
42
|
RedisAPIMethod["ZIncrBy"] = "ZIncrBy";
|
43
43
|
RedisAPIMethod["ZScan"] = "ZScan";
|
44
|
+
RedisAPIMethod["Bitfield"] = "Bitfield";
|
44
45
|
})(RedisAPIMethod || (RedisAPIMethod = {}));
|
45
46
|
export const RedisAPIMethodList = [
|
46
47
|
RedisAPIMethod.Get,
|
@@ -80,6 +81,7 @@ export const RedisAPIMethodList = [
|
|
80
81
|
RedisAPIMethod.ZRank,
|
81
82
|
RedisAPIMethod.ZIncrBy,
|
82
83
|
RedisAPIMethod.ZScan,
|
84
|
+
RedisAPIMethod.Bitfield,
|
83
85
|
];
|
84
86
|
export function createRedisAPIServer(service) {
|
85
87
|
return new TwirpServer({
|
@@ -314,6 +316,12 @@ function matchRedisAPIRoute(method, events) {
|
|
314
316
|
await events.onMatch(ctx);
|
315
317
|
return handleRedisAPIZScanRequest(ctx, service, data, interceptors);
|
316
318
|
};
|
319
|
+
case 'Bitfield':
|
320
|
+
return async (ctx, service, data, interceptors) => {
|
321
|
+
ctx = { ...ctx, methodName: 'Bitfield' };
|
322
|
+
await events.onMatch(ctx);
|
323
|
+
return handleRedisAPIBitfieldRequest(ctx, service, data, interceptors);
|
324
|
+
};
|
317
325
|
default:
|
318
326
|
events.onNotFound();
|
319
327
|
const msg = `no handler found`;
|
@@ -727,6 +735,17 @@ function handleRedisAPIZScanRequest(ctx, service, data, interceptors) {
|
|
727
735
|
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
728
736
|
}
|
729
737
|
}
|
738
|
+
function handleRedisAPIBitfieldRequest(ctx, service, data, interceptors) {
|
739
|
+
switch (ctx.contentType) {
|
740
|
+
case TwirpContentType.JSON:
|
741
|
+
return handleRedisAPIBitfieldJSON(ctx, service, data, interceptors);
|
742
|
+
case TwirpContentType.Protobuf:
|
743
|
+
return handleRedisAPIBitfieldProtobuf(ctx, service, data, interceptors);
|
744
|
+
default:
|
745
|
+
const msg = 'unexpected Content-Type';
|
746
|
+
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
747
|
+
}
|
748
|
+
}
|
730
749
|
async function handleRedisAPIGetJSON(ctx, service, data, interceptors) {
|
731
750
|
let request;
|
732
751
|
let response;
|
@@ -1615,6 +1634,30 @@ async function handleRedisAPIZScanJSON(ctx, service, data, interceptors) {
|
|
1615
1634
|
}
|
1616
1635
|
return JSON.stringify(ZScanResponse.toJSON(response));
|
1617
1636
|
}
|
1637
|
+
async function handleRedisAPIBitfieldJSON(ctx, service, data, interceptors) {
|
1638
|
+
let request;
|
1639
|
+
let response;
|
1640
|
+
try {
|
1641
|
+
const body = JSON.parse(data.toString() || '{}');
|
1642
|
+
request = BitfieldRequest.fromJSON(body);
|
1643
|
+
}
|
1644
|
+
catch (e) {
|
1645
|
+
if (e instanceof Error) {
|
1646
|
+
const msg = 'the json request could not be decoded';
|
1647
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
1648
|
+
}
|
1649
|
+
}
|
1650
|
+
if (interceptors && interceptors.length > 0) {
|
1651
|
+
const interceptor = chainInterceptors(...interceptors);
|
1652
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
1653
|
+
return service.Bitfield(ctx, inputReq);
|
1654
|
+
});
|
1655
|
+
}
|
1656
|
+
else {
|
1657
|
+
response = await service.Bitfield(ctx, request);
|
1658
|
+
}
|
1659
|
+
return JSON.stringify(BitfieldResponse.toJSON(response));
|
1660
|
+
}
|
1618
1661
|
async function handleRedisAPIGetProtobuf(ctx, service, data, interceptors) {
|
1619
1662
|
let request;
|
1620
1663
|
let response;
|
@@ -2466,3 +2509,26 @@ async function handleRedisAPIZScanProtobuf(ctx, service, data, interceptors) {
|
|
2466
2509
|
}
|
2467
2510
|
return Buffer.from(ZScanResponse.encode(response).finish());
|
2468
2511
|
}
|
2512
|
+
async function handleRedisAPIBitfieldProtobuf(ctx, service, data, interceptors) {
|
2513
|
+
let request;
|
2514
|
+
let response;
|
2515
|
+
try {
|
2516
|
+
request = BitfieldRequest.decode(data);
|
2517
|
+
}
|
2518
|
+
catch (e) {
|
2519
|
+
if (e instanceof Error) {
|
2520
|
+
const msg = 'the protobuf request could not be decoded';
|
2521
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
2522
|
+
}
|
2523
|
+
}
|
2524
|
+
if (interceptors && interceptors.length > 0) {
|
2525
|
+
const interceptor = chainInterceptors(...interceptors);
|
2526
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
2527
|
+
return service.Bitfield(ctx, inputReq);
|
2528
|
+
});
|
2529
|
+
}
|
2530
|
+
else {
|
2531
|
+
response = await service.Bitfield(ctx, request);
|
2532
|
+
}
|
2533
|
+
return Buffer.from(BitfieldResponse.encode(response).finish());
|
2534
|
+
}
|