@sentio/cli 3.9.0-rc.2 → 3.9.0-rc.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/lib/index.js CHANGED
@@ -164210,7 +164210,9 @@ async function resolveNetworkAddresses(config) {
164210
164210
  const id2 = ethers_exports.id(name);
164211
164211
  return await addressBook["getAddress(bytes32)"](id2);
164212
164212
  } catch (e3) {
164213
- throw new Error(`Failed to resolve "${name}" from AddressBook (${addressBookAddr}): ${e3.message}`);
164213
+ throw new Error(
164214
+ `Failed to resolve "${name}" from AddressBook (${addressBookAddr}): ${e3 instanceof Error ? e3.message : String(e3)}`
164215
+ );
164214
164216
  }
164215
164217
  }
164216
164218
  };
@@ -165294,7 +165296,7 @@ async function uploadFile(config, auth, options) {
165294
165296
  try {
165295
165297
  await upload2();
165296
165298
  } catch (e3) {
165297
- if (e3.constructor.name === "FetchError" && e3.type === "system" && e3.code === "EPIPE") {
165299
+ if (e3?.constructor.name === "FetchError" && e3.type === "system" && e3.code === "EPIPE") {
165298
165300
  error = e3;
165299
165301
  await new Promise((resolve) => setTimeout(resolve, 1e3));
165300
165302
  await tryUploading();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/cli",
3
- "version": "3.9.0-rc.2",
3
+ "version": "3.9.0-rc.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -360,14 +360,14 @@ async function injectProjectId(
360
360
  }
361
361
  }
362
362
 
363
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
363
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
364
364
  return command
365
365
  .option('--host <host>', 'Override Sentio host')
366
366
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
367
367
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
368
368
  }
369
369
 
370
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
370
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
371
371
  return command
372
372
  .option('--project <project>', 'Sentio project as <owner>/<slug> or <slug>')
373
373
  .option('--owner <owner>', 'Sentio project owner')
@@ -375,17 +375,17 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
375
375
  .option('--project-id <id>', 'Sentio project id')
376
376
  }
377
377
 
378
- function withJsonInputOptions<T extends Command<any, any, any>>(command: T) {
378
+ function withJsonInputOptions<Args extends any[]>(command: Command<Args, any, any>) {
379
379
  return command
380
380
  .option('--file <path>', 'Read request JSON or YAML from file')
381
381
  .option('--stdin', 'Read request JSON or YAML from stdin')
382
382
  }
383
383
 
384
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
384
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
385
385
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
386
386
  }
387
387
 
388
- function handleAlertCommandError(error: unknown, command?: Command) {
388
+ function handleAlertCommandError(error: unknown, command?: Command<any[], any, any>) {
389
389
  if (
390
390
  error instanceof CliError &&
391
391
  (error.message.startsWith('Project is required.') ||
@@ -521,14 +521,14 @@ function isRecord(value: unknown): value is Record<string, unknown> {
521
521
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value)
522
522
  }
523
523
 
524
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
524
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
525
525
  return command
526
526
  .option('--host <host>', 'Override Sentio host')
527
527
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
528
528
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
529
529
  }
530
530
 
531
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
531
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
532
532
  return command
533
533
  .option('--project <project>', 'Sentio project as <owner>/<slug> or <slug>')
534
534
  .option('--owner <owner>', 'Sentio project owner')
@@ -536,11 +536,11 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
536
536
  .option('--project-id <id>', 'Sentio project id')
537
537
  }
538
538
 
539
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
539
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
540
540
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
541
541
  }
542
542
 
