bento-auth-js
Version:
Authentication library for web applications of Bento-Platform
23 lines (22 loc) • 979 B
TypeScript
/**
* Resources are expressed as simple key-value pairs.
* Where the key is always a string identifying the resource type,
* and the value is either a string identifying the resource ID,
* or a boolean for everything.
*
* e.g. The resource for a project with ID "project-1" would be expressed as:
* { "project": "project-1" }
*/
export type Resource = {
everything: true;
} | {
project: string;
dataset?: string;
data_type?: string;
};
export declare const RESOURCE_EVERYTHING: Resource;
export declare const makeProjectResource: (projectId: string) => Resource;
export declare const makeProjectDataTypeResource: (projectId: string, dataType: string) => Resource;
export declare const makeProjectDatasetResource: (projectId: string, datasetId: string) => Resource;
export declare const makeProjectDatasetDataTypeResource: (projectId: string, datasetId: string, dataType: string) => Resource;
export declare const makeResourceKey: (x: Resource) => string;