@nocobase/plugin-workflow
Version:
A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.
63 lines (59 loc) • 1.53 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
export interface SnowflakeOpts {
custom_epoch?: number;
instance_id?: number;
}
/**
*/
export class Snowflake {
free(): void;
/**
* Constructs a Snowflake object which stores method for generation
* of a unique 64 bit time sortable ID
* @param {SnowflakeOpts | undefined} opts
*/
constructor(opts?: SnowflakeOpts);
/**
* getUniqueID generates a 64 bit unique ID
*
* NOTE: This method is blocking in nature, the function also
* has theorotical limit of generating 1,024,000 IDs/sec
* @returns {BigInt}
*/
getUniqueID(): BigInt;
/**
* idFromTimestamp takes a UNIX timestamp without any offset
* and returns an ID that has timestamp set to the given timestamp
* @param {number} timestamp
* @returns {BigInt}
*/
idFromTimestamp(timestamp: number): BigInt;
/**
* instanceID returns the current node id
* @returns {number}
*/
instanceID(): number;
/**
* customEpoch returns the current custom epoch
* @returns {number}
*/
customEpoch(): number;
/**
* timestampFromID takes a unique ID and returns the timestamp
* when the Unique ID was created
* @param {BigInt} unique_id
* @param {number} epoch_offset
* @returns {number}
*/
static timestampFromID(unique_id: BigInt, epoch_offset: number): number;
/**
* instanceIDFromID takes a unique ID and returns the instance
* ID where the unique ID was created
*
* NOTE: The unique ID could be created on ANY instance
* @param {BigInt} unique_id
* @returns {number}
*/
static instanceIDFromID(unique_id: BigInt): number;
}