@sentio/sdk 1.12.6 → 1.13.1
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/lib/cli/upload.js +1 -1
- package/lib/cli/upload.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +14 -0
- package/lib/gen/processor/protos/processor.js +90 -1
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/meter.d.ts +25 -7
- package/lib/meter.js +82 -43
- package/lib/meter.js.map +1 -1
- package/lib/test/index.d.ts +1 -0
- package/lib/test/index.js +5 -1
- package/lib/test/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/upload.ts +1 -1
- package/src/gen/processor/protos/processor.ts +109 -0
- package/src/index.ts +1 -1
- package/src/meter.ts +84 -46
- package/src/test/index.ts +1 -0
package/lib/cli/upload.js
CHANGED
package/lib/cli/upload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/cli/upload.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAwC;AACxC,mCAAmC;AACnC,0DAAgC;AAChC,4CAAmB;AAEnB,+BAA+B;AAC/B,gDAAuB;AACvB,kDAAyB;AACzB,mCAAwC;AACxC,4DAA8B;AAC9B,mCAAuC;AAEhC,KAAK,UAAU,UAAU,CAAC,OAA4B,EAAE,cAAsB;IACnF,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,MAAM,IAAA,sBAAc,EAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;KAC7C;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAEpC,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAA;IAE9D,MAAM,GAAG,G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AAE,MAAM,CAAC,CAAA;QAChD,IAAI,SAAS,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC,CAAA;SAC5D;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QACxC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,eAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,aAAa,CAAC,CAAA;KAC5F;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAA;QACzC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;KAC3C;AACH,CAAC;AAzED,gCAyEC","sourcesContent":["import { execSync } from 'child_process'\nimport { createHash } from 'crypto'\nimport FormData from 'form-data'\nimport fs from 'fs'\nimport { SentioProjectConfig } from './config'\nimport { ReadKey } from './key'\nimport path from 'path'\nimport chalk from 'chalk'\nimport { buildProcessor } from './build'\nimport fetch from 'node-fetch'\nimport { getCliVersion } from './utils'\n\nexport async function uploadFile(options: SentioProjectConfig, apiKeyOverride: string) {\n if (options.build) {\n await buildProcessor(false, options.targets)\n }\n\n console.log(chalk.blue('Uploading'))\n\n const PROCESSOR_FILE = path.join(process.cwd(), 'dist/lib.js')\n\n const url = new URL(options.host)\n const apiKey = apiKeyOverride || ReadKey(options.host)\n\n const isProd = options.host === 'https://app.sentio.xyz'\n if (!apiKey) {\n const cmd = isProd ? 'sentio login' : 'sentio login --host=' + options.host\n console.error(chalk.red('No Credential found for', options.host, '. Please run `' + cmd + '`.'))\n process.exit(1)\n }\n\n if (!fs.existsSync(PROCESSOR_FILE)) {\n console.error(chalk.red('File not existed ', PROCESSOR_FILE, \"don't use --nobuild\"))\n process.exit(1)\n }\n\n const stat = fs.statSync(PROCESSOR_FILE)\n console.log('Packed processor file size', Math.floor(stat.size / 1024) + 'K, last modified', stat.mtime)\n const content = fs.readFileSync(PROCESSOR_FILE)\n const hash = createHash('sha256')\n hash.update(content)\n const digest = hash.digest('hex')\n\n const data = new FormData()\n data.append('attachment', fs.createReadStream(PROCESSOR_FILE))\n data.append('sha256', digest)\n\n let commitSha\n try {\n commitSha = execSync('git rev-parse HEAD').toString().trim()\n data.append('commitSha', commitSha)\n } catch (e) {\n chalk.yellow(e)\n }\n try {\n const gitUrl = execSync('git remote get-url origin').toString().trim()\n data.append('gitUrl', gitUrl)\n } catch (e) {\n // skip errors\n }\n\n url.pathname = '/api/v1/processors'\n\n const res = await fetch(url, {\n method: 'POST',\n headers: {\n 'api-key': apiKey,\n project: options.project,\n version: getCliVersion(),\n },\n body: data,\n })\n\n if (res.ok) {\n console.log(chalk.green('Upload success: '))\n console.log('\\t', chalk.blue('sha256:'), digest)\n if (commitSha) {\n console.log('\\t', chalk.blue('Git commit SHA:'), commitSha)\n }\n const { ProjectSlug } = await res.json()\n console.log('\\t', chalk.blue('Check status:'), `${options.host}/${ProjectSlug}/datasource`)\n } else {\n console.error(chalk.red('Upload Failed'))\n console.error(chalk.red(await res.text()))\n }\n}\n"]}
|
|
@@ -148,6 +148,12 @@ export interface ProcessResult {
|
|
|
148
148
|
counters: CounterResult[];
|
|
149
149
|
logs: LogResult[];
|
|
150
150
|
}
|
|
151
|
+
export interface MetricDescriptor {
|
|
152
|
+
name: string;
|
|
153
|
+
unit: string;
|
|
154
|
+
description: string;
|
|
155
|
+
sparse: boolean;
|
|
156
|
+
}
|
|
151
157
|
export interface RecordMetaData {
|
|
152
158
|
contractAddress: string;
|
|
153
159
|
blockNumber: Long;
|
|
@@ -155,6 +161,7 @@ export interface RecordMetaData {
|
|
|
155
161
|
logIndex: number;
|
|
156
162
|
chainId: string;
|
|
157
163
|
name: string;
|
|
164
|
+
descriptor: MetricDescriptor | undefined;
|
|
158
165
|
labels: {
|
|
159
166
|
[key: string]: string;
|
|
160
167
|
};
|
|
@@ -416,6 +423,13 @@ export declare const ProcessResult: {
|
|
|
416
423
|
toJSON(message: ProcessResult): unknown;
|
|
417
424
|
fromPartial(object: DeepPartial<ProcessResult>): ProcessResult;
|
|
418
425
|
};
|
|
426
|
+
export declare const MetricDescriptor: {
|
|
427
|
+
encode(message: MetricDescriptor, writer?: _m0.Writer): _m0.Writer;
|
|
428
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MetricDescriptor;
|
|
429
|
+
fromJSON(object: any): MetricDescriptor;
|
|
430
|
+
toJSON(message: MetricDescriptor): unknown;
|
|
431
|
+
fromPartial(object: DeepPartial<MetricDescriptor>): MetricDescriptor;
|
|
432
|
+
};
|
|
419
433
|
export declare const RecordMetaData: {
|
|
420
434
|
encode(message: RecordMetaData, writer?: _m0.Writer): _m0.Writer;
|
|
421
435
|
decode(input: _m0.Reader | Uint8Array, length?: number): RecordMetaData;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProcessorDefinition = exports.LogResult = exports.CounterResult = exports.GaugeResult = exports.RuntimeInfo = exports.BigInteger = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.ProcessResult = exports.RawBlock = exports.BlockBinding = exports.Instruction = exports.RawTransaction = exports.RawTrace = exports.TraceBinding = exports.RawLog = exports.LogBinding = exports.ProcessBlocksResponse = exports.ProcessBlocksRequest = exports.ProcessInstructionsResponse = exports.ProcessTransactionsResponse = exports.ProcessInstructionsRequest = exports.ProcessTransactionsRequest = exports.ProcessTracesResponse = exports.ProcessTracesRequest = exports.ProcessLogsResponse = exports.ProcessLogsRequest = exports.Topic = exports.InstructionHandlerConfig = exports.LogFilter = exports.LogHandlerConfig = exports.TraceHandlerConfig = exports.BlockHandlerConfig = exports.StartRequest = exports.TemplateInstance = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = exports.logLevelToJSON = exports.logLevelFromJSON = exports.LogLevel = exports.handlerTypeToJSON = exports.handlerTypeFromJSON = exports.HandlerType = void 0;
|
|
6
|
+
exports.ProcessorDefinition = exports.LogResult = exports.CounterResult = exports.GaugeResult = exports.RuntimeInfo = exports.BigInteger = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.MetricDescriptor = exports.ProcessResult = exports.RawBlock = exports.BlockBinding = exports.Instruction = exports.RawTransaction = exports.RawTrace = exports.TraceBinding = exports.RawLog = exports.LogBinding = exports.ProcessBlocksResponse = exports.ProcessBlocksRequest = exports.ProcessInstructionsResponse = exports.ProcessTransactionsResponse = exports.ProcessInstructionsRequest = exports.ProcessTransactionsRequest = exports.ProcessTracesResponse = exports.ProcessTracesRequest = exports.ProcessLogsResponse = exports.ProcessLogsRequest = exports.Topic = exports.InstructionHandlerConfig = exports.LogFilter = exports.LogHandlerConfig = exports.TraceHandlerConfig = exports.BlockHandlerConfig = exports.StartRequest = exports.TemplateInstance = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = exports.logLevelToJSON = exports.logLevelFromJSON = exports.LogLevel = exports.handlerTypeToJSON = exports.handlerTypeFromJSON = exports.HandlerType = void 0;
|
|
7
7
|
const long_1 = __importDefault(require("long"));
|
|
8
8
|
const empty_1 = require("../../google/protobuf/empty");
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
@@ -2080,6 +2080,77 @@ exports.ProcessResult = {
|
|
|
2080
2080
|
return message;
|
|
2081
2081
|
},
|
|
2082
2082
|
};
|
|
2083
|
+
function createBaseMetricDescriptor() {
|
|
2084
|
+
return { name: "", unit: "", description: "", sparse: false };
|
|
2085
|
+
}
|
|
2086
|
+
exports.MetricDescriptor = {
|
|
2087
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
2088
|
+
if (message.name !== "") {
|
|
2089
|
+
writer.uint32(10).string(message.name);
|
|
2090
|
+
}
|
|
2091
|
+
if (message.unit !== "") {
|
|
2092
|
+
writer.uint32(18).string(message.unit);
|
|
2093
|
+
}
|
|
2094
|
+
if (message.description !== "") {
|
|
2095
|
+
writer.uint32(26).string(message.description);
|
|
2096
|
+
}
|
|
2097
|
+
if (message.sparse === true) {
|
|
2098
|
+
writer.uint32(32).bool(message.sparse);
|
|
2099
|
+
}
|
|
2100
|
+
return writer;
|
|
2101
|
+
},
|
|
2102
|
+
decode(input, length) {
|
|
2103
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
2104
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2105
|
+
const message = createBaseMetricDescriptor();
|
|
2106
|
+
while (reader.pos < end) {
|
|
2107
|
+
const tag = reader.uint32();
|
|
2108
|
+
switch (tag >>> 3) {
|
|
2109
|
+
case 1:
|
|
2110
|
+
message.name = reader.string();
|
|
2111
|
+
break;
|
|
2112
|
+
case 2:
|
|
2113
|
+
message.unit = reader.string();
|
|
2114
|
+
break;
|
|
2115
|
+
case 3:
|
|
2116
|
+
message.description = reader.string();
|
|
2117
|
+
break;
|
|
2118
|
+
case 4:
|
|
2119
|
+
message.sparse = reader.bool();
|
|
2120
|
+
break;
|
|
2121
|
+
default:
|
|
2122
|
+
reader.skipType(tag & 7);
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
return message;
|
|
2127
|
+
},
|
|
2128
|
+
fromJSON(object) {
|
|
2129
|
+
return {
|
|
2130
|
+
name: isSet(object.name) ? String(object.name) : "",
|
|
2131
|
+
unit: isSet(object.unit) ? String(object.unit) : "",
|
|
2132
|
+
description: isSet(object.description) ? String(object.description) : "",
|
|
2133
|
+
sparse: isSet(object.sparse) ? Boolean(object.sparse) : false,
|
|
2134
|
+
};
|
|
2135
|
+
},
|
|
2136
|
+
toJSON(message) {
|
|
2137
|
+
const obj = {};
|
|
2138
|
+
message.name !== undefined && (obj.name = message.name);
|
|
2139
|
+
message.unit !== undefined && (obj.unit = message.unit);
|
|
2140
|
+
message.description !== undefined &&
|
|
2141
|
+
(obj.description = message.description);
|
|
2142
|
+
message.sparse !== undefined && (obj.sparse = message.sparse);
|
|
2143
|
+
return obj;
|
|
2144
|
+
},
|
|
2145
|
+
fromPartial(object) {
|
|
2146
|
+
const message = createBaseMetricDescriptor();
|
|
2147
|
+
message.name = object.name ?? "";
|
|
2148
|
+
message.unit = object.unit ?? "";
|
|
2149
|
+
message.description = object.description ?? "";
|
|
2150
|
+
message.sparse = object.sparse ?? false;
|
|
2151
|
+
return message;
|
|
2152
|
+
},
|
|
2153
|
+
};
|
|
2083
2154
|
function createBaseRecordMetaData() {
|
|
2084
2155
|
return {
|
|
2085
2156
|
contractAddress: "",
|
|
@@ -2088,6 +2159,7 @@ function createBaseRecordMetaData() {
|
|
|
2088
2159
|
logIndex: 0,
|
|
2089
2160
|
chainId: "",
|
|
2090
2161
|
name: "",
|
|
2162
|
+
descriptor: undefined,
|
|
2091
2163
|
labels: {},
|
|
2092
2164
|
};
|
|
2093
2165
|
}
|
|
@@ -2111,6 +2183,9 @@ exports.RecordMetaData = {
|
|
|
2111
2183
|
if (message.name !== "") {
|
|
2112
2184
|
writer.uint32(50).string(message.name);
|
|
2113
2185
|
}
|
|
2186
|
+
if (message.descriptor !== undefined) {
|
|
2187
|
+
exports.MetricDescriptor.encode(message.descriptor, writer.uint32(66).fork()).ldelim();
|
|
2188
|
+
}
|
|
2114
2189
|
Object.entries(message.labels).forEach(([key, value]) => {
|
|
2115
2190
|
exports.RecordMetaData_LabelsEntry.encode({ key: key, value }, writer.uint32(58).fork()).ldelim();
|
|
2116
2191
|
});
|
|
@@ -2141,6 +2216,9 @@ exports.RecordMetaData = {
|
|
|
2141
2216
|
case 6:
|
|
2142
2217
|
message.name = reader.string();
|
|
2143
2218
|
break;
|
|
2219
|
+
case 8:
|
|
2220
|
+
message.descriptor = exports.MetricDescriptor.decode(reader, reader.uint32());
|
|
2221
|
+
break;
|
|
2144
2222
|
case 7:
|
|
2145
2223
|
const entry7 = exports.RecordMetaData_LabelsEntry.decode(reader, reader.uint32());
|
|
2146
2224
|
if (entry7.value !== undefined) {
|
|
@@ -2168,6 +2246,9 @@ exports.RecordMetaData = {
|
|
|
2168
2246
|
logIndex: isSet(object.logIndex) ? Number(object.logIndex) : 0,
|
|
2169
2247
|
chainId: isSet(object.chainId) ? String(object.chainId) : "",
|
|
2170
2248
|
name: isSet(object.name) ? String(object.name) : "",
|
|
2249
|
+
descriptor: isSet(object.descriptor)
|
|
2250
|
+
? exports.MetricDescriptor.fromJSON(object.descriptor)
|
|
2251
|
+
: undefined,
|
|
2171
2252
|
labels: isObject(object.labels)
|
|
2172
2253
|
? Object.entries(object.labels).reduce((acc, [key, value]) => {
|
|
2173
2254
|
acc[key] = String(value);
|
|
@@ -2188,6 +2269,10 @@ exports.RecordMetaData = {
|
|
|
2188
2269
|
(obj.logIndex = Math.round(message.logIndex));
|
|
2189
2270
|
message.chainId !== undefined && (obj.chainId = message.chainId);
|
|
2190
2271
|
message.name !== undefined && (obj.name = message.name);
|
|
2272
|
+
message.descriptor !== undefined &&
|
|
2273
|
+
(obj.descriptor = message.descriptor
|
|
2274
|
+
? exports.MetricDescriptor.toJSON(message.descriptor)
|
|
2275
|
+
: undefined);
|
|
2191
2276
|
obj.labels = {};
|
|
2192
2277
|
if (message.labels) {
|
|
2193
2278
|
Object.entries(message.labels).forEach(([k, v]) => {
|
|
@@ -2207,6 +2292,10 @@ exports.RecordMetaData = {
|
|
|
2207
2292
|
message.logIndex = object.logIndex ?? 0;
|
|
2208
2293
|
message.chainId = object.chainId ?? "";
|
|
2209
2294
|
message.name = object.name ?? "";
|
|
2295
|
+
message.descriptor =
|
|
2296
|
+
object.descriptor !== undefined && object.descriptor !== null
|
|
2297
|
+
? exports.MetricDescriptor.fromPartial(object.descriptor)
|
|
2298
|
+
: undefined;
|
|
2210
2299
|
message.labels = Object.entries(object.labels ?? {}).reduce((acc, [key, value]) => {
|
|
2211
2300
|
if (value !== undefined) {
|
|
2212
2301
|
acc[key] = String(value);
|