@can-it/operators-nested
Version:
[Documentation](https://can-it.github.io/packages/operators/nested)
35 lines (34 loc) • 994 B
TypeScript
import { Generator } from '@can-it/types';
import { NestedPattern } from '../types/nested-pattern';
/**
* Default resource identifier (RI) pattern:
* ```typescript
* {
* separator: '::',
* wildcard: '*',
* resourceRegex: '[\\w-]*'
* }
* ```
*
* Examples of generated RIs:
* - `orgs::*::users`
* - `orgs::*::users::any-user-id_ksi8-38`
*/
export declare class NestedGenerator implements Generator {
private riPattern;
private resourceRegex;
constructor(riPattern?: NestedPattern);
/**
* Generate the resource identity from an array of strings.
* @param resources string[] - List of strings. An empty string will be converted to a wildcard string.
* @returns string - The generated resource identity.
*
* Example usage:
* ```typescript
* transform('orgs', '', 'users', ''); // 'orgs::*::users::*'
* ```
*/
transform(...resources: string[]): string;
private validateResources;
private validateResource;
}