macrocosmos 1.2.2 → 1.2.4
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/dist/generated/apex/v1/apex.d.ts +440 -718
- package/dist/generated/apex/v1/apex.js +2924 -582
- package/dist/generated/billing/v1/billing.d.ts +71 -94
- package/dist/generated/billing/v1/billing.js +328 -80
- package/dist/generated/google/protobuf/timestamp.d.ts +122 -0
- package/dist/generated/google/protobuf/timestamp.js +92 -0
- package/dist/generated/gravity/v1/gravity.d.ts +378 -562
- package/dist/generated/gravity/v1/gravity.js +2360 -457
- package/dist/generated/sn13/v1/sn13_validator.d.ts +91 -114
- package/dist/generated/sn13/v1/sn13_validator.js +421 -96
- package/dist/lib/BaseClient.js +5 -5
- package/dist/lib/apex/Client.d.ts +8 -13
- package/dist/lib/apex/Client.js +14 -24
- package/dist/lib/billing/Client.d.ts +4 -17
- package/dist/lib/billing/Client.js +7 -21
- package/dist/lib/gravity/Client.d.ts +14 -22
- package/dist/lib/gravity/Client.js +13 -27
- package/dist/lib/sn13/Client.d.ts +4 -20
- package/dist/lib/sn13/Client.js +8 -22
- package/dist/lib/util.types.d.ts +1 -0
- package/dist/lib/util.types.js +3 -0
- package/new_version.txt +1 -1
- package/old_version.txt +1 -1
- package/package.json +7 -3
- package/tsconfig.eslint.json +1 -1
- package/eslint.config.cjs +0 -33
|
@@ -1,100 +1,425 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.7.0
|
|
5
|
+
// protoc v3.20.3
|
|
6
|
+
// source: sn13/v1/sn13_validator.proto
|
|
3
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
8
|
+
exports.Sn13ServiceClient = exports.Sn13ServiceService = exports.ValidateRedditTopicResponse = exports.ValidateRedditTopicRequest = exports.ListTopicsResponse = exports.ListTopicsResponseDetail = exports.ListTopicsRequest = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const grpc_js_1 = require("@grpc/grpc-js");
|
|
12
|
+
exports.protobufPackage = "sn13.v1";
|
|
13
|
+
function createBaseListTopicsRequest() {
|
|
14
|
+
return { source: "" };
|
|
15
|
+
}
|
|
16
|
+
exports.ListTopicsRequest = {
|
|
17
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
18
|
+
if (message.source !== "") {
|
|
19
|
+
writer.uint32(10).string(message.source);
|
|
20
|
+
}
|
|
21
|
+
return writer;
|
|
22
|
+
},
|
|
23
|
+
decode(input, length) {
|
|
24
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
25
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
26
|
+
const message = createBaseListTopicsRequest();
|
|
27
|
+
while (reader.pos < end) {
|
|
28
|
+
const tag = reader.uint32();
|
|
29
|
+
switch (tag >>> 3) {
|
|
30
|
+
case 1: {
|
|
31
|
+
if (tag !== 10) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
message.source = reader.string();
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
reader.skip(tag & 7);
|
|
42
|
+
}
|
|
43
|
+
return message;
|
|
44
|
+
},
|
|
45
|
+
fromJSON(object) {
|
|
46
|
+
return {
|
|
47
|
+
source: isSet(object.source) ? globalThis.String(object.source) : "",
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
toJSON(message) {
|
|
51
|
+
const obj = {};
|
|
52
|
+
if (message.source !== "") {
|
|
53
|
+
obj.source = message.source;
|
|
54
|
+
}
|
|
55
|
+
return obj;
|
|
56
|
+
},
|
|
57
|
+
create(base) {
|
|
58
|
+
return exports.ListTopicsRequest.fromPartial(base ?? {});
|
|
59
|
+
},
|
|
60
|
+
fromPartial(object) {
|
|
61
|
+
const message = createBaseListTopicsRequest();
|
|
62
|
+
message.source = object.source ?? "";
|
|
63
|
+
return message;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
function createBaseListTopicsResponseDetail() {
|
|
67
|
+
return { labelValue: "", contentSizeBytes: 0, adjContentSizeBytes: 0 };
|
|
68
|
+
}
|
|
69
|
+
exports.ListTopicsResponseDetail = {
|
|
70
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
71
|
+
if (message.labelValue !== "") {
|
|
72
|
+
writer.uint32(10).string(message.labelValue);
|
|
73
|
+
}
|
|
74
|
+
if (message.contentSizeBytes !== 0) {
|
|
75
|
+
writer.uint32(16).uint64(message.contentSizeBytes);
|
|
76
|
+
}
|
|
77
|
+
if (message.adjContentSizeBytes !== 0) {
|
|
78
|
+
writer.uint32(24).uint64(message.adjContentSizeBytes);
|
|
79
|
+
}
|
|
80
|
+
return writer;
|
|
81
|
+
},
|
|
82
|
+
decode(input, length) {
|
|
83
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
84
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
85
|
+
const message = createBaseListTopicsResponseDetail();
|
|
86
|
+
while (reader.pos < end) {
|
|
87
|
+
const tag = reader.uint32();
|
|
88
|
+
switch (tag >>> 3) {
|
|
89
|
+
case 1: {
|
|
90
|
+
if (tag !== 10) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
message.labelValue = reader.string();
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
case 2: {
|
|
97
|
+
if (tag !== 16) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
message.contentSizeBytes = longToNumber(reader.uint64());
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
case 3: {
|
|
104
|
+
if (tag !== 24) {
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
message.adjContentSizeBytes = longToNumber(reader.uint64());
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
reader.skip(tag & 7);
|
|
115
|
+
}
|
|
116
|
+
return message;
|
|
117
|
+
},
|
|
118
|
+
fromJSON(object) {
|
|
119
|
+
return {
|
|
120
|
+
labelValue: isSet(object.labelValue)
|
|
121
|
+
? globalThis.String(object.labelValue)
|
|
122
|
+
: "",
|
|
123
|
+
contentSizeBytes: isSet(object.contentSizeBytes)
|
|
124
|
+
? globalThis.Number(object.contentSizeBytes)
|
|
125
|
+
: 0,
|
|
126
|
+
adjContentSizeBytes: isSet(object.adjContentSizeBytes)
|
|
127
|
+
? globalThis.Number(object.adjContentSizeBytes)
|
|
128
|
+
: 0,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
toJSON(message) {
|
|
132
|
+
const obj = {};
|
|
133
|
+
if (message.labelValue !== "") {
|
|
134
|
+
obj.labelValue = message.labelValue;
|
|
135
|
+
}
|
|
136
|
+
if (message.contentSizeBytes !== 0) {
|
|
137
|
+
obj.contentSizeBytes = Math.round(message.contentSizeBytes);
|
|
138
|
+
}
|
|
139
|
+
if (message.adjContentSizeBytes !== 0) {
|
|
140
|
+
obj.adjContentSizeBytes = Math.round(message.adjContentSizeBytes);
|
|
141
|
+
}
|
|
142
|
+
return obj;
|
|
143
|
+
},
|
|
144
|
+
create(base) {
|
|
145
|
+
return exports.ListTopicsResponseDetail.fromPartial(base ?? {});
|
|
146
|
+
},
|
|
147
|
+
fromPartial(object) {
|
|
148
|
+
const message = createBaseListTopicsResponseDetail();
|
|
149
|
+
message.labelValue = object.labelValue ?? "";
|
|
150
|
+
message.contentSizeBytes = object.contentSizeBytes ?? 0;
|
|
151
|
+
message.adjContentSizeBytes = object.adjContentSizeBytes ?? 0;
|
|
152
|
+
return message;
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
function createBaseListTopicsResponse() {
|
|
156
|
+
return { details: [] };
|
|
157
|
+
}
|
|
158
|
+
exports.ListTopicsResponse = {
|
|
159
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
160
|
+
for (const v of message.details) {
|
|
161
|
+
exports.ListTopicsResponseDetail.encode(v, writer.uint32(10).fork()).join();
|
|
162
|
+
}
|
|
163
|
+
return writer;
|
|
164
|
+
},
|
|
165
|
+
decode(input, length) {
|
|
166
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
167
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
168
|
+
const message = createBaseListTopicsResponse();
|
|
169
|
+
while (reader.pos < end) {
|
|
170
|
+
const tag = reader.uint32();
|
|
171
|
+
switch (tag >>> 3) {
|
|
172
|
+
case 1: {
|
|
173
|
+
if (tag !== 10) {
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
message.details.push(exports.ListTopicsResponseDetail.decode(reader, reader.uint32()));
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
reader.skip(tag & 7);
|
|
184
|
+
}
|
|
185
|
+
return message;
|
|
186
|
+
},
|
|
187
|
+
fromJSON(object) {
|
|
188
|
+
return {
|
|
189
|
+
details: globalThis.Array.isArray(object?.details)
|
|
190
|
+
? object.details.map((e) => exports.ListTopicsResponseDetail.fromJSON(e))
|
|
191
|
+
: [],
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
toJSON(message) {
|
|
195
|
+
const obj = {};
|
|
196
|
+
if (message.details?.length) {
|
|
197
|
+
obj.details = message.details.map(e => exports.ListTopicsResponseDetail.toJSON(e));
|
|
198
|
+
}
|
|
199
|
+
return obj;
|
|
200
|
+
},
|
|
201
|
+
create(base) {
|
|
202
|
+
return exports.ListTopicsResponse.fromPartial(base ?? {});
|
|
203
|
+
},
|
|
204
|
+
fromPartial(object) {
|
|
205
|
+
const message = createBaseListTopicsResponse();
|
|
206
|
+
message.details =
|
|
207
|
+
object.details?.map(e => exports.ListTopicsResponseDetail.fromPartial(e)) || [];
|
|
208
|
+
return message;
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
function createBaseValidateRedditTopicRequest() {
|
|
212
|
+
return { topic: "" };
|
|
213
|
+
}
|
|
214
|
+
exports.ValidateRedditTopicRequest = {
|
|
215
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
216
|
+
if (message.topic !== "") {
|
|
217
|
+
writer.uint32(10).string(message.topic);
|
|
218
|
+
}
|
|
219
|
+
return writer;
|
|
220
|
+
},
|
|
221
|
+
decode(input, length) {
|
|
222
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
223
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
224
|
+
const message = createBaseValidateRedditTopicRequest();
|
|
225
|
+
while (reader.pos < end) {
|
|
226
|
+
const tag = reader.uint32();
|
|
227
|
+
switch (tag >>> 3) {
|
|
228
|
+
case 1: {
|
|
229
|
+
if (tag !== 10) {
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
message.topic = reader.string();
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
reader.skip(tag & 7);
|
|
240
|
+
}
|
|
241
|
+
return message;
|
|
242
|
+
},
|
|
243
|
+
fromJSON(object) {
|
|
244
|
+
return {
|
|
245
|
+
topic: isSet(object.topic) ? globalThis.String(object.topic) : "",
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
toJSON(message) {
|
|
249
|
+
const obj = {};
|
|
250
|
+
if (message.topic !== "") {
|
|
251
|
+
obj.topic = message.topic;
|
|
252
|
+
}
|
|
253
|
+
return obj;
|
|
254
|
+
},
|
|
255
|
+
create(base) {
|
|
256
|
+
return exports.ValidateRedditTopicRequest.fromPartial(base ?? {});
|
|
257
|
+
},
|
|
258
|
+
fromPartial(object) {
|
|
259
|
+
const message = createBaseValidateRedditTopicRequest();
|
|
260
|
+
message.topic = object.topic ?? "";
|
|
261
|
+
return message;
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
function createBaseValidateRedditTopicResponse() {
|
|
265
|
+
return {
|
|
266
|
+
platform: "",
|
|
267
|
+
topic: "",
|
|
268
|
+
exists: false,
|
|
269
|
+
over18: false,
|
|
270
|
+
quarantine: false,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
exports.ValidateRedditTopicResponse = {
|
|
274
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
275
|
+
if (message.platform !== "") {
|
|
276
|
+
writer.uint32(10).string(message.platform);
|
|
277
|
+
}
|
|
278
|
+
if (message.topic !== "") {
|
|
279
|
+
writer.uint32(18).string(message.topic);
|
|
280
|
+
}
|
|
281
|
+
if (message.exists !== false) {
|
|
282
|
+
writer.uint32(24).bool(message.exists);
|
|
283
|
+
}
|
|
284
|
+
if (message.over18 !== false) {
|
|
285
|
+
writer.uint32(32).bool(message.over18);
|
|
286
|
+
}
|
|
287
|
+
if (message.quarantine !== false) {
|
|
288
|
+
writer.uint32(40).bool(message.quarantine);
|
|
289
|
+
}
|
|
290
|
+
return writer;
|
|
291
|
+
},
|
|
292
|
+
decode(input, length) {
|
|
293
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
294
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
295
|
+
const message = createBaseValidateRedditTopicResponse();
|
|
296
|
+
while (reader.pos < end) {
|
|
297
|
+
const tag = reader.uint32();
|
|
298
|
+
switch (tag >>> 3) {
|
|
299
|
+
case 1: {
|
|
300
|
+
if (tag !== 10) {
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
message.platform = reader.string();
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
case 2: {
|
|
307
|
+
if (tag !== 18) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
message.topic = reader.string();
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
case 3: {
|
|
314
|
+
if (tag !== 24) {
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
message.exists = reader.bool();
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
case 4: {
|
|
321
|
+
if (tag !== 32) {
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
message.over18 = reader.bool();
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
case 5: {
|
|
328
|
+
if (tag !== 40) {
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
message.quarantine = reader.bool();
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
reader.skip(tag & 7);
|
|
339
|
+
}
|
|
340
|
+
return message;
|
|
341
|
+
},
|
|
342
|
+
fromJSON(object) {
|
|
343
|
+
return {
|
|
344
|
+
platform: isSet(object.platform)
|
|
345
|
+
? globalThis.String(object.platform)
|
|
346
|
+
: "",
|
|
347
|
+
topic: isSet(object.topic) ? globalThis.String(object.topic) : "",
|
|
348
|
+
exists: isSet(object.exists)
|
|
349
|
+
? globalThis.Boolean(object.exists)
|
|
350
|
+
: false,
|
|
351
|
+
over18: isSet(object.over18)
|
|
352
|
+
? globalThis.Boolean(object.over18)
|
|
353
|
+
: false,
|
|
354
|
+
quarantine: isSet(object.quarantine)
|
|
355
|
+
? globalThis.Boolean(object.quarantine)
|
|
356
|
+
: false,
|
|
357
|
+
};
|
|
358
|
+
},
|
|
359
|
+
toJSON(message) {
|
|
360
|
+
const obj = {};
|
|
361
|
+
if (message.platform !== "") {
|
|
362
|
+
obj.platform = message.platform;
|
|
363
|
+
}
|
|
364
|
+
if (message.topic !== "") {
|
|
365
|
+
obj.topic = message.topic;
|
|
366
|
+
}
|
|
367
|
+
if (message.exists !== false) {
|
|
368
|
+
obj.exists = message.exists;
|
|
369
|
+
}
|
|
370
|
+
if (message.over18 !== false) {
|
|
371
|
+
obj.over18 = message.over18;
|
|
372
|
+
}
|
|
373
|
+
if (message.quarantine !== false) {
|
|
374
|
+
obj.quarantine = message.quarantine;
|
|
375
|
+
}
|
|
376
|
+
return obj;
|
|
377
|
+
},
|
|
378
|
+
create(base) {
|
|
379
|
+
return exports.ValidateRedditTopicResponse.fromPartial(base ?? {});
|
|
380
|
+
},
|
|
381
|
+
fromPartial(object) {
|
|
382
|
+
const message = createBaseValidateRedditTopicResponse();
|
|
383
|
+
message.platform = object.platform ?? "";
|
|
384
|
+
message.topic = object.topic ?? "";
|
|
385
|
+
message.exists = object.exists ?? false;
|
|
386
|
+
message.over18 = object.over18 ?? false;
|
|
387
|
+
message.quarantine = object.quarantine ?? false;
|
|
388
|
+
return message;
|
|
389
|
+
},
|
|
390
|
+
};
|
|
391
|
+
exports.Sn13ServiceService = {
|
|
392
|
+
/** ListTopics is the RPC method for getting the top topics */
|
|
393
|
+
listTopics: {
|
|
394
|
+
path: "/sn13.v1.Sn13Service/ListTopics",
|
|
395
|
+
requestStream: false,
|
|
396
|
+
responseStream: false,
|
|
397
|
+
requestSerialize: (value) => Buffer.from(exports.ListTopicsRequest.encode(value).finish()),
|
|
398
|
+
requestDeserialize: (value) => exports.ListTopicsRequest.decode(value),
|
|
399
|
+
responseSerialize: (value) => Buffer.from(exports.ListTopicsResponse.encode(value).finish()),
|
|
400
|
+
responseDeserialize: (value) => exports.ListTopicsResponse.decode(value),
|
|
401
|
+
},
|
|
402
|
+
validateRedditTopic: {
|
|
403
|
+
path: "/sn13.v1.Sn13Service/ValidateRedditTopic",
|
|
404
|
+
requestStream: false,
|
|
405
|
+
responseStream: false,
|
|
406
|
+
requestSerialize: (value) => Buffer.from(exports.ValidateRedditTopicRequest.encode(value).finish()),
|
|
407
|
+
requestDeserialize: (value) => exports.ValidateRedditTopicRequest.decode(value),
|
|
408
|
+
responseSerialize: (value) => Buffer.from(exports.ValidateRedditTopicResponse.encode(value).finish()),
|
|
409
|
+
responseDeserialize: (value) => exports.ValidateRedditTopicResponse.decode(value),
|
|
99
410
|
},
|
|
100
411
|
};
|
|
412
|
+
exports.Sn13ServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.Sn13ServiceService, "sn13.v1.Sn13Service");
|
|
413
|
+
function longToNumber(int64) {
|
|
414
|
+
const num = globalThis.Number(int64.toString());
|
|
415
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
416
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
417
|
+
}
|
|
418
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
419
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
420
|
+
}
|
|
421
|
+
return num;
|
|
422
|
+
}
|
|
423
|
+
function isSet(value) {
|
|
424
|
+
return value !== null && value !== undefined;
|
|
425
|
+
}
|
package/dist/lib/BaseClient.js
CHANGED
|
@@ -7,14 +7,14 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
*/
|
|
8
8
|
class BaseClient {
|
|
9
9
|
constructor(options) {
|
|
10
|
-
this.apiKey = options.apiKey
|
|
11
|
-
this.baseURL = options.baseURL
|
|
12
|
-
this.appName = options.appName
|
|
13
|
-
this.userId = options.userId
|
|
10
|
+
this.apiKey = options.apiKey ?? "";
|
|
11
|
+
this.baseURL = options.baseURL ?? constants_1.BASE_URL;
|
|
12
|
+
this.appName = options.appName ?? "unknown";
|
|
13
|
+
this.userId = options.userId ?? "";
|
|
14
14
|
// Check environment variable for HTTPS setting
|
|
15
15
|
const useHttps = process.env.MACROCOSMOS_USE_HTTPS !== "false";
|
|
16
16
|
// Use secure if explicitly set in options or if HTTPS is enabled via env var
|
|
17
|
-
this.secure = options.secure
|
|
17
|
+
this.secure = options.secure ?? useHttps;
|
|
18
18
|
// Check if the API key is valid
|
|
19
19
|
if (!this.apiKey) {
|
|
20
20
|
throw new Error("API key is required");
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { ApexServiceClient, ChatCompletionRequest as GeneratedChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunkResponse, WebRetrievalRequest as GeneratedWebRetrievalRequest, WebRetrievalResponse, ChatMessage } from "../../generated/apex/v1/apex";
|
|
1
2
|
import * as grpc from "@grpc/grpc-js";
|
|
2
|
-
import { IChatCompletionRequest, IChatMessage, ISamplingParameters, IChatCompletionResponse, IChatCompletionChunkResponse, IWebRetrievalRequest, IWebRetrievalResponse, IApexServiceClient } from "../../generated/apex/v1/apex";
|
|
3
3
|
import { BaseClient, BaseClientOptions } from "../BaseClient";
|
|
4
4
|
import { ApexStream } from "./Stream";
|
|
5
|
+
import { MarkFieldsOptional } from "../util.types";
|
|
6
|
+
type ChatCompletionRequest = MarkFieldsOptional<GeneratedChatCompletionRequest, "uids">;
|
|
7
|
+
type WebRetrievalRequest = MarkFieldsOptional<GeneratedWebRetrievalRequest, "uids">;
|
|
8
|
+
export { ApexStream, WebRetrievalRequest, WebRetrievalResponse, ChatCompletionRequest, ChatMessage, };
|
|
5
9
|
interface ApexClientOptions extends BaseClientOptions {
|
|
6
10
|
timeout?: number;
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
export type SamplingParameters = ISamplingParameters;
|
|
10
|
-
export type ChatCompletionRequest = IChatCompletionRequest;
|
|
11
|
-
export type ChatCompletionResponse = IChatCompletionResponse;
|
|
12
|
-
export type ChatCompletionChunkResponse = IChatCompletionChunkResponse;
|
|
13
|
-
export type WebRetrievalRequest = IWebRetrievalRequest;
|
|
14
|
-
export type WebRetrievalResponse = IWebRetrievalResponse;
|
|
15
|
-
interface ApexService extends grpc.ServiceClientConstructor, IApexServiceClient {
|
|
12
|
+
interface ApexService extends grpc.ServiceClientConstructor, ApexServiceClient {
|
|
16
13
|
}
|
|
17
14
|
export interface ApexProtoClient {
|
|
18
15
|
ApexService: {
|
|
@@ -24,10 +21,9 @@ export interface ApexProtoClient {
|
|
|
24
21
|
* Provides OpenAI-compatible interface over gRPC
|
|
25
22
|
*/
|
|
26
23
|
export declare class ApexClient extends BaseClient {
|
|
27
|
-
private
|
|
24
|
+
private _grpcClient?;
|
|
28
25
|
private defaultTimeout;
|
|
29
|
-
constructor(options: ApexClientOptions);
|
|
30
|
-
private initializeGrpcClient;
|
|
26
|
+
constructor(options: ApexClientOptions, grpcClient?: ApexServiceClient);
|
|
31
27
|
private createGrpcClient;
|
|
32
28
|
/**
|
|
33
29
|
* Get the default timeout for chat completions
|
|
@@ -46,4 +42,3 @@ export declare class ApexClient extends BaseClient {
|
|
|
46
42
|
*/
|
|
47
43
|
webRetrieval: (params: WebRetrievalRequest) => Promise<WebRetrievalResponse>;
|
|
48
44
|
}
|
|
49
|
-
export {};
|
package/dist/lib/apex/Client.js
CHANGED
|
@@ -33,18 +33,20 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ApexClient = void 0;
|
|
36
|
+
exports.ApexClient = exports.ChatMessage = exports.WebRetrievalResponse = exports.ApexStream = void 0;
|
|
37
|
+
const apex_1 = require("../../generated/apex/v1/apex");
|
|
38
|
+
Object.defineProperty(exports, "WebRetrievalResponse", { enumerable: true, get: function () { return apex_1.WebRetrievalResponse; } });
|
|
39
|
+
Object.defineProperty(exports, "ChatMessage", { enumerable: true, get: function () { return apex_1.ChatMessage; } });
|
|
37
40
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
38
|
-
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
41
|
const BaseClient_1 = require("../BaseClient");
|
|
41
42
|
const Stream_1 = require("./Stream");
|
|
43
|
+
Object.defineProperty(exports, "ApexStream", { enumerable: true, get: function () { return Stream_1.ApexStream; } });
|
|
42
44
|
/**
|
|
43
45
|
* Client for interacting with the Apex API
|
|
44
46
|
* Provides OpenAI-compatible interface over gRPC
|
|
45
47
|
*/
|
|
46
48
|
class ApexClient extends BaseClient_1.BaseClient {
|
|
47
|
-
constructor(options) {
|
|
49
|
+
constructor(options, grpcClient) {
|
|
48
50
|
super(options);
|
|
49
51
|
/**
|
|
50
52
|
* OpenAI-compatible chat completions API
|
|
@@ -56,12 +58,13 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
56
58
|
// Apply default timeout if not specified in params
|
|
57
59
|
const requestParams = {
|
|
58
60
|
...params,
|
|
61
|
+
uids: params.uids ?? [],
|
|
59
62
|
timeout: params.timeout || this.getDefaultTimeout(),
|
|
60
63
|
};
|
|
61
64
|
// Handle streaming vs non-streaming
|
|
62
65
|
if (requestParams.stream) {
|
|
63
66
|
// Create a streaming call
|
|
64
|
-
const stream =
|
|
67
|
+
const stream = client.chatCompletionStream(requestParams);
|
|
65
68
|
// Create controller for abort capability
|
|
66
69
|
const controller = new AbortController();
|
|
67
70
|
// Return a Stream object that wraps the gRPC stream
|
|
@@ -70,7 +73,7 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
70
73
|
else {
|
|
71
74
|
// For non-streaming, return a promise that resolves with the completion
|
|
72
75
|
return new Promise((resolve, reject) => {
|
|
73
|
-
|
|
76
|
+
client.chatCompletion(requestParams, (error, response) => {
|
|
74
77
|
if (error) {
|
|
75
78
|
reject(error);
|
|
76
79
|
return;
|
|
@@ -88,7 +91,7 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
88
91
|
this.webRetrieval = async (params) => {
|
|
89
92
|
const client = this.createGrpcClient();
|
|
90
93
|
return new Promise((resolve, reject) => {
|
|
91
|
-
|
|
94
|
+
client.webRetrieval({ ...params, uids: params.uids ?? [] }, (error, response) => {
|
|
92
95
|
if (error) {
|
|
93
96
|
reject(error);
|
|
94
97
|
return;
|
|
@@ -98,24 +101,11 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
98
101
|
});
|
|
99
102
|
};
|
|
100
103
|
this.defaultTimeout = options.timeout || 60;
|
|
101
|
-
this.
|
|
102
|
-
}
|
|
103
|
-
initializeGrpcClient() {
|
|
104
|
-
// Load proto file directly
|
|
105
|
-
const PROTO_PATH = path.resolve(__dirname, "../../../protos/apex/v1/apex.proto");
|
|
106
|
-
// Load protos using standard protobuf loader
|
|
107
|
-
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
108
|
-
keepCase: false,
|
|
109
|
-
longs: String,
|
|
110
|
-
enums: String,
|
|
111
|
-
defaults: true,
|
|
112
|
-
oneofs: true,
|
|
113
|
-
});
|
|
114
|
-
// Get the ApexService definition
|
|
115
|
-
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
116
|
-
return protoDescriptor.apex.v1;
|
|
104
|
+
this._grpcClient = grpcClient;
|
|
117
105
|
}
|
|
118
106
|
createGrpcClient() {
|
|
107
|
+
if (this._grpcClient)
|
|
108
|
+
return this._grpcClient;
|
|
119
109
|
// Create gRPC credentials with API key
|
|
120
110
|
const callCreds = grpc.credentials.createFromMetadataGenerator((_params, callback) => {
|
|
121
111
|
const meta = new grpc.Metadata();
|
|
@@ -138,7 +128,7 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
138
128
|
credentials = grpc.credentials.createInsecure();
|
|
139
129
|
}
|
|
140
130
|
// Create gRPC client
|
|
141
|
-
return new
|
|
131
|
+
return new apex_1.ApexServiceClient(this.getBaseURL(), credentials);
|
|
142
132
|
}
|
|
143
133
|
/**
|
|
144
134
|
* Get the default timeout for chat completions
|