conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
cpTitles: [],
=======
cpTitles: [],
cpPlaceholder: [],
>>>>>>>
cpTitles: [],
cpPlaceholder: [],
<<<<<<<
this.processInterpolation(this.element, this.element);
=======
// Update cp placeholder
this.directives.cpPlaceholder.forEach((cpPlaceholder) => cpPlaceholder.init());
this.processInterpolation(this.element);
>>>>>>>
// Update cp placeholder
this.directives.cpPlaceholder.forEach((cpPlaceholder) => cpPlaceholder.init());
this.processInterpolation(this.element, this.element); |
<<<<<<<
log(`:fetch() > fetching resource with args: ${JSON.stringify(args)}`)
=======
>>>>>>>
log(`:fetch() > fetching resource with args: ${JSON.stringify(args)}`);
<<<<<<<
// Might move these into a private helper...
cdp.Network.requestWillBeSent((params) => {
=======
cdp.Network.requestWillBeSent(params => {
>>>>>>>
// Might move these into a private helper...
cdp.Network.requestWillBeSent(params => {
<<<<<<<
public async coverage(src: string, config = { throw: true }): Promise<{ total: number, unused: number, percentUnused: number } | Error> {
=======
public async coverage(
src: string,
): Promise<{ total: number; unused: number; percentUnused: number } | Error> {
>>>>>>>
public async coverage(
src: string,
config = { throw: true },
): Promise<{ total: number; unused: number; percentUnused: number } | Error> {
<<<<<<<
// JS and CSS have similar data-structs, but are
// retrieved via different mechanisms
const jsCoverages = await cdp.Profiler.takePreciseCoverage();
const jsCoverage = jsCoverages.result.find((scriptCoverage) => scriptCoverage.url === src);
=======
const scriptCoverage = res.result.find(
scriptCoverage => scriptCoverage.url === src,
);
>>>>>>>
// JS and CSS have similar data-structs, but are
// retrieved via different mechanisms
const jsCoverages = await cdp.Profiler.takePreciseCoverage();
const jsCoverage = jsCoverages.result.find(
scriptCoverage => scriptCoverage.url === src,
);
<<<<<<<
if (styleSheet && styleSheet.styleSheetId) {
const coverageCollection = cssCoverages.filter((coverage) => coverage.styleSheetId === styleSheet.styleSheetId);
const usedInfo = coverageCollection.reduce((rangeAccum, range) => {
const total = range.endOffset > rangeAccum.total ? range.endOffset : rangeAccum.total;
const used = range.used ? (range.endOffset - range.startOffset) : 0;
return {
total,
used: rangeAccum.used + used,
};
}, { total: 0, used: 0 });
return {
total: usedInfo.total,
unused: usedInfo.total - usedInfo.used,
percentUnused: (usedInfo.total - usedInfo.used) / usedInfo.total ,
};
}
if (jsCoverage && jsCoverage.functions && jsCoverage.functions.length) {
const coverageData = jsCoverage.functions.reduce((fnAccum, coverageStats) => {
const functionStats = coverageStats.ranges.reduce((rangeAccum, range) => {
=======
if (
scriptCoverage &&
scriptCoverage.functions &&
scriptCoverage.functions.length
) {
const coverageData = scriptCoverage.functions.reduce(
(fnAccum, coverageStats) => {
const functionStats = coverageStats.ranges.reduce(
(rangeAccum, range) => {
return {
total:
range.endOffset > rangeAccum.total
? range.endOffset
: rangeAccum.total,
unused:
rangeAccum.unused +
(range.count === 0 ? range.endOffset - range.startOffset : 0),
};
},
{
total: 0,
unused: 0,
},
);
>>>>>>>
if (styleSheet && styleSheet.styleSheetId) {
const coverageCollection = cssCoverages.filter(
coverage => coverage.styleSheetId === styleSheet.styleSheetId,
);
const usedInfo = coverageCollection.reduce(
(rangeAccum, range) => {
const total =
range.endOffset > rangeAccum.total
? range.endOffset
: rangeAccum.total;
const used = range.used ? range.endOffset - range.startOffset : 0;
return {
total,
used: rangeAccum.used + used,
};
},
{ total: 0, used: 0 },
);
return {
total: usedInfo.total,
unused: usedInfo.total - usedInfo.used,
percentUnused: (usedInfo.total - usedInfo.used) / usedInfo.total,
};
}
if (jsCoverage && jsCoverage.functions && jsCoverage.functions.length) {
const coverageData = jsCoverage.functions.reduce(
(fnAccum, coverageStats) => {
const functionStats = coverageStats.ranges.reduce(
(rangeAccum, range) => {
return {
total:
range.endOffset > rangeAccum.total
? range.endOffset
: rangeAccum.total,
unused:
rangeAccum.unused +
(range.count === 0 ? range.endOffset - range.startOffset : 0),
};
},
startingResults,
); |
<<<<<<<
renderOptions: any;
=======
panel: object | undefined;
>>>>>>>
renderOptions: any;
panel: object | undefined; |
<<<<<<<
import WFEncodeMode from './WFEncodeMode';
=======
import WFDeviceDetail from './WFDeviceDetail';
>>>>>>>
import WFDeviceDetail from './WFDeviceDetail';
import WFEncodeMode from './WFEncodeMode'; |
<<<<<<<
import { withUUID } from '../utils';
=======
/** @module actions */
import { withActionOutput } from '../utils';
>>>>>>>
import { withActionOutput } from '../utils'; |
<<<<<<<
import runJavaScriptOnWebPage from './runJavaScriptOnWebPage';
=======
import repeat from './repeat';
import runJavascriptOnWebPage from './runJavascriptOnWebPage';
>>>>>>>
import repeat from './repeat';
import runJavaScriptOnWebPage from './runJavaScriptOnWebPage';
<<<<<<<
runJavaScriptOnWebPage,
=======
repeat,
runJavascriptOnWebPage,
>>>>>>>
repeat,
runJavaScriptOnWebPage, |
<<<<<<<
=======
/** @module actions */
import Attachment from '../interfaces/WF/Attachment';
>>>>>>>
import Attachment from '../interfaces/WF/Attachment';
<<<<<<<
=======
type SetVariableOptions = {
variable: Attachment;
};
>>>>>>>
<<<<<<<
*
* ```js
* setVariable({
* name: 'My Variable',
* });
* ```
=======
* @param {Object} options
* @param {Variable} options.variable
>>>>>>>
*
* ```js
* setVariable({
* name: 'My Variable',
* });
* ```
<<<<<<<
options: {
/** The name of the variable to set */
name: string,
=======
{
variable,
}: SetVariableOptions,
): WFWorkflowAction => ({
WFWorkflowActionIdentifier: 'is.workflow.actions.setvariable',
WFWorkflowActionParameters: {
WFVariableName: variable.VariableName,
>>>>>>>
options: {
/** The name of the variable to set */
variable: Attachment, |
<<<<<<<
import formatDate from './formatDate';
=======
import generateHash from './generateHash';
>>>>>>>
import formatDate from './formatDate';
import generateHash from './generateHash';
<<<<<<<
formatDate,
=======
generateHash,
>>>>>>>
formatDate,
generateHash, |
<<<<<<<
import createNote from './createNote';
import date from './date';
=======
import deletePhotos from './deletePhotos';
import detectLanguageWithMicrosoft from './detectLanguageWithMicrosoft';
>>>>>>>
import createNote from './createNote';
import date from './date';
import deletePhotos from './deletePhotos';
import detectLanguageWithMicrosoft from './detectLanguageWithMicrosoft';
<<<<<<<
import formatDate from './formatDate';
=======
import expandURL from './expandURL';
import extractArchive from './extractArchive';
>>>>>>>
import expandURL from './expandURL';
import extractArchive from './extractArchive';
import formatDate from './formatDate';
<<<<<<<
import postOnFacebook from './postOnFacebook';
import postOnInstagram from './postOnInstagram';
import postToTumblr from './postToTumblr';
import postToWordpress from './postToWordpress';
=======
import playSound from './playSound';
>>>>>>>
import playSound from './playSound';
import postOnFacebook from './postOnFacebook';
import postOnInstagram from './postOnInstagram';
import postToTumblr from './postToTumblr';
import postToWordpress from './postToWordpress';
<<<<<<<
import showInMaps from './showInMaps';
=======
import showDefinition from './showDefinition';
import showInCalendar from './showInCalendar';
import showInItunesStore from './showInItunesStore';
>>>>>>>
import showDefinition from './showDefinition';
import showInCalendar from './showInCalendar';
import showInItunesStore from './showInItunesStore';
import showInMaps from './showInMaps';
<<<<<<<
import tweet from './tweet';
=======
import trimMedia from './trimMedia';
>>>>>>>
import trimMedia from './trimMedia';
import tweet from './tweet';
<<<<<<<
createNote,
date,
=======
deletePhotos,
detectLanguageWithMicrosoft,
>>>>>>>
createNote,
date,
deletePhotos,
detectLanguageWithMicrosoft,
<<<<<<<
formatDate,
=======
expandURL,
extractArchive,
>>>>>>>
expandURL,
extractArchive,
formatDate,
<<<<<<<
postOnFacebook,
postOnInstagram,
postToTumblr,
postToWordpress,
=======
playSound,
>>>>>>>
postOnFacebook,
postOnInstagram,
playSound,
postToTumblr,
postToWordpress,
<<<<<<<
showInMaps,
showNotification,
=======
>>>>>>>
showInMaps,
<<<<<<<
tweet,
=======
trimMedia,
>>>>>>>
tweet,
trimMedia, |
<<<<<<<
hosted_on_the_osf: 'Hosted on the Open Science Framework',
settings: 'Settings',
project: 'project',
component: 'component',
=======
hosted_on_the_osf: 'Hosted on OSF',
>>>>>>>
settings: 'Settings',
project: 'project',
component: 'component',
hosted_on_the_osf: 'Hosted on OSF', |
<<<<<<<
| 'com.apple.mobilenotes.SharingExtension'
| 'com.burbn.instagram.openin'
| 'is.workflow.actions.appendvariable'
=======
>>>>>>>
| 'com.apple.mobilenotes.SharingExtension'
| 'com.burbn.instagram.openin'
| 'is.workflow.actions.appendvariable'
<<<<<<<
| 'is.workflow.actions.format.date'
=======
| 'is.workflow.actions.getarticle'
>>>>>>>
| 'is.workflow.actions.format.date'
| 'is.workflow.actions.getarticle'
<<<<<<<
=======
| 'is.workflow.actions.getclipboard'
| 'is.workflow.actions.getcurrentlocation'
| 'is.workflow.actions.getcurrentsong'
>>>>>>>
| 'is.workflow.actions.getclipboard'
| 'is.workflow.actions.getcurrentlocation'
| 'is.workflow.actions.getcurrentsong'
<<<<<<<
| 'is.workflow.actions.getipaddress'
=======
| 'is.workflow.actions.getframesfromimage'
| 'is.workflow.actions.getipaddress'
>>>>>>>
| 'is.workflow.actions.getframesfromimage'
| 'is.workflow.actions.getipaddress'
<<<<<<<
| 'is.workflow.actions.getmyworkflows'
=======
| 'is.workflow.actions.getmarkdownfromrichtext'
| 'is.workflow.actions.getnameofemoji'
| 'is.workflow.actions.getrichtextfromhtml'
| 'is.workflow.actions.getrichtextfrommarkdown'
>>>>>>>
| 'is.workflow.actions.getmarkdownfromrichtext'
| 'is.workflow.actions.getmyworkflows'
| 'is.workflow.actions.getnameofemoji'
| 'is.workflow.actions.getrichtextfromhtml'
| 'is.workflow.actions.getrichtextfrommarkdown'
<<<<<<<
| 'is.workflow.actions.pausemusic'
=======
| 'is.workflow.actions.openurl'
| 'is.workflow.actions.pausemusic'
| 'is.workflow.actions.playsound'
>>>>>>>
| 'is.workflow.actions.openurl'
| 'is.workflow.actions.pausemusic'
| 'is.workflow.actions.playsound'
| 'is.workflow.actions.postonfacebook'
<<<<<<<
| 'is.workflow.actions.postonfacebook'
=======
| 'is.workflow.actions.readinglist'
| 'is.workflow.actions.removereminders'
| 'is.workflow.actions.runextension'
| 'is.workflow.actions.runjavascriptonwebpage'
>>>>>>>
| 'is.workflow.actions.readinglist'
| 'is.workflow.actions.removereminders'
| 'is.workflow.actions.runextension'
| 'is.workflow.actions.runjavascriptonwebpage'
<<<<<<<
| 'is.workflow.actions.searchmaps'
=======
| 'is.workflow.actions.scanbarcode'
| 'is.workflow.actions.selectemail'
| 'is.workflow.actions.selectphone'
>>>>>>>
| 'is.workflow.actions.scanbarcode'
| 'is.workflow.actions.searchmaps'
| 'is.workflow.actions.selectemail'
| 'is.workflow.actions.selectphone'
<<<<<<<
| 'is.workflow.actions.tumblr.post'
| 'is.workflow.actions.tweet'
=======
| 'is.workflow.actions.text.match'
| 'is.workflow.actions.trimvideo'
| 'is.workflow.actions.unzip'
>>>>>>>
| 'is.workflow.actions.text.match'
| 'is.workflow.actions.trimvideo'
| 'is.workflow.actions.tumblr.post'
| 'is.workflow.actions.tweet'
| 'is.workflow.actions.unzip' |
<<<<<<<
import { withUUID } from '../utils';
=======
/** @module actions */
import { withActionOutput } from '../utils';
>>>>>>>
import { withActionOutput } from '../utils'; |
<<<<<<<
import randomNumber from './randomNumber';
=======
import openInBooks from './openInBooks';
import print from './print';
import quickLook from './quickLook';
>>>>>>>
import openInBooks from './openInBooks';
import print from './print';
import quickLook from './quickLook';
import randomNumber from './randomNumber';
<<<<<<<
randomNumber,
=======
openInBooks,
print,
quickLook,
>>>>>>>
openInBooks,
print,
quickLook,
randomNumber, |
<<<<<<<
export * from './storage/query';
export * from './storage/storageBase';
export * from './storage/storageLocalStorage';
export * from './storage/storageMemory';
// export * from './storage/storageSqlite'; // doesn't work in browsers
export * from './storage/storageToAsync';
export * from './sync/syncWithChannels';
export * from './sync/syncLocal';
export * from './storage/storageTypes';
export * from './sync/syncer1';
export * from './sync/syncer2';
=======
export * from './extras';
export * from './layers/about';
export * from './layers/wiki';
export * from './storage/memory';
//export * from './storage/sqlite'; // doesn't work in browsers
export * from './sync';
export * from './sync2';
>>>>>>>
export * from './extras';
export * from './storage/query';
export * from './storage/storageBase';
export * from './storage/storageLocalStorage';
export * from './storage/storageMemory';
// export * from './storage/storageSqlite'; // doesn't work in browsers
export * from './storage/storageToAsync';
export * from './sync/syncWithChannels';
export * from './sync/syncLocal';
export * from './storage/storageTypes';
export * from './sync/syncer1';
export * from './sync/syncer2'; |
<<<<<<<
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { listAnimation } from '../animations/animations';
=======
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';
>>>>>>>
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations'; |
<<<<<<<
import {RenameView} from "../views/renameView"
import {SemanticViewPane} from "../views/semanticView"
=======
>>>>>>>
import {SemanticViewPane} from "../views/semanticView"
<<<<<<<
renameView: RenameView
semanticView: SemanticViewPane
=======
>>>>>>>
semanticView: SemanticViewPane |
<<<<<<<
import {execFile} from "child_process"
import {CommandEvent, TextEditorElement} from "atom"
=======
import {BufferedNodeProcess} from "atom"
>>>>>>>
import {BufferedNodeProcess} from "atom"
import {CommandEvent, TextEditorElement} from "atom" |
<<<<<<<
import {SemanticViewPane} from "../views/semanticViewPane"
import {FileSymbolsView} from "../views/symbolsViewMain"
=======
>>>>>>>
import {FileSymbolsView} from "../views/symbolsViewMain"
<<<<<<<
semanticView: SemanticViewPane
fileSymbolsView: FileSymbolsView
=======
>>>>>>>
fileSymbolsView: FileSymbolsView |
<<<<<<<
import { assertSingleResourceDoc } from '@cardstack/core/jsonapi';
import { Card } from '@cardstack/core/card';
import { SingleResourceDoc } from 'jsonapi-typescript';
=======
import { Entry, readCard, crawl } from '@cardstack/core/card-file';
import { statSync, Stats } from 'fs-extra';
import { inject } from '@cardstack/hub/dependency-injection';
import { AddressableCard } from '@cardstack/core/card';
import * as J from 'json-typescript';
import sane from 'sane';
>>>>>>>
import { assertSingleResourceDoc } from '@cardstack/core/jsonapi';
import { Card } from '@cardstack/core/card';
import { SingleResourceDoc } from 'jsonapi-typescript';
import { inject } from '@cardstack/hub/dependency-injection';
import { AddressableCard } from '@cardstack/core/card';
import * as J from 'json-typescript';
import sane from 'sane';
<<<<<<<
let cardDir = join(directory, name);
let json;
try {
json = assembleCard(cardDir, entry);
} catch (err) {
log.warn(`Ignoring card in ${directory} because: ${err}`);
continue;
}
let upstreamId = {
csId: json.data.attributes!.csId as string,
csOriginalRealm: json.data.attributes!.csOriginalRealm as string,
};
await ops.save(upstreamId, new UpstreamDocument(json));
this.operationsCount++;
this.ids.set(cardDir, upstreamId);
=======
let cardDir = join(directory, name);
await this.reindexCard(cardDir, entry, directory, ops);
>>>>>>>
let cardDir = join(directory, name);
await this.reindexCard(cardDir, entry, directory, ops); |
<<<<<<<
import { TestRunStartedEvent, TestRunFinishedEvent, TestSuiteEvent, TestEvent, TestSuiteInfo } from "vscode-test-adapter-api";
import { TestExplorerHelper } from './workers/test-explorer/test-explorer-helper';
import * as vscode from "vscode";
=======
import { TestRunStartedEvent, TestRunFinishedEvent, TestSuiteEvent, TestEvent } from "vscode-test-adapter-api";
import { Logger } from "./workers/test-explorer/logger";
import path = require("path");
import { KarmaEventListener } from "./workers/karma/karma-event-listener";
>>>>>>>
import { TestRunStartedEvent, TestRunFinishedEvent, TestSuiteEvent, TestEvent, TestSuiteInfo } from "vscode-test-adapter-api";
import { TestExplorerHelper } from './workers/test-explorer/test-explorer-helper';
import { KarmaEventListener } from "./workers/karma/karma-event-listener";
import { Logger } from "./workers/test-explorer/logger";
import * as vscode from "vscode";
<<<<<<<
private readonly testExplorerHelper : TestExplorerHelper;
private angularServer: AngularServer;
=======
private readonly logger: Logger;
private karmaEventListener: KarmaEventListener;
>>>>>>>
private readonly testExplorerHelper : TestExplorerHelper;
private readonly logger: Logger;
private karmaEventListener: KarmaEventListener;
private angularServer: AngularServer;
<<<<<<<
private readonly workspaceRootPath: string,
private readonly baseKarmaConfigPath:string,
eventEmitterInterface: vscode.EventEmitter<TestRunStartedEvent | TestRunFinishedEvent | TestSuiteEvent | TestEvent>
=======
private readonly angularProjectRootPath: string,
eventEmitterInterface: vscode.EventEmitter<TestRunStartedEvent | TestRunFinishedEvent | TestSuiteEvent | TestEvent>,
channel: vscode.OutputChannel
>>>>>>>
private readonly workspaceRootPath: string,
private readonly baseKarmaConfigPath:string,
eventEmitterInterface: vscode.EventEmitter<TestRunStartedEvent | TestRunFinishedEvent | TestSuiteEvent | TestEvent>,
channel: vscode.OutputChannel
<<<<<<<
this.karmaRunner = new KarmaRunner();
this.angularServer = new AngularServer();
=======
this.karmaRunner = new KarmaRunner(channel);
this.angularServer = new AngularServer(this.angularProjectRootPath, this.baseKarmaConfigPath, channel);
>>>>>>>
this.testExplorerHelper = new TestExplorerHelper();
this.karmaRunner = new KarmaRunner(channel);
this.angularServer = new AngularServer(channel);
<<<<<<<
this.testExplorerHelper = new TestExplorerHelper();
=======
this.karmaEventListener = KarmaEventListener.getInstance(channel);
>>>>>>>
this.karmaEventListener = KarmaEventListener.getInstance(channel); |
<<<<<<<
if (clonedTcModel.isValid()) {
this.tcModel = clonedTcModel;
if (this.tcModelChangeEventCallback) {
this.tcModelChangeEventCallback();
}
} else {
throw new Error(ValidationMessages.TC_MODEL_INVALID);
}
=======
this.tcModel = clonedTcModel;
this.tcModelChangeEventCallback();
>>>>>>>
this.tcModel = clonedTcModel;
if (this.tcModelChangeEventCallback) {
this.tcModelChangeEventCallback();
} |
<<<<<<<
/**
* Creates a clone of this GVL
* @return {GVL}
*/
public clone(): GVL {
return this._clone(this);
}
=======
/**
* emptyLanguageCache
*
* @param {string} [lang] - Optional ISO 639-1 langauge code to remove from
* the cache. If a falsy value is passed it will empty the entire cache.
* @return {boolean} - whether or not the item specified was in the cache and
* subsequently removed
*/
public emptyLanguageCache(lang?: string): boolean {
let retr = false;
if (lang) {
GVL.LANGUAGE_CACHE = new Map<string, Declarations>();
retr = true;
} else if (GVL.LANGUAGE_CACHE.has(lang as string)) {
GVL.LANGUAGE_CACHE.delete(lang as string);
retr = true;
}
return retr;
}
>>>>>>>
/**
* Creates a clone of this GVL
* @return {GVL}
*/
public clone(): GVL {
return this._clone(this);
}
/**
* emptyLanguageCache
*
* @param {string} [lang] - Optional ISO 639-1 langauge code to remove from
* the cache. If a falsy value is passed it will empty the entire cache.
* @return {boolean} - whether or not the item specified was in the cache and
* subsequently removed
*/
public emptyLanguageCache(lang?: string): boolean {
let retr = false;
if (lang) {
GVL.LANGUAGE_CACHE = new Map<string, Declarations>();
retr = true;
} else if (GVL.LANGUAGE_CACHE.has(lang as string)) {
GVL.LANGUAGE_CACHE.delete(lang as string);
retr = true;
}
return retr;
} |
<<<<<<<
=======
it('ping works', (done): void => {
const callback: PingCallback = (pingReturn: Ping | null): void => {
assert.isNotNull(pingReturn, 'Ping returned null');
done();
};
win[API_FUNCTION_NAME]('ping', 2, callback);
});
it('setTCModel works', (): void => {
assert.doesNotThrow((): TCModel => cmpApi.tcModel = createValidTCModel(), 'setTCModel threw an error');
});
it('custom command works', (done): void => {
const param = 'BINGO';
const expectedTestString = testData.testString.replace('DOG_NAME', param);
const callback = (data: TestData): void => {
assert.isNotNull(data, 'custom command returned null data');
assert.strictEqual(data.testString, expectedTestString);
done();
};
win[API_FUNCTION_NAME](customCommands[0].command, 2, callback, param);
});
>>>>>>>
// it('custom command works', (done): void => {
//
// const param = 'BINGO';
// const expectedTestString = custCommandTestData.testString.replace('DOG_NAME', param);
//
// const callback = (data: TestData): void => {
//
// assert.isNotNull(data, 'custom command returned null data');
// assert.strictEqual(data.testString, expectedTestString);
// done();
//
// };
//
// win[API_FUNCTION_NAME](customCommands[0].command, 2, callback, param);
//
// });
<<<<<<<
it('getTCData is queued if an invalid TcModel is set', (done): void => {
assert.throws((): TCModel => cmpApi.tcModel = new TCModel(), ValidationMessages.TC_MODEL_INVALID);
const getTCDataCallback = createGetTCDataCallback(done);
win[API_FUNCTION_NAME]('getTCData', 2, getTCDataCallback, [1, 2, 3, 12, 37, 48]);
cmpApi.tcModel = createValidTCModel(gvl);
});
it('getTCData works with vendor ids', (done): void => {
const callback: TCDataCallback = (tcData: TCData | null, success: boolean): void => {
assert.isTrue(success, 'getTCData was not successful');
assert.isNotNull(tcData, 'getTCData returned null tcData');
// @ts-ignore
assert.equal(tcData.eventStatus, EventStatus.USER_ACTION_COMPLETE, 'Event status did not match set value');
// Todo: Check the object more thoroughly
done();
};
win[API_FUNCTION_NAME]('getTCData', 2, callback, [1, 2, 3, 12, 37, 48]);
});
=======
>>>>>>> |
<<<<<<<
module(rootElement: Element, module: MithrilModule): Object;
=======
module(rootElement: Node, module: MithrilModule): void;
>>>>>>>
module(rootElement: Node, module: MithrilModule): Object; |
<<<<<<<
/* If the status is OK and a new status comes in (e.g. from a
* deserialization failure), that new status takes priority */
if (this.finalStatus === null || this.finalStatus.code === Status.OK) {
=======
/* Once endCall is called, we are definitely not using the http2 stream
* anymore, so we can always safely destroy it here */
this.destroyHttp2Stream();
if (this.finalStatus === null) {
>>>>>>>
this.destroyHttp2Stream();
/* If the status is OK and a new status comes in (e.g. from a
* deserialization failure), that new status takes priority */
if (this.finalStatus === null || this.finalStatus.code === Status.OK) {
<<<<<<<
this.maybeCloseWrites();
=======
if (this.pendingFinalCallback) {
this.trace('calling end() on HTTP/2 stream (deferred)');
stream.end(this.pendingFinalCallback);
}
>>>>>>>
this.maybeCloseWrites();
<<<<<<<
this.writesClosed = true;
this.maybeCloseWrites();
=======
if (this.http2Stream === null) {
this.trace('deferring calling end() on HTTP/2 stream');
this.pendingFinalCallback = cb;
} else {
this.trace('calling end() on HTTP/2 stream');
this.http2Stream.end(cb);
}
>>>>>>>
this.writesClosed = true;
this.maybeCloseWrites(); |
<<<<<<<
export function load(filename: string | string[], options?: Options): Promise<PackageDefinition> {
=======
export function load(
filename: string, options?: Options): Promise<PackageDefinition> {
>>>>>>>
export function load(
filename: string | string[], options?: Options): Promise<PackageDefinition> {
<<<<<<<
export function loadSync(filename: string | string[], options?: Options): PackageDefinition {
=======
export function loadSync(
filename: string, options?: Options): PackageDefinition {
>>>>>>>
export function loadSync(
filename: string | string[], options?: Options): PackageDefinition { |
<<<<<<<
import { UI, Snippet } from '../actions';
import { Strings } from '../helpers';
=======
import { UI, Snippet, GitHub } from '../actions';
import isEmpty = require('lodash/isEmpty');
>>>>>>>
import { UI, Snippet, GitHub } from '../actions';
import isEmpty = require('lodash/isEmpty');
import { Strings } from '../helpers';
<<<<<<<
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'url'}" (click)="view = 'url'">${Strings.importUrlTab}</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'snippet'}" (click)="view = 'snippet'">${Strings.importYamlTab}</li>
=======
<li class="gallery__tab ms-Pivot-link gallery__tab--icon" (click)="cancel()">
<i class="ms-Icon ms-Icon--Cancel"></i><span>Close</span>
</li>
<li class="gallery__tab ms-Pivot-link gallery__tab--icon gallery__tab--highlighted" (click)="new()">
<i class="ms-Icon ms-Icon--Add"></i><span>New snippet</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'snippets'}" (click)="view = 'snippets'">
<i class="ms-Icon ms-Icon--DocumentSet"></i><span>Snippets</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'samples'}" (click)="view = 'samples'">
<i class="ms-Icon ms-Icon--Dictionary"></i><span>Samples</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'import'}" (click)="view = 'import'">
<i class="ms-Icon ms-Icon--Download"></i><span>Import</span>
</li>
>>>>>>>
<li class="gallery__tab ms-Pivot-link gallery__tab--icon" (click)="cancel()">
<i class="ms-Icon ms-Icon--Cancel"></i><span>Close</span>
</li>
<li class="gallery__tab ms-Pivot-link gallery__tab--icon gallery__tab--highlighted" (click)="new()">
<i class="ms-Icon ms-Icon--Add"></i><span>New snippet</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'snippets'}" (click)="view = 'snippets'">
<i class="ms-Icon ms-Icon--DocumentSet"></i><span>Snippets</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'samples'}" (click)="view = 'samples'">
<i class="ms-Icon ms-Icon--Dictionary"></i><span>Samples</span>
</li>
<li class="gallery__tab ms-Pivot-link" [ngClass]="{'is-selected gallery__tab--active': view === 'import'}" (click)="view = 'import'">
<i class="ms-Icon ms-Icon--Download"></i><span>Import</span>
</li>
<<<<<<<
<div class="ms-Dialog-actions ">
<div class="ms-Dialog-actionsRight ">
<button class="ms-Dialog-action ms-Button " (click)="import() ">
<span class="ms-Button-label">${Strings.importButtonLabel}</span>
</button>
<button class="ms-Dialog-action ms-Button " (click)="cancel()">
<span class="ms-Button-label">${Strings.cancelButtonLabel}</span>
</button>
</div>
</div>
=======
>>>>>>> |
<<<<<<<
settings.snippets.notify().subscribe(() => this.render());
settings.settings.notify().subscribe(() => this.renderLastOpened());
=======
storage.settings.notify().subscribe(() => this.renderLastOpened());
storage.snippets.notify().subscribe(() => this.render());
this._$refresh.click(() => {
this.render();
this.renderLastOpened();
this.hideProgress();
});
>>>>>>>
storage.snippets.notify().subscribe(() => this.render());
storage.settings.notify().subscribe(() => this.renderLastOpened());
<<<<<<<
=======
renderLastOpened() {
this._$lastOpened.html('');
if (storage.lastOpened) {
this.insertSnippet(storage.current.lastOpened, this._$lastOpened);
this._$lastOpened.show();
this._$lastOpenedEmpty.hide();
}
else {
this._$lastOpened.hide();
this._$lastOpenedEmpty.show();
}
}
>>>>>>> |
<<<<<<<
export * from './jdbc-note-plugin';
export * from './rupert-note-plugin';
=======
export * from './jdbc-note-plugin';
export * from './bigquery-note-plugin';
>>>>>>>
export * from './jdbc-note-plugin';
export * from './rupert-note-plugin';
export * from './bigquery-note-plugin'; |
<<<<<<<
static deserialize (rawCommand: Buffer) {
const properties = {
productIdentifier: Util.bufToNullTerminatedString(rawCommand, 0, 40),
model: Util.parseEnum<Enums.Model>(rawCommand[40], Enums.Model)
=======
properties: {
deviceName: string
model: number
}
deserialize (rawCommand: Buffer) {
this.properties = {
deviceName: Util.bufToNullTerminatedString(rawCommand, 0, 40),
model: rawCommand[40]
>>>>>>>
static deserialize (rawCommand: Buffer) {
const properties = {
productIdentifier: Util.bufToNullTerminatedString(rawCommand, 0, 40),
model: rawCommand[40] |
<<<<<<<
export { default as Provider } from "./components/Provider";
export { TextField } from "./components/TextField/TextField";
=======
export {
default as SearchField,
Props as SearchFieldProps,
} from "./components/SearchField/SearchField";
export { default as Provider } from "./components/Provider";
>>>>>>>
export {
default as SearchField,
Props as SearchFieldProps,
} from "./components/SearchField/SearchField";
export { default as Provider } from "./components/Provider";
export { TextField } from "./components/TextField/TextField"; |
<<<<<<<
import { AppService, DEFAULT_APP_COLOR } from './app.service';
=======
import cuid from 'cuid';
import {
AppService,
INITIAL_COMMIT_MESSAGE,
DEFAULT_APP_COLOR,
DEFAULT_ENVIRONMENT_NAME,
DEFAULT_APP_DATA
} from './app.service';
>>>>>>>
import cuid from 'cuid';
import {
AppService,
INITIAL_COMMIT_MESSAGE,
DEFAULT_APP_COLOR,
DEFAULT_APP_DATA
} from './app.service';
<<<<<<<
expect(environmentServiceCreateDefaultEnvironmentMock).toBeCalledTimes(1);
expect(environmentServiceCreateDefaultEnvironmentMock).toBeCalledWith(
EXAMPLE_APP_ID
);
=======
expect(prismaAppFindManyMock).toBeCalledTimes(1);
expect(prismaAppFindManyMock).toHaveBeenCalledWith(findManyArgs);
expect(prismaCommitCreateMock).toBeCalledTimes(1);
expect(prismaCommitCreateMock).toBeCalledWith(commitArgs);
expect(prismaCommitCreateMock).toBeCalledTimes(1);
expect(entityServiceCreateVersionMock).toBeCalledTimes(1);
expect(entityServiceCreateVersionMock).toBeCalledWith(createVersionArgs);
expect(entityServiceReleaseLockMock).toBeCalledTimes(1);
expect(entityServiceReleaseLockMock).toBeCalledWith(EXAMPLE_ENTITY_ID);
expect(entityServiceGetChangedEntitiesMock).toBeCalledTimes(1);
expect(entityServiceGetChangedEntitiesMock).toBeCalledWith(
changedEntitiesArgs.appId,
changedEntitiesArgs.userId
);
});
it('should fail to create app for invalid color', async () => {
const createAppArgs = {
args: {
data: {
name: EXAMPLE_APP_NAME,
description: EXAMPLE_APP_DESCRIPTION,
color: INVALID_COLOR
}
},
user: EXAMPLE_USER
};
await expect(
service.createApp(createAppArgs.args, createAppArgs.user)
).rejects.toThrow(new InvalidColorError(INVALID_COLOR));
});
it('should create a sample app', async () => {
const prismaAppCreateAppArgs = {
data: {
...DEFAULT_APP_DATA,
...SAMPLE_APP_DATA,
organization: {
connect: {
id: EXAMPLE_USER.organization?.id
}
},
environments: {
create: {
name: DEFAULT_ENVIRONMENT_NAME,
address: cuid()
}
},
roles: {
create: EXAMPLE_USER_APP_ROLE
}
}
};
const initialCommitArgs = {
data: {
message: INITIAL_COMMIT_MESSAGE,
app: { connect: { id: EXAMPLE_APP_ID } },
user: { connect: { id: EXAMPLE_USER_ID } }
}
};
const createSampleEntitiesCommitArgs = {
data: {
message: CREATE_SAMPLE_ENTITIES_COMMIT_MESSAGE,
app: { connect: { id: EXAMPLE_APP_ID } },
user: { connect: { id: EXAMPLE_USER_ID } }
}
};
const findManyArgs = {
where: {
id: EXAMPLE_APP_ID,
organization: {
users: {
some: {
id: EXAMPLE_USER_ID
}
}
}
}
};
const createVersionArgs = {
data: {
commit: {
connect: {
id: EXAMPLE_COMMIT_ID
}
},
entity: {
connect: {
id: EXAMPLE_ENTITY_ID
}
}
}
};
const changedEntitiesArgs = {
appId: EXAMPLE_APP_ID,
userId: EXAMPLE_USER_ID
};
await expect(service.createSampleApp(EXAMPLE_USER)).resolves.toEqual(
EXAMPLE_APP
);
expect(prismaAppCreateMock).toBeCalledTimes(1);
expect(prismaAppCreateMock).toBeCalledWith(prismaAppCreateAppArgs);
expect(entityServiceFindFirstMock).toBeCalledTimes(1);
expect(entityServiceFindFirstMock).toBeCalledWith({
where: { name: USER_ENTITY_NAME },
select: { id: true }
});
expect(entityServiceBulkCreateEntities).toBeCalledWith(
EXAMPLE_APP_ID,
EXAMPLE_USER,
createSampleAppEntities(USER_ENTITY_MOCK.id)
);
expect(prismaAppFindManyMock).toBeCalledTimes(2);
expect(prismaAppFindManyMock.mock.calls).toEqual([
[findManyArgs],
[findManyArgs]
]);
expect(prismaCommitCreateMock).toBeCalledTimes(2);
expect(prismaCommitCreateMock.mock.calls).toEqual([
[initialCommitArgs],
[createSampleEntitiesCommitArgs]
]);
expect(entityServiceCreateVersionMock).toBeCalledTimes(2);
expect(entityServiceCreateVersionMock.mock.calls).toEqual([
[createVersionArgs],
[createVersionArgs]
]);
expect(entityServiceReleaseLockMock).toBeCalledTimes(2);
expect(entityServiceReleaseLockMock.mock.calls).toEqual([
[EXAMPLE_ENTITY_ID],
[EXAMPLE_ENTITY_ID]
]);
expect(entityServiceGetChangedEntitiesMock).toBeCalledTimes(2);
expect(entityServiceGetChangedEntitiesMock.mock.calls).toEqual([
[changedEntitiesArgs.appId, changedEntitiesArgs.userId],
[changedEntitiesArgs.appId, changedEntitiesArgs.userId]
]);
>>>>>>>
expect(environmentServiceCreateDefaultEnvironmentMock).toBeCalledTimes(1);
expect(environmentServiceCreateDefaultEnvironmentMock).toBeCalledWith(
EXAMPLE_APP_ID
);
expect(prismaAppFindManyMock).toBeCalledTimes(1);
expect(prismaAppFindManyMock).toHaveBeenCalledWith(findManyArgs);
expect(prismaCommitCreateMock).toBeCalledTimes(1);
expect(prismaCommitCreateMock).toBeCalledWith(commitArgs);
expect(prismaCommitCreateMock).toBeCalledTimes(1);
expect(entityServiceCreateVersionMock).toBeCalledTimes(1);
expect(entityServiceCreateVersionMock).toBeCalledWith(createVersionArgs);
expect(entityServiceReleaseLockMock).toBeCalledTimes(1);
expect(entityServiceReleaseLockMock).toBeCalledWith(EXAMPLE_ENTITY_ID);
expect(entityServiceGetChangedEntitiesMock).toBeCalledTimes(1);
expect(entityServiceGetChangedEntitiesMock).toBeCalledWith(
changedEntitiesArgs.appId,
changedEntitiesArgs.userId
);
});
it('should fail to create app for invalid color', async () => {
const createAppArgs = {
args: {
data: {
name: EXAMPLE_APP_NAME,
description: EXAMPLE_APP_DESCRIPTION,
color: INVALID_COLOR
}
},
user: EXAMPLE_USER
};
await expect(
service.createApp(createAppArgs.args, createAppArgs.user)
).rejects.toThrow(new InvalidColorError(INVALID_COLOR));
});
it('should create a sample app', async () => {
const prismaAppCreateAppArgs = {
data: {
...DEFAULT_APP_DATA,
...SAMPLE_APP_DATA,
organization: {
connect: {
id: EXAMPLE_USER.organization?.id
}
},
roles: {
create: EXAMPLE_USER_APP_ROLE
}
}
};
const initialCommitArgs = {
data: {
message: INITIAL_COMMIT_MESSAGE,
app: { connect: { id: EXAMPLE_APP_ID } },
user: { connect: { id: EXAMPLE_USER_ID } }
}
};
const createSampleEntitiesCommitArgs = {
data: {
message: CREATE_SAMPLE_ENTITIES_COMMIT_MESSAGE,
app: { connect: { id: EXAMPLE_APP_ID } },
user: { connect: { id: EXAMPLE_USER_ID } }
}
};
const findManyArgs = {
where: {
id: EXAMPLE_APP_ID,
organization: {
users: {
some: {
id: EXAMPLE_USER_ID
}
}
}
}
};
const createVersionArgs = {
data: {
commit: {
connect: {
id: EXAMPLE_COMMIT_ID
}
},
entity: {
connect: {
id: EXAMPLE_ENTITY_ID
}
}
}
};
const changedEntitiesArgs = {
appId: EXAMPLE_APP_ID,
userId: EXAMPLE_USER_ID
};
await expect(service.createSampleApp(EXAMPLE_USER)).resolves.toEqual(
EXAMPLE_APP
);
expect(prismaAppCreateMock).toBeCalledTimes(1);
expect(prismaAppCreateMock).toBeCalledWith(prismaAppCreateAppArgs);
expect(entityServiceFindFirstMock).toBeCalledTimes(1);
expect(entityServiceFindFirstMock).toBeCalledWith({
where: { name: USER_ENTITY_NAME },
select: { id: true }
});
expect(entityServiceBulkCreateEntities).toBeCalledWith(
EXAMPLE_APP_ID,
EXAMPLE_USER,
createSampleAppEntities(USER_ENTITY_MOCK.id)
);
expect(prismaAppFindManyMock).toBeCalledTimes(2);
expect(prismaAppFindManyMock.mock.calls).toEqual([
[findManyArgs],
[findManyArgs]
]);
expect(prismaCommitCreateMock).toBeCalledTimes(2);
expect(prismaCommitCreateMock.mock.calls).toEqual([
[initialCommitArgs],
[createSampleEntitiesCommitArgs]
]);
expect(entityServiceCreateVersionMock).toBeCalledTimes(2);
expect(entityServiceCreateVersionMock.mock.calls).toEqual([
[createVersionArgs],
[createVersionArgs]
]);
expect(entityServiceReleaseLockMock).toBeCalledTimes(2);
expect(entityServiceReleaseLockMock.mock.calls).toEqual([
[EXAMPLE_ENTITY_ID],
[EXAMPLE_ENTITY_ID]
]);
expect(entityServiceGetChangedEntitiesMock).toBeCalledTimes(2);
expect(entityServiceGetChangedEntitiesMock.mock.calls).toEqual([
[changedEntitiesArgs.appId, changedEntitiesArgs.userId],
[changedEntitiesArgs.appId, changedEntitiesArgs.userId]
]); |
<<<<<<<
@service i18n;
max = 3;
nodeId?: string;
useLink?: boolean;
contributors = defaultTo(this.contributors, A([]));
=======
@service i18n!: I18N;
contributors: Contributor[] = defaultTo(this.contributors, A([]));
>>>>>>>
@service i18n!: I18N;
max = 3;
nodeId?: string;
useLink?: boolean;
contributors: Contributor[] = defaultTo(this.contributors, A([])); |
<<<<<<<
import {
DELETE_ONE_USER_ENTITY_ERROR_MESSAGE,
EntityService,
NAME_VALIDATION_ERROR_MESSAGE
} from './entity.service';
=======
import {
EntityPendingChange,
EntityService,
NAME_VALIDATION_ERROR_MESSAGE
} from './entity.service';
>>>>>>>
import {
DELETE_ONE_USER_ENTITY_ERROR_MESSAGE,
EntityPendingChange,
EntityService,
NAME_VALIDATION_ERROR_MESSAGE
} from './entity.service'; |
<<<<<<<
ALL_ATTRIBUTES_ALLOWED,
=======
ALL_ATTRIBUTES_MATCHER,
>>>>>>>
ALL_ATTRIBUTES_ALLOWED,
<<<<<<<
attributes: ALL_ATTRIBUTES_ALLOWED,
=======
attributes: ALL_ATTRIBUTES_MATCHER,
resource: EXAMPLE_ENTITY.name,
role: EXAMPLE_APP_ROLE.name,
};
const EXAMPLE_ROLE_CREATE_GRANT_WITH_EXCLUDED_FIELD: Grant = {
action: CREATE_ANY,
attributes: createAttributes([
ALL_ATTRIBUTES_MATCHER,
createNegativeAttributeMatcher(EXAMPLE_FIELD.name),
]),
>>>>>>>
attributes: ALL_ATTRIBUTES_ALLOWED,
resource: EXAMPLE_ENTITY.name,
role: EXAMPLE_APP_ROLE.name,
};
const EXAMPLE_ROLE_CREATE_GRANT_WITH_EXCLUDED_FIELD: Grant = {
action: CREATE_ANY,
attributes: createAttributes([
ALL_ATTRIBUTES_ALLOWED,
createNegativeAttributeMatcher(EXAMPLE_FIELD.name),
]),
<<<<<<<
attributes: ALL_ATTRIBUTES_ALLOWED,
=======
attributes: ALL_ATTRIBUTES_MATCHER,
>>>>>>>
attributes: ALL_ATTRIBUTES_ALLOWED, |
<<<<<<<
if (entity.lockedByUserId) {
return this.userService.user({
where: {
id: entity.lockedByUserId
}
});
} else {
return null;
}
=======
return this.userService.findUser({
where: {
id: entity.lockedByUserId
}
});
>>>>>>>
if (entity.lockedByUserId) {
return this.userService.findUser({
where: {
id: entity.lockedByUserId
}
});
} else {
return null;
} |
<<<<<<<
if (entity.lockedByUserId) {
return this.userService.user({
where: {
id: entity.lockedByUserId
}
});
} else {
return null;
}
=======
return this.userService.findUser({
where: {
id: entity.lockedByUserId
}
});
>>>>>>>
if (entity.lockedByUserId) {
return this.userService.findUser({
where: {
id: entity.lockedByUserId
}
});
} else {
return null;
} |
<<<<<<<
CreateOneEntityVersionArgs
} from './dto';
=======
CreateOneEntityVersionArgs,
FindManyEntityVersionArgs,
DeleteOneEntityArgs
} from '../../dto/args';
>>>>>>>
CreateOneEntityVersionArgs,
FindManyEntityVersionArgs,
DeleteOneEntityArgs
} from './dto'; |
<<<<<<<
import { AccessControlModule, RolesBuilder } from "nest-access-control";
import { MorganModule } from "nest-morgan";
=======
>>>>>>>
import { MorganModule } from "nest-morgan"; |
<<<<<<<
export function createPrismaFields(
field: EntityField,
entity: Entity,
fieldNamesCount: Record<string, number> = {}
):
| [PrismaSchemaDSL.ScalarField]
| [PrismaSchemaDSL.ObjectField]
| [PrismaSchemaDSL.ObjectField, PrismaSchemaDSL.ScalarField] {
=======
export function createPrismaField(
field: EntityField,
entity: Entity
): PrismaSchemaDSL.ScalarField | PrismaSchemaDSL.ObjectField {
>>>>>>>
export function createEnumName(field: EntityField, entity: Entity): string {
return `Enum${pascalCase(entity.name)}${pascalCase(field.name)}`;
}
export function createPrismaModel(
entity: Entity,
fieldNamesCount: Record<string, number>
): PrismaSchemaDSL.Model {
return PrismaSchemaDSL.createModel(
entity.name,
entity.fields.flatMap((field) =>
createPrismaFields(field, entity, fieldNamesCount)
)
);
}
export function createPrismaFields(
field: EntityField,
entity: Entity,
fieldNamesCount: Record<string, number> = {}
):
| [PrismaSchemaDSL.ScalarField]
| [PrismaSchemaDSL.ObjectField]
| [PrismaSchemaDSL.ObjectField, PrismaSchemaDSL.ScalarField] {
<<<<<<<
return [
PrismaSchemaDSL.createObjectField(
name,
createEnumName(field),
true,
true
),
];
=======
return PrismaSchemaDSL.createObjectField(
name,
createEnumName(field, entity),
true,
true
);
>>>>>>>
return [
PrismaSchemaDSL.createObjectField(
name,
createEnumName(field, entity),
true,
true
),
];
<<<<<<<
return [
PrismaSchemaDSL.createObjectField(
name,
createEnumName(field),
false,
field.required
),
];
=======
return PrismaSchemaDSL.createObjectField(
name,
createEnumName(field, entity),
false,
field.required
);
>>>>>>>
return [
PrismaSchemaDSL.createObjectField(
name,
createEnumName(field, entity),
false,
field.required
),
]; |
<<<<<<<
app.use(oakCors());
// // const url = "https://api.spacex.land/graphql"
// // const query = ` query {
// // launch(id: "1") {
// // mission_name
// // launch_success
// // launch_year
// // }
// // }`
// // const query = `
// // query {
// // Lift(id: "panorama") {
// // name
// // status
// // }
// // }
// // `;
// // const url = "https://snowtooth.moonhighway.com/";
// // artemisQuery(url, query, ctx.state)
// // });
// // router.use("/", async (ctx, next) => {
// // console.log('in router')
// // const url = "https://api.spacex.land/graphql"
// // const query = ` query {
// // launch(id: "1") {
// // mission_name
// // launch_success
// // upcoming
// // launch_year
// // }
// // }`
// // artemisQuery(url, query, ctx.state)
// // })
// // app.use(router.routes(), router.allowedMethods())
// // router.get("/gui", async (ctx) => {
// // // ctx.response.redirect('/index.html')
// // console.log(Deno.cwd())
// // await ctx.send({
// // root: `${Deno.cwd()}`,
// // index: "index.html",
// // });
// // })
// router.get("/artemis", (ctx) => {
// ctx.response.body = "Query has been sent";
// console.log("you have entered the router");
// let counter = 3;
// while (counter > 0) {
// const url = "https://api.spacex.land/graphql";
// let id = 10;
// const query = ` query {
// launch(id: "${id}") {
// mission_name
// launch_success
// upcoming
// launch_year
// }
// // }`;
// counter--;
// id++;
// artemisQuery(url, query, ctx.state);
// ctx.response.body = ctx.state
// }
// });
// router.get("/getData", (ctx, state:any) => {
// console.log("in getData route")
// console.log("state", state.artemis)
// ctx.response.body = state.artemis
// })
=======
app.use(oakCors())
>>>>>>>
app.use(oakCors());
// // const url = "https://api.spacex.land/graphql"
// // const query = ` query {
// // launch(id: "1") {
// // mission_name
// // launch_success
// // launch_year
// // }
// // }`
// // const query = `
// // query {
// // Lift(id: "panorama") {
// // name
// // status
// // }
// // }
// // `;
// // const url = "https://snowtooth.moonhighway.com/";
// // artemisQuery(url, query, ctx.state)
// // });
// // router.use("/", async (ctx, next) => {
// // console.log('in router')
// // const url = "https://api.spacex.land/graphql"
// // const query = ` query {
// // launch(id: "1") {
// // mission_name
// // launch_success
// // upcoming
// // launch_year
// // }
// // }`
// // artemisQuery(url, query, ctx.state)
// // })
// // app.use(router.routes(), router.allowedMethods())
// // router.get("/gui", async (ctx) => {
// // // ctx.response.redirect('/index.html')
// // console.log(Deno.cwd())
// // await ctx.send({
// // root: `${Deno.cwd()}`,
// // index: "index.html",
// // });
// // })
// router.get("/artemis", (ctx) => {
// ctx.response.body = "Query has been sent";
// console.log("you have entered the router");
// let counter = 3;
// while (counter > 0) {
// const url = "https://api.spacex.land/graphql";
// let id = 10;
// const query = ` query {
// launch(id: "${id}") {
// mission_name
// launch_success
// upcoming
// launch_year
// }
// // }`;
// counter--;
// id++;
// artemisQuery(url, query, ctx.state);
// ctx.response.body = ctx.state
// }
// });
// router.get("/getData", (ctx, state:any) => {
// console.log("in getData route")
// console.log("state", state.artemis)
// ctx.response.body = state.artemis
// })
app.use(oakCors());
<<<<<<<
router.get("/getData", (ctx, state: any) => {
console.log("in getData route");
ctx.response.body = state.artemis;
});
=======
>>>>>>> |
<<<<<<<
import BreakBlot from '../leaf/break';
import Observable from '../observable';
=======
>>>>>>>
import Observable from '../observable';
<<<<<<<
class BlockBlot extends ParentBlot implements Observable {
static nodeName = 'block';
=======
class BlockBlot extends ParentBlot {
static blotName = 'block';
>>>>>>>
class BlockBlot extends ParentBlot implements Observable {
static nodeName = 'block';
<<<<<<<
observer: MutationObserver;
constructor(value: HTMLElement) {
super(value);
this.observer = new MutationObserver(this.observeHandler);
this.observer.observe(this.domNode, {
attributes: true,
characterData: true,
childList: true,
subtree: true
});
}
observeHandler(mutations: MutationRecord[]): void {
this.children.empty();
this.build();
this.observer.takeRecords(); // Ignore changes caused by this handler
}
update(): void {
this.observeHandler(this.observer.takeRecords());
}
formats(): any {
=======
format(name: string, value: any): void {
if (Registry.match(name, Registry.Type.ATTRIBUTE) != null) {
this.attribute(name, value);
} else if (value) {
this.replace(name, value);
} else {
this.replace(BlockBlot.blotName, true);
}
}
getFormat(): any {
>>>>>>>
observer: MutationObserver;
constructor(value: HTMLElement) {
super(value);
this.observer = new MutationObserver(this.observeHandler);
this.observer.observe(this.domNode, {
attributes: true,
characterData: true,
childList: true,
subtree: true
});
}
format(name: string, value: any): void {
if (Registry.match(name, Registry.Type.ATTRIBUTE) != null) {
this.attribute(name, value);
} else if (value) {
this.replace(name, value);
} else {
this.replace(BlockBlot.blotName, true);
}
}
getFormat(): any { |
<<<<<<<
=======
import { getContractWrappers } from '../../services/contract_wrappers';
import { getWeb3Wrapper } from '../../services/web3_wrapper';
import { DefaultTheme } from '../../themes/default_theme';
>>>>>>>
import { DefaultTheme } from '../../themes/default_theme';
<<<<<<<
export const startToggleTokenLockSteps: ThunkCreator = (token: Token, isUnlocked: boolean) => {
return async dispatch => {
=======
export const setThemeColor = createAction('SET_THEME_COLOR', resolve => {
return (themeColor: DefaultTheme) => resolve(themeColor);
});
export const startToggleTokenLockSteps = (token: Token, isUnlocked: boolean) => {
return async (dispatch: any) => {
>>>>>>>
export const setThemeColor = createAction('SET_THEME_COLOR', resolve => {
return (themeColor: DefaultTheme) => resolve(themeColor);
});
export const startToggleTokenLockSteps: ThunkCreator = (token: Token, isUnlocked: boolean) => {
return async dispatch => { |
<<<<<<<
export const getNotifications = (state: StoreState) => state.ui.notifications;
export const getHasUnreadNotifications = (state: StoreState) => state.ui.hasUnreadNotifications;
=======
export const getStepsModalPendingSteps = (state: StoreState) => state.ui.stepsModal.pendingSteps;
export const getStepsModalDoneSteps = (state: StoreState) => state.ui.stepsModal.doneSteps;
export const getStepsModalCurrentStep = (state: StoreState) => state.ui.stepsModal.currentStep;
>>>>>>>
export const getNotifications = (state: StoreState) => state.ui.notifications;
export const getHasUnreadNotifications = (state: StoreState) => state.ui.hasUnreadNotifications;
export const getStepsModalPendingSteps = (state: StoreState) => state.ui.stepsModal.pendingSteps;
export const getStepsModalDoneSteps = (state: StoreState) => state.ui.stepsModal.doneSteps;
export const getStepsModalCurrentStep = (state: StoreState) => state.ui.stepsModal.currentStep; |
<<<<<<<
=======
import { TX_DEFAULTS } from '../../common/constants';
import { INSUFFICIENT_ORDERS_TO_FILL_AMOUNT_ERR } from '../../exceptions/common';
import { InsufficientOrdersAmountException } from '../../exceptions/insufficient_orders_amount_exception';
>>>>>>>
import { INSUFFICIENT_ORDERS_TO_FILL_AMOUNT_ERR } from '../../exceptions/common';
import { InsufficientOrdersAmountException } from '../../exceptions/insufficient_orders_amount_exception'; |
<<<<<<<
currencyPair: CurrencyPair;
baseToken: Token | null;
quoteToken: Token | null;
markets: Market[] | null;
=======
readonly currencyPair: CurrencyPair;
readonly baseToken: Token | null;
readonly quoteToken: Token | null;
readonly ethInUsd: BigNumber | null;
>>>>>>>
readonly currencyPair: CurrencyPair;
readonly baseToken: Token | null;
readonly quoteToken: Token | null;
readonly ethInUsd: BigNumber | null;
readonly markets: Market[] | null; |
<<<<<<<
export const submitLimitOrder = (amount: BigNumber, price: number, side: OrderSide) => {
=======
export const submitOrder = (amount: BigNumber, price: BigNumber, side: OrderSide) => {
>>>>>>>
export const submitLimitOrder = (amount: BigNumber, price: BigNumber, side: OrderSide) => { |
<<<<<<<
overflow: 'hidden',
=======
padding: '16px',
>>>>>>>
overflow: 'hidden',
padding: '16px', |
<<<<<<<
export const getMarkets = () => {
return async (dispatch: any, getState: any) => {
const web3Wrapper = await getWeb3Wrapper();
=======
export const fetchMarkets = () => {
return async (dispatch: any) => {
const web3Wrapper = await getWeb3WrapperOrThrow();
>>>>>>>
export const fetchMarkets = () => {
return async (dispatch: any) => {
const web3Wrapper = await getWeb3Wrapper(); |
<<<<<<<
import { TEMPLATE_THEME } from '../../common/constants';
=======
import { SignedOrderException } from '../../exceptions/signed_order_exception';
>>>>>>>
import { TEMPLATE_THEME } from '../../common/constants';
import { SignedOrderException } from '../../exceptions/signed_order_exception'; |
<<<<<<<
import { BigNumber, MetamaskSubprovider, signatureUtils, SignedOrder } from '0x.js';
import { createAction } from 'typesafe-actions';
import {
MAINNET_ID,
METAMASK_NOT_INSTALLED,
METAMASK_USER_DENIED_AUTH,
TX_DEFAULTS,
WETH_TOKEN_SYMBOL,
} from '../common/constants';
import { getContractWrappers } from '../services/contract_wrappers';
import { cancelSignedOrder, getAllOrdersAsUIOrders, getUserOrdersAsUIOrders } from '../services/orders';
import { getRelayer } from '../services/relayer';
=======
>>>>>>>
import { MAINNET_ID } from '../common/constants';
<<<<<<<
import { getWeb3WrapperOrThrow, reconnectWallet } from '../services/web3_wrapper';
=======
import { getWeb3Wrapper } from '../services/web3_wrapper';
>>>>>>>
import { getWeb3WrapperOrThrow } from '../services/web3_wrapper';
<<<<<<<
dispatch(setWethTokenBalance(newWethTokenBalance));
};
};
export const connectWallet = () => {
return async (dispatch: any) => {
await reconnectWallet();
dispatch(initWallet());
};
};
export const initWallet = () => {
return async (dispatch: any) => {
dispatch(setWeb3State(Web3State.Loading));
try {
const web3Wrapper = await getWeb3WrapperOrThrow();
if (web3Wrapper) {
const [ethAccount] = await web3Wrapper.getAvailableAddressesAsync();
const networkId = await web3Wrapper.getNetworkIdAsync();
const knownTokens = getKnownTokens(networkId);
const tokenBalances = await Promise.all(
knownTokens.getTokens().map(token => tokenToTokenBalance(token, ethAccount)),
);
const wethToken = knownTokens.getWethToken();
const wethTokenBalance = await tokenToTokenBalance(wethToken, ethAccount);
const ethBalance = await web3Wrapper.getBalanceInWeiAsync(ethAccount);
const selectedToken = knownTokens.getTokenBySymbol('ZRX');
dispatch(
initializeBlockchainData({
web3State: Web3State.Done,
ethAccount,
ethBalance,
wethTokenBalance,
tokenBalances,
}),
);
dispatch(
initializeRelayerData({
orders: [],
userOrders: [],
selectedToken,
}),
);
dispatch(getOrderbookAndUserOrders());
}
} catch (error) {
const knownTokens = getKnownTokens(MAINNET_ID);
const selectedToken = knownTokens.getTokenBySymbol('ZRX');
switch (error.message) {
case METAMASK_USER_DENIED_AUTH: {
dispatch(setWeb3State(Web3State.Locked));
dispatch(
initializeRelayerData({
orders: [],
userOrders: [],
selectedToken,
}),
);
dispatch(getOrderBook());
break;
}
case METAMASK_NOT_INSTALLED: {
dispatch(setWeb3State(Web3State.NotInstalled));
dispatch(
initializeRelayerData({
orders: [],
userOrders: [],
selectedToken,
}),
);
dispatch(getOrderBook());
break;
}
default: {
dispatch(setWeb3State(Web3State.Error));
break;
}
}
}
};
};
export const updateStore = () => {
return async (dispatch: any) => {
try {
const web3Wrapper = await getWeb3WrapperOrThrow();
const [ethAccount] = await web3Wrapper.getAvailableAddressesAsync();
const networkId = await web3Wrapper.getNetworkIdAsync();
const knownTokens = getKnownTokens(networkId);
const tokenBalances = await Promise.all(
knownTokens.getTokens().map(token => tokenToTokenBalance(token, ethAccount)),
);
const wethToken = knownTokens.getWethToken();
const ethBalance = await web3Wrapper.getBalanceInWeiAsync(ethAccount);
const wethBalance = await getTokenBalance(wethToken, ethAccount);
dispatch(getOrderbookAndUserOrders());
dispatch(setTokenBalances(tokenBalances));
dispatch(setEthBalance(ethBalance));
dispatch(setWethBalance(wethBalance));
} catch (error) {
const knownTokens = getKnownTokens(MAINNET_ID);
const selectedToken = knownTokens.getTokenBySymbol('ZRX');
dispatch(setSelectedToken(selectedToken));
dispatch(getOrderBook());
}
};
};
export const getAllOrders = () => {
return async (dispatch: any, getState: any) => {
const state = getState();
const selectedToken = getSelectedToken(state) as Token;
const uiOrders = await getAllOrdersAsUIOrders(selectedToken);
dispatch(setOrders(uiOrders));
};
};
export const getUserOrders = () => {
return async (dispatch: any, getState: any) => {
const state = getState();
const selectedToken = getSelectedToken(state) as Token;
const ethAccount = getEthAccount(state);
const myUIOrders = await getUserOrdersAsUIOrders(selectedToken, ethAccount);
dispatch(setUserOrders(myUIOrders));
};
};
export const cancelOrder = (order: UIOrder) => {
return async (dispatch: any, getState: any) => {
const state = getState();
const selectedToken = getSelectedToken(state) as Token;
await cancelSignedOrder(order.rawOrder);
dispatch(getOrderbookAndUserOrders());
dispatch(
addNotification({
kind: NotificationKind.CancelOrder,
amount: order.size,
token: selectedToken,
timestamp: new Date(),
}),
);
};
};
export const startBuySellLimitSteps = (amount: BigNumber, price: BigNumber, side: OrderSide) => {
return async (dispatch: any) => {
const step: Step = {
kind: StepKind.BuySellLimit,
amount,
price,
side,
};
const pendingSteps: Step[] = [];
dispatch(setStepsModalPendingSteps(pendingSteps));
dispatch(setStepsModalCurrentStep(step));
dispatch(setStepsModalDoneSteps([]));
};
};
export const createSignedOrder = (amount: BigNumber, price: BigNumber, side: OrderSide) => {
return async (dispatch: any, getState: any) => {
const state = getState();
const ethAccount = getEthAccount(state);
const selectedToken = getSelectedToken(state) as Token;
const web3Wrapper = await getWeb3WrapperOrThrow();
const networkId = await web3Wrapper.getNetworkIdAsync();
const contractWrappers = await getContractWrappers();
const wethAddress = getKnownTokens(networkId).getWethToken().address;
const order = buildLimitOrder(
{
account: ethAccount,
amount,
price,
tokenAddress: selectedToken.address,
wethAddress,
exchangeAddress: contractWrappers.exchange.address,
},
side,
);
const provider = new MetamaskSubprovider(web3Wrapper.getProvider());
return signatureUtils.ecSignOrderAsync(provider, order, ethAccount);
};
};
export const submitLimitOrder = (signedOrder: SignedOrder, amount: BigNumber, side: OrderSide) => {
return async (dispatch: any, getState: any) => {
const state = getState();
const selectedToken = getSelectedToken(state) as Token;
const submitResult = await getRelayer().client.submitOrderAsync(signedOrder);
dispatch(getOrderbookAndUserOrders());
dispatch(
addNotification({
kind: NotificationKind.Limit,
amount,
token: selectedToken,
side,
timestamp: new Date(),
}),
);
return submitResult;
};
};
export const submitMarketOrder = (amount: BigNumber, side: OrderSide) => {
return async (dispatch: any, getState: any) => {
const state = getState();
const ethAccount = getEthAccount(state);
const selectedToken = getSelectedToken(state) as Token;
const contractWrappers = await getContractWrappers();
const web3Wrapper = await getWeb3WrapperOrThrow();
const orders = side === OrderSide.Buy ? getOpenSellOrders(state) : getOpenBuyOrders(state);
const [ordersToFill, amounts, canBeFilled] = buildMarketOrders(
{
amount,
orders,
},
side,
);
if (canBeFilled) {
const txHash = await contractWrappers.exchange.batchFillOrdersAsync(
ordersToFill,
amounts,
ethAccount,
TX_DEFAULTS,
);
dispatch(getOrderbookAndUserOrders());
const tx = web3Wrapper.awaitTransactionSuccessAsync(txHash);
dispatch(
addNotification({
kind: NotificationKind.Market,
amount,
token: selectedToken,
side,
tx,
timestamp: new Date(),
}),
);
} else {
window.alert('There are no enough orders to fill this amount');
}
};
};
=======
export * from './blockchain/actions';
export * from './relayer/actions';
export * from './ui/actions';
>>>>>>>
export * from './blockchain/actions';
export * from './relayer/actions';
export * from './ui/actions';
<<<<<<<
};
export const getOrderBook = () => {
return async (dispatch: any) => {
dispatch(getAllOrders());
};
=======
>>>>>>> |
<<<<<<<
import { getMarkets, setMarketTokens } from '../market/actions';
import { getOrderbookAndUserOrders, initializeRelayerData } from '../relayer/actions';
=======
import { setMarketTokens, updateMarketPriceEther } from '../market/actions';
import { getOrderBook, getOrderbookAndUserOrders, initializeRelayerData } from '../relayer/actions';
>>>>>>>
import { getMarkets, setMarketTokens, updateMarketPriceEther } from '../market/actions';
import { getOrderBook, getOrderbookAndUserOrders, initializeRelayerData } from '../relayer/actions';
<<<<<<<
dispatch(getMarkets());
=======
dispatch(updateMarketPriceEther());
>>>>>>>
dispatch(getMarkets());
dispatch(updateMarketPriceEther()); |
<<<<<<<
dispatch(getAllOrders());
dispatch(getUserOrders());
dispatch(
addNotification({
kind: NotificationKind.CancelOrder,
amount: order.size,
token: selectedToken,
timestamp: new Date(),
}),
);
=======
dispatch(getOrderbookAndUserOrders());
>>>>>>>
dispatch(getOrderbookAndUserOrders());
dispatch(
addNotification({
kind: NotificationKind.CancelOrder,
amount: order.size,
token: selectedToken,
timestamp: new Date(),
}),
);
<<<<<<<
dispatch(getAllOrders());
dispatch(getUserOrders());
dispatch(
addNotification({
kind: NotificationKind.Limit,
amount,
token: selectedToken,
side,
timestamp: new Date(),
}),
);
=======
dispatch(getOrderbookAndUserOrders());
>>>>>>>
dispatch(getOrderbookAndUserOrders());
dispatch(
addNotification({
kind: NotificationKind.Limit,
amount,
token: selectedToken,
side,
timestamp: new Date(),
}),
);
<<<<<<<
const txHash = await contractWrappers.exchange.batchFillOrdersAsync(
ordersToFill,
amounts,
ethAccount,
TX_DEFAULTS,
);
dispatch(getAllOrders());
dispatch(getUserOrders());
const tx = web3Wrapper.awaitTransactionSuccessAsync(txHash);
dispatch(
addNotification({
kind: NotificationKind.Market,
amount,
token: selectedToken,
side,
tx,
timestamp: new Date(),
}),
);
=======
await contractWrappers.exchange.batchFillOrdersAsync(ordersToFill, amounts, ethAccount, TX_DEFAULTS);
dispatch(getOrderbookAndUserOrders());
>>>>>>>
const txHash = await contractWrappers.exchange.batchFillOrdersAsync(
ordersToFill,
amounts,
ethAccount,
TX_DEFAULTS,
);
dispatch(getOrderbookAndUserOrders());
const tx = web3Wrapper.awaitTransactionSuccessAsync(txHash);
dispatch(
addNotification({
kind: NotificationKind.Market,
amount,
token: selectedToken,
side,
tx,
timestamp: new Date(),
}),
); |
<<<<<<<
export interface Market {
currencyPair: CurrencyPair;
price: BigNumber | null;
}
=======
export interface CurrencyPairBalance {
quoteBalance: BigNumber;
baseBalance: BigNumber;
}
>>>>>>>
export interface Market {
currencyPair: CurrencyPair;
price: BigNumber | null;
}
export interface CurrencyPairBalance {
quoteBalance: BigNumber;
baseBalance: BigNumber;
} |
<<<<<<<
import { getKnownTokens, getTokenBySymbol, getWethToken } from '../util/known_tokens';
import { buildLimitOrder, buildMarketOrders } from '../util/orders';
=======
import { getKnownTokens } from '../util/known_tokens';
import { buildOrder } from '../util/orders';
>>>>>>>
import { getKnownTokens } from '../util/known_tokens';
import { buildLimitOrder, buildMarketOrders } from '../util/orders'; |
<<<<<<<
};
export const createBuySellLimitSteps = (
baseToken: Token,
quoteToken: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
amount: BigNumber,
price: BigNumber,
side: OrderSide,
): Step[] => {
const buySellLimitFlow: Step[] = [];
let unlockBaseOrQuoteTokenStep;
// unlock base and quote tokens if necessary
unlockBaseOrQuoteTokenStep =
side === OrderSide.Buy
? // If it's a buy -> the quote token has to be unlocked
getUnlockTokenStepIfNeeded(quoteToken, tokenBalances, wethTokenBalance)
: // If it's a sell -> the base token has to be unlocked
getUnlockTokenStepIfNeeded(baseToken, tokenBalances, wethTokenBalance);
if (unlockBaseOrQuoteTokenStep) {
buySellLimitFlow.push(unlockBaseOrQuoteTokenStep);
}
// unlock zrx (for fees) if it's not one of the traded tokens and if the maker fee is positive
if (!isZrx(baseToken.symbol) && !isZrx(quoteToken.symbol) && MAKER_FEE.greaterThan(0)) {
const unlockZrxStep = getUnlockZrxStepIfNeeded(tokenBalances);
if (unlockZrxStep) {
buySellLimitFlow.push(unlockZrxStep);
}
}
// wrap the necessary ether if it is one of the traded tokens
if (isWeth(baseToken.symbol) || isWeth(quoteToken.symbol)) {
const wrapEthStep = getWrapEthStepIfNeeded(amount, price, side, wethTokenBalance);
if (wrapEthStep) {
buySellLimitFlow.push(wrapEthStep);
}
}
buySellLimitFlow.push({
kind: StepKind.BuySellLimit,
amount,
price,
side,
});
return buySellLimitFlow;
};
export const createBuySellMarketSteps = (
baseToken: Token,
quoteToken: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
amount: BigNumber,
side: OrderSide,
): Step[] => {
const buySellMarketFlow: Step[] = [];
const tokenToUnlock = side === OrderSide.Buy ? quoteToken : baseToken;
const unlockTokenStep = getUnlockTokenStepIfNeeded(tokenToUnlock, tokenBalances, wethTokenBalance);
if (unlockTokenStep) {
buySellMarketFlow.push(unlockTokenStep);
}
// unlock zrx (for fees) if the taker fee is positive
if (!isZrx(tokenToUnlock.symbol) && TAKER_FEE.greaterThan(0)) {
const unlockZrxStep = getUnlockZrxStepIfNeeded(tokenBalances);
if (unlockZrxStep) {
buySellMarketFlow.push(unlockZrxStep);
}
}
// todo: wrap ether if necessary
buySellMarketFlow.push({
kind: StepKind.BuySellMarket,
amount,
side,
token: baseToken,
});
return buySellMarketFlow;
};
export const getUnlockTokenStepIfNeeded = (
token: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
): StepToggleTokenLock | null => {
const tokenBalance: TokenBalance = isWeth(token.symbol)
? wethTokenBalance
: (tokenBalances.find(tb => tb.token.symbol === token.symbol) as TokenBalance);
if (tokenBalance.isUnlocked) {
return null;
} else {
return {
kind: StepKind.ToggleTokenLock,
token: tokenBalance.token,
isUnlocked: false,
context: 'order',
};
}
};
export const getWrapEthStepIfNeeded = (
amount: BigNumber,
price: BigNumber,
side: OrderSide,
wethTokenBalance: TokenBalance,
): StepWrapEth | null => {
// Weth needed only when creating a buy order
if (side === OrderSide.Sell) {
return null;
}
const wethAmount = amount.mul(price);
const wethBalance = wethTokenBalance.balance;
const deltaWeth = wethBalance.sub(wethAmount);
// Need to wrap eth only if weth balance is not enough
if (deltaWeth.lessThan(0)) {
return {
kind: StepKind.WrapEth,
currentWethBalance: wethBalance,
newWethBalance: wethAmount,
context: 'order',
};
} else {
return null;
}
};
export const getUnlockZrxStepIfNeeded = (tokenBalances: TokenBalance[]): StepToggleTokenLock | null => {
const zrxTokenBalance: TokenBalance = tokenBalances.find(tokenBalance =>
isZrx(tokenBalance.token.symbol),
) as TokenBalance;
if (zrxTokenBalance.isUnlocked) {
return null;
} else {
return {
kind: StepKind.ToggleTokenLock,
token: zrxTokenBalance.token,
isUnlocked: false,
context: 'order',
};
}
=======
};
export const makeGetProgress = (beginning: number, estimatedTxTimeMs: number) => (now: number) => {
const elapsedMs = now - beginning;
const progress = Math.round((elapsedMs / estimatedTxTimeMs) * 100);
return Math.max(0, Math.min(progress, 100));
>>>>>>>
};
export const makeGetProgress = (beginning: number, estimatedTxTimeMs: number) => (now: number) => {
const elapsedMs = now - beginning;
const progress = Math.round((elapsedMs / estimatedTxTimeMs) * 100);
return Math.max(0, Math.min(progress, 100));
};
export const createBuySellLimitSteps = (
baseToken: Token,
quoteToken: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
amount: BigNumber,
price: BigNumber,
side: OrderSide,
): Step[] => {
const buySellLimitFlow: Step[] = [];
let unlockBaseOrQuoteTokenStep;
// unlock base and quote tokens if necessary
unlockBaseOrQuoteTokenStep =
side === OrderSide.Buy
? // If it's a buy -> the quote token has to be unlocked
getUnlockTokenStepIfNeeded(quoteToken, tokenBalances, wethTokenBalance)
: // If it's a sell -> the base token has to be unlocked
getUnlockTokenStepIfNeeded(baseToken, tokenBalances, wethTokenBalance);
if (unlockBaseOrQuoteTokenStep) {
buySellLimitFlow.push(unlockBaseOrQuoteTokenStep);
}
// unlock zrx (for fees) if it's not one of the traded tokens and if the maker fee is positive
if (!isZrx(baseToken.symbol) && !isZrx(quoteToken.symbol) && MAKER_FEE.greaterThan(0)) {
const unlockZrxStep = getUnlockZrxStepIfNeeded(tokenBalances);
if (unlockZrxStep) {
buySellLimitFlow.push(unlockZrxStep);
}
}
// wrap the necessary ether if it is one of the traded tokens
if (isWeth(baseToken.symbol) || isWeth(quoteToken.symbol)) {
const wrapEthStep = getWrapEthStepIfNeeded(amount, price, side, wethTokenBalance);
if (wrapEthStep) {
buySellLimitFlow.push(wrapEthStep);
}
}
buySellLimitFlow.push({
kind: StepKind.BuySellLimit,
amount,
price,
side,
});
return buySellLimitFlow;
};
export const createBuySellMarketSteps = (
baseToken: Token,
quoteToken: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
amount: BigNumber,
side: OrderSide,
): Step[] => {
const buySellMarketFlow: Step[] = [];
const tokenToUnlock = side === OrderSide.Buy ? quoteToken : baseToken;
const unlockTokenStep = getUnlockTokenStepIfNeeded(tokenToUnlock, tokenBalances, wethTokenBalance);
if (unlockTokenStep) {
buySellMarketFlow.push(unlockTokenStep);
}
// unlock zrx (for fees) if the taker fee is positive
if (!isZrx(tokenToUnlock.symbol) && TAKER_FEE.greaterThan(0)) {
const unlockZrxStep = getUnlockZrxStepIfNeeded(tokenBalances);
if (unlockZrxStep) {
buySellMarketFlow.push(unlockZrxStep);
}
}
// todo: wrap ether if necessary
buySellMarketFlow.push({
kind: StepKind.BuySellMarket,
amount,
side,
token: baseToken,
});
return buySellMarketFlow;
};
export const getUnlockTokenStepIfNeeded = (
token: Token,
tokenBalances: TokenBalance[],
wethTokenBalance: TokenBalance,
): StepToggleTokenLock | null => {
const tokenBalance: TokenBalance = isWeth(token.symbol)
? wethTokenBalance
: (tokenBalances.find(tb => tb.token.symbol === token.symbol) as TokenBalance);
if (tokenBalance.isUnlocked) {
return null;
} else {
return {
kind: StepKind.ToggleTokenLock,
token: tokenBalance.token,
isUnlocked: false,
context: 'order',
};
}
};
export const getWrapEthStepIfNeeded = (
amount: BigNumber,
price: BigNumber,
side: OrderSide,
wethTokenBalance: TokenBalance,
): StepWrapEth | null => {
// Weth needed only when creating a buy order
if (side === OrderSide.Sell) {
return null;
}
const wethAmount = amount.mul(price);
const wethBalance = wethTokenBalance.balance;
const deltaWeth = wethBalance.sub(wethAmount);
// Need to wrap eth only if weth balance is not enough
if (deltaWeth.lessThan(0)) {
return {
kind: StepKind.WrapEth,
currentWethBalance: wethBalance,
newWethBalance: wethAmount,
context: 'order',
};
} else {
return null;
}
};
export const getUnlockZrxStepIfNeeded = (tokenBalances: TokenBalance[]): StepToggleTokenLock | null => {
const zrxTokenBalance: TokenBalance = tokenBalances.find(tokenBalance =>
isZrx(tokenBalance.token.symbol),
) as TokenBalance;
if (zrxTokenBalance.isUnlocked) {
return null;
} else {
return {
kind: StepKind.ToggleTokenLock,
token: zrxTokenBalance.token,
isUnlocked: false,
context: 'order',
};
} |
<<<<<<<
import { BlockchainState, RelayerState, StoreState, UIState, Web3State } from '../util/types';
=======
import { BlockchainState, RelayerState, Step, StepsModalState, StoreState, UIState, Web3State } from '../util/types';
>>>>>>>
import { BlockchainState, RelayerState, Step, StepsModalState, StoreState, UIState, Web3State } from '../util/types';
<<<<<<<
const initialUIState: UIState = {
notifications: [],
hasUnreadNotifications: false,
};
=======
const initialStepsModalState: StepsModalState = {
doneSteps: [],
currentStep: null,
pendingSteps: [],
};
const initialUIState: UIState = {
stepsModal: initialStepsModalState,
};
>>>>>>>
const initialStepsModalState: StepsModalState = {
doneSteps: [],
currentStep: null,
pendingSteps: [],
};
const initialUIState: UIState = {
notifications: [],
hasUnreadNotifications: false,
stepsModal: initialStepsModalState,
};
<<<<<<<
export function ui(state: UIState = initialUIState, action: RootAction): UIState {
switch (action.type) {
case getType(actions.setHasUnreadNotifications):
return { ...state, hasUnreadNotifications: action.payload };
case getType(actions.addNotification):
return {
...state,
notifications: [action.payload, ...state.notifications],
hasUnreadNotifications: true,
};
}
return state;
}
=======
export function stepsModal(state: StepsModalState = initialStepsModalState, action: RootAction): StepsModalState {
switch (action.type) {
case getType(actions.setStepsModalDoneSteps):
return { ...state, doneSteps: action.payload };
case getType(actions.setStepsModalPendingSteps):
return { ...state, pendingSteps: action.payload };
case getType(actions.setStepsModalCurrentStep):
return { ...state, currentStep: action.payload };
case getType(actions.stepsModalAdvanceStep):
const { doneSteps, currentStep, pendingSteps } = state;
if (pendingSteps.length === 0 && currentStep !== null) {
return {
...state,
doneSteps: doneSteps.concat([currentStep as Step]),
currentStep: null,
};
} else {
return {
...state,
pendingSteps: pendingSteps.slice(1),
doneSteps: doneSteps.concat([currentStep as Step]),
currentStep: pendingSteps[0] as Step,
};
}
case getType(actions.stepsModalReset):
return initialStepsModalState;
}
return state;
}
export function ui(state: UIState = initialUIState, action: RootAction): UIState {
return {
...state,
stepsModal: stepsModal(state.stepsModal, action),
};
}
>>>>>>>
export function stepsModal(state: StepsModalState = initialStepsModalState, action: RootAction): StepsModalState {
switch (action.type) {
case getType(actions.setStepsModalDoneSteps):
return { ...state, doneSteps: action.payload };
case getType(actions.setStepsModalPendingSteps):
return { ...state, pendingSteps: action.payload };
case getType(actions.setStepsModalCurrentStep):
return { ...state, currentStep: action.payload };
case getType(actions.stepsModalAdvanceStep):
const { doneSteps, currentStep, pendingSteps } = state;
if (pendingSteps.length === 0 && currentStep !== null) {
return {
...state,
doneSteps: doneSteps.concat([currentStep as Step]),
currentStep: null,
};
} else {
return {
...state,
pendingSteps: pendingSteps.slice(1),
doneSteps: doneSteps.concat([currentStep as Step]),
currentStep: pendingSteps[0] as Step,
};
}
case getType(actions.stepsModalReset):
return initialStepsModalState;
}
return state;
}
export function ui(state: UIState = initialUIState, action: RootAction): UIState {
switch (action.type) {
case getType(actions.setHasUnreadNotifications):
return { ...state, hasUnreadNotifications: action.payload };
case getType(actions.addNotification):
return {
...state,
notifications: [action.payload, ...state.notifications],
hasUnreadNotifications: true,
};
}
return {
...state,
stepsModal: stepsModal(state.stepsModal, action),
};
} |
<<<<<<<
import { getEthereumPriceInUSD } from './market_prices';
import { tokenAmountInUnits } from './tokens';
import { OrderSide } from './types';
=======
import { OrderSide, UIOrder } from '../util/types';
>>>>>>>
import { OrderSide, UIOrder } from '../util/types';
import { getEthereumPriceInUSD } from './market_prices';
import { tokenAmountInUnits } from './tokens';
<<<<<<<
};
export const orderDetailsFeeEther = (
makerAmount: BigNumber,
takerAmount: BigNumber,
orderType: OrderSide,
makerFeeConstant: string = MAKER_FEE,
takerFeeConstant: string = TAKER_FEE,
tokenDecimals: number = 18,
): BigNumber => {
let totalFee = new BigNumber(1);
// Convert the makerAmount
const makerAmountConverted = new BigNumber(tokenAmountInUnits(makerAmount, tokenDecimals));
if (orderType === OrderSide.Sell) {
// Calculate makerFee
const makerFeeWithoutPrice = makerAmountConverted.mul(makerFeeConstant);
const makerFeeWithPrice = makerFeeWithoutPrice.mul(takerAmount.div(makerAmountConverted));
// Calculate takerFee
const takerFee = takerAmount.mul(takerFeeConstant);
// Total plus
totalFee = makerFeeWithPrice.plus(takerFee);
}
if (orderType === OrderSide.Buy) {
// Calculate makerFee
const makerFee = makerAmountConverted.mul(makerFeeConstant);
// Calculate takerFee
const takerFeeWithoutPrice = takerAmount.mul(takerFeeConstant);
const takerFeeWithPrice = takerFeeWithoutPrice.mul(makerAmountConverted.div(takerAmount));
// Total plus
totalFee = takerFeeWithPrice.plus(makerFee);
}
return totalFee;
};
export const orderDetailsFeeDollar = async (
makerAmount: BigNumber,
takerAmount: BigNumber,
orderType: OrderSide,
makerFeeConstant: string = MAKER_FEE,
takerFeeConstant: string = TAKER_FEE,
tokenDecimals: number = 18,
): Promise<any> => {
const priceInEther = orderDetailsFeeEther(
makerAmount,
takerAmount,
orderType,
makerFeeConstant,
takerFeeConstant,
tokenDecimals,
);
const priceInDollar = await getEthereumPriceInUSD();
return priceInEther.mul(priceInDollar);
=======
};
export const buildMarketOrders = (
params: BuildMarketOrderParams,
side: OrderSide,
): [SignedOrder[], BigNumber[], boolean] => {
const { amount, orders } = params;
// sort orders from best to worse
const sortedOrders = orders.sort((a, b) => {
if (side === OrderSide.Buy) {
return a.price.comparedTo(b.price);
} else {
return b.price.comparedTo(a.price);
}
});
const ordersToFill: SignedOrder[] = [];
const amounts: BigNumber[] = [];
let filledAmount = new BigNumber(0);
for (let i = 0; i < sortedOrders.length && filledAmount.lessThan(amount); i++) {
const order = sortedOrders[i];
ordersToFill.push(order.rawOrder);
const available = order.size.sub(order.filled);
if (filledAmount.plus(available).greaterThan(amount)) {
amounts.push(amount.sub(filledAmount));
filledAmount = amount;
} else {
amounts.push(available);
filledAmount = filledAmount.plus(available);
}
if (side === OrderSide.Buy) {
amounts[i] = amounts[i].mul(order.price);
}
}
const canBeFilled = filledAmount.eq(amount);
const roundedAmounts = amounts.map(a => a.ceil());
return [ordersToFill, roundedAmounts, canBeFilled];
>>>>>>>
};
export const buildMarketOrders = (
params: BuildMarketOrderParams,
side: OrderSide,
): [SignedOrder[], BigNumber[], boolean] => {
const { amount, orders } = params;
// sort orders from best to worse
const sortedOrders = orders.sort((a, b) => {
if (side === OrderSide.Buy) {
return a.price.comparedTo(b.price);
} else {
return b.price.comparedTo(a.price);
}
});
const ordersToFill: SignedOrder[] = [];
const amounts: BigNumber[] = [];
let filledAmount = new BigNumber(0);
for (let i = 0; i < sortedOrders.length && filledAmount.lessThan(amount); i++) {
const order = sortedOrders[i];
ordersToFill.push(order.rawOrder);
const available = order.size.sub(order.filled);
if (filledAmount.plus(available).greaterThan(amount)) {
amounts.push(amount.sub(filledAmount));
filledAmount = amount;
} else {
amounts.push(available);
filledAmount = filledAmount.plus(available);
}
if (side === OrderSide.Buy) {
amounts[i] = amounts[i].mul(order.price);
}
}
const canBeFilled = filledAmount.eq(amount);
const roundedAmounts = amounts.map(a => a.ceil());
return [ordersToFill, roundedAmounts, canBeFilled];
};
export const orderDetailsFeeEther = (
makerAmount: BigNumber,
takerAmount: BigNumber,
orderType: OrderSide,
makerFeeConstant: string = MAKER_FEE,
takerFeeConstant: string = TAKER_FEE,
tokenDecimals: number = 18,
): BigNumber => {
let totalFee = new BigNumber(1);
// Convert the makerAmount
const makerAmountConverted = new BigNumber(tokenAmountInUnits(makerAmount, tokenDecimals));
if (orderType === OrderSide.Sell) {
// Calculate makerFee
const makerFeeWithoutPrice = makerAmountConverted.mul(makerFeeConstant);
const makerFeeWithPrice = makerFeeWithoutPrice.mul(takerAmount.div(makerAmountConverted));
// Calculate takerFee
const takerFee = takerAmount.mul(takerFeeConstant);
// Total plus
totalFee = makerFeeWithPrice.plus(takerFee);
}
if (orderType === OrderSide.Buy) {
// Calculate makerFee
const makerFee = makerAmountConverted.mul(makerFeeConstant);
// Calculate takerFee
const takerFeeWithoutPrice = takerAmount.mul(takerFeeConstant);
const takerFeeWithPrice = takerFeeWithoutPrice.mul(makerAmountConverted.div(takerAmount));
// Total plus
totalFee = takerFeeWithPrice.plus(makerFee);
}
return totalFee;
};
export const orderDetailsFeeDollar = async (
makerAmount: BigNumber,
takerAmount: BigNumber,
orderType: OrderSide,
makerFeeConstant: string = MAKER_FEE,
takerFeeConstant: string = TAKER_FEE,
tokenDecimals: number = 18,
): Promise<any> => {
const priceInEther = orderDetailsFeeEther(
makerAmount,
takerAmount,
orderType,
makerFeeConstant,
takerFeeConstant,
tokenDecimals,
);
const priceInDollar = await getEthereumPriceInUSD();
return priceInEther.mul(priceInDollar); |
<<<<<<<
import { assetDataUtils, BigNumber, DutchAuctionWrapper, generatePseudoRandomSalt, Order, SignedOrder } from '0x.js';
=======
import { assetDataUtils, BigNumber, Order, SignedOrder } from '0x.js';
>>>>>>>
import { assetDataUtils, BigNumber, DutchAuctionWrapper, Order, SignedOrder } from '0x.js'; |
<<<<<<<
{ side: OrderSide.Sell, size: new BigNumber(1), price: new BigNumber('8.1') },
{ side: OrderSide.Sell, size: new BigNumber(2), price: new BigNumber('8.0') },
=======
{
side: UIOrderSide.Sell,
size: new BigNumber(1),
price: new BigNumber('8.1'),
},
{
side: UIOrderSide.Sell,
size: new BigNumber(2),
price: new BigNumber('8.0'),
},
>>>>>>>
{
side: OrderSide.Sell,
size: new BigNumber(1),
price: new BigNumber('8.1'),
},
{
side: OrderSide.Sell,
size: new BigNumber(2),
price: new BigNumber('8.0'),
},
<<<<<<<
{ side: OrderSide.Buy, size: new BigNumber(1), price: new BigNumber('7.5') },
{ side: OrderSide.Buy, size: new BigNumber(2), price: new BigNumber('7.3') },
=======
{
side: UIOrderSide.Buy,
size: new BigNumber(1),
price: new BigNumber('7.5'),
},
{
side: UIOrderSide.Buy,
size: new BigNumber(2),
price: new BigNumber('7.3'),
},
>>>>>>>
{
side: OrderSide.Buy,
size: new BigNumber(1),
price: new BigNumber('7.5'),
},
{
side: OrderSide.Buy,
size: new BigNumber(2),
price: new BigNumber('7.3'),
}, |
<<<<<<<
dispatch(getOrderbookAndUserOrders());
=======
export const submitLimitOrder = (signedOrder: SignedOrder) => {
return async (dispatch: any) => {
const submitResult = await getRelayer().client.submitOrderAsync(signedOrder);
dispatch(getAllOrders());
dispatch(getUserOrders());
return submitResult;
>>>>>>>
export const submitLimitOrder = (signedOrder: SignedOrder) => {
return async (dispatch: any) => {
const submitResult = await getRelayer().client.submitOrderAsync(signedOrder);
dispatch(getOrderbookAndUserOrders());
return submitResult; |
<<<<<<<
const baseToken = getBaseToken(state) as Token;
const contractWrappers = await getContractWrappers();
const web3Wrapper = await getWeb3WrapperOrThrow();
=======
>>>>>>>
<<<<<<<
const txHash = await contractWrappers.exchange.batchFillOrdersAsync(
ordersToFill,
amounts,
ethAccount,
TX_DEFAULTS,
);
dispatch(getOrderbookAndUserOrders());
const tx = web3Wrapper.awaitTransactionSuccessAsync(txHash);
dispatch(
addNotification({
kind: NotificationKind.Market,
amount,
token: baseToken,
side,
tx,
timestamp: new Date(),
}),
);
=======
const contractWrappers = await getContractWrappers();
return contractWrappers.exchange.batchFillOrdersAsync(ordersToFill, amounts, ethAccount, TX_DEFAULTS);
>>>>>>>
const baseToken = getBaseToken(state) as Token;
const contractWrappers = await getContractWrappers();
const web3Wrapper = await getWeb3WrapperOrThrow();
const txHash = await contractWrappers.exchange.batchFillOrdersAsync(
ordersToFill,
amounts,
ethAccount,
TX_DEFAULTS,
);
dispatch(getOrderbookAndUserOrders());
const tx = web3Wrapper.awaitTransactionSuccessAsync(txHash);
dispatch(
addNotification({
kind: NotificationKind.Market,
amount,
token: baseToken,
side,
tx,
timestamp: new Date(),
}),
);
return txHash; |
<<<<<<<
import { cancelSignedOrder } from '../../services/orders';
=======
import { TX_DEFAULTS, ZERO_ADDRESS } from '../../common/constants';
>>>>>>>
import { cancelSignedOrder } from '../../services/orders';
import { TX_DEFAULTS, ZERO_ADDRESS } from '../../common/constants';
<<<<<<<
};
export const cancelOrderCollectible: ThunkCreator = (order: any) => {
return async (dispatch, getState, { getContractWrappers, getWeb3Wrapper }) => {
const state = getState();
const gasPrice = getGasPriceInWei(state);
const txPromise = cancelSignedOrder(order, gasPrice);
// tslint:disable-next-line:no-floating-promises no-unsafe-any
txPromise.then(transaction => {
// tslint:disable-next-line:no-floating-promises
dispatch(getAllCollectibles());
});
};
=======
};
const isDutchAuction = (order: SignedOrder) => {
return false;
};
export const submitBuyCollectible: ThunkCreator<Promise<string>> = (order: SignedOrder, ethAccount: string) => {
return async (dispatch, getState, { getContractWrappers }) => {
const contractWrappers = await getContractWrappers();
if (isDutchAuction(order)) {
throw new Error('not implemented');
} else {
return contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
[order],
order.makerAssetAmount,
ethAccount,
order.takerAssetAmount,
[],
0,
ZERO_ADDRESS,
TX_DEFAULTS,
);
}
};
>>>>>>>
};
const isDutchAuction = (order: SignedOrder) => {
return false;
};
export const submitBuyCollectible: ThunkCreator<Promise<string>> = (order: SignedOrder, ethAccount: string) => {
return async (dispatch, getState, { getContractWrappers }) => {
const contractWrappers = await getContractWrappers();
if (isDutchAuction(order)) {
throw new Error('not implemented');
} else {
return contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
[order],
order.makerAssetAmount,
ethAccount,
order.takerAssetAmount,
[],
0,
ZERO_ADDRESS,
TX_DEFAULTS,
);
}
};
};
export const cancelOrderCollectible: ThunkCreator = (order: any) => {
return async (dispatch, getState, { getContractWrappers, getWeb3Wrapper }) => {
const state = getState();
const gasPrice = getGasPriceInWei(state);
const txPromise = cancelSignedOrder(order, gasPrice);
// tslint:disable-next-line:no-floating-promises no-unsafe-any
txPromise.then(transaction => {
// tslint:disable-next-line:no-floating-promises
dispatch(getAllCollectibles());
});
}; |
<<<<<<<
export const getMarket = (state: StoreState) => state.market;
export const getMarketPrices = (state: StoreState) => state.market.prices;
export const getMarketPriceEther = (state: StoreState) => state.market.prices.eth;
=======
export const getCurrencyPair = (state: StoreState) => state.market.currencyPair;
export const getBaseToken = (state: StoreState) => state.market.baseToken;
export const getQuoteToken = (state: StoreState) => state.market.quoteToken;
>>>>>>>
export const getCurrencyPair = (state: StoreState) => state.market.currencyPair;
export const getBaseToken = (state: StoreState) => state.market.baseToken;
export const getQuoteToken = (state: StoreState) => state.market.quoteToken;
export const getMarket = (state: StoreState) => state.market;
export const getMarketPrices = (state: StoreState) => state.market.prices;
export const getMarketPriceEther = (state: StoreState) => state.market.prices.eth; |
<<<<<<<
markets: null,
=======
ethInUsd: null,
>>>>>>>
markets: null,
ethInUsd: null,
<<<<<<<
case getType(actions.setMarkets):
return { ...state, markets: action.payload };
=======
case getType(actions.fetchMarketPriceEtherUpdate):
return { ...state, ethInUsd: action.payload };
case getType(actions.fetchMarketPriceEtherStart):
return state;
case getType(actions.fetchMarketPriceEtherError):
return state;
>>>>>>>
case getType(actions.setMarkets):
return { ...state, markets: action.payload };
case getType(actions.fetchMarketPriceEtherUpdate):
return { ...state, ethInUsd: action.payload };
case getType(actions.fetchMarketPriceEtherStart):
return state;
case getType(actions.fetchMarketPriceEtherError):
return state; |
<<<<<<<
import {
ICellTools, CellTools, INotebookTracker
=======
/* import {
ICellTools, NotebookActions, CellTools, INotebookTracker
} from '@jupyterlab/notebook'; */
import {
ICellTools, NotebookActions, CellTools, INotebookTracker
>>>>>>>
import {
ICellTools, CellTools, INotebookTracker
<<<<<<<
// import runCell from '@jupyterlab/notebook';
=======
>>>>>>>
<<<<<<<
//let session = this.notebookTracker.currentWidget.session;
=======
/* let session = this.notebookTracker.currentWidget.session;
>>>>>>>
//let session = this.notebookTracker.currentWidget.session; |
<<<<<<<
"7b77a6e",
"1581527146",
"fix",
"contacts",
"Don't include contacts' nicknames when composing emails to them"
],
[
=======
"97b6f79",
"1581532103",
"fix",
"calendar",
"Make the datetime picker show up again"
],
[
>>>>>>>
"7b77a6e",
"1581527146",
"fix",
"contacts",
"Don't include contacts' nicknames when composing emails to them"
],
[
"97b6f79",
"1581532103",
"fix",
"calendar",
"Make the datetime picker show up again"
],
[ |
<<<<<<<
"ef90f54",
"1582728986",
"fix",
"shopping-cart",
"Increase quantities in cart when adding duplicate products"
],
[
"e34f447",
"1582549440",
"fix",
"ci",
"Bump the revision number for commit log tests"
],
[
=======
"bc4f9f3",
"1582737676",
"feat",
"build",
"Add an option to enable Sentry monitoring"
],
[
"d399270",
"1582803126",
"feat",
"app",
"Add an indicator if the API connection is lost"
],
[
"72d4d93",
"1582650205",
"fix",
"menu",
"Bugfix."
],
[
"be967ed",
"1582561863",
"fix",
"menu",
"Delint."
],
[
"2276d18",
"1582552419",
"feat",
"update-notifier",
"Make the update notifier link to changelog for changes"
],
[
"e34f447",
"1582549440",
"fix",
"ci",
"Bump the revision number for commit log tests"
],
[
>>>>>>>
"ef90f54",
"1582728986",
"fix",
"shopping-cart",
"Increase quantities in cart when adding duplicate products"
],
[
"bc4f9f3",
"1582737676",
"feat",
"build",
"Add an option to enable Sentry monitoring"
],
[
"d399270",
"1582803126",
"feat",
"app",
"Add an indicator if the API connection is lost"
],
[
"72d4d93",
"1582650205",
"fix",
"menu",
"Bugfix."
],
[
"be967ed",
"1582561863",
"fix",
"menu",
"Delint."
],
[
"2276d18",
"1582552419",
"feat",
"update-notifier",
"Make the update notifier link to changelog for changes"
],
[
"e34f447",
"1582549440",
"fix",
"ci",
"Bump the revision number for commit log tests"
],
[ |
<<<<<<<
| 'FF_62'
=======
>>>>>>> |
<<<<<<<
* we look at Z/Y's predecessors, the best we can say is ["A"] without getting
* into the details of which of Z/Y's descendant nodes have predecessors to
=======
* we look at Z/Y's predecessors, the best we can say is ['A'] without getting
* into the details of which of of Z/Y's descendant nodes have predecessors to
>>>>>>>
* we look at Z/Y's predecessors, the best we can say is ['A'] without getting
* into the details of which of Z/Y's descendant nodes have predecessors to |
<<<<<<<
var actionBar = this.actionBar;
if(actionBar === undefined) {
actionBar = new actionBarModule.ActionBar();
}
actionBar.title = this._associatedExampleMeta.title;
=======
>>>>>>> |
<<<<<<<
name: 'Ruby on Rails',
description: `Rails is a web application development framework written in the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks.`,
summary: `Ruby on Rails is a web framework that allows web designers and developers to implement dynamic, fully featured web applications. `,
related_guides: [
{
title: 'Ruby on Rails with NGINX On Debian 9',
href: 'https://www.linode.com/docs/development/ror/ruby-on-rails-nginx-debian/'
},
],
related_info: [
{
title: 'https://rubyonrails.org/',
href: 'https://rubyonrails.org/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]:3000</em> in a browser.`
],
logo_url: 'assets/rubyonrails_color.svg'
},
{
=======
name: 'Prometheus',
description: `Prometheus is a powerful monitoring software tool that collects metrics from configurable data points at given intervals, evaluates rule expressions, and can trigger alerts if some condition is observed.`,
summary:
'Gain metrics and receive alerts with this open-source monitoring tool.',
related_info: [
{
title: 'https://prometheus.io/',
href: 'https://prometheus.io/'
}
],
logo_url: 'assets/prometheus_color.svg'
},
{
>>>>>>>
name: 'Ruby on Rails',
description: `Rails is a web application development framework written in the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks.`,
summary: `Ruby on Rails is a web framework that allows web designers and developers to implement dynamic, fully featured web applications. `,
related_guides: [
{
title: 'Ruby on Rails with NGINX On Debian 9',
href: 'https://www.linode.com/docs/development/ror/ruby-on-rails-nginx-debian/'
},
],
related_info: [
{
title: 'https://rubyonrails.org/',
href: 'https://rubyonrails.org/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]:3000</em> in a browser.`
],
logo_url: 'assets/rubyonrails_color.svg'
},
{
name: 'Prometheus',
description: `Prometheus is a powerful monitoring software tool that collects metrics from configurable data points at given intervals, evaluates rule expressions, and can trigger alerts if some condition is observed.`,
summary:
'Gain metrics and receive alerts with this open-source monitoring tool.',
related_info: [
{
title: 'https://prometheus.io/',
href: 'https://prometheus.io/'
}
],
logo_url: 'assets/prometheus_color.svg'
},
{ |
<<<<<<<
name: 'Ruby on Rails',
description: `Rails is a web application development framework written in the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks.`,
summary: `Ruby on Rails is a web framework that allows web designers and developers to implement dynamic, fully featured web applications. `,
related_guides: [
{
title: 'Ruby on Rails with NGINX On Debian 9',
href: 'https://www.linode.com/docs/development/ror/ruby-on-rails-nginx-debian/'
},
],
related_info: [
{
title: 'https://rubyonrails.org/',
href: 'https://rubyonrails.org/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]:3000</em> in a browser.`
],
logo_url: 'assets/rubyonrails_color.svg'
},
{
=======
name: 'phpMyAdmin',
description: `phpMyAdmin is a web application that provides a GUI to aid in MySQL and MariaDB database administration. It supports multiple database servers and is a robust and easy alternative to using the MySQL command line client.`,
summary: `An easy to use web application that simplifies the management of your MySQL and MariaDB databases.`,
related_guides: [
{
title: 'How to Install and Configure phpMyAdmin on Debian 8',
href:
'https://www.linode.com/docs/databases/mysql/install-and-configure-phpmyadmin-on-debian-8/'
},
],
related_info: [
{
title: 'https://www.phpmyadmin.net/',
href: 'https://www.phpmyadmin.net/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]/phpmyadmin</em> in a browser.`
],
logo_url: 'assets/phpmyadmin_color.svg'
},
{
>>>>>>>
name: 'Ruby on Rails',
description: `Rails is a web application development framework written in the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks.`,
summary: `Ruby on Rails is a web framework that allows web designers and developers to implement dynamic, fully featured web applications. `,
related_guides: [
{
title: 'Ruby on Rails with NGINX On Debian 9',
href: 'https://www.linode.com/docs/development/ror/ruby-on-rails-nginx-debian/'
},
],
related_info: [
{
title: 'https://rubyonrails.org/',
href: 'https://rubyonrails.org/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]:3000</em> in a browser.`
],
logo_url: 'assets/rubyonrails_color.svg'
},
{
name: 'phpMyAdmin',
description: `phpMyAdmin is a web application that provides a GUI to aid in MySQL and MariaDB database administration. It supports multiple database servers and is a robust and easy alternative to using the MySQL command line client.`,
summary: `An easy to use web application that simplifies the management of your MySQL and MariaDB databases.`,
related_guides: [
{
title: 'How to Install and Configure phpMyAdmin on Debian 8',
href:
'https://www.linode.com/docs/databases/mysql/install-and-configure-phpmyadmin-on-debian-8/'
},
],
related_info: [
{
title: 'https://www.phpmyadmin.net/',
href: 'https://www.phpmyadmin.net/'
},
],
tips: [
`Once the script finishes, go to <em>https://[your-Linode's-IP-address]/phpmyadmin</em> in a browser.`
],
logo_url: 'assets/phpmyadmin_color.svg'
},
{ |
<<<<<<<
'401697': 'WordPress - Latest One-Click',
'604068': 'Shadowsocks - One-Click'
=======
'401697': 'WordPress - Latest One-Click',
'595742': 'cPanel One-Click',
'593835': 'Plesk One-Click'
>>>>>>>
'401697': 'WordPress - Latest One-Click',
'595742': 'cPanel One-Click',
'593835': 'Plesk One-Click',
'604068': 'Shadowsocks - One-Click' |
<<<<<<<
if (this.pageManagers.length && (this.currentPage > 0)) {
const { pageHeadingText } = this.pageManagers[this.currentPage - 1];
return getPrevPageParam(this.currentPage, pageHeadingText!);
=======
if (this.pageManagers.length) {
const currentPage = this.inReview ? this.lastPage + 1 : this.currentPage;
if (currentPage > 0) {
const { pageHeadingText } = this.pageManagers[currentPage - 1];
return getPrevPageParam(currentPage, pageHeadingText);
}
>>>>>>>
if (this.pageManagers.length) {
const currentPage = this.inReview ? this.lastPage + 1 : this.currentPage;
if (currentPage > 0) {
const { pageHeadingText } = this.pageManagers[currentPage - 1];
return getPrevPageParam(currentPage, pageHeadingText!);
} |
<<<<<<<
'401697': 'WordPress - Latest One-Click',
'606691': 'LEMP One-Click'
=======
'401697': 'WordPress - Latest One-Click',
'595742': 'cPanel One-Click',
'593835': 'Plesk One-Click'
>>>>>>>
'401697': 'WordPress - Latest One-Click',
'595742': 'cPanel One-Click',
'593835': 'Plesk One-Click',
'606691': 'LEMP One-Click' |
<<<<<<<
//this.pipeline.push(new ex.CollisionDetectionModule());
this.pipeline.push(new ex.OffscreenCullingModule());
this.pipeline.push(new ex.EventPropagationModule());
=======
this.pipeline.push(new ex.CollisionDetectionModule());
this.pipeline.push(new ex.OffscreenCullingModule());
this.pipeline.push(new ex.InputPropagationModule());
>>>>>>>
//this.pipeline.push(new ex.CollisionDetectionModule());
this.pipeline.push(new ex.OffscreenCullingModule());
this.pipeline.push(new ex.InputPropagationModule()); |
<<<<<<<
=======
import Storage = require("./Storage");
import UriLabeller = require("./UriLabeller");
>>>>>>>
import UriLabeller = require("./UriLabeller");
<<<<<<<
result.push(<IMetadataItem>{
label: "license",
value: this.manifest.getLicense()
=======
metadata.unshift({
"label": "license",
"value": this.licenseFormatter.format(this.manifest.getLicense())
>>>>>>>
result.push(<IMetadataItem>{
label: "license",
value: this.licenseFormatter.format(this.manifest.getLicense()) |
<<<<<<<
=======
import LoginDialogue = require("../../modules/uv-dialogues-module/LoginDialogue");
import LoginWarningMessages = require("./LoginWarningMessages");
import Metric = require("../../modules/uv-shared-module/Metric");
import {MetricType} from "../../modules/uv-shared-module/MetricType";
import Params = require("../../Params");
import RestrictedDialogue = require("../../modules/uv-dialogues-module/RestrictedDialogue");
import Shell = require("./Shell");
>>>>>>>
<<<<<<<
this.fire(BaseEvents.CREATE, {
data: this.data,
=======
this._parseMetrics();
if (!this.isReload && Utils.Documents.isInIFrame()){
// communication with parent frame (if it exists).
this.bootstrapper.socket = new easyXDM.Socket({
onMessage: (message, origin) => {
message = $.parseJSON(message);
this.handleParentFrameEvent(message);
}
});
}
this.triggerSocket(BaseCommands.LOAD, {
bootstrapper: {
config: this.bootstrapper.config,
params: this.bootstrapper.params
},
>>>>>>>
this.fire(BaseEvents.CREATE, {
data: this.data,
<<<<<<<
if (this.metric !== metric) {
this.metric = metric;
$.publish(BaseEvents.METRIC_CHANGED);
=======
if (this.metric !== metric.type) {
this.metric = metric.type;
$.publish(BaseCommands.METRIC_CHANGED);
>>>>>>>
if (this.metric !== metric.type) {
this.metric = metric.type;
$.publish(BaseCommands.METRIC_CHANGED); |
<<<<<<<
export class Metric {
constructor(public minWidth: number, public maxWidth: number) {
=======
import {MetricType} from "./MetricType";
class Metric {
constructor(public type: MetricType, public minWidth: number, public maxWidth: number) {
>>>>>>>
import {MetricType} from "./MetricType";
export class Metric {
constructor(public type: MetricType, public minWidth: number, public maxWidth: number) { |
<<<<<<<
import config from 'ember-get-config';
import CurrentUser from 'ember-osf-web/services/current-user';
import Theme from 'ember-osf-web/services/theme';
import pathJoin from 'ember-osf-web/utils/path-join';
import $ from 'jquery';
=======
>>>>>>>
import Theme from 'ember-osf-web/services/theme'; |
<<<<<<<
case PlayerActions.TOGGLE_PLAY_PAUSE: {
return Object.assign({}, state, {
isPlaying: !state.isPlaying,
});
}
=======
case PlayerActions.VOLUME_CHANGE: {
if(state.isMuted) {
return Object.assign({}, state, {
volume: state.volumeBeforeMute,
isMuted: !state.isMuted,
})
} else {
return Object.assign({}, state, {
volumeBeforeMute: action.payload.volume,
volume: 0,
isMuted: !state.isMuted,
})
}
}
>>>>>>>
case PlayerActions.TOGGLE_PLAY_PAUSE: {
return Object.assign({}, state, {
isPlaying: !state.isPlaying,
});
case PlayerActions.VOLUME_CHANGE: {
if(state.isMuted) {
return Object.assign({}, state, {
volume: state.volumeBeforeMute,
isMuted: !state.isMuted,
})
} else {
return Object.assign({}, state, {
volumeBeforeMute: action.payload.volume,
volume: 0,
isMuted: !state.isMuted,
})
}
}
<<<<<<<
case PlayerActions.UPDATE_CURRENT_TIME:
return Object.assign({}, state, {
currentTime: action.payload
});
=======
case PlayerActions.TOGGLE_REPEAT: {
return Object.assign({}, state, {
repeatTrack: !state.repeatTrack,
});
}
case PlayerActions.TOGGLE_SHUFFLE: {
return Object.assign({}, state, {
shuffleTracks: !state.shuffleTracks,
});
}
>>>>>>>
case PlayerActions.UPDATE_CURRENT_TIME:
return Object.assign({}, state, {
currentTime: action.payload
});
case PlayerActions.TOGGLE_REPEAT: {
return Object.assign({}, state, {
repeatTrack: !state.repeatTrack,
});
}
case PlayerActions.TOGGLE_SHUFFLE: {
return Object.assign({}, state, {
shuffleTracks: !state.shuffleTracks,
});
} |
<<<<<<<
getCurrentTrackIndex(): number {
return this.tracksList.reduce((acc, cur, index) => {
if (acc !== null) {
return acc;
} else if (cur.id === this.currentTrackId) {
return index;
} else {
return null;
}
}, null);
}
=======
changePosition(fraction: number) {
this.audio.currentTime = this.audio.duration * fraction;
}
>>>>>>>
getCurrentTrackIndex(): number {
return this.tracksList.reduce((acc, cur, index) => {
if (acc !== null) {
return acc;
} else if (cur.id === this.currentTrackId) {
return index;
} else {
return null;
}
}, null);
}
changePosition(fraction: number) {
this.audio.currentTime = this.audio.duration * fraction;
} |
<<<<<<<
AudioControlsActions,
PlaylistService,
PlaylistActions
=======
AudioControlsActions,
SoundmooseUserActions
>>>>>>>
AudioControlsActions,
PlaylistService,
PlaylistActions
SoundmooseUserActions
<<<<<<<
comments: comments,
playlist: playlist
=======
comments: comments,
soundmooseUser: soundmooseUser
>>>>>>>
comments: comments,
playlist: playlist
soundmooseUser: soundmooseUser
<<<<<<<
ThreeDComponent,
PlaylistComponent,
PlaylistTrackDetailsComponent,
PlaylistTrackListComponent
=======
ThreeDComponent,
ThreeDFrequencyBarsComponent,
ThreeDParticlesComponent,
ThreeDSphereComponent
>>>>>>>
ThreeDComponent,
PlaylistComponent,
PlaylistTrackDetailsComponent,
PlaylistTrackListComponent
ThreeDFrequencyBarsComponent,
ThreeDParticlesComponent,
ThreeDSphereComponent
<<<<<<<
RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules }),
SortablejsModule
=======
RouterModule.forRoot(ROUTES, { useHash: false, preloadingStrategy: PreloadAllModules })
>>>>>>>
RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules }),
SortablejsModule
RouterModule.forRoot(ROUTES, { useHash: false, preloadingStrategy: PreloadAllModules }) |
<<<<<<<
discover: {
main: {
providers: 'Providers',
subject: 'Subject',
status: 'Status',
type: 'Type',
},
relevance: 'Relevance',
sort_oldest_newest: 'Modified Date (oldest to newest)',
sort_newest_oldest: 'Modified Date (newest to oldest)',
search_results: {
lastEdited: 'Last edited: {{date}} (UTC)',
status: 'Status: {{value}}',
},
},
search_paginator: {
prev: '«',
next: '»',
},
page_not_found: { // 404
heading: 'Page not found',
message: 'The page you were looking for is not found on the {{brand}} service.',
},
page_forbidden: { // 403
heading: 'Forbidden',
message: 'User has restricted access to this page.',
},
resource_deleted: { // 410
heading: 'Resource deleted',
message: 'User has deleted this content.',
},
=======
'osf-components': {
'draft-registration-card': {
initiated_by: 'Initiated by:',
started: 'Started:',
last_updated: 'Last updated:',
register: 'Register',
delete_draft_confirm: 'Are you sure you want to delete this draft registration?',
},
'copyable-text': {
copyToClipboard: 'クリップボードへコピー',
copied: 'Copied!',
},
},
settings: {
toggleNav: 'Toggle navigation',
profile: {
title: 'Profile information',
},
account: {
title: 'Account settings',
},
addons: {
title: 'Configure add-on accounts',
},
notifications: {
title: 'Notifications',
},
apps: {
title: 'Developer apps',
},
tokens: {
title: 'Personal access tokens',
explanation: 'Personal access tokens function like ordinary OAuth access tokens. They can be used to authenticate to the API.',
listDescription: 'Your personal access tokens:',
emptyList: 'You have not created any tokens.',
createToken: 'Create token',
deleteToken: 'Delete token',
editToken: 'Edit token',
copyToken: 'Copy token ID',
backToList: 'Back to list of tokens',
tokenName: 'Token name',
scopes: 'Scopes',
scopesDescription: 'Scopes limit access for personal access tokens.',
confirmDelete: {
title: 'Delete token <strong>{{tokenName}}</strong>?',
body: 'Are you sure you want to delete this personal access token? This cannot be reversed.',
},
createSuccess: {
message: 'Successfully created personal access token <strong>{{tokenName}}</strong>.',
instructions: 'This token will never expire. This token should never be shared with others. If it is accidentally revealed publicly, it should be deactivated immediately.',
warning: 'This is the only time your token will be displayed.',
idDescription: 'ID used to authenticate with token <strong>{{tokenName}}<strong>:',
},
},
},
>>>>>>>
discover: {
main: {
providers: 'Providers',
subject: 'Subject',
status: 'Status',
type: 'Type',
},
relevance: 'Relevance',
sort_oldest_newest: 'Modified Date (oldest to newest)',
sort_newest_oldest: 'Modified Date (newest to oldest)',
search_results: {
lastEdited: 'Last edited: {{date}} (UTC)',
status: 'Status: {{value}}',
},
},
search_paginator: {
prev: '«',
next: '»',
},
page_not_found: { // 404
heading: 'Page not found',
message: 'The page you were looking for is not found on the {{brand}} service.',
},
page_forbidden: { // 403
heading: 'Forbidden',
message: 'User has restricted access to this page.',
},
resource_deleted: { // 410
heading: 'Resource deleted',
message: 'User has deleted this content.',
},
'osf-components': {
'draft-registration-card': {
initiated_by: 'Initiated by:',
started: 'Started:',
last_updated: 'Last updated:',
register: 'Register',
delete_draft_confirm: 'Are you sure you want to delete this draft registration?',
},
'copyable-text': {
copyToClipboard: 'クリップボードへコピー',
copied: 'Copied!',
},
},
settings: {
toggleNav: 'Toggle navigation',
profile: {
title: 'Profile information',
},
account: {
title: 'Account settings',
},
addons: {
title: 'Configure add-on accounts',
},
notifications: {
title: 'Notifications',
},
apps: {
title: 'Developer apps',
},
tokens: {
title: 'Personal access tokens',
explanation: 'Personal access tokens function like ordinary OAuth access tokens. They can be used to authenticate to the API.',
listDescription: 'Your personal access tokens:',
emptyList: 'You have not created any tokens.',
createToken: 'Create token',
deleteToken: 'Delete token',
editToken: 'Edit token',
copyToken: 'Copy token ID',
backToList: 'Back to list of tokens',
tokenName: 'Token name',
scopes: 'Scopes',
scopesDescription: 'Scopes limit access for personal access tokens.',
confirmDelete: {
title: 'Delete token <strong>{{tokenName}}</strong>?',
body: 'Are you sure you want to delete this personal access token? This cannot be reversed.',
},
createSuccess: {
message: 'Successfully created personal access token <strong>{{tokenName}}</strong>.',
instructions: 'This token will never expire. This token should never be shared with others. If it is accidentally revealed publicly, it should be deactivated immediately.',
warning: 'This is the only time your token will be displayed.',
idDescription: 'ID used to authenticate with token <strong>{{tokenName}}<strong>:',
},
},
}, |
<<<<<<<
encapsulation: ViewEncapsulation.None,
styleUrls: [
'./app.component.css'
],
template: `
<nav>
<span>
<a [routerLink]=" ['./'] ">
Index
</a>
</span>
|
<span>
<a [routerLink]=" ['./home'] ">
Home
</a>
</span>
|
<span>
<a [routerLink]=" ['./detail'] ">
Detail
</a>
</span>
|
<span>
<a [routerLink]=" ['./about'] ">
About
</a>
</span>
|
<span>
<a [routerLink]=" ['./player'] ">
Player-Controls
</a>
</span>
</nav>
<main>
<router-outlet></router-outlet>
</main>
<pre class="app-state">this.appState.state = {{ appState.state | json }}</pre>
<footer>
<span>WebPack Angular 2 Starter by <a [href]="url">@AngularClass</a></span>
<div>
<a [href]="url">
<img [src]="angularclassLogo" width="25%">
</a>
</div>
</footer>
`
=======
templateUrl: 'app.component.html'
>>>>>>>
styleUrls: [
'./app.component.css'
],
templateUrl: 'app.component.html' |
<<<<<<<
this.currentProgress = Math.floor(((currentProgressInMilliseconds/this.duration)*100)) * this.multiplier / 100;
=======
// Why is {{ progressMinutesSeconds }} so laggy?
//$('#track-current-time').html(this.progressMinutesSeconds);
this.currentProgress = Math.floor(((currentProgressInMilliseconds/this.duration)*1000)) * this.multiplier / 1000;
>>>>>>>
this.currentProgress = Math.floor(((currentProgressInMilliseconds/this.duration)*1000)) * this.multiplier / 1000; |
<<<<<<<
platform: 'soundcloud'
})))
.first()
.subscribe(tracks => this.store.dispatch(this.searchActions.searchSuccess(tracks)));
=======
platform: 'soundcloud',
trackId: item.id.toString()
})));
>>>>>>>
platform: 'soundcloud',
trackId: item.id.toString()
})))
.first()
.subscribe(tracks => this.store.dispatch(this.searchActions.searchSuccess(tracks))); |
<<<<<<<
return (new Promise((resolve, reject) => {
if (seemToBeInIE()) {
readIE().then(
(s: string) => resolve(DTFromText(s)),
reject
);
return;
}
// TODO: Attempt to read using async clipboard API.
reject("Read is not supported in your browser.");
=======
return (new PromiseOrPolyfill((resolve, reject) => {
// TODO: Attempt to use navigator.clipboard.read() directly.
// Requires DT -> DataTransfer conversion.
this.readText().then(
(s: string) => resolve(DTFromText(s)),
reject
);
>>>>>>>
return (new Promise((resolve, reject) => {
// TODO: Attempt to use navigator.clipboard.read() directly.
// Requires DT -> DataTransfer conversion.
this.readText().then(
(s: string) => resolve(DTFromText(s)),
reject
);
<<<<<<<
return (new Promise((resolve, reject) => {
// TODO: Attempt to read using async clipboard API.
=======
return (new PromiseOrPolyfill((resolve, reject) => {
>>>>>>>
return (new Promise((resolve, reject) => { |
<<<<<<<
'service:status-messages',
=======
'service:ready',
>>>>>>>
'service:status-messages',
'service:ready', |
<<<<<<<
import { BottomSheetComponent, DrawerState } from './bottom-sheet/bottom-sheet.component';
import { BottomSheetContentComponent } from './bottom-sheet/bottom-sheet-content/bottom-sheet-content.component';
=======
import { ToolbarSearchComponent } from './toolbar-search/toolbar-search.component';
import { LoadingButtonComponent } from './loading-button/loading-button.component';
import { LoadingProgressBarComponent } from './loading-progress-bar/loading-progress-bar.component';
import { LoadingContentComponent } from './loading-content/loading-content.component';
import { LoadingFabComponent } from './loading-fab/loading-fab.component';
import { AppBarComponent } from './app-bar/app-bar.component';
>>>>>>>
import { BottomSheetComponent, DrawerState } from './bottom-sheet/bottom-sheet.component';
import { BottomSheetContentComponent } from './bottom-sheet/bottom-sheet-content/bottom-sheet-content.component';
import { ToolbarSearchComponent } from './toolbar-search/toolbar-search.component';
import { LoadingButtonComponent } from './loading-button/loading-button.component';
import { LoadingProgressBarComponent } from './loading-progress-bar/loading-progress-bar.component';
import { LoadingContentComponent } from './loading-content/loading-content.component';
import { LoadingFabComponent } from './loading-fab/loading-fab.component';
import { AppBarComponent } from './app-bar/app-bar.component';
<<<<<<<
CollapsableMenuDirective,
BottomSheetComponent,
BottomSheetContentComponent
=======
CollapsableMenuDirective,
ToolbarSearchComponent,
LoadingButtonComponent,
LoadingProgressBarComponent,
LoadingContentComponent,
LoadingFabComponent,
AppBarComponent,
>>>>>>>
CollapsableMenuDirective,
BottomSheetComponent,
BottomSheetContentComponent,
ToolbarSearchComponent,
LoadingButtonComponent,
LoadingProgressBarComponent,
LoadingContentComponent,
LoadingFabComponent,
AppBarComponent,
<<<<<<<
CollapsableMenuButtonComponent,
BottomSheetComponent,
BottomSheetContentComponent
=======
CollapsableMenuButtonComponent,
ToolbarSearchComponent,
LoadingButtonComponent,
LoadingProgressBarComponent,
LoadingContentComponent,
LoadingFabComponent,
AppBarComponent,
>>>>>>>
CollapsableMenuButtonComponent,
BottomSheetComponent,
BottomSheetContentComponent,
ToolbarSearchComponent,
LoadingButtonComponent,
LoadingProgressBarComponent,
LoadingContentComponent,
LoadingFabComponent,
AppBarComponent, |
<<<<<<<
maintenance: string;
},
=======
cookieConsent: string;
};
>>>>>>>
cookieConsent: string;
maintenance: string;
}; |
<<<<<<<
let socket: Socket | undefined = undefined;
if (args.reAttach) {
try {
socket = await connect(args.port || 6000, 'localhost');
this.reloadTabs = true;
} catch(err) {}
}
if (socket === undefined) {
let proc = await launchFirefox(args);
if (!args.reAttach) {
this.firefoxProc = proc;
}
socket = await waitForSocket(args);
}
=======
// only send messages from Firefox' stdout to the debug console when debugging an addonSdk extension
let sendToConsole: (msg: string) => void =
(this.addonType === 'addonSdk') ?
(msg) => this.sendEvent(new OutputEvent(msg, 'stdout')) :
(msg) => undefined;
this.firefoxProc = await launchFirefox(args, sendToConsole);
>>>>>>>
let socket: Socket | undefined = undefined;
if (args.reAttach) {
try {
socket = await connect(args.port || 6000, 'localhost');
this.reloadTabs = true;
} catch(err) {}
}
if (socket === undefined) {
// only send messages from Firefox' stdout to the debug console when debugging an addonSdk extension
let sendToConsole: (msg: string) => void =
(this.addonType === 'addonSdk') ?
(msg) => this.sendEvent(new OutputEvent(msg, 'stdout')) :
(msg) => undefined;
let proc = await launchFirefox(args, sendToConsole);
if (!args.reAttach) {
this.firefoxProc = proc;
}
socket = await waitForSocket(args);
} |
<<<<<<<
import {GlobalMessageManager} from "../../Administration/GlobalMessageManager";
import {ConsoleGlobalMessageManager} from "../../Administration/ConsoleGlobalMessageManager";
=======
import {UserMovedMessage} from "../../Messages/generated/messages_pb";
import {ProtobufClientUtils} from "../../Network/ProtobufClientUtils";
import {connectionManager} from "../../Connexion/ConnectionManager";
import {RoomConnection} from "../../Connexion/RoomConnection";
>>>>>>>
import {UserMovedMessage} from "../../Messages/generated/messages_pb";
import {ProtobufClientUtils} from "../../Network/ProtobufClientUtils";
import {connectionManager} from "../../Connexion/ConnectionManager";
import {RoomConnection} from "../../Connexion/RoomConnection";
import {GlobalMessageManager} from "../../Administration/GlobalMessageManager";
import {ConsoleGlobalMessageManager} from "../../Administration/ConsoleGlobalMessageManager";
<<<<<<<
private GlobalMessageManager!: GlobalMessageManager;
private ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager;
private connectionPromise!: Promise<Connection>
=======
private connectionPromise!: Promise<RoomConnection>
>>>>>>>
private GlobalMessageManager!: GlobalMessageManager;
private ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager;
private connectionPromise!: Promise<RoomConnection> |
<<<<<<<
import {Player} from "../Player/Player";
import {getPlayerAnimations, PlayerAnimationNames} from "../Player/Animation";
import Rectangle = Phaser.GameObjects.Rectangle;
import {PLAYER_RESOURCES} from "../Entity/PlayableCaracter";
=======
import {cypressAsserter} from "../../Cypress/CypressAsserter";
>>>>>>>
import {Player} from "../Player/Player";
import {getPlayerAnimations, PlayerAnimationNames} from "../Player/Animation";
import Rectangle = Phaser.GameObjects.Rectangle;
import {PLAYER_RESOURCES} from "../Entity/PlayableCaracter";
import {cypressAsserter} from "../../Cypress/CypressAsserter";
<<<<<<<
//add player png
PLAYER_RESOURCES.forEach((playerResource: any) => {
this.load.spritesheet(
playerResource.name,
playerResource.img,
{frameWidth: 32, frameHeight: 32}
);
});
=======
cypressAsserter.preloadFinished();
>>>>>>>
cypressAsserter.preloadFinished();
//add player png
PLAYER_RESOURCES.forEach((playerResource: any) => {
this.load.spritesheet(
playerResource.name,
playerResource.img,
{frameWidth: 32, frameHeight: 32}
);
});
<<<<<<<
/*create user*/
this.createCurrentPlayer("test");
=======
cypressAsserter.initFinished();
>>>>>>>
/*create user*/
this.createCurrentPlayer("test");
cypressAsserter.initFinished(); |
<<<<<<<
import {DEBUG_MODE, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import {
ITiledMap,
ITiledMapLayer,
ITiledMapLayerProperty, ITiledMapObject,
ITiledTileSet
} from "../Map/ITiledMap";
=======
import {DEBUG_MODE, JITSI_URL, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import {ITiledMap, ITiledMapLayer, ITiledMapLayerProperty, ITiledTileSet} from "../Map/ITiledMap";
>>>>>>>
import {DEBUG_MODE, JITSI_URL, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import {
ITiledMap,
ITiledMapLayer,
ITiledMapLayerProperty, ITiledMapObject,
ITiledTileSet
} from "../Map/ITiledMap";
<<<<<<<
import {FourOFourSceneName} from "../Reconnecting/FourOFourScene";
import {ItemFactoryInterface} from "../Items/ItemFactoryInterface";
import {ActionableItem} from "../Items/ActionableItem";
import {UserInputManager} from "../UserInput/UserInputManager";
=======
import {GameMap} from "./GameMap";
import {CoWebsiteManager} from "../../WebRtc/CoWebsiteManager";
import {mediaManager} from "../../WebRtc/MediaManager";
>>>>>>>
import {GameMap} from "./GameMap";
import {CoWebsiteManager} from "../../WebRtc/CoWebsiteManager";
import {mediaManager} from "../../WebRtc/MediaManager";
import {FourOFourSceneName} from "../Reconnecting/FourOFourScene";
import {ItemFactoryInterface} from "../Items/ItemFactoryInterface";
import {ActionableItem} from "../Items/ActionableItem";
import {UserInputManager} from "../UserInput/UserInputManager";
<<<<<<<
private repositionCallback!: (this: Window, ev: UIEvent) => void;
private actionableItems: Map<number, ActionableItem> = new Map<number, ActionableItem>();
// The item that can be selected by pressing the space key.
private outlinedItem: ActionableItem|null = null;
private userInputManager!: UserInputManager;
=======
private onResizeCallback!: (this: Window, ev: UIEvent) => void;
private gameMap!: GameMap;
>>>>>>>
private onResizeCallback!: (this: Window, ev: UIEvent) => void;
private gameMap!: GameMap;
private actionableItems: Map<number, ActionableItem> = new Map<number, ActionableItem>();
// The item that can be selected by pressing the space key.
private outlinedItem: ActionableItem|null = null;
private userInputManager!: UserInputManager;
<<<<<<<
connection.joinARoom(this.RoomId, this.startX, this.startY, PlayerAnimationNames.WalkDown, false).then((roomJoinedMessage: RoomJoinedMessageInterface) => {
this.initUsersPosition(roomJoinedMessage.users);
this.connectionAnswerPromiseResolve(roomJoinedMessage);
=======
const camera = this.cameras.main;
connection.joinARoom(this.RoomId,
this.startX,
this.startY,
PlayerAnimationNames.WalkDown,
false, {
left: camera.scrollX,
top: camera.scrollY,
right: camera.scrollX + camera.width,
bottom: camera.scrollY + camera.height,
}).then((userPositions: MessageUserPositionInterface[]) => {
this.initUsersPosition(userPositions);
>>>>>>>
const camera = this.cameras.main;
connection.joinARoom(this.RoomId,
this.startX,
this.startY,
PlayerAnimationNames.WalkDown,
false, {
left: camera.scrollX,
top: camera.scrollY,
right: camera.scrollX + camera.width,
bottom: camera.scrollY + camera.height,
}).then((roomJoinedMessage: RoomJoinedMessageInterface) => {
this.initUsersPosition(roomJoinedMessage.users);
this.connectionAnswerPromiseResolve(roomJoinedMessage);
<<<<<<<
this.CurrentPlayer.on(hasMovedEventName, this.outlineItem.bind(this))
=======
this.CurrentPlayer.on(hasMovedEventName, (event: HasMovedEvent) => {
this.gameMap.setPosition(event.x, event.y);
})
>>>>>>>
this.CurrentPlayer.on(hasMovedEventName, this.outlineItem.bind(this))
this.CurrentPlayer.on(hasMovedEventName, (event: HasMovedEvent) => {
this.gameMap.setPosition(event.x, event.y);
})
<<<<<<<
/**
* Sends to the server an event emitted by one of the ActionableItems.
*
* @param itemId
* @param eventName
* @param state
* @param parameters
*/
emitActionableEvent(itemId: number, eventName: string, state: unknown, parameters: unknown) {
this.connection.emitActionableEvent(itemId, eventName, state, parameters);
}
=======
private onResize(): void {
this.reposition();
// Send new viewport to server
const camera = this.cameras.main;
this.connection.setViewport({
left: camera.scrollX,
top: camera.scrollY,
right: camera.scrollX + camera.width,
bottom: camera.scrollY + camera.height,
});
}
>>>>>>>
/**
* Sends to the server an event emitted by one of the ActionableItems.
*
* @param itemId
* @param eventName
* @param state
* @param parameters
*/
emitActionableEvent(itemId: number, eventName: string, state: unknown, parameters: unknown) {
this.connection.emitActionableEvent(itemId, eventName, state, parameters);
}
private onResize(): void {
this.reposition();
// Send new viewport to server
const camera = this.cameras.main;
this.connection.setViewport({
left: camera.scrollX,
top: camera.scrollY,
right: camera.scrollX + camera.width,
bottom: camera.scrollY + camera.height,
});
} |
<<<<<<<
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "pusher.workadventure.localhost");
const UPLOADER_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.UPLOADER_URL || 'uploader.workadventure.localhost');
const ADMIN_URL = API_URL.replace('api', 'admin');
=======
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "api.workadventure.localhost");
const ADMIN_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.ADMIN_URL || "admin.workadventure.localhost");
>>>>>>>
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "pusher.workadventure.localhost");
const UPLOADER_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.UPLOADER_URL || 'uploader.workadventure.localhost');
const ADMIN_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.ADMIN_URL || "admin.workadventure.localhost"); |
<<<<<<<
private isReconnecting: boolean = false;
=======
private startLayerName!: string | null;
>>>>>>>
private isReconnecting: boolean = false;
private startLayerName!: string | null;
<<<<<<<
//this.initUsersPosition(roomJoinedMessage.users);
this.connectionAnswerPromiseResolve(onConnect.room);
// Analyze tags to find if we are admin. If yes, show console.
if (this.connection.hasTag('admin')) {
this.ConsoleGlobalMessageManager = new ConsoleGlobalMessageManager(this.connection, this.userInputManager);
}
console.log('wakingup');
=======
>>>>>>>
//this.initUsersPosition(roomJoinedMessage.users);
this.connectionAnswerPromiseResolve(onConnect.room);
// Analyze tags to find if we are admin. If yes, show console.
if (this.connection.hasTag('admin')) {
this.ConsoleGlobalMessageManager = new ConsoleGlobalMessageManager(this.connection, this.userInputManager);
}
<<<<<<<
return this.connection;
=======
//init user position and play trigger to check layers properties
this.gameMap.setPosition(this.CurrentPlayer.x, this.CurrentPlayer.y);
return connection;
>>>>>>>
//init user position and play trigger to check layers properties
this.gameMap.setPosition(this.CurrentPlayer.x, this.CurrentPlayer.y);
return this.connection; |
<<<<<<<
connect(name:string) {
this.playerName = name;
this.ConnexionInstance = new Connexion(name, this);
ConnexionInstance = this.ConnexionInstance;
=======
connect(email:string) {
this.ConnexionInstance = new Connexion(email, this);
>>>>>>>
connect(name:string) {
this.playerName = name;
this.ConnexionInstance = new Connexion(name, this);
<<<<<<<
getPlayerName(): string {
return this.playerName;
}
=======
pushPlayerPosition(event: HasMovedEvent) {
this.ConnexionInstance.sharePosition(event.x, event.y, event.direction);
}
>>>>>>>
getPlayerName(): string {
return this.playerName;
}
pushPlayerPosition(event: HasMovedEvent) {
this.ConnexionInstance.sharePosition(event.x, event.y, event.direction);
} |
<<<<<<<
import {uuid} from "uuidv4";
=======
import {PositionInterface} from "_Model/PositionInterface";
>>>>>>>
import {PositionInterface} from "_Model/PositionInterface";
import {uuid} from "uuidv4";
<<<<<<<
getId() : string{
return this.id;
}
=======
/**
* Returns the barycenter of all users (i.e. the center of the group)
*/
getPosition(): PositionInterface {
let x = 0;
let y = 0;
// Let's compute the barycenter of all users.
this.users.forEach((user: UserInterface) => {
x += user.position.x;
y += user.position.y;
});
x /= this.users.length;
y /= this.users.length;
return {
x,
y
};
}
>>>>>>>
getId() : string{
return this.id;
}
/**
* Returns the barycenter of all users (i.e. the center of the group)
*/
getPosition(): PositionInterface {
let x = 0;
let y = 0;
// Let's compute the barycenter of all users.
this.users.forEach((user: UserInterface) => {
x += user.position.x;
y += user.position.y;
});
x /= this.users.length;
y /= this.users.length;
return {
x,
y
};
} |