543
- function handleDashboardCommandError(error: unknown, command?: Command) {
543
+ function handleDashboardCommandError(error: unknown, command?: Command<any[], any, any>) {
544
544
  if (
545
545
  error instanceof CliError &&
546
546
  (error.message.startsWith('Project is required.') ||
@@ -566,14 +566,14 @@ async function runSqlExecutionRead(
566
566
  printOutput(options, data)
567
567
  }
568
568
 
569
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
569
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
570
570
  return command
571
571
  .option('--host <host>', 'Override Sentio host')
572
572
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
573
573
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
574
574
  }
575
575
 
576
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
576
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
577
577
  return command
578
578
  .option('--project <project>', 'Sentio project as <owner>/<slug> or <slug>')
579
579
  .option('--owner <owner>', 'Sentio project owner')
@@ -581,19 +581,19 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
581
581
  .option('--project-id <id>', 'Sentio project id')
582
582
  }
583
583
 
584
- function withJsonInputOptions<T extends Command<any, any, any>>(command: T) {
584
+ function withJsonInputOptions<Args extends any[]>(command: Command<Args, any, any>) {
585
585
  return command
586
586
  .option('--file <path>', 'Read request JSON or YAML from file')
587
587
  .option('--stdin', 'Read request JSON or YAML from stdin')
588
588
  }
589
589
 
590
- function withQueryInputOptions<T extends Command<any, any, any>>(command: T) {
590
+ function withQueryInputOptions<Args extends any[]>(command: Command<Args, any, any>) {
591
591
  return command
592
592
  .option('--file <path>', 'Read request JSON or YAML from file. Use --doc to show the full insight query format')
593
593
  .option('--stdin', 'Read request JSON or YAML from stdin. Use --doc to show the full insight query format')
594
594
  }
595
595
 
596
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
596
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
597
597
  return command
598
598
  .showHelpAfterError()
599
599
  .option('--json', 'Print raw JSON response')
@@ -617,7 +617,7 @@ function printJson(data: unknown) {
617
617
  console.log(JSON.stringify(data, null, 2))
618
618
  }
619
619
 
620
- function handleDataCommandError(error: unknown, command?: Command) {
620
+ function handleDataCommandError(error: unknown, command?: Command<any[], any, any>) {
621
621
  if (error instanceof CliError && shouldShowHelpForDataCommandError(error)) {
622
622
  console.error(chalk.red(error.message))
623
623
  if (command) {
@@ -366,14 +366,14 @@ async function runEndpointTest(options: EndpointTestOptions) {
366
366
  })
367
367
  }
368
368
 
369
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
369
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
370
370
  return command
371
371
  .option('--host <host>', 'Override Sentio host')
372
372
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
373
373
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
374
374
  }
375
375
 
376
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
376
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
377
377
  return command
378
378
  .option('--project <project>', 'Sentio project as <owner>/<slug> or <slug>')
379
379
  .option('--owner <owner>', 'Sentio project owner')
@@ -381,11 +381,11 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
381
381
  .option('--project-id <id>', 'Sentio project id')
382
382
  }
383
383
 
384
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
384
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
385
385
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
386
386
  }
387
387
 
388
- function handleEndpointCommandError(error: unknown, command?: Command) {
388
+ function handleEndpointCommandError(error: unknown, command?: Command<any[], any, any>) {
389
389
  if (
390
390
  error instanceof CliError &&
391
391
  (error.message.startsWith('Project is required.') ||
@@ -185,24 +185,24 @@ async function runPriceCheckLatest(options: PriceOptions) {
185
185
  printOutput(options, unwrapApiResult(response))
186
186
  }
187
187
 
188
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
188
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
189
189
  return command
190
190
  .option('--host <host>', 'Override Sentio host')
191
191
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
192
192
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
193
193
  }
194
194
 
195
- function withJsonInputOptions<T extends Command<any, any, any>>(command: T) {
195
+ function withJsonInputOptions<Args extends any[]>(command: Command<Args, any, any>) {
196
196
  return command
197
197
  .option('--file <path>', 'Read request JSON or YAML from file')
198
198
  .option('--stdin', 'Read request JSON or YAML from stdin')
199
199
  }
200
200
 
201
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
201
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
202
202
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
203
203
  }
204
204
 
205
- function handlePriceCommandError(error: unknown, command?: Command) {
205
+ function handlePriceCommandError(error: unknown, command?: Command<any[], any, any>) {
206
206
  if (
207
207
  error instanceof CliError &&
208
208
  (error.message.startsWith('Provide exactly one coin identifier.') ||
@@ -478,14 +478,14 @@ function colorSeverity(severity: string): string {
478
478
  }
479
479
  }
480
480
 
481
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
481
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
482
482
  return command
483
483
  .option('--host <host>', 'Override Sentio host')
484
484
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
485
485
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
486
486
  }
487
487
 
488
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
488
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
489
489
  return command
490
490
  .option('--project <owner/slug>', 'Sentio project in <owner>/<slug> format')
491
491
  .option('--owner <owner>', 'Sentio project owner')
@@ -493,11 +493,11 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
493
493
  .option('--project-id <id>', 'Sentio project id')
494
494
  }
495
495
 
496
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
496
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
497
497
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
498
498
  }
499
499
 
500
- function handleProcessorCommandError(error: unknown, command?: Command) {
500
+ function handleProcessorCommandError(error: unknown, command?: Command<any[], any, any>) {
501
501
  if (
502
502
  error instanceof CliError &&
503
503
  (error.message.startsWith('Project is required.') ||
@@ -267,14 +267,14 @@ async function fetchProjectBySlug(options: ProjectLookupOptions, context: Return
267
267
  return fetchApiJson<{ project?: ProjectSummary }>(`/api/v1/project/${project.owner}/${project.slug}`, context)
268
268
  }
269
269
 
270
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
270
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
271
271
  return command
272
272
  .option('--host <host>', 'Override Sentio host')
273
273
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
274
274
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
275
275
  }
276
276
 
277
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
277
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
278
278
  return command
279
279
  .option('--project <owner/slug>', 'Sentio project in <owner>/<slug> format')
280
280
  .option('--owner <owner>', 'Sentio project owner')
@@ -282,11 +282,11 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
282
282
  .option('--project-id <id>', 'Sentio project id')
283
283
  }
284
284
 
285
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
285
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
286
286
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
287
287
  }
288
288
 
289
- function handleProjectCommandError(error: unknown, command?: Command) {
289
+ function handleProjectCommandError(error: unknown, command?: Command<any[], any, any>) {
290
290
  if (
291
291
  error instanceof CliError &&
292
292
  (error.message.startsWith('Project is required.') ||
@@ -369,14 +369,14 @@ function buildTraceQuery(options: SimulationTraceOptions) {
369
369
  }
370
370
  }
371
371
 
372
- function withAuthOptions<T extends Command<any, any, any>>(command: T) {
372
+ function withAuthOptions<Args extends any[]>(command: Command<Args, any, any>) {
373
373
  return command
374
374
  .option('--host <host>', 'Override Sentio host')
375
375
  .option('--api-key <key>', 'Use an explicit API key instead of saved credentials')
376
376
  .option('--token <token>', 'Use an explicit bearer token instead of saved credentials')
377
377
  }
378
378
 
379
- function withSharedProjectOptions<T extends Command<any, any, any>>(command: T) {
379
+ function withSharedProjectOptions<Args extends any[]>(command: Command<Args, any, any>) {
380
380
  return command
381
381
  .option('--project <owner/slug>', 'Sentio project in <owner>/<slug> format')
382
382
  .option('--owner <owner>', 'Sentio project owner')
@@ -384,17 +384,17 @@ function withSharedProjectOptions<T extends Command<any, any, any>>(command: T)
384
384
  .option('--project-id <id>', 'Sentio project id')
385
385
  }
386
386
 
387
- function withJsonInputOptions<T extends Command<any, any, any>>(command: T) {
387
+ function withJsonInputOptions<Args extends any[]>(command: Command<Args, any, any>) {
388
388
  return command
389
389
  .option('--file <path>', 'Read request JSON or YAML from file')
390
390
  .option('--stdin', 'Read request JSON or YAML from stdin')
391
391
  }
392
392
 
393
- function withOutputOptions<T extends Command<any, any, any>>(command: T) {
393
+ function withOutputOptions<Args extends any[]>(command: Command<Args, any, any>) {
394
394
  return command.option('--json', 'Print raw JSON response').option('--yaml', 'Print raw YAML response')
395
395
  }
396
396
 
397
- function withTraceOptions<T extends Command<any, any, any>>(command: T) {
397
+ function withTraceOptions<Args extends any[]>(command: Command<Args, any, any>) {
398
398
  return command
399
399
  .option('--chain-id <id>', 'Chain id')
400
400
  .option('--with-internal-calls', 'Fetch decoded trace with internal calls')
@@ -402,7 +402,7 @@ function withTraceOptions<T extends Command<any, any, any>>(command: T) {
402
402
  .option('--ignore-gas-cost', 'Ignore gas cost when optimizer is disabled')
403
403
  }
404
404
 
405
- function handleSimulationCommandError(error: unknown, command?: Command) {
405
+ function handleSimulationCommandError(error: unknown, command?: Command<any[], any, any>) {
406
406
  if (
407
407
  error instanceof CliError &&
408
408
  (error.message.startsWith('Project is required.') ||
@@ -737,8 +737,8 @@ export async function uploadFile(
737
737
  }
738
738
  try {
739
739
  await upload()
740
- } catch (e) {
741
- if (e.constructor.name === 'FetchError' && e.type === 'system' && e.code === 'EPIPE') {
740
+ } catch (e: any) {
741
+ if (e?.constructor.name === 'FetchError' && e.type === 'system' && e.code === 'EPIPE') {
742
742
  error = e
743
743
  await new Promise((resolve) => setTimeout(resolve, 1000))
744
744
  await tryUploading()
package/src/network.ts CHANGED
@@ -158,7 +158,9 @@ export async function resolveNetworkAddresses(config: SentioNetworkConfig): Prom
158
158
  const id = ethers.id(name)
159
159
  return await addressBook['getAddress(bytes32)'](id)
160
160
  } catch (e) {
161
- throw new Error(`Failed to resolve "${name}" from AddressBook (${addressBookAddr}): ${e.message}`)
161
+ throw new Error(
162
+ `Failed to resolve "${name}" from AddressBook (${addressBookAddr}): ${e instanceof Error ? e.message : String(e)}`
163
+ )
162
164
  }
163
165
  }
164
166
  }