type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
InterfaceDeclaration |
export interface PostTelegrafsIDOwnersRequest {
/** The Telegraf config ID. */
telegrafID: string
/** User to add as owner */
body: AddResourceMemberRequestBody
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
InterfaceDeclaration |
export interface DeleteTelegrafsIDOwnersIDRequest {
/** The ID of the owner to remove. */
userID: string
/** The Telegraf config ID. */
telegrafID: string
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTelegrafs }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
getTelegrafs(
request?: GetTelegrafsRequest,
requestOptions?: RequestOptions
): Promise<Telegrafs> {
return this.base.request(
'GET',
`/api/v2/telegrafs${this.base.queryString(request, ['orgID'])}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Create a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTelegrafs }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
postTelegrafs(
request: PostTelegrafsRequest,
requestOptions?: RequestOptions
): Promise<Telegraf> {
return this.base.request(
'POST',
`/api/v2/telegrafs`,
request,
requestOptions,
'application/json'
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Retrieve a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTelegrafsID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
getTelegrafsID(
request: GetTelegrafsIDRequest,
requestOptions?: RequestOptions
): Promise<string> {
return this.base.request(
'GET',
`/api/v2/telegrafs/${request.telegrafID}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Update a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PutTelegrafsID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
putTelegrafsID(
request: PutTelegrafsIDRequest,
requestOptions?: RequestOptions
): Promise<Telegraf> {
return this.base.request(
'PUT',
`/api/v2/telegrafs/${request.telegrafID}`,
request,
requestOptions,
'application/json'
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Delete a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteTelegrafsID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
deleteTelegrafsID(
request: DeleteTelegrafsIDRequest,
requestOptions?: RequestOptions
): Promise<void> {
return this.base.request(
'DELETE',
`/api/v2/telegrafs/${request.telegrafID}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* List all labels for a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTelegrafsIDLabels }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
getTelegrafsIDLabels(
request: GetTelegrafsIDLabelsRequest,
requestOptions?: RequestOptions
): Promise<LabelsResponse> {
return this.base.request(
'GET',
`/api/v2/telegrafs/${request.telegrafID}/labels`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Add a label to a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTelegrafsIDLabels }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
postTelegrafsIDLabels(
request: PostTelegrafsIDLabelsRequest,
requestOptions?: RequestOptions
): Promise<LabelResponse> {
return this.base.request(
'POST',
`/api/v2/telegrafs/${request.telegrafID}/labels`,
request,
requestOptions,
'application/json'
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Delete a label from a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteTelegrafsIDLabelsID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
deleteTelegrafsIDLabelsID(
request: DeleteTelegrafsIDLabelsIDRequest,
requestOptions?: RequestOptions
): Promise<void> {
return this.base.request(
'DELETE',
`/api/v2/telegrafs/${request.telegrafID}/labels/${request.labelID}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* List all users with member privileges for a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTelegrafsIDMembers }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
getTelegrafsIDMembers(
request: GetTelegrafsIDMembersRequest,
requestOptions?: RequestOptions
): Promise<ResourceMembers> {
return this.base.request(
'GET',
`/api/v2/telegrafs/${request.telegrafID}/members`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Add a member to a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTelegrafsIDMembers }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
postTelegrafsIDMembers(
request: PostTelegrafsIDMembersRequest,
requestOptions?: RequestOptions
): Promise<ResourceMember> {
return this.base.request(
'POST',
`/api/v2/telegrafs/${request.telegrafID}/members`,
request,
requestOptions,
'application/json'
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Remove a member from a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteTelegrafsIDMembersID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
deleteTelegrafsIDMembersID(
request: DeleteTelegrafsIDMembersIDRequest,
requestOptions?: RequestOptions
): Promise<void> {
return this.base.request(
'DELETE',
`/api/v2/telegrafs/${request.telegrafID}/members/${request.userID}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* List all owners of a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTelegrafsIDOwners }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
getTelegrafsIDOwners(
request: GetTelegrafsIDOwnersRequest,
requestOptions?: RequestOptions
): Promise<ResourceOwners> {
return this.base.request(
'GET',
`/api/v2/telegrafs/${request.telegrafID}/owners`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Add an owner to a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTelegrafsIDOwners }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
postTelegrafsIDOwners(
request: PostTelegrafsIDOwnersRequest,
requestOptions?: RequestOptions
): Promise<ResourceOwner> {
return this.base.request(
'POST',
`/api/v2/telegrafs/${request.telegrafID}/owners`,
request,
requestOptions,
'application/json'
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
MethodDeclaration | /**
* Remove an owner from a Telegraf config.
* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteTelegrafsIDOwnersID }
* @param request - request parameters and body (if supported)
* @param requestOptions - optional transport options
* @returns promise of response
*/
deleteTelegrafsIDOwnersID(
request: DeleteTelegrafsIDOwnersIDRequest,
requestOptions?: RequestOptions
): Promise<void> {
return this.base.request(
'DELETE',
`/api/v2/telegrafs/${request.telegrafID}/owners/${request.userID}`,
request,
requestOptions
)
} | JungDonggun/influxdb-client-js | packages/apis/src/generated/TelegrafsAPI.ts | TypeScript |
ArrowFunction |
(
filterOption: ExtendedDateFilters.DateFilterOption,
): IExtendedDateFilterErrors => {
const errors: IExtendedDateFilterErrors = {};
if (!filterOption.visible) {
// indicate that the Apply button should be disabled, it makes no sense for hidden forms
errors[filterOption.type] = {};
}
return errors;
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
ArrowFunction |
(
filterOption: ExtendedDateFilters.IAbsoluteDateFilterForm,
): IExtendedDateFilterErrors => {
const errors = validateVisibility(filterOption);
const absoluteFormKeys: Array<keyof IExtendedDateFilterErrors["absoluteForm"]> = ["from", "to"];
absoluteFormKeys.forEach(field => {
if (!filterOption[field]) {
errors.absoluteForm = errors.absoluteForm || {};
// null means empty, undefined means invalid
// this is dictated by react-day-picker that returns undefined on invalid values
if (filterOption[field] === undefined) {
errors.absoluteForm[field] = "filters.staticPeriod.incorrectFormat";
}
}
});
return errors.absoluteForm ? errors : {};
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
ArrowFunction |
field => {
if (!filterOption[field]) {
errors.absoluteForm = errors.absoluteForm || {};
// null means empty, undefined means invalid
// this is dictated by react-day-picker that returns undefined on invalid values
if (filterOption[field] === undefined) {
errors.absoluteForm[field] = "filters.staticPeriod.incorrectFormat";
}
}
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
ArrowFunction |
(
filterOption: ExtendedDateFilters.IRelativeDateFilterForm,
): IExtendedDateFilterErrors => {
const errors = validateVisibility(filterOption);
const relativeFormKeys: Array<keyof IExtendedDateFilterErrors["relativeForm"]> = ["from", "to"];
relativeFormKeys.forEach(field => {
if (filterOption[field] === undefined) {
errors.relativeForm = errors.relativeForm || {};
// There is no validation message as we have no place to show it
}
});
return errors.relativeForm ? errors : {};
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
ArrowFunction |
field => {
if (filterOption[field] === undefined) {
errors.relativeForm = errors.relativeForm || {};
// There is no validation message as we have no place to show it
}
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
ArrowFunction |
(
filterOption: ExtendedDateFilters.DateFilterOption,
): IExtendedDateFilterErrors => {
if (ExtendedDateFilters.isAbsoluteDateFilterForm(filterOption)) {
return validateAbsoluteForm(filterOption);
} else if (ExtendedDateFilters.isRelativeDateFilterForm(filterOption)) {
return validateRelativeForm(filterOption);
} else {
return validateVisibility(filterOption);
}
} | hoaithuong/reactSDK8 | libs/sdk-ui-filters/src/DateFilter/validation/OptionValidation.ts | TypeScript |
FunctionDeclaration | /**
* Determines whether or not an element has the virtual hierarchy extension.
*/
export function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {
return element && !!(<VirtualElement>element)._virtual;
} | An631/fluentui | packages/react-portal/src/virtualParent/isVirtualElement.ts | TypeScript |
FunctionDeclaration |
export async function post({
params,
request
}: RequestEvent & { params: { slug: string } }): Promise<
{ body: string; headers: ResponseHeaders } | { error: string; status: number }
> {
try {
const { slug } = params;
const query = `
query PhotographerQuery($photographerQuerySlug: String!) {
photographer(slug: $photographerQuerySlug) {
photographer {
name
slug
website
websiteUrl
exhibitions {
id
name
}
id
}
}
}
`;
const variables = {
photographerQuerySlug: slug
};
const response = await fetch(process.env['GRAPHQL_ENDPOINT'], {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Cookie: request.headers.get('Cookie')
},
body: JSON.stringify({
query,
variables
})
});
const { headers } = response;
const data = await response.json();
console.log({ data });
return {
body: JSON.stringify({ ...data }),
headers: {
'Set-Cookie': headers.get('Set-Cookie')
}
};
} catch (err) {
const error = `Error in /query/photographer/[slug].json.ts: ${err}`;
console.error(error);
return {
status: 500,
error
};
}
} | rodneylab/decisive | src/routes/query/photographer/[slug].json.ts | TypeScript |
ClassDeclaration |
@Injectable({providedIn:'root'})
export class DataSetService {
constructor(private httpClient: HttpClient) {}
performAnalysis(id: string, norm: string, k: number, folds: number) {
return this.httpClient
.get<AnalysisResult>(
`${environment.apiUrl}/dataset/${id}/performAnalysis`,
{
params: {
'normalizacion': norm,
'k': k.toString(),
'folds': folds.toString()
}
})
}
} | carlosmontoyargz/clasificador-web | src/app/services/data-set.service.ts | TypeScript |
MethodDeclaration |
performAnalysis(id: string, norm: string, k: number, folds: number) {
return this.httpClient
.get<AnalysisResult>(
`${environment.apiUrl}/dataset/${id}/performAnalysis`,
{
params: {
'normalizacion': norm,
'k': k.toString(),
'folds': folds.toString()
}
})
} | carlosmontoyargz/clasificador-web | src/app/services/data-set.service.ts | TypeScript |
ArrowFunction |
() => {
this.messageQueue.forEach(this.postMessage.bind(this));
this.messageQueue = [];
this.iframeLoaded = true;
} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
ClassDeclaration |
@Component({
tag: 'docs-demo',
styleUrl: 'demo.css',
})
export class DocsDemo {
@Prop() url!: string;
@Prop() source = '';
iframe!: HTMLIFrameElement;
iframeLoaded = false;
messageQueue: CustomEvent[] = [];
@Listen('demoMessage', { target: 'window' })
async handleMessage(msg: CustomEvent) {
this.iframeLoaded ? this.postMessage(msg) : this.messageQueue.push(msg);
}
postMessage({ detail }: CustomEvent) {
try {
if (this.iframe?.contentWindow) {
this.iframe.contentWindow.postMessage(detail, '*');
}
} catch (e) {
// ignore
}
}
onIframeLoad = () => {
this.messageQueue.forEach(this.postMessage.bind(this));
this.messageQueue = [];
this.iframeLoaded = true;
};
renderSourceLink() {
if (!this.source.length) {
return null;
}
return (
<a href={this.source} class="docs-demo-source" target="_blank" title="Demo Source">
<ion-icon name="open" /> View Source
</a>
);
}
renderDevice() {
return (
<div class="docs-demo-device">
<figure>
<svg class="docs-demo-device__md-bar" viewBox="0 0 1384.3 40.3">
<path
class="st0"
d="M1343 5l18.8 32.3c.8 1.3 2.7 1.3 3.5 0L1384 5c.8-1.3-.2-3-1.7-3h-37.6c-1.5 0-2.5 1.7-1.7 3z"
/>
<circle class="st0" cx="1299" cy="20.2" r="20" />
<path
class="st0"
d="M1213 1.2h30c2.2 0 4 1.8 4 4v30c0 2.2-1.8 4-4 4h-30c-2.2 0-4-1.8-4-4v-30c0-2.3 1.8-4 4-4zM16 4.2h64c8.8 0 16 7.2 16 16s-7.2 16-16 16H16c-8.8 0-16-7.2-16-16s7.2-16 16-16z"
/>
</svg>
<svg class="docs-demo-device__ios-notch" viewBox="0 0 219 31">
<path
d="M0 1V0h219v1a5 5 0 0 0-5 5v3c0 12.15-9.85 22-22 22H27C14.85 31 5 21.15 5 9V6a5 5 0 0 0-5-5z"
fill-rule="evenodd"
/>
</svg>
<iframe
loading="lazy"
importance="low"
onLoad={this.onIframeLoad}
src={this.url}
ref={node => {
this.iframe = node as HTMLIFrameElement;
}} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
MethodDeclaration |
@Listen('demoMessage', { target: 'window' })
async handleMessage(msg: CustomEvent) {
this.iframeLoaded ? this.postMessage(msg) : this.messageQueue.push(msg);
} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
MethodDeclaration |
postMessage({ detail }: CustomEvent) {
try {
if (this.iframe?.contentWindow) {
this.iframe.contentWindow.postMessage(detail, '*');
}
} catch (e) {
// ignore
}
} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
MethodDeclaration |
renderSourceLink() {
if (!this.source.length) {
return null;
}
return (
<a href={this.source} class="docs-demo-source" target="_blank" title="Demo Source">
<ion-icon name="open" /> View Source
</a>
);
} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
MethodDeclaration |
renderDevice() {
return (
<div class="docs-demo-device">
<figure>
<svg class="docs-demo-device__md-bar" viewBox="0 0 1384.3 40.3">
<path
class="st0"
d="M1343 5l18.8 32.3c.8 1.3 2.7 1.3 3.5 0L1384 5c.8-1.3-.2-3-1.7-3h-37.6c-1.5 0-2.5 1.7-1.7 3z"
/>
<circle class="st0" cx="1299" cy="20.2" r="20" />
<path
class="st0"
d="M1213 1.2h30c2.2 0 4 1.8 4 4v30c0 2.2-1.8 4-4 4h-30c-2.2 0-4-1.8-4-4v-30c0-2.3 1.8-4 4-4zM16 4.2h64c8.8 0 16 7.2 16 16s-7.2 16-16 16H16c-8.8 0-16-7.2-16-16s7.2-16 16-16z"
/>
</svg>
<svg class="docs-demo-device__ios-notch" viewBox="0 0 219 31">
<path
d="M0 1V0h219v1a5 5 0 0 0-5 5v3c0 12.15-9.85 22-22 22H27C14.85 31 5 21.15 5 9V6a5 5 0 0 0-5-5z"
fill-rule="evenodd"
/>
</svg>
<iframe
loading="lazy"
importance="low"
onLoad={this.onIframeLoad}
src={this.url}
ref={node => {
this.iframe = node as HTMLIFrameElement;
}} | senna-ui/senna-docs | src/components/demo/demo.tsx | TypeScript |
ArrowFunction |
(provider) => {
return this.get(provider.token);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(instance: any) => {
this.#cache.set(token, instance);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(provider) => {
if (provider.configuration && provider.type !== "server:module") {
Object.entries(provider.configuration).forEach(([key, value]) => {
if (!["resolvers", "mount", "imports"].includes(key)) {
value = mergedConfiguration.has(key) ? deepMerge(mergedConfiguration.get(key), value) : deepClone(value);
mergedConfiguration.set(key, value);
}
});
}
if (provider.resolvers) {
this.settings.resolvers = this.settings.resolvers.concat(provider.resolvers);
}
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
([key, value]) => {
if (!["resolvers", "mount", "imports"].includes(key)) {
value = mergedConfiguration.has(key) ? deepMerge(mergedConfiguration.get(key), value) : deepClone(value);
mergedConfiguration.set(key, value);
}
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(value, key) => {
this.settings.set(key, deepMerge(value, this.settings.get(key)));
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(properties: any, target: any) => {
const store = Store.from(target);
return {
...properties,
...(store.get(INJECTABLE_PROP) || {})
};
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(definition) => {
switch (definition.bindingType) {
case InjectablePropertyType.METHOD:
this.bindMethod(instance, definition);
break;
case InjectablePropertyType.PROPERTY:
this.bindProperty(instance, definition, locals, options);
break;
case InjectablePropertyType.CONSTANT:
this.bindConstant(instance, definition);
break;
case InjectablePropertyType.VALUE:
this.bindValue(instance, definition);
break;
case InjectablePropertyType.INTERCEPTOR:
this.bindInterceptor(instance, definition);
break;
}
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() => {
const services = deps.map((dependency: any) => this.get(dependency));
return originalMethod.call(instance, ...services);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(dependency: any) => this.get(dependency) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() =>
Object.defineProperty(instance, propertyKey, {
get
}) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() => this.settings.get(expression) || defaultValue | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(value: any) => this.settings.set(expression, value) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() => Object.defineProperty(instance, propertyKey, descriptor) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() => {
if (bean !== undefined) {
return bean;
}
const value = this.settings.get(expression, defaultValue);
bean = Object.freeze(deepClone(value));
return bean;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(...args: any[]) => {
const next = (err?: Error) => {
if (!err) {
return originalMethod.apply(instance, args);
}
throw err;
};
const context: InterceptorContext<any> = {
target,
propertyKey,
args,
options,
next
};
const interceptor = this.get<InterceptorMethods>(useType)!;
return interceptor.intercept!(
{
...context,
options
},
next
);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(err?: Error) => {
if (!err) {
return originalMethod.apply(instance, args);
}
throw err;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(parent?: any) =>
(token: any, index: number): any => {
currentDependency = {token, index, deps};
if (token !== DI_PARAM_OPTIONS) {
const options = provider?.store?.get(`${DI_PARAM_OPTIONS}:${index}`);
locals.set(DI_PARAM_OPTIONS, options || {});
}
return isInheritedFrom(token, Provider, 1) ? provider : this.invoke(token, locals, {parent});
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(token: any, index: number): any => {
currentDependency = {token, index, deps};
if (token !== DI_PARAM_OPTIONS) {
const options = provider?.store?.get(`${DI_PARAM_OPTIONS}:${index}`);
locals.set(DI_PARAM_OPTIONS, options || {});
}
return isInheritedFrom(token, Provider, 1) ? provider : this.invoke(token, locals, {parent});
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
([key, cb]) => {
instance[key] = (...args: any[]) => cb(instance, ...args);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(...args: any[]) => cb(instance, ...args) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(resolver) => {
const result = resolver.get(token, locals.get(DI_PARAM_OPTIONS));
if (result !== undefined) {
provider.useFactory = () => result;
}
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
() => (isFunction(provider.useValue) ? provider.useValue() : provider.useValue) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(deps: TokenProvider[]) => provider.useFactory(...deps) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
async (deps: TokenProvider[]) => {
deps = await Promise.all(deps);
return provider.useAsyncFactory(...deps);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
ArrowFunction |
(deps: TokenProvider[]) => new provider.useClass(...deps) | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Retrieve default scope for a given provider.
* @param provider
*/
public scopeOf(provider: Provider) {
return provider.scope || this.scopes[provider.type] || ProviderScope.SINGLETON;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Clone a provider from GlobalProviders and the given token. forkProvider method build automatically the provider if the instance parameter ins't given.
* @param token
* @param settings
* @deprecated
*/
public forkProvider(token: TokenProvider, settings: Partial<ProviderOpts<any>> = {}): Provider {
if (!this.hasProvider(token)) {
this.addProvider(token);
}
const provider = this.getProvider(token)!;
Object.assign(provider, settings);
this.#cache.set(token, this.invoke(token));
return provider;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Return a list of instance build by the injector.
*/
public toArray(): any[] {
return this.#cache.toArray();
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Get a service or factory already constructed from his symbol or class.
*
* #### Example
*
* ```typescript
* import {InjectorService} from "@tsed/di";
* import MyService from "./services";
*
* class OtherService {
* constructor(injectorService: InjectorService) {
* const myService = injectorService.get<MyService>(MyService);
* }
* }
* ```
*
* @param token The class or symbol registered in InjectorService.
* @param options
* @returns {boolean}
*/
get<T = any>(token: TokenProvider, options: any = {}): T | undefined {
const instance = this.getInstance(token);
if (instance !== undefined) {
return instance;
}
if (!this.hasProvider(token)) {
for (const resolver of this.resolvers) {
const result = resolver.get(token, options);
if (result !== undefined) {
return result;
}
}
}
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Return all instance of the same provider type
* @param type
*/
getAll(type: string) {
return this.getProviders(type).map((provider) => {
return this.get(provider.token);
});
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* The has() method returns a boolean indicating whether an element with the specified key exists or not.
* @returns {boolean}
* @param token
*/
has(token: TokenProvider): boolean {
return this.#cache.get(token) !== undefined;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Invoke the class and inject all services that required by the class constructor.
*
* #### Example
*
* ```typescript
* import {InjectorService} from "@tsed/di";
* import MyService from "./services";
*
* class OtherService {
* constructor(injectorService: InjectorService) {
* const myService = injectorService.invoke<MyService>(MyService);
* }
* }
* ```
*
* @param token The injectable class to invoke. Class parameters are injected according constructor signature.
* @param locals Optional object. If preset then any argument Class are read from this object first, before the `InjectorService` is consulted.
* @param options
* @returns {T} The class constructed.
*/
public invoke<T>(
token: TokenProvider,
locals: Map<TokenProvider, any> = new LocalsContainer(),
options: Partial<InvokeOptions<T>> = {}
): T {
const provider = this.ensureProvider(token);
let instance: any;
!locals.has(Configuration) && locals.set(Configuration, this.settings);
if (locals.has(token)) {
return locals.get(token);
}
if (token === DI_PARAM_OPTIONS) {
return {} as T;
}
if (!provider || options.rebuild) {
instance = this.resolve(token, locals, options);
if (this.hasProvider(token)) {
this.#cache.set(token, instance);
}
return instance;
}
switch (this.scopeOf(provider)) {
case ProviderScope.SINGLETON:
if (!this.has(token)) {
this.#cache.set(token, this.resolve(token, locals, options));
if (provider.isAsync()) {
this.#cache.get(token).then((instance: any) => {
this.#cache.set(token, instance);
});
}
}
instance = this.get<T>(token)!;
break;
case ProviderScope.REQUEST:
instance = this.resolve(token, locals, options);
locals.set(token, instance);
break;
case ProviderScope.INSTANCE:
instance = this.resolve(provider.provide, locals, options);
break;
}
return instance;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Build only providers which are asynchronous.
*/
async loadAsync(locals: LocalsContainer = new LocalsContainer()) {
for (const [, provider] of this) {
if (!locals.has(provider.token)) {
if (provider.isAsync()) {
await this.invoke(provider.token, locals);
}
const instance = this.#cache.get(provider.token);
if (instance !== undefined) {
locals.set(provider.token, instance);
}
}
}
return locals;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration |
loadSync(locals: LocalsContainer = new LocalsContainer()) {
for (const [, provider] of this) {
if (!locals.has(provider.token) && this.scopeOf(provider) === ProviderScope.SINGLETON) {
this.invoke(provider.token, locals);
}
const instance = this.#cache.get(provider.token);
if (instance !== undefined) {
locals.set(provider.token, instance);
}
}
return locals;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Boostrap injector from container and resolve configuration.
*
* @param container
*/
bootstrap(container: Container = createContainer()) {
// Clone all providers in the container
this.addProviders(container);
// Resolve all configuration
this.resolveConfiguration();
return this;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Load injector from a given module
* @param rootModule
*/
loadModule(rootModule: TokenProvider) {
this.settings.routes = this.settings.routes.concat(resolveControllers(this.settings));
const container = createContainer();
container.delete(rootModule);
container.addProvider(rootModule, {
type: "server:module",
scope: ProviderScope.SINGLETON
});
return this.load(container);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Build all providers from given container (or GlobalProviders) and emit `$onInit` event.
*
* @param container
* @param rootModule
*/
async load(container: Container = createContainer(), rootModule?: TokenProvider): Promise<LocalsContainer<any>> {
this.bootstrap(container);
// build async and sync provider
let locals = await this.loadAsync();
if (rootModule) {
await this.invoke(rootModule);
}
// load sync provider
locals = this.loadSync(locals);
await locals.emit("$beforeInit");
await locals.emit("$onInit");
return locals;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Load all configurations registered on providers
*/
resolveConfiguration() {
if (this.resolvedConfiguration) {
return;
}
const mergedConfiguration = new Map();
super.forEach((provider) => {
if (provider.configuration && provider.type !== "server:module") {
Object.entries(provider.configuration).forEach(([key, value]) => {
if (!["resolvers", "mount", "imports"].includes(key)) {
value = mergedConfiguration.has(key) ? deepMerge(mergedConfiguration.get(key), value) : deepClone(value);
mergedConfiguration.set(key, value);
}
});
}
if (provider.resolvers) {
this.settings.resolvers = this.settings.resolvers.concat(provider.resolvers);
}
});
mergedConfiguration.forEach((value, key) => {
this.settings.set(key, deepMerge(value, this.settings.get(key)));
});
this.resolvedConfiguration = true;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
*
* @param instance
* @param locals
* @param options
*/
public bindInjectableProperties(instance: any, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions>) {
const properties: InjectableProperties = ancestorsOf(classOf(instance)).reduce((properties: any, target: any) => {
const store = Store.from(target);
return {
...properties,
...(store.get(INJECTABLE_PROP) || {})
};
}, {});
Object.values(properties).forEach((definition) => {
switch (definition.bindingType) {
case InjectablePropertyType.METHOD:
this.bindMethod(instance, definition);
break;
case InjectablePropertyType.PROPERTY:
this.bindProperty(instance, definition, locals, options);
break;
case InjectablePropertyType.CONSTANT:
this.bindConstant(instance, definition);
break;
case InjectablePropertyType.VALUE:
this.bindValue(instance, definition);
break;
case InjectablePropertyType.INTERCEPTOR:
this.bindInterceptor(instance, definition);
break;
}
});
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
*
* @param instance
* @param {string} propertyKey
*/
public bindMethod(instance: any, {propertyKey}: InjectablePropertyOptions) {
const target = classOf(instance);
const originalMethod = instance[propertyKey];
const deps = Metadata.getParamTypes(prototypeOf(target), propertyKey);
instance[propertyKey] = () => {
const services = deps.map((dependency: any) => this.get(dependency));
return originalMethod.call(instance, ...services);
};
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Create an injectable property.
*
* @param instance
* @param {string} propertyKey
* @param {any} useType
* @param resolver
* @param options
* @param locals
* @param invokeOptions
*/
public bindProperty(
instance: any,
{propertyKey, resolver, options = {}}: InjectablePropertyOptions,
locals: Map<TokenProvider, any>,
invokeOptions: Partial<InvokeOptions>
) {
let get: () => any;
get = resolver(this, locals, {...invokeOptions, options});
catchError(() =>
Object.defineProperty(instance, propertyKey, {
get
})
);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
*
* @param instance
* @param {string} propertyKey
* @param {any} useType
*/
public bindValue(instance: any, {propertyKey, expression, defaultValue}: InjectablePropertyValue) {
const descriptor = {
get: () => this.settings.get(expression) || defaultValue,
set: (value: any) => this.settings.set(expression, value),
enumerable: true,
configurable: true
};
catchError(() => Object.defineProperty(instance, propertyKey, descriptor));
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
*
* @param instance
* @param {string} propertyKey
* @param {any} useType
*/
public bindConstant(instance: any, {propertyKey, expression, defaultValue}: InjectablePropertyValue) {
let bean: any;
const get = () => {
if (bean !== undefined) {
return bean;
}
const value = this.settings.get(expression, defaultValue);
bean = Object.freeze(deepClone(value));
return bean;
};
const descriptor = {
get,
enumerable: true,
configurable: true
};
catchError(() => Object.defineProperty(instance, propertyKey, descriptor));
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
*
* @param instance
* @param propertyKey
* @param useType
* @param options
*/
public bindInterceptor(instance: any, {propertyKey, useType, options}: InjectablePropertyOptions) {
const target = classOf(instance);
const originalMethod = instance[propertyKey];
instance[propertyKey] = (...args: any[]) => {
const next = (err?: Error) => {
if (!err) {
return originalMethod.apply(instance, args);
}
throw err;
};
const context: InterceptorContext<any> = {
target,
propertyKey,
args,
options,
next
};
const interceptor = this.get<InterceptorMethods>(useType)!;
return interceptor.intercept!(
{
...context,
options
},
next
);
};
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration |
async lazyInvoke<T = any>(token: TokenProvider) {
let instance = this.getInstance(token);
if (!instance) {
instance = await this.invoke<T>(token);
if (isFunction(instance?.$onInit)) {
await instance.$onInit();
}
}
return instance;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Emit an event to all service. See service [lifecycle hooks](/docs/services.md#lifecycle-hooks).
* @param eventName The event name to emit at all services.
* @param args List of the parameters to give to each services.
* @returns {Promise<any[]>} A list of promises.
*/
public async emit(eventName: string, ...args: any[]) {
return this.#cache.emit(eventName, ...args);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* @param eventName
* @param value
* @param args
*/
public alter<T = any>(eventName: string, value: any, ...args: any[]): T {
return this.#cache.alter(eventName, value, ...args);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* @param eventName
* @param value
* @param args
*/
public async alterAsync<T = any>(eventName: string, value: any, ...args: any[]): Promise<T> {
return this.#cache.alterAsync(eventName, value, ...args);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration |
async destroy() {
await this.#cache.destroy();
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration |
protected ensureProvider(token: TokenProvider): Provider | undefined {
if (!this.hasProvider(token) && GlobalProviders.has(token)) {
this.addProvider(token);
}
return this.getProvider(token)!;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration |
protected getInstance(token: any) {
return this.#cache.get(token);
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Invoke a class method and inject service.
*
* #### IInjectableMethod options
*
* * **target**: Optional. The class instance.
* * **methodName**: `string` Optional. The method name.
* * **designParamTypes**: `any[]` Optional. List of injectable types.
* * **locals**: `Map<Function, any>` Optional. If preset then any argument Class are read from this object first, before the `InjectorService` is consulted.
*
* #### Example
*
* @param target
* @param locals
* @param options
* @private
*/
private resolve<T>(target: TokenProvider, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions<T>> = {}): Promise<T> {
const resolvedOpts = this.mapInvokeOptions(target, locals, options);
const {token, deps, construct, imports, provider} = resolvedOpts;
if (provider) {
GlobalProviders.onInvoke(provider, locals, {...resolvedOpts, injector: this});
}
let instance: any;
let currentDependency: any = false;
try {
const invokeDependency =
(parent?: any) =>
(token: any, index: number): any => {
currentDependency = {token, index, deps};
if (token !== DI_PARAM_OPTIONS) {
const options = provider?.store?.get(`${DI_PARAM_OPTIONS}:${index}`);
locals.set(DI_PARAM_OPTIONS, options || {});
}
return isInheritedFrom(token, Provider, 1) ? provider : this.invoke(token, locals, {parent});
};
// Invoke manually imported providers
imports.forEach(invokeDependency());
// Inject dependencies
const services = deps.map(invokeDependency(token));
currentDependency = false;
instance = construct(services);
} catch (error) {
InjectionError.throwInjectorError(token, currentDependency, error);
}
if (instance === undefined) {
throw new InjectionError(
token,
`Unable to create new instance from undefined value. Check your provider declaration for ${nameOf(token)}`
);
}
if (instance && isClass(classOf(instance))) {
this.bindInjectableProperties(instance, locals, options);
}
if (instance && provider.hooks) {
Object.entries(provider.hooks).forEach(([key, cb]) => {
instance[key] = (...args: any[]) => cb(instance, ...args);
});
}
return instance;
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
MethodDeclaration | /**
* Create options to invoke a provider or class.
* @param token
* @param locals
* @param options
*/
private mapInvokeOptions(token: TokenProvider, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions>): ResolvedInvokeOptions {
let imports: TokenProvider[] | undefined = options.imports;
let deps: TokenProvider[] | undefined = options.deps;
let scope = options.scope;
let construct;
if (!token) {
throw new UndefinedTokenError();
}
let provider: Provider;
if (!this.hasProvider(token)) {
provider = new Provider(token);
this.resolvers.forEach((resolver) => {
const result = resolver.get(token, locals.get(DI_PARAM_OPTIONS));
if (result !== undefined) {
provider.useFactory = () => result;
}
});
} else {
provider = this.getProvider(token)!;
}
scope = scope || this.scopeOf(provider);
deps = deps || provider.deps;
imports = imports || provider.imports;
if (provider.useValue !== undefined) {
construct = () => (isFunction(provider.useValue) ? provider.useValue() : provider.useValue);
} else if (provider.useFactory) {
construct = (deps: TokenProvider[]) => provider.useFactory(...deps);
} else if (provider.useAsyncFactory) {
construct = async (deps: TokenProvider[]) => {
deps = await Promise.all(deps);
return provider.useAsyncFactory(...deps);
};
} else {
// useClass
deps = deps || Metadata.getParamTypes(provider.useClass);
construct = (deps: TokenProvider[]) => new provider.useClass(...deps);
}
return {
token,
scope: scope || Store.from(token).get("scope") || ProviderScope.SINGLETON,
deps: deps! || [],
imports: imports || [],
construct,
provider
};
} | Romakita/express-router-decorator | packages/di/src/services/InjectorService.ts | TypeScript |
FunctionDeclaration |
async function isMonorepo() {
const { workspaces } = await readJson<PackageJSON>(join(process.cwd(), 'package.json'));
return !!workspaces;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
FunctionDeclaration |
function banner() {
console.log(`${Chalk.cyan(`
${b('`qQQQQQQg.')}
'${b('N@@@@@@@;')}
7${b('g@@@@@@@S')}
^QD${b('Q@@@@@@@|')}
+QQQ${b('K@@@@@@@@i')}
'jQQQQD${b('d@@@@@@@@X,')}
,mQQQQQQQb${b('k@@@@@@@@@b+')}
.;7qQQQQQQQQQD~;${b('8@@@@@@@@@8}^\'')}
=77JyU%NQQQQQQQQQNi\` ${b('`cQ@@@@@@@@@@@BKauz|')}
${b('%@@@@@@QQ#')}gDR&QDL. ${b('`iN@@@@@@@@@@@@@@Q')}
${b('%@@@@@@@@@@@QK')}= ${b('+RQ@@@@@@@@@@@Q')}
${b('%@@@@@@@@@@@@@@B7.')} \`?bQBRd%${b('NQQ@@@@@@Q')}
${b('=7uaq#@@@@@@@@@@@Qz`')} \`|WQQQQQQQQQN%UyJ77?
${b('.!Ig@@@@@@@@@B!')},qQQQQQQQQQbz;.
${b('~A@@@@@@@@@X')}qQQQQQQQk^
${b(';D@@@@@@@@K')}DQQQQK;
${b('*@@@@@@@@b')}NQQ*
${b('=@@@@@@@Q')}dQ<
${b('j@@@@@@@Wx')}
${b('_@@@@@@@Q,')}
${b('`bQQQQQQ%``')}
${Chalk.bold(Chalk.blue('PatternFly Elements'))}
`)}`);
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
FunctionDeclaration |
export async function promptForElementGeneratorOptions(
options?: PromptOptions<GenerateElementOptions>
): Promise<GenerateElementOptions> {
banner();
return {
...options,
...await prompts([{
type: () => !options?.tagName && 'text',
name: 'tagName',
message: 'What is the element\'s tag name?',
initial: options?.tagName ?? '',
validate: name => name.includes('-') || ERR_BAD_CE_TAG_NAME,
}, {
type: () => (!options?.scope && options?.monorepo) ? 'text' : false,
name: 'scope',
message: 'What is the package\'s NPM scope?',
initial: options?.scope ?? ''
}]),
} as GenerateElementOptions;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
FunctionDeclaration |
export async function main(): Promise<void> {
return Promise.resolve(
Yargs(process.argv)
.scriptName('npm init @patternfly/element')
.usage('$0 [<cmd>] [args]')
.option('directory', {
type: 'string',
default: process.cwd(),
demandOption: false,
description: 'Output directory',
})
.option('silent', {
type: 'boolean',
default: false,
description: 'Do not log anything to stdout',
})
.option('tagName', {
alias: 'n',
type: 'string',
description: 'Custom element tag name. e.g. `pfe-button`',
})
.option('scope', {
alias: 's',
type: 'string',
description: 'NPM package scope. e.g. `@patternfly`',
})
.option('overwrite', {
type: 'boolean',
default: false,
description: 'Overwrite files without prompting',
})
.option('monorepo', {
type: 'boolean',
default: await isMonorepo(),
description: 'Generate an npm package for the element'
})
.help()
.check(({ name }) => {
if (typeof name === 'string' && !name.includes('-')) {
throw new Error(ERR_BAD_CE_TAG_NAME);
} else {
return true;
}
}))
.then(({ argv }) => argv)
.then(promptForElementGeneratorOptions)
.then(generateElement);
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
ArrowFunction |
() => !options?.tagName && 'text' | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
ArrowFunction |
name => name.includes('-') || ERR_BAD_CE_TAG_NAME | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
ArrowFunction |
() => (!options?.scope && options?.monorepo) ? 'text' : false | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
ArrowFunction |
({ name }) => {
if (typeof name === 'string' && !name.includes('-')) {
throw new Error(ERR_BAD_CE_TAG_NAME);
} else {
return true;
}
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
ArrowFunction |
({ argv }) => argv | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
InterfaceDeclaration |
export interface BaseOptions {
silent: boolean;
directory: string;
overwrite: boolean;
monorepo: boolean;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
InterfaceDeclaration |
export interface AppOptions extends BaseOptions {
packageDefaults: boolean;
install: boolean;
start: boolean;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
InterfaceDeclaration |
export interface GenerateElementOptions extends BaseOptions {
/** The element's tagname e.g. `pfe-button` */
tagName: string;
/** The element's npm package scope e.g. `patternfly` */
scope: string;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
InterfaceDeclaration |
interface PackageJSON {
customElements?: string;
name: string;
version: string;
workspaces?: string;
} | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
TypeAliasDeclaration |
export type PromptOptions<T> =
Partial<T> & BaseOptions; | RHElements/rhelements | tools/create-element/main.ts | TypeScript |
InterfaceDeclaration |
export interface IContinueLearningData extends IContent {
continueData: any
} | aastarurmika/sunbird-cb-adminportal | project/ws/app/src/lib/head/_services/widget-content.model.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.