@control_yourself/contracts 0.0.4 → 0.0.6
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @generated by protoc-gen-es v2.10.2 with parameter "target=ts"
|
|
2
|
-
// @generated from file
|
|
2
|
+
// @generated from file auth.proto (package auth.v1, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
5
|
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
@@ -7,10 +7,10 @@ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2
|
|
|
7
7
|
import type { Message } from "@bufbuild/protobuf";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Describes the file
|
|
10
|
+
* Describes the file auth.proto.
|
|
11
11
|
*/
|
|
12
|
-
export const
|
|
13
|
-
fileDesc("
|
|
12
|
+
export const file_auth: GenFile = /*@__PURE__*/
|
|
13
|
+
fileDesc("CgphdXRoLnByb3RvEgdhdXRoLnYxIisKFFZhbGlkYXRlVG9rZW5SZXF1ZXN0EhMKC2FjY2Vzc1Rva2VuGAEgASgJIjYKFVZhbGlkYXRlVG9rZW5SZXNwb25zZRINCgV2YWxpZBgBIAEoCBIOCgZ1c2VySWQYAiABKAkyXQoLQXV0aFNlcnZpY2USTgoNVmFsaWRhdGVUb2tlbhIdLmF1dGgudjEuVmFsaWRhdGVUb2tlblJlcXVlc3QaHi5hdXRoLnYxLlZhbGlkYXRlVG9rZW5SZXNwb25zZWIGcHJvdG8z");
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @generated from message auth.v1.ValidateTokenRequest
|
|
@@ -27,7 +27,7 @@ export type ValidateTokenRequest = Message<"auth.v1.ValidateTokenRequest"> & {
|
|
|
27
27
|
* Use `create(ValidateTokenRequestSchema)` to create a new message.
|
|
28
28
|
*/
|
|
29
29
|
export const ValidateTokenRequestSchema: GenMessage<ValidateTokenRequest> = /*@__PURE__*/
|
|
30
|
-
messageDesc(
|
|
30
|
+
messageDesc(file_auth, 0);
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @generated from message auth.v1.ValidateTokenResponse
|
|
@@ -49,7 +49,7 @@ export type ValidateTokenResponse = Message<"auth.v1.ValidateTokenResponse"> & {
|
|
|
49
49
|
* Use `create(ValidateTokenResponseSchema)` to create a new message.
|
|
50
50
|
*/
|
|
51
51
|
export const ValidateTokenResponseSchema: GenMessage<ValidateTokenResponse> = /*@__PURE__*/
|
|
52
|
-
messageDesc(
|
|
52
|
+
messageDesc(file_auth, 1);
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* @generated from service auth.v1.AuthService
|
|
@@ -64,5 +64,5 @@ export const AuthService: GenService<{
|
|
|
64
64
|
output: typeof ValidateTokenResponseSchema;
|
|
65
65
|
},
|
|
66
66
|
}> = /*@__PURE__*/
|
|
67
|
-
serviceDesc(
|
|
67
|
+
serviceDesc(file_auth, 0);
|
|
68
68
|
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import {
|
|
10
|
+
type CallOptions,
|
|
11
|
+
type ChannelCredentials,
|
|
12
|
+
Client,
|
|
13
|
+
type ClientOptions,
|
|
14
|
+
type ClientUnaryCall,
|
|
15
|
+
type handleUnaryCall,
|
|
16
|
+
makeGenericClientConstructor,
|
|
17
|
+
type Metadata,
|
|
18
|
+
type ServiceError,
|
|
19
|
+
type UntypedServiceImplementation,
|
|
20
|
+
} from "@grpc/grpc-js";
|
|
21
|
+
|
|
22
|
+
export const protobufPackage = "auth.v1";
|
|
23
|
+
|
|
24
|
+
export interface ValidateTokenRequest {
|
|
25
|
+
accessToken: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ValidateTokenResponse {
|
|
29
|
+
valid: boolean;
|
|
30
|
+
userId: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function createBaseValidateTokenRequest(): ValidateTokenRequest {
|
|
34
|
+
return { accessToken: "" };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const ValidateTokenRequest: MessageFns<ValidateTokenRequest> = {
|
|
38
|
+
encode(message: ValidateTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
39
|
+
if (message.accessToken !== "") {
|
|
40
|
+
writer.uint32(10).string(message.accessToken);
|
|
41
|
+
}
|
|
42
|
+
return writer;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ValidateTokenRequest {
|
|
46
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
47
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
48
|
+
const message = createBaseValidateTokenRequest();
|
|
49
|
+
while (reader.pos < end) {
|
|
50
|
+
const tag = reader.uint32();
|
|
51
|
+
switch (tag >>> 3) {
|
|
52
|
+
case 1: {
|
|
53
|
+
if (tag !== 10) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message.accessToken = reader.string();
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
reader.skip(tag & 7);
|
|
65
|
+
}
|
|
66
|
+
return message;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
fromJSON(object: any): ValidateTokenRequest {
|
|
70
|
+
return { accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "" };
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
toJSON(message: ValidateTokenRequest): unknown {
|
|
74
|
+
const obj: any = {};
|
|
75
|
+
if (message.accessToken !== "") {
|
|
76
|
+
obj.accessToken = message.accessToken;
|
|
77
|
+
}
|
|
78
|
+
return obj;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
create<I extends Exact<DeepPartial<ValidateTokenRequest>, I>>(base?: I): ValidateTokenRequest {
|
|
82
|
+
return ValidateTokenRequest.fromPartial(base ?? ({} as any));
|
|
83
|
+
},
|
|
84
|
+
fromPartial<I extends Exact<DeepPartial<ValidateTokenRequest>, I>>(object: I): ValidateTokenRequest {
|
|
85
|
+
const message = createBaseValidateTokenRequest();
|
|
86
|
+
message.accessToken = object.accessToken ?? "";
|
|
87
|
+
return message;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
function createBaseValidateTokenResponse(): ValidateTokenResponse {
|
|
92
|
+
return { valid: false, userId: "" };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const ValidateTokenResponse: MessageFns<ValidateTokenResponse> = {
|
|
96
|
+
encode(message: ValidateTokenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
97
|
+
if (message.valid !== false) {
|
|
98
|
+
writer.uint32(8).bool(message.valid);
|
|
99
|
+
}
|
|
100
|
+
if (message.userId !== "") {
|
|
101
|
+
writer.uint32(18).string(message.userId);
|
|
102
|
+
}
|
|
103
|
+
return writer;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ValidateTokenResponse {
|
|
107
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
108
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
109
|
+
const message = createBaseValidateTokenResponse();
|
|
110
|
+
while (reader.pos < end) {
|
|
111
|
+
const tag = reader.uint32();
|
|
112
|
+
switch (tag >>> 3) {
|
|
113
|
+
case 1: {
|
|
114
|
+
if (tag !== 8) {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
message.valid = reader.bool();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
case 2: {
|
|
122
|
+
if (tag !== 18) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
message.userId = reader.string();
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
reader.skip(tag & 7);
|
|
134
|
+
}
|
|
135
|
+
return message;
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
fromJSON(object: any): ValidateTokenResponse {
|
|
139
|
+
return {
|
|
140
|
+
valid: isSet(object.valid) ? globalThis.Boolean(object.valid) : false,
|
|
141
|
+
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
toJSON(message: ValidateTokenResponse): unknown {
|
|
146
|
+
const obj: any = {};
|
|
147
|
+
if (message.valid !== false) {
|
|
148
|
+
obj.valid = message.valid;
|
|
149
|
+
}
|
|
150
|
+
if (message.userId !== "") {
|
|
151
|
+
obj.userId = message.userId;
|
|
152
|
+
}
|
|
153
|
+
return obj;
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
create<I extends Exact<DeepPartial<ValidateTokenResponse>, I>>(base?: I): ValidateTokenResponse {
|
|
157
|
+
return ValidateTokenResponse.fromPartial(base ?? ({} as any));
|
|
158
|
+
},
|
|
159
|
+
fromPartial<I extends Exact<DeepPartial<ValidateTokenResponse>, I>>(object: I): ValidateTokenResponse {
|
|
160
|
+
const message = createBaseValidateTokenResponse();
|
|
161
|
+
message.valid = object.valid ?? false;
|
|
162
|
+
message.userId = object.userId ?? "";
|
|
163
|
+
return message;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export type AuthServiceService = typeof AuthServiceService;
|
|
168
|
+
export const AuthServiceService = {
|
|
169
|
+
validateToken: {
|
|
170
|
+
path: "/auth.v1.AuthService/ValidateToken",
|
|
171
|
+
requestStream: false,
|
|
172
|
+
responseStream: false,
|
|
173
|
+
requestSerialize: (value: ValidateTokenRequest): Buffer => Buffer.from(ValidateTokenRequest.encode(value).finish()),
|
|
174
|
+
requestDeserialize: (value: Buffer): ValidateTokenRequest => ValidateTokenRequest.decode(value),
|
|
175
|
+
responseSerialize: (value: ValidateTokenResponse): Buffer =>
|
|
176
|
+
Buffer.from(ValidateTokenResponse.encode(value).finish()),
|
|
177
|
+
responseDeserialize: (value: Buffer): ValidateTokenResponse => ValidateTokenResponse.decode(value),
|
|
178
|
+
},
|
|
179
|
+
} as const;
|
|
180
|
+
|
|
181
|
+
export interface AuthServiceServer extends UntypedServiceImplementation {
|
|
182
|
+
validateToken: handleUnaryCall<ValidateTokenRequest, ValidateTokenResponse>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface AuthServiceClient extends Client {
|
|
186
|
+
validateToken(
|
|
187
|
+
request: ValidateTokenRequest,
|
|
188
|
+
callback: (error: ServiceError | null, response: ValidateTokenResponse) => void,
|
|
189
|
+
): ClientUnaryCall;
|
|
190
|
+
validateToken(
|
|
191
|
+
request: ValidateTokenRequest,
|
|
192
|
+
metadata: Metadata,
|
|
193
|
+
callback: (error: ServiceError | null, response: ValidateTokenResponse) => void,
|
|
194
|
+
): ClientUnaryCall;
|
|
195
|
+
validateToken(
|
|
196
|
+
request: ValidateTokenRequest,
|
|
197
|
+
metadata: Metadata,
|
|
198
|
+
options: Partial<CallOptions>,
|
|
199
|
+
callback: (error: ServiceError | null, response: ValidateTokenResponse) => void,
|
|
200
|
+
): ClientUnaryCall;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export const AuthServiceClient = makeGenericClientConstructor(AuthServiceService, "auth.v1.AuthService") as unknown as {
|
|
204
|
+
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): AuthServiceClient;
|
|
205
|
+
service: typeof AuthServiceService;
|
|
206
|
+
serviceName: string;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
210
|
+
|
|
211
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
212
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
213
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
214
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
215
|
+
: Partial<T>;
|
|
216
|
+
|
|
217
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
218
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
219
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
220
|
+
|
|
221
|
+
function isSet(value: any): boolean {
|
|
222
|
+
return value !== null && value !== undefined;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface MessageFns<T> {
|
|
226
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
227
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
228
|
+
fromJSON(object: any): T;
|
|
229
|
+
toJSON(message: T): unknown;
|
|
230
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
231
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
232
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@control_yourself/contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"author": "vladimir.pariy@gmail.com",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,16 +19,17 @@
|
|
|
19
19
|
"@bufbuild/buf": "^1.63.0",
|
|
20
20
|
"@bufbuild/protoc-gen-es": "^2.10.2",
|
|
21
21
|
"@connectrpc/connect": "^2.1.1",
|
|
22
|
-
"proto-loader-gen-types": "^1.0.0",
|
|
23
22
|
"ts-node": "^10.9.2",
|
|
24
23
|
"typescript": "^5.9.3"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"@bufbuild/protobuf": "^2.10.2"
|
|
28
27
|
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@grpc/grpc-js": "^1.14.3"
|
|
30
|
+
},
|
|
29
31
|
"scripts": {
|
|
30
32
|
"build": "tsc",
|
|
31
|
-
"proto:gen": "pnpm buf generate"
|
|
32
|
-
"grpc:types": "proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=generated-grpc protos/*.proto"
|
|
33
|
+
"proto:gen": "pnpm buf generate protos"
|
|
33
34
|
}
|
|
34
35
|
}
|
package/protos/buf.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version: v1
|