@casual-simulation/aux-runtime
Version:
Runtime for AUX projects
49 lines • 2.27 kB
TypeScript
import { RealtimeEditMode } from './RuntimeBot';
import type { AuxPartitionRealtimeStrategy } from '@casual-simulation/aux-common/partitions/AuxPartition';
import '@casual-simulation/aux-common/BlobPolyfill';
export declare function realtimeStrategyToRealtimeEditMode(strategy: AuxPartitionRealtimeStrategy): RealtimeEditMode;
/**
* Embeds the given base64 string into a PDF document that references CasualOS.
* @param str The base64 string to embed.
*/
export declare function embedBase64InPdf(str: string): string;
/**
* Gets the Base64 data that was embedded in the given PDF document by embedBase64InPdf().
*/
export declare function getEmbeddedBase64FromPdf(pdf: string): string;
/**
* Formats the given token and service (bundle ID) into a string that can be used as an auth token for records requests.
*/
export declare function formatAuthToken(token: string, service: string): string;
/**
* Parses the given auth token into a token and service (bundle ID) pair.
* The returned token is the token that was returned from the auth API and the service is the bundle ID of the app that requested it.
*/
export declare function parseAuthToken(token: string): [string, string];
/**
* Constructs a Uint8Array from the given hexadecimal formatted string.
* @param hex The hexadecimal string.
*/
export declare function fromHexString(hex: string): Uint8Array<ArrayBuffer>;
/**
* Constructs a hexidecimal formatted string from the given array of bytes.
* @param bytes The bytes that should be hex formatted.
*/
export declare function toHexString(bytes: Uint8Array): string;
/**
* Determines if the given value represents a promise.
* @param value The value to check.
*/
export declare function isPromise<T>(value: unknown): value is Promise<T>;
export declare const RUNTIME_PROMISE: unique symbol;
export interface RuntimePromise<T> extends Promise<T> {
[RUNTIME_PROMISE]: true;
}
export declare function isRuntimePromise<T>(value: unknown): value is RuntimePromise<T>;
export declare function markAsRuntimePromise<T>(promise: Promise<T>): RuntimePromise<T>;
/**
* Determines if the given string represents a URL.
* @param value The value to check.
*/
export declare function isUrl(value: string): boolean;
//# sourceMappingURL=Utils.d.ts.map