@teslemetry/tesla-protocol 0.5.0 → 1.0.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/README.md +1 -3
- package/dist/charging/charging.cjs +550 -0
- package/dist/charging/charging.d.cts +75 -0
- package/dist/charging/charging.d.mts +75 -0
- package/dist/charging/charging.mjs +543 -0
- package/dist/command/car_server.cjs +212 -11
- package/dist/command/car_server.d.cts +121 -96
- package/dist/command/car_server.d.mts +121 -96
- package/dist/command/car_server.mjs +206 -12
- package/dist/command/common.cjs +43 -0
- package/dist/command/common.d.cts +6 -2
- package/dist/command/common.d.mts +6 -2
- package/dist/command/common.mjs +43 -1
- package/dist/command/managed_charging.d.cts +1 -1
- package/dist/command/managed_charging.d.mts +1 -1
- package/dist/command/session.d.cts +0 -4
- package/dist/command/session.d.mts +0 -4
- package/dist/command/universal_message.cjs +8 -3
- package/dist/command/universal_message.d.cts +5 -3
- package/dist/command/universal_message.d.mts +5 -3
- package/dist/command/universal_message.mjs +8 -3
- package/dist/command/vcsec.cjs +124 -39
- package/dist/command/vcsec.d.cts +50 -40
- package/dist/command/vcsec.d.mts +50 -40
- package/dist/command/vcsec.mjs +123 -40
- package/dist/command/vehicle.cjs +156 -18
- package/dist/command/vehicle.d.cts +70 -57
- package/dist/command/vehicle.d.mts +70 -57
- package/dist/command/vehicle.mjs +156 -20
- package/dist/dashcam/dashcam_sei.cjs +263 -0
- package/dist/dashcam/dashcam_sei.d.cts +60 -0
- package/dist/dashcam/dashcam_sei.d.mts +60 -0
- package/dist/dashcam/dashcam_sei.mjs +255 -0
- package/dist/energy_command/identifier_type.cjs +0 -5
- package/dist/energy_command/identifier_type.d.cts +0 -5
- package/dist/energy_command/identifier_type.d.mts +0 -5
- package/dist/energy_command/identifier_type.mjs +0 -5
- package/dist/energy_device/authorization_api.d.cts +0 -5
- package/dist/energy_device/authorization_api.d.mts +0 -5
- package/dist/energy_device/authorization_types.cjs +0 -5
- package/dist/energy_device/authorization_types.d.cts +0 -5
- package/dist/energy_device/authorization_types.d.mts +0 -5
- package/dist/energy_device/authorization_types.mjs +0 -5
- package/dist/energy_device/common_api.cjs +604 -11
- package/dist/energy_device/common_api.d.cts +60 -8
- package/dist/energy_device/common_api.d.mts +60 -8
- package/dist/energy_device/common_api.mjs +596 -12
- package/dist/energy_device/device.cjs +129 -5
- package/dist/energy_device/device.d.cts +13 -6
- package/dist/energy_device/device.d.mts +13 -6
- package/dist/energy_device/device.mjs +127 -6
- package/dist/energy_device/energy.cjs +0 -5
- package/dist/energy_device/energy.d.cts +0 -5
- package/dist/energy_device/energy.d.mts +0 -5
- package/dist/energy_device/energy.mjs +0 -5
- package/dist/energy_device/energy_site_net.cjs +747 -5
- package/dist/energy_device/energy_site_net.d.cts +84 -6
- package/dist/energy_device/energy_site_net.d.mts +84 -6
- package/dist/energy_device/energy_site_net.mjs +736 -6
- package/dist/energy_device/error.d.cts +0 -5
- package/dist/energy_device/error.d.mts +0 -5
- package/dist/energy_device/filestore_api.cjs +570 -0
- package/dist/energy_device/filestore_api.d.cts +76 -0
- package/dist/energy_device/filestore_api.d.mts +76 -0
- package/dist/energy_device/filestore_api.mjs +558 -0
- package/dist/energy_device/google/protobuf/duration.cjs +71 -0
- package/dist/energy_device/google/protobuf/duration.d.cts +95 -0
- package/dist/energy_device/google/protobuf/duration.d.mts +95 -0
- package/dist/energy_device/google/protobuf/duration.mjs +69 -0
- package/dist/energy_device/graphql_api.cjs +444 -0
- package/dist/energy_device/graphql_api.d.cts +73 -0
- package/dist/energy_device/graphql_api.d.mts +73 -0
- package/dist/energy_device/graphql_api.mjs +429 -0
- package/dist/energy_device/intra_site_api.cjs +1693 -0
- package/dist/energy_device/intra_site_api.d.cts +222 -0
- package/dist/energy_device/intra_site_api.d.mts +222 -0
- package/dist/energy_device/intra_site_api.mjs +1639 -0
- package/dist/energy_device/local_auth_api.cjs +500 -0
- package/dist/energy_device/local_auth_api.d.cts +68 -0
- package/dist/energy_device/local_auth_api.d.mts +68 -0
- package/dist/energy_device/local_auth_api.mjs +487 -0
- package/dist/energy_device/networking.cjs +20 -7
- package/dist/energy_device/networking.d.cts +2 -5
- package/dist/energy_device/networking.d.mts +2 -5
- package/dist/energy_device/networking.mjs +20 -7
- package/dist/energy_device/neurio_meter_api.cjs +1437 -0
- package/dist/energy_device/neurio_meter_api.d.cts +197 -0
- package/dist/energy_device/neurio_meter_api.d.mts +197 -0
- package/dist/energy_device/neurio_meter_api.mjs +1396 -0
- package/dist/energy_device/pvi_api.cjs +2949 -0
- package/dist/energy_device/pvi_api.d.cts +314 -0
- package/dist/energy_device/pvi_api.d.mts +314 -0
- package/dist/energy_device/pvi_api.mjs +2887 -0
- package/dist/energy_device/teg_api.cjs +5179 -147
- package/dist/energy_device/teg_api.d.cts +490 -80
- package/dist/energy_device/teg_api.d.mts +490 -80
- package/dist/energy_device/teg_api.mjs +5059 -148
- package/dist/energy_device/transport.cjs +82 -7
- package/dist/energy_device/transport.d.cts +16 -10
- package/dist/energy_device/transport.d.mts +16 -10
- package/dist/energy_device/transport.mjs +82 -7
- package/dist/energy_device/update.cjs +33 -11
- package/dist/energy_device/update.d.cts +3 -5
- package/dist/energy_device/update.d.mts +3 -5
- package/dist/energy_device/update.mjs +33 -11
- package/dist/energy_device/wall_connector.cjs +6729 -10
- package/dist/energy_device/wall_connector.d.cts +696 -7
- package/dist/energy_device/wall_connector.d.mts +696 -7
- package/dist/energy_device/wall_connector.mjs +6591 -11
- package/dist/telemetry/vehicle_data.cjs +1 -1
- package/dist/telemetry/vehicle_data.d.cts +1 -1
- package/dist/telemetry/vehicle_data.d.mts +1 -1
- package/dist/telemetry/vehicle_data.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { StringValue } from "./google/protobuf/wrappers.mjs";
|
|
2
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
3
|
+
//#region src/energy_device/graphql_api.ts
|
|
4
|
+
const protobufPackage = "tesla.proto.energy_device.v1";
|
|
5
|
+
let GraphQLQueryFormat = /* @__PURE__ */ function(GraphQLQueryFormat) {
|
|
6
|
+
GraphQLQueryFormat[GraphQLQueryFormat["GRAPH_QL_QUERY_FORMAT_INVALID"] = 0] = "GRAPH_QL_QUERY_FORMAT_INVALID";
|
|
7
|
+
GraphQLQueryFormat[GraphQLQueryFormat["GRAPH_QL_QUERY_FORMAT_RAW"] = 1] = "GRAPH_QL_QUERY_FORMAT_RAW";
|
|
8
|
+
GraphQLQueryFormat[GraphQLQueryFormat["GRAPH_QL_QUERY_FORMAT_SIGNED_SHA256_ECDSA_ASN1"] = 2] = "GRAPH_QL_QUERY_FORMAT_SIGNED_SHA256_ECDSA_ASN1";
|
|
9
|
+
GraphQLQueryFormat[GraphQLQueryFormat["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
10
|
+
return GraphQLQueryFormat;
|
|
11
|
+
}({});
|
|
12
|
+
function graphQLQueryFormatFromJSON(object) {
|
|
13
|
+
switch (object) {
|
|
14
|
+
case 0:
|
|
15
|
+
case "GRAPH_QL_QUERY_FORMAT_INVALID": return 0;
|
|
16
|
+
case 1:
|
|
17
|
+
case "GRAPH_QL_QUERY_FORMAT_RAW": return 1;
|
|
18
|
+
case 2:
|
|
19
|
+
case "GRAPH_QL_QUERY_FORMAT_SIGNED_SHA256_ECDSA_ASN1": return 2;
|
|
20
|
+
default: return -1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function graphQLQueryFormatToJSON(object) {
|
|
24
|
+
switch (object) {
|
|
25
|
+
case 0: return "GRAPH_QL_QUERY_FORMAT_INVALID";
|
|
26
|
+
case 1: return "GRAPH_QL_QUERY_FORMAT_RAW";
|
|
27
|
+
case 2: return "GRAPH_QL_QUERY_FORMAT_SIGNED_SHA256_ECDSA_ASN1";
|
|
28
|
+
default: return "UNRECOGNIZED";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let GraphQLStatus = /* @__PURE__ */ function(GraphQLStatus) {
|
|
32
|
+
GraphQLStatus[GraphQLStatus["GRAPH_QL_STATUS_INVALID"] = 0] = "GRAPH_QL_STATUS_INVALID";
|
|
33
|
+
GraphQLStatus[GraphQLStatus["GRAPH_QL_STATUS_SUCCESS"] = 1] = "GRAPH_QL_STATUS_SUCCESS";
|
|
34
|
+
GraphQLStatus[GraphQLStatus["GRAPH_QL_STATUS_ERROR_PARTIAL"] = 2] = "GRAPH_QL_STATUS_ERROR_PARTIAL";
|
|
35
|
+
GraphQLStatus[GraphQLStatus["GRAPH_QL_STATUS_ERROR_FULL"] = 3] = "GRAPH_QL_STATUS_ERROR_FULL";
|
|
36
|
+
GraphQLStatus[GraphQLStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
37
|
+
return GraphQLStatus;
|
|
38
|
+
}({});
|
|
39
|
+
function graphQLStatusFromJSON(object) {
|
|
40
|
+
switch (object) {
|
|
41
|
+
case 0:
|
|
42
|
+
case "GRAPH_QL_STATUS_INVALID": return 0;
|
|
43
|
+
case 1:
|
|
44
|
+
case "GRAPH_QL_STATUS_SUCCESS": return 1;
|
|
45
|
+
case 2:
|
|
46
|
+
case "GRAPH_QL_STATUS_ERROR_PARTIAL": return 2;
|
|
47
|
+
case 3:
|
|
48
|
+
case "GRAPH_QL_STATUS_ERROR_FULL": return 3;
|
|
49
|
+
default: return -1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function graphQLStatusToJSON(object) {
|
|
53
|
+
switch (object) {
|
|
54
|
+
case 0: return "GRAPH_QL_STATUS_INVALID";
|
|
55
|
+
case 1: return "GRAPH_QL_STATUS_SUCCESS";
|
|
56
|
+
case 2: return "GRAPH_QL_STATUS_ERROR_PARTIAL";
|
|
57
|
+
case 3: return "GRAPH_QL_STATUS_ERROR_FULL";
|
|
58
|
+
default: return "UNRECOGNIZED";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let GraphQLErrorCode = /* @__PURE__ */ function(GraphQLErrorCode) {
|
|
62
|
+
GraphQLErrorCode[GraphQLErrorCode["GRAPH_QL_ERROR_CODE_INVALID"] = 0] = "GRAPH_QL_ERROR_CODE_INVALID";
|
|
63
|
+
GraphQLErrorCode[GraphQLErrorCode["GRAPH_QL_ERROR_CODE_FIELD_NOT_FOUND"] = 1] = "GRAPH_QL_ERROR_CODE_FIELD_NOT_FOUND";
|
|
64
|
+
GraphQLErrorCode[GraphQLErrorCode["GRAPH_QL_ERROR_CODE_UNAUTHORIZED"] = 2] = "GRAPH_QL_ERROR_CODE_UNAUTHORIZED";
|
|
65
|
+
GraphQLErrorCode[GraphQLErrorCode["GRAPH_QL_ERROR_CODE_RESOLVER_PROCESS_UNRESPONSIVE"] = 3] = "GRAPH_QL_ERROR_CODE_RESOLVER_PROCESS_UNRESPONSIVE";
|
|
66
|
+
GraphQLErrorCode[GraphQLErrorCode["GRAPH_QL_ERROR_CODE_RESPONSE_TOO_BIG"] = 4] = "GRAPH_QL_ERROR_CODE_RESPONSE_TOO_BIG";
|
|
67
|
+
GraphQLErrorCode[GraphQLErrorCode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
68
|
+
return GraphQLErrorCode;
|
|
69
|
+
}({});
|
|
70
|
+
function graphQLErrorCodeFromJSON(object) {
|
|
71
|
+
switch (object) {
|
|
72
|
+
case 0:
|
|
73
|
+
case "GRAPH_QL_ERROR_CODE_INVALID": return 0;
|
|
74
|
+
case 1:
|
|
75
|
+
case "GRAPH_QL_ERROR_CODE_FIELD_NOT_FOUND": return 1;
|
|
76
|
+
case 2:
|
|
77
|
+
case "GRAPH_QL_ERROR_CODE_UNAUTHORIZED": return 2;
|
|
78
|
+
case 3:
|
|
79
|
+
case "GRAPH_QL_ERROR_CODE_RESOLVER_PROCESS_UNRESPONSIVE": return 3;
|
|
80
|
+
case 4:
|
|
81
|
+
case "GRAPH_QL_ERROR_CODE_RESPONSE_TOO_BIG": return 4;
|
|
82
|
+
default: return -1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function graphQLErrorCodeToJSON(object) {
|
|
86
|
+
switch (object) {
|
|
87
|
+
case 0: return "GRAPH_QL_ERROR_CODE_INVALID";
|
|
88
|
+
case 1: return "GRAPH_QL_ERROR_CODE_FIELD_NOT_FOUND";
|
|
89
|
+
case 2: return "GRAPH_QL_ERROR_CODE_UNAUTHORIZED";
|
|
90
|
+
case 3: return "GRAPH_QL_ERROR_CODE_RESOLVER_PROCESS_UNRESPONSIVE";
|
|
91
|
+
case 4: return "GRAPH_QL_ERROR_CODE_RESPONSE_TOO_BIG";
|
|
92
|
+
default: return "UNRECOGNIZED";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function createBaseSignedGraphQLQuery() {
|
|
96
|
+
return {
|
|
97
|
+
version: 0,
|
|
98
|
+
query: /* @__PURE__ */ new Uint8Array(0)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const SignedGraphQLQuery = {
|
|
102
|
+
encode(message, writer = new BinaryWriter()) {
|
|
103
|
+
if (message.version !== 0) writer.uint32(8).uint32(message.version);
|
|
104
|
+
if (message.query.length !== 0) writer.uint32(18).bytes(message.query);
|
|
105
|
+
return writer;
|
|
106
|
+
},
|
|
107
|
+
decode(input, length) {
|
|
108
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
109
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
110
|
+
const message = createBaseSignedGraphQLQuery();
|
|
111
|
+
while (reader.pos < end) {
|
|
112
|
+
const tag = reader.uint32();
|
|
113
|
+
switch (tag >>> 3) {
|
|
114
|
+
case 1:
|
|
115
|
+
if (tag !== 8) break;
|
|
116
|
+
message.version = reader.uint32();
|
|
117
|
+
continue;
|
|
118
|
+
case 2:
|
|
119
|
+
if (tag !== 18) break;
|
|
120
|
+
message.query = reader.bytes();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
124
|
+
reader.skip(tag & 7);
|
|
125
|
+
}
|
|
126
|
+
return message;
|
|
127
|
+
},
|
|
128
|
+
fromJSON(object) {
|
|
129
|
+
return {
|
|
130
|
+
version: isSet(object.version) ? globalThis.Number(object.version) : 0,
|
|
131
|
+
query: isSet(object.query) ? bytesFromBase64(object.query) : /* @__PURE__ */ new Uint8Array(0)
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
toJSON(message) {
|
|
135
|
+
const obj = {};
|
|
136
|
+
if (message.version !== void 0) obj.version = Math.round(message.version);
|
|
137
|
+
if (message.query !== void 0) obj.query = base64FromBytes(message.query);
|
|
138
|
+
return obj;
|
|
139
|
+
},
|
|
140
|
+
create(base) {
|
|
141
|
+
return SignedGraphQLQuery.fromPartial(base ?? {});
|
|
142
|
+
},
|
|
143
|
+
fromPartial(object) {
|
|
144
|
+
const message = createBaseSignedGraphQLQuery();
|
|
145
|
+
message.version = object.version ?? 0;
|
|
146
|
+
message.query = object.query ?? /* @__PURE__ */ new Uint8Array(0);
|
|
147
|
+
return message;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
function createBaseGraphQLError() {
|
|
151
|
+
return {
|
|
152
|
+
path: [],
|
|
153
|
+
code: 0,
|
|
154
|
+
message: ""
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const GraphQLError = {
|
|
158
|
+
encode(message, writer = new BinaryWriter()) {
|
|
159
|
+
for (const v of message.path) writer.uint32(10).string(v);
|
|
160
|
+
if (message.code !== 0) writer.uint32(16).int32(message.code);
|
|
161
|
+
if (message.message !== "") writer.uint32(26).string(message.message);
|
|
162
|
+
return writer;
|
|
163
|
+
},
|
|
164
|
+
decode(input, length) {
|
|
165
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
166
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
167
|
+
const message = createBaseGraphQLError();
|
|
168
|
+
while (reader.pos < end) {
|
|
169
|
+
const tag = reader.uint32();
|
|
170
|
+
switch (tag >>> 3) {
|
|
171
|
+
case 1:
|
|
172
|
+
if (tag !== 10) break;
|
|
173
|
+
message.path.push(reader.string());
|
|
174
|
+
continue;
|
|
175
|
+
case 2:
|
|
176
|
+
if (tag !== 16) break;
|
|
177
|
+
message.code = reader.int32();
|
|
178
|
+
continue;
|
|
179
|
+
case 3:
|
|
180
|
+
if (tag !== 26) break;
|
|
181
|
+
message.message = reader.string();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
185
|
+
reader.skip(tag & 7);
|
|
186
|
+
}
|
|
187
|
+
return message;
|
|
188
|
+
},
|
|
189
|
+
fromJSON(object) {
|
|
190
|
+
return {
|
|
191
|
+
path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.String(e)) : [],
|
|
192
|
+
code: isSet(object.code) ? graphQLErrorCodeFromJSON(object.code) : 0,
|
|
193
|
+
message: isSet(object.message) ? globalThis.String(object.message) : ""
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
toJSON(message) {
|
|
197
|
+
const obj = {};
|
|
198
|
+
if (message.path?.length) obj.path = message.path;
|
|
199
|
+
if (message.code !== void 0) obj.code = graphQLErrorCodeToJSON(message.code);
|
|
200
|
+
if (message.message !== void 0) obj.message = message.message;
|
|
201
|
+
return obj;
|
|
202
|
+
},
|
|
203
|
+
create(base) {
|
|
204
|
+
return GraphQLError.fromPartial(base ?? {});
|
|
205
|
+
},
|
|
206
|
+
fromPartial(object) {
|
|
207
|
+
const message = createBaseGraphQLError();
|
|
208
|
+
message.path = object.path?.map((e) => e) || [];
|
|
209
|
+
message.code = object.code ?? 0;
|
|
210
|
+
message.message = object.message ?? "";
|
|
211
|
+
return message;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
function createBaseGraphQLAPIQueryRequest() {
|
|
215
|
+
return {
|
|
216
|
+
format: 0,
|
|
217
|
+
query: /* @__PURE__ */ new Uint8Array(0),
|
|
218
|
+
signature: /* @__PURE__ */ new Uint8Array(0),
|
|
219
|
+
variablesJson: void 0
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const GraphQLAPIQueryRequest = {
|
|
223
|
+
encode(message, writer = new BinaryWriter()) {
|
|
224
|
+
if (message.format !== 0) writer.uint32(8).int32(message.format);
|
|
225
|
+
if (message.query.length !== 0) writer.uint32(18).bytes(message.query);
|
|
226
|
+
if (message.signature.length !== 0) writer.uint32(26).bytes(message.signature);
|
|
227
|
+
if (message.variablesJson !== void 0) StringValue.encode({ value: message.variablesJson }, writer.uint32(34).fork()).join();
|
|
228
|
+
return writer;
|
|
229
|
+
},
|
|
230
|
+
decode(input, length) {
|
|
231
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
232
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
233
|
+
const message = createBaseGraphQLAPIQueryRequest();
|
|
234
|
+
while (reader.pos < end) {
|
|
235
|
+
const tag = reader.uint32();
|
|
236
|
+
switch (tag >>> 3) {
|
|
237
|
+
case 1:
|
|
238
|
+
if (tag !== 8) break;
|
|
239
|
+
message.format = reader.int32();
|
|
240
|
+
continue;
|
|
241
|
+
case 2:
|
|
242
|
+
if (tag !== 18) break;
|
|
243
|
+
message.query = reader.bytes();
|
|
244
|
+
continue;
|
|
245
|
+
case 3:
|
|
246
|
+
if (tag !== 26) break;
|
|
247
|
+
message.signature = reader.bytes();
|
|
248
|
+
continue;
|
|
249
|
+
case 4:
|
|
250
|
+
if (tag !== 34) break;
|
|
251
|
+
message.variablesJson = StringValue.decode(reader, reader.uint32()).value;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
255
|
+
reader.skip(tag & 7);
|
|
256
|
+
}
|
|
257
|
+
return message;
|
|
258
|
+
},
|
|
259
|
+
fromJSON(object) {
|
|
260
|
+
return {
|
|
261
|
+
format: isSet(object.format) ? graphQLQueryFormatFromJSON(object.format) : 0,
|
|
262
|
+
query: isSet(object.query) ? bytesFromBase64(object.query) : /* @__PURE__ */ new Uint8Array(0),
|
|
263
|
+
signature: isSet(object.signature) ? bytesFromBase64(object.signature) : /* @__PURE__ */ new Uint8Array(0),
|
|
264
|
+
variablesJson: isSet(object.variablesJson) ? String(object.variablesJson) : void 0
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
toJSON(message) {
|
|
268
|
+
const obj = {};
|
|
269
|
+
if (message.format !== void 0) obj.format = graphQLQueryFormatToJSON(message.format);
|
|
270
|
+
if (message.query !== void 0) obj.query = base64FromBytes(message.query);
|
|
271
|
+
if (message.signature !== void 0) obj.signature = base64FromBytes(message.signature);
|
|
272
|
+
if (message.variablesJson !== void 0) obj.variablesJson = message.variablesJson;
|
|
273
|
+
return obj;
|
|
274
|
+
},
|
|
275
|
+
create(base) {
|
|
276
|
+
return GraphQLAPIQueryRequest.fromPartial(base ?? {});
|
|
277
|
+
},
|
|
278
|
+
fromPartial(object) {
|
|
279
|
+
const message = createBaseGraphQLAPIQueryRequest();
|
|
280
|
+
message.format = object.format ?? 0;
|
|
281
|
+
message.query = object.query ?? /* @__PURE__ */ new Uint8Array(0);
|
|
282
|
+
message.signature = object.signature ?? /* @__PURE__ */ new Uint8Array(0);
|
|
283
|
+
message.variablesJson = object.variablesJson ?? void 0;
|
|
284
|
+
return message;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
function createBaseGraphQLAPIQueryResponse() {
|
|
288
|
+
return {
|
|
289
|
+
status: 0,
|
|
290
|
+
data: "",
|
|
291
|
+
errors: []
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const GraphQLAPIQueryResponse = {
|
|
295
|
+
encode(message, writer = new BinaryWriter()) {
|
|
296
|
+
if (message.status !== 0) writer.uint32(8).int32(message.status);
|
|
297
|
+
if (message.data !== "") writer.uint32(18).string(message.data);
|
|
298
|
+
for (const v of message.errors) GraphQLError.encode(v, writer.uint32(26).fork()).join();
|
|
299
|
+
return writer;
|
|
300
|
+
},
|
|
301
|
+
decode(input, length) {
|
|
302
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
303
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
304
|
+
const message = createBaseGraphQLAPIQueryResponse();
|
|
305
|
+
while (reader.pos < end) {
|
|
306
|
+
const tag = reader.uint32();
|
|
307
|
+
switch (tag >>> 3) {
|
|
308
|
+
case 1:
|
|
309
|
+
if (tag !== 8) break;
|
|
310
|
+
message.status = reader.int32();
|
|
311
|
+
continue;
|
|
312
|
+
case 2:
|
|
313
|
+
if (tag !== 18) break;
|
|
314
|
+
message.data = reader.string();
|
|
315
|
+
continue;
|
|
316
|
+
case 3:
|
|
317
|
+
if (tag !== 26) break;
|
|
318
|
+
message.errors.push(GraphQLError.decode(reader, reader.uint32()));
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
322
|
+
reader.skip(tag & 7);
|
|
323
|
+
}
|
|
324
|
+
return message;
|
|
325
|
+
},
|
|
326
|
+
fromJSON(object) {
|
|
327
|
+
return {
|
|
328
|
+
status: isSet(object.status) ? graphQLStatusFromJSON(object.status) : 0,
|
|
329
|
+
data: isSet(object.data) ? globalThis.String(object.data) : "",
|
|
330
|
+
errors: globalThis.Array.isArray(object?.errors) ? object.errors.map((e) => GraphQLError.fromJSON(e)) : []
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
toJSON(message) {
|
|
334
|
+
const obj = {};
|
|
335
|
+
if (message.status !== void 0) obj.status = graphQLStatusToJSON(message.status);
|
|
336
|
+
if (message.data !== void 0) obj.data = message.data;
|
|
337
|
+
if (message.errors?.length) obj.errors = message.errors.map((e) => GraphQLError.toJSON(e));
|
|
338
|
+
return obj;
|
|
339
|
+
},
|
|
340
|
+
create(base) {
|
|
341
|
+
return GraphQLAPIQueryResponse.fromPartial(base ?? {});
|
|
342
|
+
},
|
|
343
|
+
fromPartial(object) {
|
|
344
|
+
const message = createBaseGraphQLAPIQueryResponse();
|
|
345
|
+
message.status = object.status ?? 0;
|
|
346
|
+
message.data = object.data ?? "";
|
|
347
|
+
message.errors = object.errors?.map((e) => GraphQLError.fromPartial(e)) || [];
|
|
348
|
+
return message;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
function createBaseGraphQLMessages() {
|
|
352
|
+
return {
|
|
353
|
+
queryRequest: void 0,
|
|
354
|
+
queryResponse: void 0
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
const GraphQLMessages = {
|
|
358
|
+
encode(message, writer = new BinaryWriter()) {
|
|
359
|
+
if (message.queryRequest !== void 0) GraphQLAPIQueryRequest.encode(message.queryRequest, writer.uint32(10).fork()).join();
|
|
360
|
+
if (message.queryResponse !== void 0) GraphQLAPIQueryResponse.encode(message.queryResponse, writer.uint32(18).fork()).join();
|
|
361
|
+
return writer;
|
|
362
|
+
},
|
|
363
|
+
decode(input, length) {
|
|
364
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
365
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
366
|
+
const message = createBaseGraphQLMessages();
|
|
367
|
+
while (reader.pos < end) {
|
|
368
|
+
const tag = reader.uint32();
|
|
369
|
+
switch (tag >>> 3) {
|
|
370
|
+
case 1:
|
|
371
|
+
if (tag !== 10) break;
|
|
372
|
+
message.queryRequest = GraphQLAPIQueryRequest.decode(reader, reader.uint32());
|
|
373
|
+
continue;
|
|
374
|
+
case 2:
|
|
375
|
+
if (tag !== 18) break;
|
|
376
|
+
message.queryResponse = GraphQLAPIQueryResponse.decode(reader, reader.uint32());
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
380
|
+
reader.skip(tag & 7);
|
|
381
|
+
}
|
|
382
|
+
return message;
|
|
383
|
+
},
|
|
384
|
+
fromJSON(object) {
|
|
385
|
+
return {
|
|
386
|
+
queryRequest: isSet(object.queryRequest) ? GraphQLAPIQueryRequest.fromJSON(object.queryRequest) : void 0,
|
|
387
|
+
queryResponse: isSet(object.queryResponse) ? GraphQLAPIQueryResponse.fromJSON(object.queryResponse) : void 0
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
toJSON(message) {
|
|
391
|
+
const obj = {};
|
|
392
|
+
if (message.queryRequest !== void 0) obj.queryRequest = GraphQLAPIQueryRequest.toJSON(message.queryRequest);
|
|
393
|
+
if (message.queryResponse !== void 0) obj.queryResponse = GraphQLAPIQueryResponse.toJSON(message.queryResponse);
|
|
394
|
+
return obj;
|
|
395
|
+
},
|
|
396
|
+
create(base) {
|
|
397
|
+
return GraphQLMessages.fromPartial(base ?? {});
|
|
398
|
+
},
|
|
399
|
+
fromPartial(object) {
|
|
400
|
+
const message = createBaseGraphQLMessages();
|
|
401
|
+
message.queryRequest = object.queryRequest !== void 0 && object.queryRequest !== null ? GraphQLAPIQueryRequest.fromPartial(object.queryRequest) : void 0;
|
|
402
|
+
message.queryResponse = object.queryResponse !== void 0 && object.queryResponse !== null ? GraphQLAPIQueryResponse.fromPartial(object.queryResponse) : void 0;
|
|
403
|
+
return message;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
function bytesFromBase64(b64) {
|
|
407
|
+
if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
408
|
+
else {
|
|
409
|
+
const bin = globalThis.atob(b64);
|
|
410
|
+
const arr = new Uint8Array(bin.length);
|
|
411
|
+
for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
|
|
412
|
+
return arr;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function base64FromBytes(arr) {
|
|
416
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
|
|
417
|
+
else {
|
|
418
|
+
const bin = [];
|
|
419
|
+
arr.forEach((byte) => {
|
|
420
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
421
|
+
});
|
|
422
|
+
return globalThis.btoa(bin.join(""));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function isSet(value) {
|
|
426
|
+
return value !== null && value !== void 0;
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
export { GraphQLAPIQueryRequest, GraphQLAPIQueryResponse, GraphQLError, GraphQLErrorCode, GraphQLMessages, GraphQLQueryFormat, GraphQLStatus, SignedGraphQLQuery, graphQLErrorCodeFromJSON, graphQLErrorCodeToJSON, graphQLQueryFormatFromJSON, graphQLQueryFormatToJSON, graphQLStatusFromJSON, graphQLStatusToJSON, protobufPackage };
|