@iobroker/db-objects-redis
Version:
The Library contains the Database classes for Redis based objects database client.
52 lines • 2.57 kB
TypeScript
/**
* Common functions between client and server
*
* Copyright 2013-2024 bluefox <dogafox@gmail.com>
*
* MIT License
*
*/
import * as CONSTS from '../../lib/objects/constants.js';
export * as CONSTS from '../../lib/objects/constants.js';
export declare const ERRORS: typeof CONSTS.ERRORS;
export declare const REG_CHECK_ID: RegExp;
export interface FileMimeInformation {
/** the mime type, of the file */
mimeType: string;
/** if content is binary or textual */
isBinary: boolean;
}
export interface ACLObject {
owner: string;
ownerGroup: string;
object: number;
state: number;
file: number;
}
export interface FileObject {
virtualFile?: boolean;
stats: any;
modifiedAt: number;
createdAt: number;
acl: ioBroker.EvaluatedFileACL;
}
export type CheckFileRightsCallback = (err: Error | null | undefined, options: Record<string, any>, opt?: any) => void;
/**
* Determines the mime type, of an extension and if it is binary content
*
* @param ext file extension e.g. `.txt`
* @param isTextData if content is of type string
*/
export declare function getMimeType(ext: string, isTextData: boolean): FileMimeInformation;
export declare function checkFile(fileOptions: Record<string, any>, options: Record<string, any>, flag: any, defaultNewAcl?: ACLObject | null): boolean;
export declare function checkFileRights(objects: any, id: string, name: string | null, options: Record<string, any> | null | undefined, flag: CONSTS.GenericAccessFlags, callback?: CheckFileRightsCallback): any;
export type GetUserGroupPromiseReturn = [user: string, groups: string[], acl: ioBroker.ObjectPermissions];
type GetUserGroupCallback = (err: Error | null | undefined, user: string, groups: string[], acl: ioBroker.ObjectPermissions) => void;
export declare function getUserGroup(objects: any, user: ioBroker.ObjectIDs.User, callback?: GetUserGroupCallback): Promise<GetUserGroupPromiseReturn> | void;
export declare function sanitizePath(id: string, name: string): {
id: string;
name: string;
};
export declare function checkObject(obj: ioBroker.AnyObject | FileObject | null, options: Record<string, any>, flag: CONSTS.GenericAccessFlags): boolean;
export declare function checkObjectRights(objects: any, id: string | null, object: ioBroker.Object | null, options: Record<string, any> | null | undefined, flag: CONSTS.GenericAccessFlags, callback: (err: Error | null | undefined, options: Record<string, any>) => void): void | Promise<Record<string, any>>;
//# sourceMappingURL=objectsUtils.d.ts.map