repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
ThomasLaforge/ZeldaJS | src/app/zelda/editor/actionable-panel/actionable-panel.tsx | <reponame>ThomasLaforge/ZeldaJS<filename>src/app/zelda/editor/actionable-panel/actionable-panel.tsx
import * as React from 'react';
import { ActionablePanelAction } from './actionable-panel-action';
import ActionButton from './action-button';
interface ActionablePanelProps {
title: string;
panelClass?: string;... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/reducers.ts | import { combineReducers, Reducer } from 'redux';
import { Action } from 'redux-actions';
import { State } from './state';
import { ZeldaGame } from '../ZeldaGame';
import { Constants } from '../Constants';
import { Map } from '../Map';
declare let game: ZeldaGame;
// Initialize the game declared in zelda.ts
const pa... |
ThomasLaforge/ZeldaJS | src/app/zelda/event/Event.ts | import { Position, PositionData } from '../Position';
export abstract class Event<T extends EventData> {
protected tile: Position;
constructor(tile: Position) {
this.tile = tile;
}
abstract execute(): boolean;
getTile(): Position {
return this.tile;
}
abstract shouldOcc... |
ThomasLaforge/ZeldaJS | src/app/zelda/MainGameState.ts | <reponame>ThomasLaforge/ZeldaJS
import { Direction, DirectionUtil } from './Direction';
import { Constants } from './Constants';
import { BaseState } from './BaseState';
import { Screen } from './Screen';
import { Map } from './Map';
import { ZeldaGame } from './ZeldaGame';
import { BaseStateArgs, Game } from 'gtp';
im... |
ThomasLaforge/ZeldaJS | src/app/zelda/event/GoDownStairsEvent.ts | <filename>src/app/zelda/event/GoDownStairsEvent.ts<gh_stars>1-10
import { Animation } from '../Animation';
import { AnimationListener } from '../AnimationListener';
import { Position, PositionData } from '../Position';
import { Event, EventData } from './Event';
import { ZeldaGame } from '../ZeldaGame';
import { Curtai... |
ThomasLaforge/ZeldaJS | src/app/zelda/Constants.ts | <gh_stars>1-10
export class Constants {
//static TILE_SIZE = 8;//16;
static readonly CANVAS_WIDTH: number = 256;
static readonly CANVAS_HEIGHT: number = 240;
static readonly SCREEN_ROW_COUNT: number = 11;
static readonly SCREEN_COL_COUNT: number = 16;
static readonly TILE_HEIGHT: number = 1... |
ThomasLaforge/ZeldaJS | src/app/zelda/event/ChangeScreenWarpEvent.ts | <filename>src/app/zelda/event/ChangeScreenWarpEvent.ts
import { Event, EventData } from './Event';
import { Position, PositionData } from '../Position';
import { ZeldaGame } from '../ZeldaGame';
import { AnimationListener } from '../AnimationListener';
import { Animation } from '../Animation';
declare let game: ZeldaGa... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/editor-main.ts | import * as React from 'react';
import { render as ReactDOMRender } from 'react-dom';
import { Provider, Store } from 'react-redux';
import { Editor } from './editor';
import { State } from './state';
import configureStore from './store';
import 'bootstrap/dist/js/bootstrap';
// Webpack makes you import your HTML and ... |
ThomasLaforge/ZeldaJS | src/app/zelda/Sword.ts | <gh_stars>1-10
import { Link } from './Link';
import { DirectionUtil } from './Direction';
import { Actor } from './Actor';
import { ZeldaGame } from './ZeldaGame';
import { Rectangle, SpriteSheet } from 'gtp';
declare let game: ZeldaGame;
/**
* A sword Link is in the middle of swinging.
*/
export class Sword extend... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/actionable-panel/actionable-panel-action.ts | <filename>src/app/zelda/editor/actionable-panel/actionable-panel-action.ts
/**
* An action that can be anchored to an actionable panel.
*/
export interface ActionablePanelAction {
iconClass: string;
toggle?: boolean;
pressed?: boolean | null | undefined;
callback?: ActionCallback;
menu?: Actionabl... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/modifiable-table/modifiable-table.tsx | <filename>src/app/zelda/editor/modifiable-table/modifiable-table.tsx
import * as React from 'react';
import { ModifiableTableEventHandler } from './modifiable-table-event-handler';
import { ColumnRenderer } from './modifiable-table-column-renderer';
interface ModifiableTableProps {
headers: ModifiableTableHeader[]... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/actions.ts | import { Action } from 'redux-actions';
import { ZeldaGame } from '../ZeldaGame';
import { Map } from '../Map';
declare let game: ZeldaGame;
export type ACTION_TYPE = 'SCREEN_MODIFIED' | 'TILE_SELECTED' | 'CURRENT_SCREEN_CHANGED';
export const screenModified: (row: number, col: number) => Action<number> =
(row: n... |
ThomasLaforge/ZeldaJS | src/app/zelda/Secrets.spec.ts | import { Secrets } from './Secrets';
import * as chai from 'chai';
describe('Secrets', () => {
it('get() one-arg works', () => {
const secrets: Secrets = new Secrets();
secrets.add('door', {
value: true,
defaultValue: true
});
chai.assert.equal(secrets.get... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/containers/visible-main-content.ts | import { ComponentClass, connect, Dispatch, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { State } from '../state';
import { currentScreenChanged } from '../actions';
import MainContent from '../main-content';
import { Action } from 'redux-actions';
import { Map } from '../../Map';
const mapStateTo... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/map-preview.tsx | <filename>src/app/zelda/editor/map-preview.tsx
import { ZeldaGame } from '../ZeldaGame';
import * as React from 'react';
import { Constants } from '../Constants';
import { Map } from '../Map';
import { Screen } from '../Screen';
export interface MapPreviewProps {
game?: ZeldaGame;
map: Map;
lastModified: n... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/enemy-selector.tsx | <reponame>ThomasLaforge/ZeldaJS
import * as React from 'react';
import { ZeldaGame } from '../ZeldaGame';
import ModifiableTable, { ModifiableTableHeader, ModifiableTableRow } from './modifiable-table/modifiable-table';
import { EnemyGroup, EnemyInfo } from '../EnemyGroup';
import { LabelValuePair } from './label-value... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/edit-screen-event-modal.tsx | import * as React from 'react';
import { ZeldaGame } from '../ZeldaGame';
import Select, { SelectOnChangeEvent } from './select';
import { Event } from '../event/Event';
import { LabelValuePair } from './label-value-pair';
import { ChangeScreenWarpEventGenerator, EventGenerator, GoDownStairsEventGenerator } from './eve... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/edit-enemy-row-modal.tsx | <filename>src/app/zelda/editor/edit-enemy-row-modal.tsx
import * as React from 'react';
import { ZeldaGame } from '../ZeldaGame';
import { EnemyInfo } from '../EnemyGroup';
import { LabelValuePair } from './label-value-pair';
import Select, { SelectOnChangeEvent } from './select';
import { EnemyStrength } from '../enem... |
ThomasLaforge/ZeldaJS | src/app/zelda/Position.ts | /**
* A row/column pair.
*/
export class Position {
row: number;
col: number;
constructor(row: number | PositionData = 0, col: number = 0) {
if (typeof row === 'number') {
this.row = row;
this.col = col;
}
else {
this.row = row.row;
... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/modifiable-table/modifiable-table-event-handler.ts | import { ModifiableTableRow } from './modifiable-table';
/**
* An instance of this interface must be passed to any <code>ModifiableTable</code> instance. This contains
* all of the callbacks that should actually modify the table's row data.
*/
export interface ModifiableTableEventHandler {
/**
* Called w... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/tile-palette.tsx | import { ZeldaGame } from '../ZeldaGame';
import * as React from 'react';
import SpriteSheet from 'gtp/lib/gtp/SpriteSheet';
import { Constants } from '../Constants';
/**
* Properties passed to the tile palette component.
*/
export interface TilePaletteProps {
game?: ZeldaGame;
tilesetName: string;
selec... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/state.ts | import { ZeldaGame } from '../ZeldaGame';
import { Map } from '../Map';
export type State = {
game: ZeldaGame;
map: Map;
selectedTileIndex: number;
lastModified: number;
currentScreenRow: number;
currentScreenCol: number;
};
|
ThomasLaforge/ZeldaJS | src/app/electron-main.ts | <gh_stars>1-10
import { app, BrowserWindow, Menu } from 'electron';
import * as path from 'path';
import { format as formatUrl } from 'url';
const devMode: boolean = process.env.NODE_ENV !== 'production';
// Global reference to the window, necessary to prevent garbage collection
let mainWindow: BrowserWindow | null;
... |
ThomasLaforge/ZeldaJS | src/app/zelda/Position.spec.ts | import { Position, PositionData } from './Position';
import * as chai from 'chai';
describe('Position', () => {
it('empty constructor works', () => {
const pos: Position = new Position();
chai.assert.equal(pos.row, 0);
chai.assert.equal(pos.col, 0);
});
it('constructor taking obje... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/store.ts | <reponame>ThomasLaforge/ZeldaJS
import { createStore, StoreEnhancer, Store } from 'redux';
import rootReducer from './reducers';
import { State } from './state';
const configureStore: () => Store<State> = (): Store<State> => {
const enhancer: StoreEnhancer<State> | undefined = undefined;
const store: Store<S... |
ThomasLaforge/ZeldaJS | src/app/zelda/CurtainOpeningState.ts | import { Constants } from './Constants';
import { ZeldaGame } from './ZeldaGame';
import { State, Delay } from 'gtp';
import { MainGameState } from './MainGameState';
declare let game: ZeldaGame;
export class CurtainOpeningState extends State {
private readonly mainState: MainGameState;
private readonly delay... |
ThomasLaforge/ZeldaJS | src/app/zelda/Hud.ts | <filename>src/app/zelda/Hud.ts
import { ZeldaGame } from './ZeldaGame';
import Image from 'gtp/lib/gtp/Image';
import { Link } from './Link';
declare let game: ZeldaGame;
export class Hud {
private static paintMap(ctx: CanvasRenderingContext2D) {
ctx.fillStyle = '#83d313';
const s: number = 3;
... |
ThomasLaforge/ZeldaJS | src/app/zelda/Link.spec.ts | <gh_stars>1-10
import { Link } from './Link';
import * as chai from 'chai';
describe('Link', () => {
it('constructor initializes Link properly', () => {
const link: Link = new Link();
chai.assert.equal(link.getHealth(), 6);
chai.assert.equal(link.getBombCount(), 99);
});
});
|
ThomasLaforge/ZeldaJS | src/app/zelda/InstanceLoader.ts | import * as EnemyTypes from './EnemyTypes';
export class InstanceLoader {
static create<T>(className: string, ...args: any[]): T {
const instance: T = Object.create((EnemyTypes as any)[className].prototype);
if (args) {
instance.constructor.apply(instance, args);
}
retu... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/containers/visible-enemy-selector.ts | import { ComponentClass, connect, Dispatch, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { State } from '../state';
import EnemySelector from '../enemy-selector';
import { EnemyGroup } from '../../EnemyGroup';
import { Action } from 'redux-actions';
const mapStateToProps: MapStateToProps<any, any, ... |
ThomasLaforge/ZeldaJS | src/app/zelda/editor/modifiable-table/modifiable-table-column-renderer.ts | import { ModifiableTableRow } from './modifiable-table';
/**
* Allows consumers of <code>ModifiableTable</code> to style cells differently than <code>value.toString()</code>.
*/
export interface ColumnRenderer {
/**
* Converts a cell value to a display value. Other values in the row are provided for conte... |
ritesh-modi/terraform-static-code-tfsec-task | tfsec/index.ts | <reponame>ritesh-modi/terraform-static-code-tfsec-task
import * as tl from 'azure-pipelines-task-lib';
import * as toolLib from 'azure-pipelines-tool-lib';
import { ToolRunner } from 'azure-pipelines-task-lib/toolrunner';
import * as os from 'os';
import * as path from 'path';
import * as util from 'util';
let osPla... |
wSedlacek/cqrs | src/operators/of-type.ts | import { Type } from '@nestjs/common';
import { Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
import { IEvent } from '../interfaces';
/**
* Filter values depending on their instance type (comparison is made
* using native `instanceof`).
*
* @param types List of types implementing `IEvent`.
*
... |
wSedlacek/cqrs | src/operators/of-type.spec.ts | import { Subject } from 'rxjs';
import { ofType } from './of-type';
import { IEvent } from '../interfaces';
describe('operators/ofType', () => {
class A implements IEvent {
keyAOrB: string = 'keyAOrB';
keyAOnly: string = 'keyAOnly';
}
class B implements IEvent {
keyAOrB: string = 'keyAOrB';
}
cla... |
CheerfulMushroom/brackets-viewer.js | src/types.d.ts | import {Stage, Match, MatchGame, Participant, ParticipantResult} from 'brackets-model';
import { BracketsViewer } from './main';
import { locales } from './i18n';
import {TFunction} from "i18next";
declare global {
interface Window {
bracketsViewer: BracketsViewer,
}
}
/**
* The data to display with ... |
CheerfulMushroom/brackets-viewer.js | src/i18n/index.ts | <reponame>CheerfulMushroom/brackets-viewer.js
import en from './en/translation.json';
import fr from './fr/translation.json';
export const locales = {
en,
fr,
}; |
CheerfulMushroom/brackets-viewer.js | src/main.ts | import './style.scss';
import {Participant, Match, MatchResults, ParticipantResult, StageType} from 'brackets-model';
import {splitBy, getRanking, getOriginAbbreviation, findRoot} from './helpers';
import * as dom from './dom';
import * as lang from './lang';
import {
Config,
Connection,
FinalType,
Brac... |
CheerfulMushroom/brackets-viewer.js | src/dom.ts | <reponame>CheerfulMushroom/brackets-viewer.js
import { ParticipantResult } from 'brackets-model';
import { rankingHeader } from './helpers';
import { abbreviations } from './lang';
import { Connection, FinalType, BracketType, Placement, Ranking } from './types';
/**
* Creates the title of the viewer.
*
* @param tit... |
Jonham/co-wechat-api | index.d.ts | /**
* generate by ikrong from ikrong.com
* 2019-1-14 20:35
*/
declare class AccessToken {
constructor(accessToken?, expireTime?)
/*!
* 检查AccessToken是否有效,检查规则为当前时间和过期时间进行对比
* Examples:
* ```
* token.isValid();
* ```
*/
isValid: () => boolean
}
declare class API {
/**小程... |
Jonham/co-wechat-api | base.d.ts | <reponame>Jonham/co-wechat-api
/**
* generate by ikrong from ikrong.com
* @@datetime@@
*/
declare class AccessToken {
constructor(accessToken?, expireTime?)
/*!
* 检查AccessToken是否有效,检查规则为当前时间和过期时间进行对比
* Examples:
* ```
* token.isValid();
* ```
*/
isValid: () => boolean
}
d... |
SiY2OS/SiY | siy-wechat-vanui/dist/common/color.d.ts | <reponame>SiY2OS/SiY
export declare const RED = "#f44";
export declare const BLUE = "#1989fa";
export declare const WHITE = "#fff";
export declare const GREEN = "#07c160";
export declare const ORANGE = "#ff976a";
|
SiY2OS/SiY | siy-wechat-vanui/dist/notify/notify.d.ts | interface NotifyOptions {
color?: string;
zIndex?: number;
message: string;
context?: any;
duration?: number;
selector?: string;
background?: string;
safeAreaInsetTop?: boolean;
}
export default function Notify(options: NotifyOptions | string): void;
export {};
|
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/test/utils.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@aws-cdk/assert/jest';
import { CfnCondition, Fn, Stack } from 'aws-cdk-lib';
import { Bucket, CfnBucket } from 'aws-cdk-lib/aws-s3';
impo... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/test/validations-connections.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// PREPARE
import { LambdaError } from '../errors';
import { ConnectionControl, MachineProtocol } from '../types/solution-common-types';
import { ValidationsLimit, validateConnectionDefinition } from '../valida... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/iot-handler-types.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Below ones are the supported IoT endpoint types as of February 2022.
* {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Iot.... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/test/sqs-message-consumer.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@aws-cdk/assert/jest';
import { SynthUtils } from '@aws-cdk/assert';
import { Stack } from 'aws-cdk-lib';
import { Bucket } from 'aws-cdk-lib/aws-s3';
import { SQSMessageConsumerConstruct } from '../lib... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/components/__test__/EmptyRow.test.tsx | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { render } from '@testing-library/react';
import EmptyRow from '../EmptyRow';
test('renders the EmptyRow component', async () => {
const emptyRow = render(<EmptyRow />);
expect(emptyRow.container).t... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/test/lambda-handler.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { consoleErrorSpy, mockAwsLambda } from './mock';
import { LambdaError } from '../errors';
import LambdaHandler from '../aws-handlers/lambda-handler';
const lambdaHandler = new LambdaHandler();
describ... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/test/mock.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
export const mockAwsDynamoDB = {
delete: jest.fn(),
get: jest.fn(),
put: jest.fn(),
query: jest.fn(),
scan: jest.fn(),
update: jest.fn()
};
jest.mock('aws-sdk/clients/dynamodb', () =>... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/ui-custom-resources/index.ts | <filename>source/lambda/custom-resource/ui-custom-resources/index.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import S3Handler from '../../lib/aws-handlers/s3-handler';
import Logger, { LoggingLevel as LogLevel } from '../../lib/logger';
import { Copy... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/test/custom-resources.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@aws-cdk/assert/jest';
import { SynthUtils } from '@aws-cdk/assert';
import { CfnCondition, Stack } from 'aws-cdk-lib';
import { Effect, PolicyDocument, PolicyStatement } from 'aws-cdk-lib/aws-iam';
imp... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/s3-handler-types.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
export interface GetObjectRequest {
bucket: string;
key: string;
}
export interface CopyObjectRequest {
destinationBucket: string;
destinationKey: string;
sourceBucketKey: string;
}
export interface... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/aws-handlers/iot-sitewise-handler.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import IotSitewise from 'aws-sdk/clients/iotsitewise';
import { LambdaError } from '../errors';
import Logger, { LoggingLevel } from '../logger';
import {
AddGatewayCapacityConfigurationRequest... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/sqs-message-consumer/index.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { DocumentClient } from 'aws-sdk/clients/dynamodb';
import { LambdaError } from '../lib/errors';
import Logger, { LoggingLevel } from '../lib/logger';
import { BatchPutRequest, EventMessage, ItemBody, Re... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/utils/utils.ts | <filename>source/infrastructure/utils/utils.ts<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { CfnCondition, CfnOutput, CfnResource, Resource, Stack } from 'aws-cdk-lib';
interface CfnNagSuppressRule {
id: string;
reason: string;
... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/views/greengrass/GreengrassCoreDevicesDashboard.tsx | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n, Logger } from '@aws-amplify/core';
import { Storage } from '@aws-amplify/storage';
import { useState } from 'react';
import Alert from 'react-bootstrap/Alert';
import Breadcrumb from 'react-boots... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/greengrass-deployer/test/connection-deploy.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
consoleErrorSpy,
mockDynamoDbHandler,
mockGreengrassV2Handler,
mockIoTHandler,
mockIoTSiteWiseHandler,
mockValues,
sendAnonymousMetricsSpy,
sleepSpy
} from './mock';
import { handler } ... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/greengrass-deployer/index.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/lambda/greengrass-deployer/index.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import DynamoDBHandler from '../lib/aws-handlers/dynamodb-handler';
import GreengrassV2Handler... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/greengrass-deployer/test/jest-environment-variables.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
process.env.KINESIS_STREAM = 'mock-kinesis-stream';
process.env.LOGGING_LEVEL = 'ERROR';
process.env.SEND_ANONYMOUS_METRIC = 'Yes';
process.env.SOLUTION_UUID = 'mock-uuid';
|
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/test/jest-environment-variables.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
process.env.AWS_REGION = 'mock-region-1';
process.env.LOGGING_LEVEL = 'WARN';
|
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/util/__test__/utils.setValue.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { setValue } from '../utils';
const obj: Record<string, unknown> = {
first: 'first',
child: {
second: 'second'
}
};
test('Set value when the key exists', () => {
const input = { ...obj };
... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/hooks/GreengrassCoreDeviceHook.tsx | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/ui/src/hooks/GreengrassCoreDeviceHook.tsx<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n, Logger } from '@aws-amplify/core';
import React, { useCallb... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/lib/data-flow/sqs-message-consumer.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { IotToSqs, IotToSqsProps } from '@aws-solutions-constructs/aws-iot-sqs';
import { LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb';
import { SqsToLambda } from '@aws-solutions-con... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/dynamodb-handler-types.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { DocumentClient } from 'aws-sdk/clients/dynamodb';
import { ConnectionControl, LogType, MachineProtocol, OpcDaDefinition, OpcUaDefinition } from './solution-common-types';
export type Pa... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/connection-builder/test/jest-environment-variables.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
process.env = {
API_ENDPOINT: 'api.endpoint',
GREENGRASS_RESOURCE_BUCKET: 'mock-greengrass-bucket',
IOT_CERTIFICATE_ARN: 'arn:of:iot:certifi... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/utils/aspects.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { CfnCondition, CfnResource, IAspect } from 'aws-cdk-lib';
import { IConstruct } from 'constructs';
/**
* CDK Aspect implementation to set up conditions to the entire Construct resources... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/connection-builder/test/api-post-connections-request.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
consoleErrorSpy,
mockDynamoDbHandler,
mockIoTHandler,
mockIoTSiteWiseHandler,
mockLambdaHandler,
mockValue,
sendAnonymousMetricsSpy
} from './mock';
import { LambdaError } from '../../lib... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/greengrass-deployer/test/mock.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { CapabilityConfigurationSource, GetDefaultSourceRequest } from '../../lib/types/iot-sitewise-handler-types';
import * as utils from '../../lib/utils';
export const mockValues = {
area: 'area',
comp... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/connection-builder/test/invalid-request.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { consoleErrorSpy, mockValue } from './mock';
import { LambdaError } from '../../lib/errors';
import { handler } from '../index';
test('Unit tests of GET other path', async () => {
consoleErrorSpy.moc... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/hooks/ConnectionHook.tsx | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n, Logger } from '@aws-amplify/core';
import { useCallback, useEffect, useState } from 'react';
import Alert from 'react-bootstrap/Alert';
import { useNavigate } from 'react-router-dom';
import { re... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/test/invalid-inputs.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { buildResponseBody, consoleErrorSpy, mockAxios, mockValues } from './mock';
import { handler } from '../index';
import { Lam... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/views/greengrass/GreengrassCoreDeviceInputForm.tsx | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n } from '@aws-amplify/core';
import React from 'react';
import Form from 'react-bootstrap/Form';
import { CreatedBy, FormControlElement, GreengrassCoreDeviceDomIds, UserGreengrassCoreDevice } from ... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/views/connection/ConnectionForm.tsx | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n, Logger } from '@aws-amplify/core';
import React, { FormEvent, useState } from 'react';
import { LinkContainer } from 'react-router-bootstrap';
import { useParams } from 'react-router-dom';
import... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/test/iot-sitewise-handler.test.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { consoleErrorSpy, mockAwsIoTSiteWise } from './mock';
import { LambdaError } from '../errors';
import IotSiteWiseHandler from '../aws-handlers/iot-sitewise-handler';
const iotSiteWiseHan... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/general-custom-resources/index.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { v4 } from 'uuid';
import IoTHandler from '../../lib/aws-handlers/iot-handler';
import { LambdaError } from '../../lib/error... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/util/validations.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { I18n } from '@aws-amplify/core';
import {
AlphaNumericValidationProps,
ConnectionDefinition,
KeyStringValue,
MachineProtocol,
O... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/sqs-message-consumer/test/mock.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
export const mockBatchWrite = jest.fn();
jest.mock('aws-sdk/clients/dynamodb', () => ({
DocumentClient: jest.fn(() => ({ batchWrite: mockBatchWrite }))
}));
jest.mock('../../lib/utils', () => ({
getAwsSdkO... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/lib/machine-to-cloud-connectivity-stack.ts | <filename>source/infrastructure/lib/machine-to-cloud-connectivity-stack.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Aspects, Aws, CfnCondition, CfnMapping, CfnParameter, Fn, Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'c... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/index.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import { createUuid, describeIoTEndpoints, sendAnonymousMetrics } from './general-custom-resources';
import {
copyGreengrassCom... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/test/timestream-handler.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { mockAwsTimestreamWrite } from './mock';
import TimestreamHandler from '../aws-handlers/timestream-handler';
const database... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/lib/greengrass/greengrass.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { ArnFormat, RemovalPolicy, Stack } from 'aws-cdk-lib';
import {
Effect,
PolicyStatement,
Role,
ServicePrincipal,
CompositePrinci... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/custom-resource-types.ts | <filename>source/lambda/lib/types/custom-resource-types.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
type ResourcePropertyTypes =
| CopyUiAssetsProperties
| CreateUiConfigProperties
| CreateGreengrassInstallationScriptsProperties
| DeleteIoTCer... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/util/Utils.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/ui/src/util/Utils.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Auth } from '@aws-amplify/auth';
import { Logger } from '@aws-amplify/core';
import {
AmplifyConfi... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/connection-builder/api-post-request.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import DynamoDBHandler from '../lib/aws-handlers/dynamodb-handler';
import GreengrassV2Handler from '../lib/aws-handlers/greengrass-v2-handler';
i... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/iot-sitewise-handler-types.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* The below types restricts the values only for the solution only.
* This can be expended to support other values in the future.
*/
type CertificateTrustType = 'TrustAny';
type DefinitionRootPathType = '... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/bin/machine-to-cloud-connectivity.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework<filename>source/infrastructure/bin/machine-to-cloud-connectivity.ts<gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { App, Aspects, DefaultStackSynthesizer } from 'aws-cdk-l... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/util/__test__/utils.buildOpcDaTags.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { buildOpcDaTags } from '../utils';
test('Test success to build OPC DA tags with the provided value', () => {
const value = 'Random.String\nRandom.Int4\n';
expect(buildOpcDaTags(value)).toEqual(['Ra... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/greengrass-custom-resources/index.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import IoTHandler from '../../lib/aws-handlers/iot-handler';
import S3Handler from '../../lib/aws-handlers/s3-handler';
import Logger, { LoggingLevel } from '../../lib/logger... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/test/kinesis-data-stream.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@aws-cdk/assert/jest';
import { SynthUtils } from '@aws-cdk/assert';
import { Stack } from 'aws-cdk-lib';
import { Bucket, CfnBucket } fro... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/types/greengrass-deployer-types.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { DynamoDBHandlerTypes, SolutionCommonTypes } from '.';
import { ConnectionControl, MachineProtocol } from './solution-common-types';
export interface MetricData {
EventType: ConnectionControl;
prot... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/greengrass-deployer/test/no-send-anonymous-metrics.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
mockDynamoDbHandler,
mockGreengrassV2Handler,
mockIoTHandler,
mockIoTSiteWiseHandler,
mockValues,
sendAnonymousMetricsSpy,
sleepSpy
} from './mock';
import { handler } from '../index';
im... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/aws-handlers/greengrass-v2-component-builder.ts | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
ComponentConnectionMetadata,
ComponentDependency,
ComponentType,
CreateComponentRecipeRequest,
CreateComponentRecipeResponse
} from '../types/greengrass-v2-handler-types';
impo... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/connection-builder/test/mock.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { CreatedBy } from '../../lib/types/dynamodb-handler-types';
import * as utils from '../../lib/utils';
export const mockDynamoDbHandler = {
addGreengrassCoreDevice: jest.fn(),
deleteGreengrassCoreDe... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/lib/aws-handlers/s3-handler.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import S3 from 'aws-sdk/clients/s3';
import {
CopyObjectRequest,
DeleteObjectRequest,
GetObjectRequest,
GetSignedUrlRequest,
PutObjectRe... |
aws-solutions/machine-to-cloud-connectivity-framework | source/lambda/custom-resource/test/greengrass-custom-resources.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import {
buildResponseBody,
consoleWarnSpy,
fsReadFileSyncSpy,
mockAxios,
mockIoTHandler,
mockS3Handler,
mockValues,
script,
sle... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/util/__test__/utils.getConditionalValue.test.ts | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { getConditionalValue } from '../utils';
test('return false value when condition is an empty string', () => {
expect(getConditionalValue... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/lib/custom-resource/custom-resources.ts | <filename>source/infrastructure/lib/custom-resource/custom-resources.ts
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { CfnCondition, CfnCustomResource, CustomResource, Duration, Stack } from 'aws-cdk-lib';
import { Effect, Policy, PolicyDocument, P... |
aws-solutions/machine-to-cloud-connectivity-framework | source/infrastructure/test/aspects.test.ts | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@aws-cdk/assert/jest';
import { SynthUtils } from '@aws-cdk/assert';
import { Aspects, CfnCondition, CfnResource, Stack } from 'aws-cdk-lib';
import { Code, Function as LambdaFunction, Runtime } from 'a... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/views/__test__/GreengrassCoreDeviceDashboard.test.tsx | <reponame>aws-solutions/machine-to-cloud-connectivity-framework
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@testing-library/jest-dom';
import { API } from '@aws-amplify/api';
import { I18n } from '@aws-amplify/core';
import { Storage } from '@aw... |
aws-solutions/machine-to-cloud-connectivity-framework | source/ui/src/App.tsx | <gh_stars>1-10
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import Amplify from '@aws-amplify/core';
import { withAuthenticator } from '@aws-amplify/ui-react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import Header from './componen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.