UNPKG

@taqueria/node-sdk

Version:

A TypeScript SDK for NodeJS used for Taqueria plugin development.

136 lines (133 loc) • 7.47 kB
import * as NonStrict from '@taqueria/protocol/types'; export * from '@taqueria/protocol/types'; import * as Protocol from '@taqueria/protocol'; export { Protocol }; export { Config, EconomicalProtocolHash, Environment, Faucet, LoadedConfig, NetworkConfig, NonEmptyString, Option, PositionalArg, ProxyTaskArgs, ProxyTemplateArgs, RequestArgs, Task } from '@taqueria/protocol'; import * as Template from '@taqueria/protocol/Template'; export { Template }; import { TaqError } from '@taqueria/protocol/TaqError'; import { ExecException } from 'child_process'; import { FutureInstance } from 'fluture'; import { LikeAPromise, StdIO, pluginDefiner } from './types.mjs'; import '@taqueria/protocol/Environment'; import '@taqueria/protocol/i18n'; import '@taqueria/protocol/LoadedConfig'; import '@taqueria/protocol/MetadataConfig'; import '@taqueria/protocol/NetworkConfig'; import '@taqueria/protocol/Operation'; import '@taqueria/protocol/Option'; import '@taqueria/protocol/PersistentState'; import '@taqueria/protocol/PluginSchema'; import '@taqueria/protocol/PositionalArg'; import '@taqueria/protocol/SandboxAccountConfig'; import '@taqueria/protocol/SandboxConfig'; import '@taqueria/protocol/SanitizedAbsPath'; import '@taqueria/protocol/SanitizedPath'; import '@taqueria/protocol/Task'; declare const TAQ_OPERATOR_ACCOUNT = "taqOperatorAccount"; declare const eager: <T>(f: FutureInstance<TaqError, T>) => Promise<T>; declare const writeJsonFile: (filePath: string) => (data: unknown) => Promise<string>; declare const readJsonFile: <T>(filePath: string) => Promise<T>; declare const readJsonFileWithoutTransform: <T>(filename: string) => Promise<T>; type FilteredStdErr = { skip: boolean; output: string[]; }; declare const execCmd: (cmd: string, stdErrFilter?: (stderr: string) => string) => LikeAPromise<StdIO, ExecException & { stdout: string; stderr: string; }>; type ExecErrProps = { stderr: string; stdout: string; }; declare const toExecErr: (message: string | Error, props: ExecErrProps) => Error & ExecErrProps; declare const execCommandWithoutWrapping: (cmd: string) => LikeAPromise<StdIO, ExecException>; declare const spawnCmd: (cmd: string, envVars?: Record<string, string>) => Promise<number | null>; declare const getArchSync: () => "linux/arm64/v8" | "linux/amd64"; declare const getArch: () => LikeAPromise<"linux/arm64/v8" | "linux/amd64", TaqError>; declare const parseJSON: <T>(input: string) => LikeAPromise<T, TaqError>; declare const sendRes: (msg: string, newline?: boolean) => void; declare const sendAsyncRes: (msg: string, newline?: boolean) => Promise<void>; declare const sendErr: (msg: string, newline?: boolean) => string | undefined; declare const sendWarn: (msg: string, newline?: boolean) => string | undefined; declare const sendAsyncErr: (msg: string, newline?: boolean) => Promise<never>; declare const sendJson: (msg: unknown, newline?: boolean) => void; declare const sendJsonErr: (msg: unknown, newline?: boolean) => string | undefined; declare const sendAsyncJson: (msg: unknown, newline?: boolean) => Promise<void>; declare const sendAsyncJsonErr: (msg: unknown, newline?: boolean) => Promise<never>; declare const sendJsonRes: <T>(data: T, messages?: { header?: string; footer?: string; }) => void; declare const sendAsyncJsonRes: <T>(data: T) => Promise<void>; declare const noop: () => void; declare const getSelectedEnvironment: (args: { env: string | undefined; config: { environment: Record<string, unknown>; }; }) => {}; /** * Gets the name of the current environment */ declare const getCurrentEnvironment: (parsedArgs: Protocol.RequestArgs.t) => string; /** * Gets the name of the current environment */ /** * Gets the configuration for the current environment, if one is configured */ declare const getCurrentEnvironmentConfig: (parsedArgs: Protocol.RequestArgs.t) => any; /** * Gets the configuration for the project metadata */ declare const getMetadataConfig: (parsedArgs: Protocol.RequestArgs.t) => () => Protocol.MetadataConfig.t | undefined; /** * Gets the configuration for the named network */ declare const getNetworkConfig: (parsedArgs: Protocol.RequestArgs.t) => (networkName: string) => Protocol.NetworkConfig.t | undefined; /** * Gets the configuration for the named sandbox */ declare const getSandboxConfig: (parsedArgs: Protocol.RequestArgs.t) => (sandboxName: string) => Protocol.SandboxConfig.t | undefined; /** * Gets the name of accounts for the given sandbox */ declare const getSandboxAccountNames: (parsedArgs: Protocol.RequestArgs.t) => (sandboxName: string) => string[]; /** * Gets the account config for the named account of the given sandbox */ declare const getSandboxAccountConfig: (sandbox: Protocol.SandboxConfig.t, accountName: string) => any; declare const addTzExtensionIfMissing: (contractFilename: string) => string; declare const getArtifactsDir: (parsedArgs: Protocol.RequestArgs.t) => any; declare const getContractsDir: (parsedArgs: Protocol.RequestArgs.t) => any; declare const getContractContent: (parsedArgs: Protocol.RequestArgs.t, contractFilename: string) => Promise<string | undefined>; /** * Gets the parameter for the contract associated with the given parameter file */ declare const getParameter: (parsedArgs: Protocol.RequestArgs.t, paramFilename: string) => Promise<string>; /** * Update the alias of an address for the current environment */ /** * Update the alias of an address for the current environment */ declare const updateAddressAlias: (parsedArgs: Protocol.RequestArgs.t, alias: string, address: Protocol.NonEmptyString.t) => Promise<void>; declare const getAddressOfAlias: (env: Protocol.Environment.t, alias: string) => Promise<string>; declare const getAccountPrivateKey: (parsedArgs: Protocol.RequestArgs.t, network: Protocol.NetworkConfig.t | NonStrict.NetworkConfig, account: string) => Promise<string>; declare const getDockerImage: (defaultImageName: string, envVarName: string) => string; /** * Gets the default account associated with a sandbox * TODO: Replace with Taq Operator Account */ declare const getDefaultSandboxAccount: (sandbox: Protocol.SandboxConfig.t) => any; declare const getContracts: (regex: RegExp, config: Protocol.LoadedConfig.t) => string[]; declare const joinPaths: (...paths: string[]) => string; declare const stringToSHA256: (s: string) => Promise<unknown>; declare const isTaqError: (err: unknown) => err is TaqError; declare const Plugin: { create: <Args extends Protocol.RequestArgs.t>(definer: pluginDefiner, unparsedArgs: string[]) => Promise<void>; }; declare const isContractFile: (filename: string) => boolean; export { type FilteredStdErr, Plugin, TAQ_OPERATOR_ACCOUNT, addTzExtensionIfMissing, eager, execCmd, execCommandWithoutWrapping, getAccountPrivateKey, getAddressOfAlias, getArch, getArchSync, getArtifactsDir, getContractContent, getContracts, getContractsDir, getCurrentEnvironment, getCurrentEnvironmentConfig, getDefaultSandboxAccount, getDockerImage, getMetadataConfig, getNetworkConfig, getParameter, getSandboxAccountConfig, getSandboxAccountNames, getSandboxConfig, getSelectedEnvironment, isContractFile, isTaqError, joinPaths, noop, parseJSON, readJsonFile, readJsonFileWithoutTransform, sendAsyncErr, sendAsyncJson, sendAsyncJsonErr, sendAsyncJsonRes, sendAsyncRes, sendErr, sendJson, sendJsonErr, sendJsonRes, sendRes, sendWarn, spawnCmd, stringToSHA256, toExecErr, updateAddressAlias, writeJsonFile };