2021-12-19 21:19:33 +09:00
|
|
|
/* tslint:disable */
|
2021-11-21 19:23:53 +09:00
|
|
|
/* eslint-disable */
|
|
|
|
|
2021-12-19 21:19:33 +09:00
|
|
|
/* auto-generated by NAPI-RS */
|
|
|
|
|
2021-11-21 17:11:15 +09:00
|
|
|
export class ExternalObject<T> {
|
2021-11-21 19:23:53 +09:00
|
|
|
readonly '': {
|
|
|
|
readonly '': unique symbol
|
|
|
|
[K: symbol]: T
|
|
|
|
}
|
2021-11-21 17:11:15 +09:00
|
|
|
}
|
2021-11-29 13:54:45 +09:00
|
|
|
/** This is a const */
|
2021-11-10 20:04:36 +09:00
|
|
|
export const DEFAULT_COST: number
|
2021-09-23 02:29:09 +09:00
|
|
|
export function getWords(): Array<string>
|
2021-11-29 13:54:45 +09:00
|
|
|
/** Gets some numbers */
|
2021-09-23 02:29:09 +09:00
|
|
|
export function getNums(): Array<number>
|
|
|
|
export function sumNums(nums: Array<number>): number
|
2021-10-30 01:05:05 +09:00
|
|
|
export function readFileAsync(path: string): Promise<Buffer>
|
2021-11-06 23:19:42 +09:00
|
|
|
export function asyncMultiTwo(arg: number): Promise<number>
|
2021-11-11 01:33:51 +09:00
|
|
|
export function bigintAdd(a: BigInt, b: BigInt): BigInt
|
|
|
|
export function createBigInt(): BigInt
|
|
|
|
export function createBigIntI64(): BigInt
|
2021-09-23 02:29:09 +09:00
|
|
|
export function getCwd(callback: (arg0: string) => void): void
|
2021-11-29 13:54:45 +09:00
|
|
|
/** napi = { version = 2, features = ["serde-json"] } */
|
2021-11-16 14:02:40 +09:00
|
|
|
export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void
|
2021-11-02 01:34:19 +09:00
|
|
|
export function eitherStringOrNumber(input: string | number): number
|
|
|
|
export function returnEither(input: number): string | number
|
|
|
|
export function either3(input: string | number | boolean): number
|
2021-11-29 13:54:45 +09:00
|
|
|
export interface Obj {
|
2021-11-02 01:34:19 +09:00
|
|
|
v: string | number
|
|
|
|
}
|
|
|
|
export function either4(input: string | number | boolean | Obj): number
|
2021-11-29 13:54:45 +09:00
|
|
|
/** default enum values are continuos i32s start from 0 */
|
2021-12-09 19:48:50 +09:00
|
|
|
export const enum Kind {
|
2021-11-29 13:54:45 +09:00
|
|
|
/** Barks */
|
|
|
|
Dog = 0,
|
|
|
|
/** Kills birds */
|
|
|
|
Cat = 1,
|
|
|
|
/** Tasty */
|
|
|
|
Duck = 2
|
|
|
|
}
|
|
|
|
/** You could break the step and for an new continuous value. */
|
2021-12-09 19:48:50 +09:00
|
|
|
export const enum CustomNumEnum {
|
2021-11-29 13:54:45 +09:00
|
|
|
One = 1,
|
|
|
|
Two = 2,
|
|
|
|
Three = 3,
|
|
|
|
Four = 4,
|
|
|
|
Six = 6,
|
|
|
|
Eight = 8,
|
|
|
|
Nine = 9,
|
|
|
|
Ten = 10
|
|
|
|
}
|
2021-09-23 02:29:09 +09:00
|
|
|
export function enumToI32(e: CustomNumEnum): number
|
2021-09-24 15:45:27 +09:00
|
|
|
export function throwError(): void
|
2021-11-21 17:11:15 +09:00
|
|
|
export function createExternal(size: number): ExternalObject<number>
|
|
|
|
export function createExternalString(content: string): ExternalObject<string>
|
|
|
|
export function getExternal(external: ExternalObject<number>): number
|
|
|
|
export function mutateExternal(external: ExternalObject<number>, newVal: number): void
|
2021-11-26 18:26:14 +09:00
|
|
|
export function tsRename(a: { foo: number }): string[]
|
2021-11-23 20:00:31 +09:00
|
|
|
export function xxh64Alias(input: Buffer): BigInt
|
2021-12-19 00:16:09 +09:00
|
|
|
export function getMapping(): Record<string, number>
|
|
|
|
export function sumMapping(nums: Record<string, number>): number
|
2021-11-16 14:02:40 +09:00
|
|
|
export function mapOption(val?: number | undefined | null): number | undefined | null
|
2021-12-18 14:36:45 +09:00
|
|
|
export function returnNull(): null
|
|
|
|
export function returnUndefined(): void
|
2021-09-23 02:29:09 +09:00
|
|
|
export function add(a: number, b: number): number
|
|
|
|
export function fibonacci(n: number): number
|
|
|
|
export function listObjKeys(obj: object): Array<string>
|
|
|
|
export function createObj(): object
|
2021-11-15 19:56:06 +09:00
|
|
|
export function getGlobal(): typeof global
|
2021-11-16 00:09:44 +09:00
|
|
|
export function getUndefined(): void
|
2021-11-15 19:56:06 +09:00
|
|
|
export function getNull(): JsNull
|
2021-12-02 16:47:59 +09:00
|
|
|
export interface AllOptionalObject {
|
|
|
|
name?: string | undefined | null
|
|
|
|
age?: number | undefined | null
|
|
|
|
}
|
|
|
|
export function receiveAllOptionalObject(obj?: AllOptionalObject | undefined | null): void
|
2021-12-09 19:48:50 +09:00
|
|
|
export const enum ALIAS {
|
2021-12-02 17:25:20 +09:00
|
|
|
A = 0,
|
|
|
|
B = 1
|
|
|
|
}
|
|
|
|
export interface AliasedStruct {
|
|
|
|
a: ALIAS
|
|
|
|
b: number
|
|
|
|
}
|
|
|
|
export function fnReceivedAliased(s: AliasedStruct, e: ALIAS): void
|
2021-11-13 21:51:14 +09:00
|
|
|
export function asyncPlus100(p: Promise<number>): Promise<number>
|
2021-11-29 13:54:45 +09:00
|
|
|
/** This is an interface for package.json */
|
|
|
|
export interface PackageJson {
|
2021-09-28 01:01:19 +09:00
|
|
|
name: string
|
2021-11-29 13:54:45 +09:00
|
|
|
/** The version of the package */
|
2021-09-28 01:01:19 +09:00
|
|
|
version: string
|
2021-11-16 14:02:40 +09:00
|
|
|
dependencies?: Record<string, any> | undefined | null
|
|
|
|
devDependencies?: Record<string, any> | undefined | null
|
2021-09-28 01:01:19 +09:00
|
|
|
}
|
|
|
|
export function readPackageJson(): PackageJson
|
|
|
|
export function getPackageJsonName(packageJson: PackageJson): string
|
2021-09-23 02:29:09 +09:00
|
|
|
export function contains(source: string, target: string): boolean
|
2021-11-11 17:59:24 +09:00
|
|
|
export function concatStr(s: string): string
|
2021-09-28 01:01:19 +09:00
|
|
|
export function concatUtf16(s: string): string
|
|
|
|
export function concatLatin1(s: string): string
|
2021-11-16 00:09:44 +09:00
|
|
|
export function setSymbolInObj(symbol: symbol): object
|
|
|
|
export function createSymbol(): symbol
|
2021-11-02 21:36:34 +09:00
|
|
|
export function withoutAbortController(a: number, b: number): Promise<number>
|
2021-11-16 00:09:44 +09:00
|
|
|
export function withAbortController(a: number, b: number, signal: AbortSignal): Promise<number>
|
2021-11-12 18:22:57 +09:00
|
|
|
export function callThreadsafeFunction(callback: (...args: any[]) => any): void
|
|
|
|
export function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void
|
2021-11-21 15:49:04 +09:00
|
|
|
export function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void
|
2021-12-14 01:37:46 +09:00
|
|
|
export function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void
|
2021-10-08 22:13:27 +09:00
|
|
|
export function getBuffer(): Buffer
|
2021-12-18 14:24:16 +09:00
|
|
|
export function appendBuffer(buf: Buffer): Buffer
|
2021-11-30 19:43:34 +09:00
|
|
|
export function convertU32Array(input: Uint32Array): Array<number>
|
|
|
|
export function createExternalTypedArray(): Uint32Array
|
|
|
|
export function mutateTypedArray(input: Float32Array): void
|
2021-11-29 13:54:45 +09:00
|
|
|
/**
|
|
|
|
* `constructor` option for `struct` requires all fields to be public,
|
|
|
|
* otherwise tag impl fn as constructor
|
|
|
|
* #[napi(constructor)]
|
|
|
|
*/
|
2021-09-23 02:29:09 +09:00
|
|
|
export class Animal {
|
2021-11-29 13:54:45 +09:00
|
|
|
/** Kind of animal */
|
2021-09-23 02:29:09 +09:00
|
|
|
readonly kind: Kind
|
2021-11-29 13:54:45 +09:00
|
|
|
/** This is the constructor */
|
2021-09-23 02:29:09 +09:00
|
|
|
constructor(kind: Kind, name: string)
|
2021-11-29 13:54:45 +09:00
|
|
|
/** This is a factory method */
|
2021-11-05 19:31:36 +09:00
|
|
|
static withKind(kind: Kind): Animal
|
2021-09-24 14:00:35 +09:00
|
|
|
get name(): string
|
|
|
|
set name(name: string)
|
2021-11-29 13:54:45 +09:00
|
|
|
/**
|
|
|
|
* This is a
|
|
|
|
* multi-line comment
|
|
|
|
* with an emoji 🚀
|
|
|
|
*/
|
2021-09-23 02:29:09 +09:00
|
|
|
whoami(): string
|
2021-11-29 13:54:45 +09:00
|
|
|
/** This is static... */
|
2021-09-24 21:19:54 +09:00
|
|
|
static getDogKind(): Kind
|
2021-12-23 15:07:35 +09:00
|
|
|
returnOtherClass(): Dog
|
2021-12-24 19:46:10 +09:00
|
|
|
returnOtherClassWithCustomConstructor(): Bird
|
2021-12-23 15:07:35 +09:00
|
|
|
}
|
|
|
|
export class Dog {
|
|
|
|
name: string
|
|
|
|
constructor(name: string)
|
2021-11-06 12:53:53 +09:00
|
|
|
}
|
2021-12-24 19:46:10 +09:00
|
|
|
export class Bird {
|
|
|
|
name: string
|
|
|
|
constructor(name: string)
|
2021-12-24 23:56:16 +09:00
|
|
|
getCount(): number
|
2021-12-24 19:46:10 +09:00
|
|
|
}
|
2021-11-29 13:54:45 +09:00
|
|
|
/** Smoking test for type generation */
|
2021-11-06 12:53:53 +09:00
|
|
|
export class Blake2BHasher {
|
|
|
|
static withKey(key: Blake2bKey): Blake2BHasher
|
|
|
|
}
|
2021-11-29 13:54:45 +09:00
|
|
|
export class Blake2BKey { }
|
2021-11-06 22:48:18 +09:00
|
|
|
export class Context {
|
2021-11-16 14:02:40 +09:00
|
|
|
maybeNeed?: boolean | undefined | null
|
2021-11-06 22:48:18 +09:00
|
|
|
constructor()
|
|
|
|
static withData(data: string): Context
|
|
|
|
method(): string
|
2021-09-23 02:29:09 +09:00
|
|
|
}
|
2021-12-08 18:32:16 +09:00
|
|
|
export class AnimalWithDefaultConstructor {
|
|
|
|
name: string
|
|
|
|
kind: number
|
|
|
|
constructor(name: string, kind: number)
|
|
|
|
}
|
2021-12-19 21:17:54 +09:00
|
|
|
export class NinjaTurtle {
|
|
|
|
name: string
|
|
|
|
/** Create your ninja turtle! 🐢 */
|
|
|
|
static newRaph(): NinjaTurtle
|
|
|
|
getMaskColor(): string
|
|
|
|
getName(): string
|
|
|
|
}
|
2021-11-05 19:31:36 +09:00
|
|
|
export class ClassWithFactory {
|
|
|
|
name: string
|
|
|
|
static withName(name: string): ClassWithFactory
|
2021-11-26 00:42:40 +09:00
|
|
|
setName(name: string): this
|
2021-11-05 19:31:36 +09:00
|
|
|
}
|
2021-11-23 20:00:31 +09:00
|
|
|
export namespace xxh3 {
|
|
|
|
export const ALIGNMENT: number
|
|
|
|
export function xxh3_64(input: Buffer): BigInt
|
2021-11-29 13:54:45 +09:00
|
|
|
/** xxh128 function */
|
2021-11-23 20:00:31 +09:00
|
|
|
export function xxh128(input: Buffer): BigInt
|
2021-11-29 13:54:45 +09:00
|
|
|
/** Xxh3 class */
|
2021-11-23 20:00:31 +09:00
|
|
|
export class Xxh3 {
|
|
|
|
constructor()
|
2021-11-29 13:54:45 +09:00
|
|
|
/** update */
|
2021-11-23 20:00:31 +09:00
|
|
|
update(input: Buffer): void
|
|
|
|
digest(): BigInt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export namespace xxh2 {
|
|
|
|
export function xxh2Plus(a: number, b: number): number
|
|
|
|
export function xxh3Xxh64Alias(input: Buffer): BigInt
|
|
|
|
}
|