type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration
|
protected writeIndexedDoodad(value?: IDoodad): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedNPC(): INPC | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedNPC(value?: INPC): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedCorpse(): ICorpse | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedCorpse(value?: ICorpse): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedEntity(): ICreature | INPC | IPlayer | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedEntity(value?: IEntity): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedHuman(): Human | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedHuman(value?: Human): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedItem(): IItem | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedItem(value?: IItem): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedMovementIntent(): IMovementIntent | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedMovementIntent(value?: IMovementIntent): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedItems(): IItem[] | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedItems(value?: IItem[]): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedObject(): any;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedObject(value?: any): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected readIndexedVector2Array(): IVector2[] | undefined;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
MethodDeclaration
|
protected writeIndexedVector2Array(value?: IVector2[]): void;
|
WaywardGameKorean/addContents
|
mod-reference/definitions/multiplayer/packets/IndexedPacket.d.ts
|
TypeScript
|
FunctionDeclaration
|
function getUtilityClasses(ownerState: MenuItemOwnerState) {
const { disabled, focusVisible } = ownerState;
const slots = {
root: ['root', disabled && 'disabled', focusVisible && 'focusVisible'],
};
return composeClasses(slots, getMenuItemUnstyledUtilityClass, {});
}
|
Starcoder0x/material-ui
|
packages/mui-base/src/MenuItemUnstyled/MenuItemUnstyled.tsx
|
TypeScript
|
ClassDeclaration
|
@Injectable()
export class QuestionService {
constructor(
private questionApi: QuestionApi
){}
getQuestions(){
let filter: LoopBackFilter = {
"include":{
"relation": "answers"
}
}
return this.questionApi.find<Question>(filter)
.toPromise()
}
getQuestion(questionId){
let query = {
id: questionId
}
return this.questionApi.find<Question>({where: query})
.toPromise()
}
getQuestionsBySlug(slug){
let filter: LoopBackFilter = {
"include":{
"relation": "answers"
},
"where": {
"questionSlug": slug
}
}
return this.questionApi.find<Question>(filter)
.toPromise()
}
deleteQuestion(questionId){
return this.questionApi.deleteById<Question>(questionId)
.toPromise()
}
updateQuestion(values){
let data = new Question();
data.question = values.question;
data.positiveVotes = values.positiveVotes;
data.negativeVotes = values.negativeVotes;
data.questionSlug = values.categorySlug;
return this.questionApi.updateAttributes<Question>(values.id, data)
.toPromise()
}
createQuestion(values){
let data = new Question();
data.question = values.question;
data.questionSlug = values.categorySlug
return this.questionApi.create<Question>(data)
.toPromise()
}
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
getQuestions(){
let filter: LoopBackFilter = {
"include":{
"relation": "answers"
}
}
return this.questionApi.find<Question>(filter)
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
getQuestion(questionId){
let query = {
id: questionId
}
return this.questionApi.find<Question>({where: query})
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
getQuestionsBySlug(slug){
let filter: LoopBackFilter = {
"include":{
"relation": "answers"
},
"where": {
"questionSlug": slug
}
}
return this.questionApi.find<Question>(filter)
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
deleteQuestion(questionId){
return this.questionApi.deleteById<Question>(questionId)
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
updateQuestion(values){
let data = new Question();
data.question = values.question;
data.positiveVotes = values.positiveVotes;
data.negativeVotes = values.negativeVotes;
data.questionSlug = values.categorySlug;
return this.questionApi.updateAttributes<Question>(values.id, data)
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
MethodDeclaration
|
createQuestion(values){
let data = new Question();
data.question = values.question;
data.questionSlug = values.categorySlug
return this.questionApi.create<Question>(data)
.toPromise()
}
|
gonzad77/ionic2-loopback-mongo-example-web-app
|
src/app/services/question.service.ts
|
TypeScript
|
ClassDeclaration
|
/**
* <p>Put or replace tags on an existing Amazon S3 Storage Lens configuration. For more information about S3 Storage Lens, see
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html">Assessing your storage
* activity and usage with Amazon S3 Storage Lens </a> in the
* <i>Amazon S3 User Guide</i>.</p>
* <note>
* <p>To use this action,
* you must have permission to perform the <code>s3:PutStorageLensConfigurationTagging</code> action. For more
* information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html">Setting permissions to use Amazon S3 Storage Lens</a> in the
* <i>Amazon S3 User Guide</i>.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { S3ControlClient, PutStorageLensConfigurationTaggingCommand } from "../../client-s3-control/mod.ts";
* // const { S3ControlClient, PutStorageLensConfigurationTaggingCommand } = require("@aws-sdk/client-s3-control"); // CommonJS import
* const client = new S3ControlClient(config);
* const command = new PutStorageLensConfigurationTaggingCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link PutStorageLensConfigurationTaggingCommandInput} for command's `input` shape.
* @see {@link PutStorageLensConfigurationTaggingCommandOutput} for command's `response` shape.
* @see {@link S3ControlClientResolvedConfig | config} for command's `input` shape.
*
*/
export class PutStorageLensConfigurationTaggingCommand extends $Command<
PutStorageLensConfigurationTaggingCommandInput,
PutStorageLensConfigurationTaggingCommandOutput,
S3ControlClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties
constructor(readonly input: PutStorageLensConfigurationTaggingCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: S3ControlClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<PutStorageLensConfigurationTaggingCommandInput, PutStorageLensConfigurationTaggingCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(getProcessArnablesPlugin(configuration));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "S3ControlClient";
const commandName = "PutStorageLensConfigurationTaggingCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: PutStorageLensConfigurationTaggingRequest.filterSensitiveLog,
outputFilterSensitiveLog: PutStorageLensConfigurationTaggingResult.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
private serialize(
input: PutStorageLensConfigurationTaggingCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return serializeAws_restXmlPutStorageLensConfigurationTaggingCommand(input, context);
}
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<PutStorageLensConfigurationTaggingCommandOutput> {
return deserializeAws_restXmlPutStorageLensConfigurationTaggingCommand(output, context);
}
// Start section: command_body_extra
// End section: command_body_extra
}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface PutStorageLensConfigurationTaggingCommandInput extends PutStorageLensConfigurationTaggingRequest {}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface PutStorageLensConfigurationTaggingCommandOutput
extends PutStorageLensConfigurationTaggingResult,
__MetadataBearer {}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
MethodDeclaration
|
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: S3ControlClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<PutStorageLensConfigurationTaggingCommandInput, PutStorageLensConfigurationTaggingCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(getProcessArnablesPlugin(configuration));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "S3ControlClient";
const commandName = "PutStorageLensConfigurationTaggingCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: PutStorageLensConfigurationTaggingRequest.filterSensitiveLog,
outputFilterSensitiveLog: PutStorageLensConfigurationTaggingResult.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
MethodDeclaration
|
private serialize(
input: PutStorageLensConfigurationTaggingCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return serializeAws_restXmlPutStorageLensConfigurationTaggingCommand(input, context);
}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
MethodDeclaration
|
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<PutStorageLensConfigurationTaggingCommandOutput> {
return deserializeAws_restXmlPutStorageLensConfigurationTaggingCommand(output, context);
}
|
Autoskaler/aws-sdk-js-v3
|
deno/client-s3-control/commands/PutStorageLensConfigurationTaggingCommand.ts
|
TypeScript
|
ClassDeclaration
|
/*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export class HrefVariableParser {
/**
* Get the value of a variable from the URL string
* @param {string} href - The link to search in
* @param {string} name - The name of the variable
* @return {string} The value of the variable
*/
public getHrefVariable(href: string, name: string): string {
if (!href.includes("?")) {
console.log("getHrefVariable: href does not include ? ", href);
return "";
}
const path = href.split("?");
const parts = path[1].split("&");
for (const part of parts) {
const p = part.split("=");
if (decodeURIComponent(p[0]) === name) {
return decodeURIComponent(p[1]);
}
}
console.log(`getHrefVariable: ${name} not found`);
return "";
}
}
|
alexamies/chinesenotes-go
|
web-resources/src/HrefVariableParser.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Get the value of a variable from the URL string
* @param {string} href - The link to search in
* @param {string} name - The name of the variable
* @return {string} The value of the variable
*/
public getHrefVariable(href: string, name: string): string {
if (!href.includes("?")) {
console.log("getHrefVariable: href does not include ? ", href);
return "";
}
const path = href.split("?");
const parts = path[1].split("&");
for (const part of parts) {
const p = part.split("=");
if (decodeURIComponent(p[0]) === name) {
return decodeURIComponent(p[1]);
}
}
console.log(`getHrefVariable: ${name} not found`);
return "";
}
|
alexamies/chinesenotes-go
|
web-resources/src/HrefVariableParser.ts
|
TypeScript
|
ArrowFunction
|
({ children, description, className, category, ...labelProps }) => {
const categories = category?.map((c, i) => {
return (
<span className={'datav-form-label-categories'} key={`${c}/${i}`}>
<span>{c}</span>
<RightOutlined className={'datav-form-label-chevron'} />
</span>
);
}
|
genoka/datav
|
ui/src/packages/datav-core/src/ui/components/Form/Label.tsx
|
TypeScript
|
ArrowFunction
|
(c, i) => {
return (
<span className={'datav-form-label-categories'} key={`${c}/${i}`}
|
genoka/datav
|
ui/src/packages/datav-core/src/ui/components/Form/Label.tsx
|
TypeScript
|
ArrowFunction
|
(theme: DatavTheme) => {
return {
label: css`
label: Label;
font-size: ${theme.typography.size.sm};
font-weight: ${theme.typography.weight.semibold};
line-height: 1.25;
margin: ${theme.spacing.formLabelMargin};
padding: ${theme.spacing.formLabelPadding};
color: ${theme.colors.formLabel};
max-width: 480px;
`,
labelContent: css`
display: flex;
align-items: center;
`,
description: css`
label: Label-description;
color: ${theme.colors.formDescription};
font-size: ${theme.typography.size.sm};
font-weight: ${theme.typography.weight.regular};
margin-top: ${theme.spacing.xxs};
display: block;
`,
categories: css`
label: Label-categories;
color: ${theme.isLight
? tinycolor(theme.colors.formLabel)
.lighten(10)
.toHexString()
: tinycolor(theme.colors.formLabel)
.darken(10)
.toHexString()};
display: inline-flex;
align-items: center;
`,
chevron: css`
margin: 0 ${theme.spacing.xxs};
`,
};
}
|
genoka/datav
|
ui/src/packages/datav-core/src/ui/components/Form/Label.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
children: React.ReactNode;
description?: React.ReactNode;
category?: string[];
}
|
genoka/datav
|
ui/src/packages/datav-core/src/ui/components/Form/Label.tsx
|
TypeScript
|
MethodDeclaration
|
cx('datav-form-label', className)
|
genoka/datav
|
ui/src/packages/datav-core/src/ui/components/Form/Label.tsx
|
TypeScript
|
ArrowFunction
|
(propsData: Record<string, any>) =>
mount(SanityImage, {
propsData: {
projectId,
...propsData,
},
})
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('parses asset IDs correctly', () => {
const wrapper = getWrapper({
assetId: 'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
})
expect(wrapper.attributes().src).toBe(
`https://cdn.sanity.io/images/${projectId}/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg`,
)
})
it('correctly adds query params', () => {
const wrapper = getWrapper({
assetId: 'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
w: 20,
h: '21',
})
expect(wrapper.attributes().src).toBe(
`https://cdn.sanity.io/images/${projectId}/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg?h=21&w=20`,
)
})
it('provides a valid renderless component', () => {
const wrapper = mount(
{
template: `
<SanityImage
asset-id="image-G3i4emG6B8JnTmGoN0UjgAp8-300x450-jpg"
auto="format"
>
<template #default="{ src }">
<img :src="src" />
</template>
</SanityImage>
`,
},
{
components: { SanityImage },
},
)
expect(wrapper.html()).toMatchSnapshot()
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
const wrapper = getWrapper({
assetId: 'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
})
expect(wrapper.attributes().src).toBe(
`https://cdn.sanity.io/images/${projectId}/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg`,
)
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
const wrapper = getWrapper({
assetId: 'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
w: 20,
h: '21',
})
expect(wrapper.attributes().src).toBe(
`https://cdn.sanity.io/images/${projectId}/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg?h=21&w=20`,
)
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
const wrapper = mount(
{
template: `
<SanityImage
asset-id="image-G3i4emG6B8JnTmGoN0UjgAp8-300x450-jpg"
auto="format"
>
<template #default="{ src }">
<img :src="src" />
</template>
</SanityImage>
`,
},
{
components: { SanityImage },
},
)
expect(wrapper.html()).toMatchSnapshot()
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
const mockError = jest.fn()
// eslint-disable-next-line
console.error = mockError
const failures: [string, any[]][] = [
['auto', [-200, 200]],
['bg', [-200, 200]],
['blur', [-200, 200]],
['crop', [-200, 200]],
['dl', [-200, 200]],
['dpr', [-200, 200]],
['fit', [-200, 200]],
['flip', [-200, 200]],
['fm', [-200, 200]],
['fpX', [-200, 200]],
['fpY', [-200, 200]],
['h', [false]],
['invert', [-200, 200]],
['maxH', [false]],
['maxW', [false]],
['minH', [false]],
['minW', [false]],
['or', [-200, 200]],
['q', [200, '200']],
['rect', [-200, 200]],
['sat', [false]],
['sharpen', [-200, 200]],
['w', [false]],
]
beforeEach(() => {
mockError.mockReset()
})
failures.forEach(([key, values]) => {
it(`fails for ${key}`, () => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalled()
})
})
})
const validOptions: [string, any[]][] = [
['crop', ['top']],
['fit', ['clip']],
['flip', ['h']],
['fm', ['jpg']],
['or', [270]],
]
validOptions.forEach(([key, values]) => {
it(`succeeds for ${key}`, () => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalledTimes(0)
})
})
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
mockError.mockReset()
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
([key, values]) => {
it(`fails for ${key}`, () => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalled()
})
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalled()
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
(value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalled()
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
([key, values]) => {
it(`succeeds for ${key}`, () => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalledTimes(0)
})
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
values.forEach((value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalledTimes(0)
})
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
ArrowFunction
|
(value) => {
getWrapper({
assetId:
'image-7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170-jpg',
[key]: value,
})
expect(mockError).toHaveBeenCalledTimes(0)
}
|
liqueflies/sanity-module
|
test/unit/sanity-image.test.ts
|
TypeScript
|
FunctionDeclaration
|
export function reducer(state = initialState, action: <
|
AngularDoc-Showcases/platform
|
modules/schematics/src/reducer/files/__name@dasherize@if-flat__/__name@dasherize__.reducer.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface State {
}
|
AngularDoc-Showcases/platform
|
modules/schematics/src/reducer/files/__name@dasherize@if-flat__/__name@dasherize__.reducer.ts
|
TypeScript
|
ClassDeclaration
|
// @generated message type with reflection information, may provide speed optimized methods
class RollResponse$Type extends MessageType<RollResponse> {
constructor() {
super("monopoly.RollResponse", [
{ no: 1, name: "steps", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
]);
}
create(value?: PartialMessage<RollResponse>): RollResponse {
const message = { steps: 0 };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<RollResponse>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RollResponse): RollResponse {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int32 steps */ 1:
message.steps = reader.int32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: RollResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int32 steps = 1; */
if (message.steps !== 0)
writer.tag(1, WireType.Varint).int32(message.steps);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
|
SeawolvesAtCali/Monopoly
|
protos/gen_ts/monopoly/roll_spec.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* type : "roll"
* packet_type : RESPONSE
*
* @generated from protobuf message monopoly.RollResponse
*/
export interface RollResponse {
/**
* @generated from protobuf field: int32 steps = 1;
*/
steps: number;
}
|
SeawolvesAtCali/Monopoly
|
protos/gen_ts/monopoly/roll_spec.ts
|
TypeScript
|
MethodDeclaration
|
create(value?: PartialMessage<RollResponse>): RollResponse {
const message = { steps: 0 };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<RollResponse>(this, message, value);
return message;
}
|
SeawolvesAtCali/Monopoly
|
protos/gen_ts/monopoly/roll_spec.ts
|
TypeScript
|
MethodDeclaration
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RollResponse): RollResponse {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int32 steps */ 1:
message.steps = reader.int32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
|
SeawolvesAtCali/Monopoly
|
protos/gen_ts/monopoly/roll_spec.ts
|
TypeScript
|
MethodDeclaration
|
internalBinaryWrite(message: RollResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int32 steps = 1; */
if (message.steps !== 0)
writer.tag(1, WireType.Varint).int32(message.steps);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
|
SeawolvesAtCali/Monopoly
|
protos/gen_ts/monopoly/roll_spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
const original = jest.requireActual('@elastic/eui');
return {
...original,
// eslint-disable-next-line react/display-name
EuiFieldText: () => <input />,
};
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => <input />,
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => ({
FormDataProvider: ({ children }: { children: ({ tags }: { tags: string[] }) => void }) =>
children({ tags: ['rad', 'dude'] }),
})
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
({ children }: { children: ({ tags }: { tags: string[] }) => void }) =>
children({ tags: ['rad', 'dude'] })
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const fetchTags = jest.fn();
const formHookMock = getFormMock(sampleData);
beforeEach(() => {
jest.resetAllMocks();
useInsertTimelineMock.mockImplementation(() => defaultInsertTimeline);
usePostCaseMock.mockImplementation(() => defaultPostCase);
useFormMock.mockImplementation(() => ({ form: formHookMock }));
useFormDataMock.mockImplementation(() => [
{
description: sampleData.description,
},
]);
useConnectorsMock.mockReturnValue(sampleConnectorData);
jest.spyOn(routeData, 'useLocation').mockReturnValue(mockLocation);
(useGetTags as jest.Mock).mockImplementation(() => ({
tags: sampleTags,
fetchTags,
}));
});
describe('Step 1 - Case Fields', () => {
it('should post case on submit click', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-submit"]`).first().simulate('click');
await waitFor(() => expect(postCase).toBeCalledWith(sampleData));
});
it('should redirect to all cases on cancel click', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-cancel"]`).first().simulate('click');
await waitFor(() => expect(mockHistory.push).toHaveBeenCalledWith('/'));
});
it('should redirect to new case when caseData is there', async () => {
const sampleId = '777777';
usePostCaseMock.mockImplementation(() => ({
...defaultPostCase,
caseData: { id: sampleId },
}));
mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => expect(mockHistory.push).toHaveBeenNthCalledWith(1, '/777777'));
});
it('should render spinner when loading', async () => {
usePostCaseMock.mockImplementation(() => ({ ...defaultPostCase, isLoading: true }));
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(wrapper.find(`[data-test-subj="create-case-loading-spinner"]`).exists()).toBeTruthy()
);
});
it('Tag options render with new tags added', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(
wrapper
.find(`[data-test-subj="caseTags"] [data-test-subj="input"]`)
.first()
.prop('options')
).toEqual([{ label: 'coke' }, { label: 'pepsi' }, { label: 'rad' }, { label: 'dude' }])
);
});
});
// FAILED ES PROMOTION: https://github.com/elastic/kibana/issues/84145
describe.skip('Step 2 - Connector Fields', () => {
const connectorTypes = [
{
label: 'Jira',
testId: 'jira-1',
dataTestSubj: 'connector-settings-jira',
},
{
label: 'Resilient',
testId: 'resilient-2',
dataTestSubj: 'connector-settings-resilient',
},
{
label: 'ServiceNow',
testId: 'servicenow-1',
dataTestSubj: 'connector-settings-sn',
},
];
connectorTypes.forEach(({ label, testId, dataTestSubj }) => {
it(`should change from none to ${label} connector fields`, async () => {
useConnectorsMock.mockReturnValue({
...sampleConnectorData,
connectors: connectorsMock,
});
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => {
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeFalsy();
wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
wrapper.find(`button[data-test-subj="dropdown-connector-${testId}"]`).simulate('click');
wrapper.update();
});
await waitFor(() => {
wrapper.update();
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeTruthy();
});
});
});
});
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
jest.resetAllMocks();
useInsertTimelineMock.mockImplementation(() => defaultInsertTimeline);
usePostCaseMock.mockImplementation(() => defaultPostCase);
useFormMock.mockImplementation(() => ({ form: formHookMock }));
useFormDataMock.mockImplementation(() => [
{
description: sampleData.description,
},
]);
useConnectorsMock.mockReturnValue(sampleConnectorData);
jest.spyOn(routeData, 'useLocation').mockReturnValue(mockLocation);
(useGetTags as jest.Mock).mockImplementation(() => ({
tags: sampleTags,
fetchTags,
}));
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => defaultInsertTimeline
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => defaultPostCase
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => ({ form: formHookMock })
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => [
{
description: sampleData.description,
},
]
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => ({
tags: sampleTags,
fetchTags,
})
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
it('should post case on submit click', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-submit"]`).first().simulate('click');
await waitFor(() => expect(postCase).toBeCalledWith(sampleData));
});
it('should redirect to all cases on cancel click', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-cancel"]`).first().simulate('click');
await waitFor(() => expect(mockHistory.push).toHaveBeenCalledWith('/'));
});
it('should redirect to new case when caseData is there', async () => {
const sampleId = '777777';
usePostCaseMock.mockImplementation(() => ({
...defaultPostCase,
caseData: { id: sampleId },
}));
mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => expect(mockHistory.push).toHaveBeenNthCalledWith(1, '/777777'));
});
it('should render spinner when loading', async () => {
usePostCaseMock.mockImplementation(() => ({ ...defaultPostCase, isLoading: true }));
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(wrapper.find(`[data-test-subj="create-case-loading-spinner"]`).exists()).toBeTruthy()
);
});
it('Tag options render with new tags added', async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(
wrapper
.find(`[data-test-subj="caseTags"] [data-test-subj="input"]`)
.first()
.prop('options')
).toEqual([{ label: 'coke' }, { label: 'pepsi' }, { label: 'rad' }, { label: 'dude' }])
);
});
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-submit"]`).first().simulate('click');
await waitFor(() => expect(postCase).toBeCalledWith(sampleData));
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => expect(postCase).toBeCalledWith(sampleData)
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
wrapper.find(`[data-test-subj="create-case-cancel"]`).first().simulate('click');
await waitFor(() => expect(mockHistory.push).toHaveBeenCalledWith('/'));
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => expect(mockHistory.push).toHaveBeenCalledWith('/')
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
const sampleId = '777777';
usePostCaseMock.mockImplementation(() => ({
...defaultPostCase,
caseData: { id: sampleId },
}));
mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => expect(mockHistory.push).toHaveBeenNthCalledWith(1, '/777777'));
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => ({
...defaultPostCase,
caseData: { id: sampleId },
})
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => expect(mockHistory.push).toHaveBeenNthCalledWith(1, '/777777')
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
usePostCaseMock.mockImplementation(() => ({ ...defaultPostCase, isLoading: true }));
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(wrapper.find(`[data-test-subj="create-case-loading-spinner"]`).exists()).toBeTruthy()
);
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => ({ ...defaultPostCase, isLoading: true })
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() =>
expect(wrapper.find(`[data-test-subj="create-case-loading-spinner"]`).exists()).toBeTruthy()
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() =>
expect(
wrapper
.find(`[data-test-subj="caseTags"] [data-test-subj="input"]`)
.first()
.prop('options')
).toEqual([{ label: 'coke' }, { label: 'pepsi' }, { label: 'rad' }, { label: 'dude' }])
);
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() =>
expect(
wrapper
.find(`[data-test-subj="caseTags"] [data-test-subj="input"]`)
.first()
.prop('options')
).toEqual([{ label: 'coke' }, { label: 'pepsi' }, { label: 'rad' }, { label: 'dude' }])
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const connectorTypes = [
{
label: 'Jira',
testId: 'jira-1',
dataTestSubj: 'connector-settings-jira',
},
{
label: 'Resilient',
testId: 'resilient-2',
dataTestSubj: 'connector-settings-resilient',
},
{
label: 'ServiceNow',
testId: 'servicenow-1',
dataTestSubj: 'connector-settings-sn',
},
];
connectorTypes.forEach(({ label, testId, dataTestSubj }) => {
it(`should change from none to ${label} connector fields`, async () => {
useConnectorsMock.mockReturnValue({
...sampleConnectorData,
connectors: connectorsMock,
});
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => {
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeFalsy();
wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
wrapper.find(`button[data-test-subj="dropdown-connector-${testId}"]`).simulate('click');
wrapper.update();
});
await waitFor(() => {
wrapper.update();
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeTruthy();
});
});
});
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
({ label, testId, dataTestSubj }) => {
it(`should change from none to ${label} connector fields`, async () => {
useConnectorsMock.mockReturnValue({
...sampleConnectorData,
connectors: connectorsMock,
});
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => {
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeFalsy();
wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
wrapper.find(`button[data-test-subj="dropdown-connector-${testId}"]`).simulate('click');
wrapper.update();
});
await waitFor(() => {
wrapper.update();
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeTruthy();
});
});
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
useConnectorsMock.mockReturnValue({
...sampleConnectorData,
connectors: connectorsMock,
});
const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<Create />
</Router>
</TestProviders>
);
await waitFor(() => {
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeFalsy();
wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
wrapper.find(`button[data-test-subj="dropdown-connector-${testId}"]`).simulate('click');
wrapper.update();
});
await waitFor(() => {
wrapper.update();
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeTruthy();
});
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeFalsy();
wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
wrapper.find(`button[data-test-subj="dropdown-connector-${testId}"]`).simulate('click');
wrapper.update();
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
ArrowFunction
|
() => {
wrapper.update();
expect(wrapper.find(`[data-test-subj="${dataTestSubj}"]`).exists()).toBeTruthy();
}
|
eyalkoren/kibana
|
x-pack/plugins/security_solution/public/cases/components/create/index.test.tsx
|
TypeScript
|
FunctionDeclaration
|
export async function requireRequestBody(req: Request): Promise<unknown> {
const contentType = req.header('content-type');
if (!contentType) {
throw new InputError('Content-Type missing');
} else if (!contentType.match(/^application\/json($|;)/)) {
throw new InputError('Illegal Content-Type');
}
const body = req.body;
if (!body) {
throw new InputError('Missing request body');
} else if (!lodash.isPlainObject(body)) {
throw new InputError('Expected body to be a JSON object');
} else if (Object.keys(body).length === 0) {
// Because of how express.json() translates the empty body to {}
throw new InputError('Empty request body');
}
return body;
}
|
AlleyWei/backstage
|
plugins/catalog-backend/src/service/util.ts
|
TypeScript
|
FunctionDeclaration
|
export async function validateRequestBody<T>(
req: Request,
schema: yup.Schema<T>,
): Promise<T> {
const body = await requireRequestBody(req);
try {
await schema.validate(body, { strict: true });
} catch (e) {
throw new InputError(`Malformed request: ${e}`);
}
return (body as unknown) as T;
}
|
AlleyWei/backstage
|
plugins/catalog-backend/src/service/util.ts
|
TypeScript
|
FunctionDeclaration
|
export function disallowReadonlyMode(readonly: boolean) {
if (readonly) {
throw new NotAllowedError('This operation not allowed in readonly mode');
}
}
|
AlleyWei/backstage
|
plugins/catalog-backend/src/service/util.ts
|
TypeScript
|
ClassDeclaration
|
/**
* <p>Deletes the known host key or certificate used by the Amazon Lightsail browser-based SSH or
* RDP clients to authenticate an instance. This operation enables the Lightsail browser-based
* SSH or RDP clients to connect to the instance after a host key mismatch.</p>
* <important>
* <p>Perform this operation only if you were expecting the host key or certificate mismatch
* or if you are familiar with the new host key or certificate on the instance. For more
* information, see <a href="https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-troubleshooting-browser-based-ssh-rdp-client-connection">Troubleshooting connection issues when using the Amazon Lightsail browser-based SSH or RDP
* client</a>.</p>
* </important>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LightsailClient, DeleteKnownHostKeysCommand } from "@aws-sdk/client-lightsail"; // ES Modules import
* // const { LightsailClient, DeleteKnownHostKeysCommand } = require("@aws-sdk/client-lightsail"); // CommonJS import
* const client = new LightsailClient(config);
* const command = new DeleteKnownHostKeysCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link DeleteKnownHostKeysCommandInput} for command's `input` shape.
* @see {@link DeleteKnownHostKeysCommandOutput} for command's `response` shape.
* @see {@link LightsailClientResolvedConfig | config} for command's `input` shape.
*
*/
export class DeleteKnownHostKeysCommand extends $Command<
DeleteKnownHostKeysCommandInput,
DeleteKnownHostKeysCommandOutput,
LightsailClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties
constructor(readonly input: DeleteKnownHostKeysCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: LightsailClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DeleteKnownHostKeysCommandInput, DeleteKnownHostKeysCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "LightsailClient";
const commandName = "DeleteKnownHostKeysCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DeleteKnownHostKeysRequest.filterSensitiveLog,
outputFilterSensitiveLog: DeleteKnownHostKeysResult.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
private serialize(input: DeleteKnownHostKeysCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1DeleteKnownHostKeysCommand(input, context);
}
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DeleteKnownHostKeysCommandOutput> {
return deserializeAws_json1_1DeleteKnownHostKeysCommand(output, context);
}
// Start section: command_body_extra
// End section: command_body_extra
}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface DeleteKnownHostKeysCommandInput extends DeleteKnownHostKeysRequest {}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface DeleteKnownHostKeysCommandOutput extends DeleteKnownHostKeysResult, __MetadataBearer {}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
MethodDeclaration
|
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: LightsailClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DeleteKnownHostKeysCommandInput, DeleteKnownHostKeysCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "LightsailClient";
const commandName = "DeleteKnownHostKeysCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DeleteKnownHostKeysRequest.filterSensitiveLog,
outputFilterSensitiveLog: DeleteKnownHostKeysResult.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
MethodDeclaration
|
private serialize(input: DeleteKnownHostKeysCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1DeleteKnownHostKeysCommand(input, context);
}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
MethodDeclaration
|
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DeleteKnownHostKeysCommandOutput> {
return deserializeAws_json1_1DeleteKnownHostKeysCommand(output, context);
}
|
Acium-Global/aws-sdk-js-v3
|
clients/client-lightsail/commands/DeleteKnownHostKeysCommand.ts
|
TypeScript
|
FunctionDeclaration
|
export declare function isEmpty(value: any): boolean;
|
cdieter/tmdb-proj
|
node_modules/postgraphile/build-turbo/postgraphile/http/createPostGraphileHttpRequestHandler.d.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* Creates a GraphQL request handler that can support many different `http` frameworks, including:
*
* - Native Node.js `http`.
* - `connect`.
* - `express`.
* - `koa` (2.0).
*/
export default function createPostGraphileHttpRequestHandler(options: CreateRequestHandlerOptions): HttpRequestHandler;
|
cdieter/tmdb-proj
|
node_modules/postgraphile/build-turbo/postgraphile/http/createPostGraphileHttpRequestHandler.d.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.