@devrev/typescript-sdk 1.1.25 → 1.1.27
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/auto-generated/beta/beta-devrev-sdk.d.ts +266 -4
- package/dist/auto-generated/beta/beta-devrev-sdk.js +59 -3
- package/dist/auto-generated/public-devrev-sdk.d.ts +87 -2
- package/dist/auto-generated/public-devrev-sdk.js +2 -0
- package/dist/snap-ins/index.d.ts +4 -0
- package/dist/snap-ins/index.js +20 -0
- package/dist/snap-ins/interfaces.d.ts +15 -0
- package/dist/snap-ins/interfaces.js +2 -0
- package/dist/snap-ins/schema.pb.d.ts +461 -0
- package/dist/snap-ins/schema.pb.js +678 -0
- package/dist/snap-ins/stock_objects.d.ts +16 -0
- package/dist/snap-ins/stock_objects.js +28 -0
- package/dist/snap-ins/struct.pb.d.ts +201 -0
- package/dist/snap-ins/struct.pb.js +491 -0
- package/dist/snap-ins/types.d.ts +166 -0
- package/dist/snap-ins/types.js +15 -0
- package/dist/snap-ins/types.test.d.ts +1 -0
- package/dist/snap-ins/types.test.js +81 -0
- package/package.json +2 -1
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.176.0
|
|
5
|
+
// protoc v4.25.2
|
|
6
|
+
// source: google/protobuf/struct.proto
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.ListValue = exports.Value = exports.Struct_FieldsEntry = exports.Struct = exports.nullValueToJSON = exports.nullValueFromJSON = exports.NullValue = exports.protobufPackage = void 0;
|
|
32
|
+
/* eslint-disable */
|
|
33
|
+
const _m0 = __importStar(require("protobufjs/minimal"));
|
|
34
|
+
exports.protobufPackage = 'google.protobuf';
|
|
35
|
+
/**
|
|
36
|
+
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
37
|
+
* `Value` type union.
|
|
38
|
+
*
|
|
39
|
+
* The JSON representation for `NullValue` is JSON `null`.
|
|
40
|
+
*/
|
|
41
|
+
var NullValue;
|
|
42
|
+
(function (NullValue) {
|
|
43
|
+
/** NULL_VALUE - Null value. */
|
|
44
|
+
NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
|
|
45
|
+
NullValue[NullValue["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
46
|
+
})(NullValue = exports.NullValue || (exports.NullValue = {}));
|
|
47
|
+
function nullValueFromJSON(object) {
|
|
48
|
+
switch (object) {
|
|
49
|
+
case 0:
|
|
50
|
+
case 'NULL_VALUE':
|
|
51
|
+
return NullValue.NULL_VALUE;
|
|
52
|
+
case -1:
|
|
53
|
+
case 'UNRECOGNIZED':
|
|
54
|
+
default:
|
|
55
|
+
return NullValue.UNRECOGNIZED;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.nullValueFromJSON = nullValueFromJSON;
|
|
59
|
+
function nullValueToJSON(object) {
|
|
60
|
+
switch (object) {
|
|
61
|
+
case NullValue.NULL_VALUE:
|
|
62
|
+
return 'NULL_VALUE';
|
|
63
|
+
case NullValue.UNRECOGNIZED:
|
|
64
|
+
default:
|
|
65
|
+
return 'UNRECOGNIZED';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.nullValueToJSON = nullValueToJSON;
|
|
69
|
+
function createBaseStruct() {
|
|
70
|
+
return { fields: {} };
|
|
71
|
+
}
|
|
72
|
+
exports.Struct = {
|
|
73
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
74
|
+
Object.entries(message.fields).forEach(([key, value]) => {
|
|
75
|
+
if (value !== undefined) {
|
|
76
|
+
exports.Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return writer;
|
|
80
|
+
},
|
|
81
|
+
decode(input, length) {
|
|
82
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
83
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
84
|
+
const message = createBaseStruct();
|
|
85
|
+
while (reader.pos < end) {
|
|
86
|
+
const tag = reader.uint32();
|
|
87
|
+
switch (tag >>> 3) {
|
|
88
|
+
case 1:
|
|
89
|
+
if (tag !== 10) {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
const entry1 = exports.Struct_FieldsEntry.decode(reader, reader.uint32());
|
|
93
|
+
if (entry1.value !== undefined) {
|
|
94
|
+
message.fields[entry1.key] = entry1.value;
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
reader.skipType(tag & 7);
|
|
102
|
+
}
|
|
103
|
+
return message;
|
|
104
|
+
},
|
|
105
|
+
fromJSON(object) {
|
|
106
|
+
return {
|
|
107
|
+
fields: isObject(object.fields)
|
|
108
|
+
? Object.entries(object.fields).reduce((acc, [key, value]) => {
|
|
109
|
+
acc[key] = value;
|
|
110
|
+
return acc;
|
|
111
|
+
}, {})
|
|
112
|
+
: {},
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
toJSON(message) {
|
|
116
|
+
const obj = {};
|
|
117
|
+
if (message.fields) {
|
|
118
|
+
const entries = Object.entries(message.fields);
|
|
119
|
+
if (entries.length > 0) {
|
|
120
|
+
obj.fields = {};
|
|
121
|
+
entries.forEach(([k, v]) => {
|
|
122
|
+
obj.fields[k] = v;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return obj;
|
|
127
|
+
},
|
|
128
|
+
create(base) {
|
|
129
|
+
return exports.Struct.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
130
|
+
},
|
|
131
|
+
fromPartial(object) {
|
|
132
|
+
var _a;
|
|
133
|
+
const message = createBaseStruct();
|
|
134
|
+
message.fields = Object.entries((_a = object.fields) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
|
|
135
|
+
if (value !== undefined) {
|
|
136
|
+
acc[key] = value;
|
|
137
|
+
}
|
|
138
|
+
return acc;
|
|
139
|
+
}, {});
|
|
140
|
+
return message;
|
|
141
|
+
},
|
|
142
|
+
wrap(object) {
|
|
143
|
+
const struct = createBaseStruct();
|
|
144
|
+
if (object !== undefined) {
|
|
145
|
+
for (const key of Object.keys(object)) {
|
|
146
|
+
struct.fields[key] = object[key];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return struct;
|
|
150
|
+
},
|
|
151
|
+
unwrap(message) {
|
|
152
|
+
const object = {};
|
|
153
|
+
if (message.fields) {
|
|
154
|
+
for (const key of Object.keys(message.fields)) {
|
|
155
|
+
object[key] = message.fields[key];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return object;
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
function createBaseStruct_FieldsEntry() {
|
|
162
|
+
return { key: '', value: undefined };
|
|
163
|
+
}
|
|
164
|
+
exports.Struct_FieldsEntry = {
|
|
165
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
166
|
+
if (message.key !== '') {
|
|
167
|
+
writer.uint32(10).string(message.key);
|
|
168
|
+
}
|
|
169
|
+
if (message.value !== undefined) {
|
|
170
|
+
exports.Value.encode(exports.Value.wrap(message.value), writer.uint32(18).fork()).ldelim();
|
|
171
|
+
}
|
|
172
|
+
return writer;
|
|
173
|
+
},
|
|
174
|
+
decode(input, length) {
|
|
175
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
176
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
177
|
+
const message = createBaseStruct_FieldsEntry();
|
|
178
|
+
while (reader.pos < end) {
|
|
179
|
+
const tag = reader.uint32();
|
|
180
|
+
switch (tag >>> 3) {
|
|
181
|
+
case 1:
|
|
182
|
+
if (tag !== 10) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
message.key = reader.string();
|
|
186
|
+
continue;
|
|
187
|
+
case 2:
|
|
188
|
+
if (tag !== 18) {
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
message.value = exports.Value.unwrap(exports.Value.decode(reader, reader.uint32()));
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
reader.skipType(tag & 7);
|
|
198
|
+
}
|
|
199
|
+
return message;
|
|
200
|
+
},
|
|
201
|
+
fromJSON(object) {
|
|
202
|
+
return {
|
|
203
|
+
key: isSet(object.key) ? globalThis.String(object.key) : '',
|
|
204
|
+
value: isSet(object === null || object === void 0 ? void 0 : object.value) ? object.value : undefined,
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
toJSON(message) {
|
|
208
|
+
const obj = {};
|
|
209
|
+
if (message.key !== '') {
|
|
210
|
+
obj.key = message.key;
|
|
211
|
+
}
|
|
212
|
+
if (message.value !== undefined) {
|
|
213
|
+
obj.value = message.value;
|
|
214
|
+
}
|
|
215
|
+
return obj;
|
|
216
|
+
},
|
|
217
|
+
create(base) {
|
|
218
|
+
return exports.Struct_FieldsEntry.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
219
|
+
},
|
|
220
|
+
fromPartial(object) {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
const message = createBaseStruct_FieldsEntry();
|
|
223
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
|
|
224
|
+
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : undefined;
|
|
225
|
+
return message;
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
function createBaseValue() {
|
|
229
|
+
return {
|
|
230
|
+
null_value: undefined,
|
|
231
|
+
number_value: undefined,
|
|
232
|
+
string_value: undefined,
|
|
233
|
+
bool_value: undefined,
|
|
234
|
+
struct_value: undefined,
|
|
235
|
+
list_value: undefined,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
exports.Value = {
|
|
239
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
240
|
+
if (message.null_value !== undefined) {
|
|
241
|
+
writer.uint32(8).int32(message.null_value);
|
|
242
|
+
}
|
|
243
|
+
if (message.number_value !== undefined) {
|
|
244
|
+
writer.uint32(17).double(message.number_value);
|
|
245
|
+
}
|
|
246
|
+
if (message.string_value !== undefined) {
|
|
247
|
+
writer.uint32(26).string(message.string_value);
|
|
248
|
+
}
|
|
249
|
+
if (message.bool_value !== undefined) {
|
|
250
|
+
writer.uint32(32).bool(message.bool_value);
|
|
251
|
+
}
|
|
252
|
+
if (message.struct_value !== undefined) {
|
|
253
|
+
exports.Struct.encode(exports.Struct.wrap(message.struct_value), writer.uint32(42).fork()).ldelim();
|
|
254
|
+
}
|
|
255
|
+
if (message.list_value !== undefined) {
|
|
256
|
+
exports.ListValue.encode(exports.ListValue.wrap(message.list_value), writer.uint32(50).fork()).ldelim();
|
|
257
|
+
}
|
|
258
|
+
return writer;
|
|
259
|
+
},
|
|
260
|
+
decode(input, length) {
|
|
261
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
262
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
263
|
+
const message = createBaseValue();
|
|
264
|
+
while (reader.pos < end) {
|
|
265
|
+
const tag = reader.uint32();
|
|
266
|
+
switch (tag >>> 3) {
|
|
267
|
+
case 1:
|
|
268
|
+
if (tag !== 8) {
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
message.null_value = reader.int32();
|
|
272
|
+
continue;
|
|
273
|
+
case 2:
|
|
274
|
+
if (tag !== 17) {
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
message.number_value = reader.double();
|
|
278
|
+
continue;
|
|
279
|
+
case 3:
|
|
280
|
+
if (tag !== 26) {
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
message.string_value = reader.string();
|
|
284
|
+
continue;
|
|
285
|
+
case 4:
|
|
286
|
+
if (tag !== 32) {
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
message.bool_value = reader.bool();
|
|
290
|
+
continue;
|
|
291
|
+
case 5:
|
|
292
|
+
if (tag !== 42) {
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
message.struct_value = exports.Struct.unwrap(exports.Struct.decode(reader, reader.uint32()));
|
|
296
|
+
continue;
|
|
297
|
+
case 6:
|
|
298
|
+
if (tag !== 50) {
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
message.list_value = exports.ListValue.unwrap(exports.ListValue.decode(reader, reader.uint32()));
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
reader.skipType(tag & 7);
|
|
308
|
+
}
|
|
309
|
+
return message;
|
|
310
|
+
},
|
|
311
|
+
fromJSON(object) {
|
|
312
|
+
return {
|
|
313
|
+
null_value: isSet(object.null_value)
|
|
314
|
+
? nullValueFromJSON(object.null_value)
|
|
315
|
+
: undefined,
|
|
316
|
+
number_value: isSet(object.number_value)
|
|
317
|
+
? globalThis.Number(object.number_value)
|
|
318
|
+
: undefined,
|
|
319
|
+
string_value: isSet(object.string_value)
|
|
320
|
+
? globalThis.String(object.string_value)
|
|
321
|
+
: undefined,
|
|
322
|
+
bool_value: isSet(object.bool_value)
|
|
323
|
+
? globalThis.Boolean(object.bool_value)
|
|
324
|
+
: undefined,
|
|
325
|
+
struct_value: isObject(object.struct_value)
|
|
326
|
+
? object.struct_value
|
|
327
|
+
: undefined,
|
|
328
|
+
list_value: globalThis.Array.isArray(object.list_value)
|
|
329
|
+
? [...object.list_value]
|
|
330
|
+
: undefined,
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
toJSON(message) {
|
|
334
|
+
const obj = {};
|
|
335
|
+
if (message.null_value !== undefined) {
|
|
336
|
+
obj.null_value = nullValueToJSON(message.null_value);
|
|
337
|
+
}
|
|
338
|
+
if (message.number_value !== undefined) {
|
|
339
|
+
obj.number_value = message.number_value;
|
|
340
|
+
}
|
|
341
|
+
if (message.string_value !== undefined) {
|
|
342
|
+
obj.string_value = message.string_value;
|
|
343
|
+
}
|
|
344
|
+
if (message.bool_value !== undefined) {
|
|
345
|
+
obj.bool_value = message.bool_value;
|
|
346
|
+
}
|
|
347
|
+
if (message.struct_value !== undefined) {
|
|
348
|
+
obj.struct_value = message.struct_value;
|
|
349
|
+
}
|
|
350
|
+
if (message.list_value !== undefined) {
|
|
351
|
+
obj.list_value = message.list_value;
|
|
352
|
+
}
|
|
353
|
+
return obj;
|
|
354
|
+
},
|
|
355
|
+
create(base) {
|
|
356
|
+
return exports.Value.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
357
|
+
},
|
|
358
|
+
fromPartial(object) {
|
|
359
|
+
var _a, _b, _c, _d, _e, _f;
|
|
360
|
+
const message = createBaseValue();
|
|
361
|
+
message.null_value = (_a = object.null_value) !== null && _a !== void 0 ? _a : undefined;
|
|
362
|
+
message.number_value = (_b = object.number_value) !== null && _b !== void 0 ? _b : undefined;
|
|
363
|
+
message.string_value = (_c = object.string_value) !== null && _c !== void 0 ? _c : undefined;
|
|
364
|
+
message.bool_value = (_d = object.bool_value) !== null && _d !== void 0 ? _d : undefined;
|
|
365
|
+
message.struct_value = (_e = object.struct_value) !== null && _e !== void 0 ? _e : undefined;
|
|
366
|
+
message.list_value = (_f = object.list_value) !== null && _f !== void 0 ? _f : undefined;
|
|
367
|
+
return message;
|
|
368
|
+
},
|
|
369
|
+
wrap(value) {
|
|
370
|
+
const result = createBaseValue();
|
|
371
|
+
if (value === null) {
|
|
372
|
+
result.null_value = NullValue.NULL_VALUE;
|
|
373
|
+
}
|
|
374
|
+
else if (typeof value === 'boolean') {
|
|
375
|
+
result.bool_value = value;
|
|
376
|
+
}
|
|
377
|
+
else if (typeof value === 'number') {
|
|
378
|
+
result.number_value = value;
|
|
379
|
+
}
|
|
380
|
+
else if (typeof value === 'string') {
|
|
381
|
+
result.string_value = value;
|
|
382
|
+
}
|
|
383
|
+
else if (globalThis.Array.isArray(value)) {
|
|
384
|
+
result.list_value = value;
|
|
385
|
+
}
|
|
386
|
+
else if (typeof value === 'object') {
|
|
387
|
+
result.struct_value = value;
|
|
388
|
+
}
|
|
389
|
+
else if (typeof value !== 'undefined') {
|
|
390
|
+
throw new globalThis.Error('Unsupported any value type: ' + typeof value);
|
|
391
|
+
}
|
|
392
|
+
return result;
|
|
393
|
+
},
|
|
394
|
+
unwrap(message) {
|
|
395
|
+
if (message.string_value !== undefined) {
|
|
396
|
+
return message.string_value;
|
|
397
|
+
}
|
|
398
|
+
else if ((message === null || message === void 0 ? void 0 : message.number_value) !== undefined) {
|
|
399
|
+
return message.number_value;
|
|
400
|
+
}
|
|
401
|
+
else if ((message === null || message === void 0 ? void 0 : message.bool_value) !== undefined) {
|
|
402
|
+
return message.bool_value;
|
|
403
|
+
}
|
|
404
|
+
else if ((message === null || message === void 0 ? void 0 : message.struct_value) !== undefined) {
|
|
405
|
+
return message.struct_value;
|
|
406
|
+
}
|
|
407
|
+
else if ((message === null || message === void 0 ? void 0 : message.list_value) !== undefined) {
|
|
408
|
+
return message.list_value;
|
|
409
|
+
}
|
|
410
|
+
else if ((message === null || message === void 0 ? void 0 : message.null_value) !== undefined) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
return undefined;
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
function createBaseListValue() {
|
|
417
|
+
return { values: [] };
|
|
418
|
+
}
|
|
419
|
+
exports.ListValue = {
|
|
420
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
421
|
+
for (const v of message.values) {
|
|
422
|
+
exports.Value.encode(exports.Value.wrap(v), writer.uint32(10).fork()).ldelim();
|
|
423
|
+
}
|
|
424
|
+
return writer;
|
|
425
|
+
},
|
|
426
|
+
decode(input, length) {
|
|
427
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
428
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
429
|
+
const message = createBaseListValue();
|
|
430
|
+
while (reader.pos < end) {
|
|
431
|
+
const tag = reader.uint32();
|
|
432
|
+
switch (tag >>> 3) {
|
|
433
|
+
case 1:
|
|
434
|
+
if (tag !== 10) {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
message.values.push(exports.Value.unwrap(exports.Value.decode(reader, reader.uint32())));
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
reader.skipType(tag & 7);
|
|
444
|
+
}
|
|
445
|
+
return message;
|
|
446
|
+
},
|
|
447
|
+
fromJSON(object) {
|
|
448
|
+
return {
|
|
449
|
+
values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values)
|
|
450
|
+
? [...object.values]
|
|
451
|
+
: [],
|
|
452
|
+
};
|
|
453
|
+
},
|
|
454
|
+
toJSON(message) {
|
|
455
|
+
var _a;
|
|
456
|
+
const obj = {};
|
|
457
|
+
if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) {
|
|
458
|
+
obj.values = message.values;
|
|
459
|
+
}
|
|
460
|
+
return obj;
|
|
461
|
+
},
|
|
462
|
+
create(base) {
|
|
463
|
+
return exports.ListValue.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
464
|
+
},
|
|
465
|
+
fromPartial(object) {
|
|
466
|
+
var _a;
|
|
467
|
+
const message = createBaseListValue();
|
|
468
|
+
message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
|
|
469
|
+
return message;
|
|
470
|
+
},
|
|
471
|
+
wrap(array) {
|
|
472
|
+
const result = createBaseListValue();
|
|
473
|
+
result.values = array !== null && array !== void 0 ? array : [];
|
|
474
|
+
return result;
|
|
475
|
+
},
|
|
476
|
+
unwrap(message) {
|
|
477
|
+
if ((message === null || message === void 0 ? void 0 : message.hasOwnProperty('values')) &&
|
|
478
|
+
globalThis.Array.isArray(message.values)) {
|
|
479
|
+
return message.values;
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
return message;
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
function isObject(value) {
|
|
487
|
+
return typeof value === 'object' && value !== null;
|
|
488
|
+
}
|
|
489
|
+
function isSet(value) {
|
|
490
|
+
return value !== null && value !== undefined;
|
|
491
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { WebhookEventRequest } from '../auto-generated/public-devrev-sdk';
|
|
2
|
+
import { OperationIfc } from './interfaces';
|
|
3
|
+
import { ExecuteOperationInput } from './schema.pb';
|
|
4
|
+
/**
|
|
5
|
+
* The context object contains information about the execution environment and the snap-in.
|
|
6
|
+
*/
|
|
7
|
+
export type Context = {
|
|
8
|
+
/**
|
|
9
|
+
* ID of the DevOrg for which the function is being invoked.
|
|
10
|
+
*/
|
|
11
|
+
dev_oid: string;
|
|
12
|
+
/**
|
|
13
|
+
* ID of the Automation/Command/SnapKit Action/Event Source for which the function is being invoked.
|
|
14
|
+
*/
|
|
15
|
+
source_id: string;
|
|
16
|
+
/**
|
|
17
|
+
* ID of the Snap-in as part of which the function is being invoked.
|
|
18
|
+
*/
|
|
19
|
+
snap_in_id: string;
|
|
20
|
+
/**
|
|
21
|
+
* ID of the Snap-in version as part of which the function is being invoked.
|
|
22
|
+
*/
|
|
23
|
+
snap_in_version_id: string;
|
|
24
|
+
/**
|
|
25
|
+
* The ID of the service account associated with the snap-in.
|
|
26
|
+
*/
|
|
27
|
+
service_account_id: string;
|
|
28
|
+
/**
|
|
29
|
+
* This secrets map would contain some secrets which platform would provide to the snap-in.
|
|
30
|
+
* `service_account_token`: This is the token of the service account which belongs to this snap-in. This can be used to make API calls to DevRev.
|
|
31
|
+
* `actor_session_token`: For commands, and snap-kits, where the user is performing some action, this is the token of the user who is performing the action.
|
|
32
|
+
*/
|
|
33
|
+
secrets: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Metadata about the execution of the function.
|
|
37
|
+
*/
|
|
38
|
+
export type ExecutionMetadata = {
|
|
39
|
+
/**
|
|
40
|
+
* A unique id for the function invocation. Can be used to filter logs for a particular invocation.
|
|
41
|
+
*/
|
|
42
|
+
request_id: string;
|
|
43
|
+
/**
|
|
44
|
+
* Function name as defined in the manifest being invoked.
|
|
45
|
+
*/
|
|
46
|
+
function_name: string;
|
|
47
|
+
/**
|
|
48
|
+
* Type of event that triggered the function invocation as defined in manifest.
|
|
49
|
+
*/
|
|
50
|
+
event_type: string;
|
|
51
|
+
/**
|
|
52
|
+
* DevRev endpoint to which the function can make API calls.
|
|
53
|
+
* @example
|
|
54
|
+
* "https://api.devrev.ai/"
|
|
55
|
+
*/
|
|
56
|
+
devrev_endpoint: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Input data provided to the function.
|
|
60
|
+
*/
|
|
61
|
+
export type InputData = {
|
|
62
|
+
/**
|
|
63
|
+
* Map of globals and their corresponding values stored in Snap-in.
|
|
64
|
+
* The values are passed as string and typing need to be handled by the function
|
|
65
|
+
*/
|
|
66
|
+
global_values: Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Map of event sources and their corresponding ids stored in Snap-in.
|
|
69
|
+
* These could be used to schedule events on a schedule based event source.
|
|
70
|
+
*/
|
|
71
|
+
event_sources: Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Map of resources stored in the Snap-in. The resources include keyrings and tags.
|
|
74
|
+
* The key is the resource name defined in manifest and value is the resource object.
|
|
75
|
+
*/
|
|
76
|
+
resources?: Record<string, any>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The input object received by the function.
|
|
80
|
+
*/
|
|
81
|
+
export type FunctionInput = {
|
|
82
|
+
/**
|
|
83
|
+
* Actual payload of the event. WebhookEventRequest if event souce is `devrev-webhooks`; otherwise, a record of event data.
|
|
84
|
+
*/
|
|
85
|
+
payload: WebhookEventRequest | Record<string, any> | ExecuteOperationInput;
|
|
86
|
+
/**
|
|
87
|
+
* Context of the function invocation.
|
|
88
|
+
*/
|
|
89
|
+
context: Context;
|
|
90
|
+
/**
|
|
91
|
+
* Metadata of the function invocation.
|
|
92
|
+
*/
|
|
93
|
+
execution_metadata: ExecutionMetadata;
|
|
94
|
+
/**
|
|
95
|
+
* Input data provided to the function.
|
|
96
|
+
*/
|
|
97
|
+
input_data: InputData;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Return type for hooks.
|
|
101
|
+
*/
|
|
102
|
+
export interface HookResult {
|
|
103
|
+
/**
|
|
104
|
+
* Updated input values returned from hooks function execution
|
|
105
|
+
*/
|
|
106
|
+
inputs_values: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Metadata about the operation context. This is passed to the operation function as an argument.
|
|
110
|
+
*/
|
|
111
|
+
export type OperationContext = {
|
|
112
|
+
/**
|
|
113
|
+
* DevRev endpoint to which the function can make API calls.
|
|
114
|
+
* @example
|
|
115
|
+
* "https://api.devrev.ai/"
|
|
116
|
+
*/
|
|
117
|
+
devrev_endpoint: string;
|
|
118
|
+
/**
|
|
119
|
+
* This secrets map would contain some secrets which platform would provide to the snap-in.
|
|
120
|
+
* `access_token`: Access token of the user invoking this operation.
|
|
121
|
+
*/
|
|
122
|
+
secrets: OperationContextSecrets;
|
|
123
|
+
/**
|
|
124
|
+
* ID of the DevOrg for which the function is being invoked.
|
|
125
|
+
*/
|
|
126
|
+
dev_oid: string;
|
|
127
|
+
/**
|
|
128
|
+
* Name of the input port.
|
|
129
|
+
*/
|
|
130
|
+
input_port: string;
|
|
131
|
+
/**
|
|
132
|
+
* Additional metadata that the developer can pass to the Operation.
|
|
133
|
+
*/
|
|
134
|
+
metadata?: Record<string, any>;
|
|
135
|
+
};
|
|
136
|
+
export type OperationContextSecrets = {
|
|
137
|
+
/**
|
|
138
|
+
* Access token of the user invoking this operation.
|
|
139
|
+
*/
|
|
140
|
+
access_token: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Map of operation slug to operation class.
|
|
144
|
+
*/
|
|
145
|
+
export type OperationMap = {
|
|
146
|
+
[slug: string]: new (e: any) => OperationIfc;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Error instance type to be thrown when an error occurs in the snap-in. The
|
|
150
|
+
* error type is used to determine if the event should be retried or not.
|
|
151
|
+
*/
|
|
152
|
+
export declare class FunctionExecutionError extends Error {
|
|
153
|
+
/**
|
|
154
|
+
* Toggle to determine if the event should be retried or not. If not set or set to false,
|
|
155
|
+
* the event will not be retried.
|
|
156
|
+
*/
|
|
157
|
+
retry: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Whether to retry the event payload with updated metadata
|
|
160
|
+
* that platform provides. Useful when the event payload is
|
|
161
|
+
* not in a state to be directly processed, and may need new
|
|
162
|
+
* keyrings/service account tokens or new inputs.
|
|
163
|
+
*/
|
|
164
|
+
refresh?: boolean;
|
|
165
|
+
constructor(message: string, retry: boolean, refresh?: boolean);
|
|
166
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionExecutionError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Error instance type to be thrown when an error occurs in the snap-in. The
|
|
6
|
+
* error type is used to determine if the event should be retried or not.
|
|
7
|
+
*/
|
|
8
|
+
class FunctionExecutionError extends Error {
|
|
9
|
+
constructor(message, retry, refresh) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.retry = retry;
|
|
12
|
+
this.refresh = refresh;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.FunctionExecutionError = FunctionExecutionError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|