mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Merge remote-tracking branch 'DefinitelyTyped/master'
This commit is contained in:
@@ -1,22 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) at [definitelytyped.org](http://definitelytyped.org/guides/contributing.html) for information on how to contribute to DefinitelyTyped.
|
||||
-1893
File diff suppressed because it is too large
Load Diff
Vendored
+2
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular Material (angular.material module) 1.1
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>
|
||||
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as angular from 'angular';
|
||||
@@ -18,6 +18,7 @@ declare module 'angular' {
|
||||
controller?: string | Function;
|
||||
locals?: { [index: string]: any };
|
||||
clickOutsideToClose?: boolean;
|
||||
bindToController?: boolean; // default: false
|
||||
disableBackdrop?: boolean;
|
||||
escapeToClose?: boolean;
|
||||
resolve?: { [index: string]: () => angular.IPromise<any> };
|
||||
|
||||
Vendored
+13
-7
@@ -15,6 +15,7 @@ export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig;
|
||||
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
|
||||
export type IModalService = angular.ui.bootstrap.IModalService;
|
||||
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
|
||||
export type IModalInstanceService = angular.ui.bootstrap.IModalInstanceService;
|
||||
export type IModalScope = angular.ui.bootstrap.IModalScope;
|
||||
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
|
||||
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
|
||||
@@ -320,12 +321,12 @@ declare module 'angular' {
|
||||
interface IModalService {
|
||||
/**
|
||||
* @param {IModalSettings} options
|
||||
* @returns {IModalServiceInstance}
|
||||
* @returns {IModalInstanceService}
|
||||
*/
|
||||
open(options: IModalSettings): IModalServiceInstance;
|
||||
open(options: IModalSettings): IModalInstanceService;
|
||||
}
|
||||
|
||||
interface IModalServiceInstance {
|
||||
interface IModalInstanceService {
|
||||
/**
|
||||
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
|
||||
*/
|
||||
@@ -357,6 +358,11 @@ declare module 'angular' {
|
||||
closed: angular.IPromise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use IModalInstanceService instead.
|
||||
*/
|
||||
interface IModalServiceInstance extends IModalInstanceService { }
|
||||
|
||||
interface IModalScope extends angular.IScope {
|
||||
/**
|
||||
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
|
||||
@@ -512,17 +518,17 @@ declare module 'angular' {
|
||||
/**
|
||||
* Opens a new modal instance.
|
||||
*/
|
||||
open(modalInstance: IModalServiceInstance, modal: any): void;
|
||||
open(modalInstance: IModalInstanceService, modal: any): void;
|
||||
|
||||
/**
|
||||
* Closes a modal instance with an optional result.
|
||||
*/
|
||||
close(modalInstance: IModalServiceInstance, result?: any): void;
|
||||
close(modalInstance: IModalInstanceService, result?: any): void;
|
||||
|
||||
/**
|
||||
* Dismisses a modal instance with an optional reason.
|
||||
*/
|
||||
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;
|
||||
dismiss(modalInstance: IModalInstanceService, reason?: any): void;
|
||||
|
||||
/**
|
||||
* Dismiss all open modal instances with an optional reason that will be passed to each instance.
|
||||
@@ -536,7 +542,7 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IModalStackedMapKeyValuePair {
|
||||
key: IModalServiceInstance;
|
||||
key: IModalInstanceService;
|
||||
value: any;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+21
-22
@@ -6,17 +6,16 @@
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
interface ErrorCallback<T> { (err?: T): void; }
|
||||
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
|
||||
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
|
||||
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
|
||||
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
|
||||
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
|
||||
interface AsyncBooleanResultCallback<E> { (err?: E, truthValue?: boolean): void; }
|
||||
interface AsyncResultCallback<T, E> { (err?: E, result?: T): void; }
|
||||
interface AsyncResultArrayCallback<T, E> { (err?: E, results?: (T | undefined)[]): void; }
|
||||
interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
|
||||
|
||||
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
|
||||
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
|
||||
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
|
||||
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
|
||||
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
|
||||
interface AsyncMemoIterator<T, R, E> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
|
||||
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
|
||||
|
||||
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
|
||||
@@ -76,7 +75,7 @@ interface AsyncPriorityQueue<T> {
|
||||
|
||||
interface AsyncCargo {
|
||||
length(): number;
|
||||
payload: number;
|
||||
payload?: number;
|
||||
push(task: any, callback? : Function): void;
|
||||
push(task: any[], callback? : Function): void;
|
||||
saturated(): void;
|
||||
@@ -175,7 +174,7 @@ interface Async {
|
||||
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
|
||||
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
|
||||
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
|
||||
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
|
||||
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T, E | Error>): void;
|
||||
compose(...fns: Function[]): Function;
|
||||
seq(...fns: Function[]): Function;
|
||||
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
@@ -186,29 +185,30 @@ interface Async {
|
||||
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
|
||||
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
|
||||
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
|
||||
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
|
||||
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
|
||||
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
|
||||
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
|
||||
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E | Error>): void;
|
||||
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E | Error>): void;
|
||||
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E | Error>;
|
||||
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E | Error>;
|
||||
nextTick(callback: Function, ...args: any[]): void;
|
||||
setImmediate: typeof async.nextTick;
|
||||
|
||||
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
|
||||
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
|
||||
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void;
|
||||
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[];
|
||||
|
||||
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
|
||||
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
|
||||
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E | Error>;
|
||||
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E | Error>;
|
||||
|
||||
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
|
||||
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
|
||||
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
|
||||
|
||||
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
|
||||
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
|
||||
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
|
||||
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
|
||||
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
|
||||
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
|
||||
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
|
||||
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
|
||||
|
||||
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E | Error>) : void;
|
||||
|
||||
// Utils
|
||||
memoize(fn: Function, hasher?: Function): Function;
|
||||
@@ -226,4 +226,3 @@ declare var async: Async;
|
||||
declare module "async" {
|
||||
export = async;
|
||||
}
|
||||
|
||||
|
||||
+42
-12
@@ -1,44 +1,74 @@
|
||||
|
||||
|
||||
interface StringCallback { (err: Error, result: string): void; }
|
||||
interface StringCallback { (err?: Error, result?: string): void; }
|
||||
interface AsyncStringGetter { (callback: StringCallback): void; }
|
||||
|
||||
var taskArray: AsyncStringGetter[] = [
|
||||
function (callback) {
|
||||
setTimeout(function () {
|
||||
callback(null, 'one');
|
||||
callback(undefined, 'one');
|
||||
}, 200);
|
||||
},
|
||||
function (callback) {
|
||||
setTimeout(function () {
|
||||
callback(null, 'two');
|
||||
callback(undefined, 'two');
|
||||
}, 100);
|
||||
},
|
||||
];
|
||||
|
||||
async.series(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
|
||||
async.parallel(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
|
||||
async.parallelLimit(taskArray, 3, function (err, results) { console.log(results[0].match(/o/)) });
|
||||
async.series(taskArray, function (err, results) {
|
||||
if (results) {
|
||||
let first = results[0];
|
||||
if (first) {
|
||||
console.log(first.match(/o/))
|
||||
}
|
||||
}
|
||||
});
|
||||
async.parallel(taskArray, function (err, results) {
|
||||
if (results) {
|
||||
let first = results[0];
|
||||
if (first) {
|
||||
console.log(first.match(/o/))
|
||||
}
|
||||
}
|
||||
});
|
||||
async.parallelLimit(taskArray, 3, function (err, results) {
|
||||
if (results) {
|
||||
let first = results[0];
|
||||
if (first) {
|
||||
console.log(first.match(/o/))
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
interface Lookup<T> { [key: string]: T; }
|
||||
interface NumberCallback { (err: Error, result: number): void; }
|
||||
interface NumberCallback { (err?: Error, result?: number): void; }
|
||||
interface AsyncNumberGetter { (callback: NumberCallback): void; }
|
||||
|
||||
var taskDict: Lookup<AsyncNumberGetter> = {
|
||||
one: function(callback){
|
||||
setTimeout(function(){
|
||||
callback(null, 1);
|
||||
callback(undefined, 1);
|
||||
}, 200);
|
||||
},
|
||||
two: function(callback){
|
||||
setTimeout(function(){
|
||||
callback(null, 2);
|
||||
callback(undefined, 2);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
async.series(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
|
||||
async.parallel(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
|
||||
async.parallelLimit(taskDict, 3, function(err, results) { console.log(results['one'].toFixed(1)) });
|
||||
async.series(taskDict, function(err, results) {
|
||||
let one = results['one'];
|
||||
console.log(one && one.toFixed(1))
|
||||
});
|
||||
async.parallel(taskDict, function(err, results) {
|
||||
let one = results['one'];
|
||||
console.log(one && one.toFixed(1))
|
||||
});
|
||||
async.parallelLimit(taskDict, 3, function(err, results) {
|
||||
let one = results['one'];
|
||||
console.log(one && one.toFixed(1))
|
||||
});
|
||||
|
||||
|
||||
+8
-8
@@ -350,9 +350,9 @@ q2.unshift(['task3', 'task4', 'task5'], function (error) {
|
||||
});
|
||||
|
||||
|
||||
var aq = async.queue<number, number, Error>(function (level: number, callback: (error : Error, newLevel: number) => void) {
|
||||
var aq = async.queue<number, number, Error>(function (level: number, callback: (error?: Error, newLevel?: number) => void) {
|
||||
console.log('hello ' + level);
|
||||
callback(null, level+1);
|
||||
callback(undefined, level+1);
|
||||
});
|
||||
|
||||
aq.push(1, function (err : Error, newLevel : number) {
|
||||
@@ -807,9 +807,9 @@ async.some<number, Error>({
|
||||
|
||||
// timeout
|
||||
|
||||
function myFunction1(foo : any, callback: (err : Error, result : any) => void ) : void {
|
||||
function myFunction1(foo : any, callback: (err?: Error, result?: any) => void ) : void {
|
||||
console.log(`async.timeout 1 ${foo}`);
|
||||
return callback(null, foo);
|
||||
return callback(undefined, foo);
|
||||
}
|
||||
var wrapped1 = async.timeout(myFunction1, 1000);
|
||||
wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
|
||||
@@ -817,9 +817,9 @@ wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
|
||||
});
|
||||
|
||||
|
||||
function myFunction2(callback: (err : Error, result : any) => void ) : void {
|
||||
function myFunction2(callback: (err?: Error, result?: any) => void ) : void {
|
||||
console.log(`async.timeout 2`);
|
||||
return callback(null, { bar: 'bar' });
|
||||
return callback(undefined, { bar: 'bar' });
|
||||
}
|
||||
|
||||
var wrapped2 = async.timeout(myFunction2, 1000);
|
||||
@@ -827,9 +827,9 @@ wrapped2( function(err : Error, data : any) {
|
||||
console.log(`async.timeout 2 end ${data}`);
|
||||
});
|
||||
|
||||
function myFunction3(callback: (err : Error, result : any) => void ) : void {
|
||||
function myFunction3(callback: (err?: Error, result?: any) => void ) : void {
|
||||
console.log(`async.timeout 3`);
|
||||
return callback(null, { bar: 'bar' });
|
||||
return callback(undefined, { bar: 'bar' });
|
||||
}
|
||||
|
||||
var wrapped3 = async.timeout(myFunction3, 1000, { bar: 'bar' });
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +20,4 @@
|
||||
"test/index.ts",
|
||||
"test/explicit.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,6 @@
|
||||
// Definitions by: vvakame <https://github.com/vvakame/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="space-pen" />
|
||||
/// <reference types="emissary" />
|
||||
@@ -1519,6 +1518,7 @@ declare var atom:AtomCore.IAtom;
|
||||
|
||||
declare module "atom" {
|
||||
import spacePen = require("space-pen");
|
||||
import Q = require("q");
|
||||
|
||||
var $:typeof spacePen.$;
|
||||
var $$:typeof spacePen.$$;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -34,7 +34,7 @@ function test_client() {
|
||||
session.publish('com.myapp.hello', ['Hello, world!']);
|
||||
|
||||
// 3) register a procedure for remoting
|
||||
session.register('com.myapp.add2', myInstance.add2);
|
||||
session.register('com.myapp.add2', myInstance.add2, { invoke: 'roundrobin' });
|
||||
|
||||
// 4) call a remote procedure
|
||||
session.call<number>('com.myapp.add2', [2, 3]).then(
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for AutobahnJS v0.9.6
|
||||
// Type definitions for AutobahnJS v0.9.7
|
||||
// Project: http://autobahn.ws/js/
|
||||
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -177,6 +177,7 @@ declare namespace autobahn {
|
||||
|
||||
interface IRegisterOptions {
|
||||
disclose_caller?: boolean;
|
||||
invoke?: 'single' | 'roundrobin' | 'random' | 'first' | 'last';
|
||||
}
|
||||
|
||||
export class Connection {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/// <reference types="express"/>
|
||||
|
||||
import * as awsServerlessExpress from 'aws-serverless-express';
|
||||
import * as express from 'express';
|
||||
import { eventContext } from 'aws-serverless-express/middleware';
|
||||
|
||||
const app = express();
|
||||
app.use(eventContext());
|
||||
|
||||
const server = awsServerlessExpress.createServer(app, () => {});
|
||||
|
||||
const mockEvent = {
|
||||
|
||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for aws-serverless-express
|
||||
// Type definitions for aws-serverless-express 2.1
|
||||
// Project: https://github.com/awslabs/aws-serverless-express
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>, Josh Caffey <https://github.com/jcaffey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
@@ -16,4 +16,4 @@ export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context
|
||||
): void;
|
||||
): void;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { RequestHandler } from 'express';
|
||||
|
||||
export interface Options {
|
||||
reqPropKey?: string;
|
||||
deleteHeaders?: boolean;
|
||||
}
|
||||
|
||||
export function eventContext(options?: Options): RequestHandler;
|
||||
@@ -17,6 +17,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"middleware.d.ts",
|
||||
"aws-serverless-express-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
import * as axel from 'axel';
|
||||
|
||||
axel.clear();
|
||||
axel.bg(0,255,0);
|
||||
axel.line(1,1,10,10);
|
||||
axel.cursor.restore();
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// Type definitions for Axel module
|
||||
// Project: https://github.com/F1LT3R/axel
|
||||
// Definitions by: Ruslan Molodyko <https://github.com/ruslan-molodyko>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Axel {
|
||||
brush: string;
|
||||
rows: number;
|
||||
cols: number;
|
||||
cursor: cursorInterface;
|
||||
|
||||
lerp(p1: number, p2: number, m: number): number;
|
||||
circ(x: number, y: number, m: number): number;
|
||||
goto(x: number, y: number): void;
|
||||
scrub(x1: number, y1: number, w: number, h: number): void;
|
||||
box(x1: number, y1: number, w: number, h: number): void;
|
||||
point(x: number, y: number, char: string): void;
|
||||
dist(x1: number, y1: number, x2: number, y2: number): number;
|
||||
line(x1: number, y1: number, x2: number, y2: number): void;
|
||||
text(x: number, y: number, text: string): void;
|
||||
fg(r: number, g: number, b: number): void;
|
||||
bg(r: number, g: number, b: number): void;
|
||||
draw(cb: Function): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
declare interface cursorInterface {
|
||||
on(): void;
|
||||
off(): void;
|
||||
reset(): void;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
declare module 'axel' {
|
||||
const instance: Axel;
|
||||
export = instance;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"axel-tests.ts",
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+2
@@ -80,6 +80,8 @@ declare global {
|
||||
// then: typeof Bluebird.prototype.then;
|
||||
thenReturn: typeof Bluebird.prototype.thenReturn;
|
||||
thenThrow: typeof Bluebird.prototype.thenThrow;
|
||||
catchReturn: typeof Bluebird.prototype.catchReturn;
|
||||
catchThrow: typeof Bluebird.prototype.catchThrow;
|
||||
throw: typeof Bluebird.prototype.throw;
|
||||
timeout: typeof Bluebird.prototype.timeout;
|
||||
toJSON: typeof Bluebird.prototype.toJSON;
|
||||
|
||||
@@ -506,6 +506,15 @@ fooProm = fooProm.thenThrow(err);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catchReturn(bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooProm
|
||||
fooProm = fooProm.catchThrow(err);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
str = fooProm.toString();
|
||||
|
||||
obj = fooProm.toJSON();
|
||||
|
||||
Vendored
+31
@@ -248,6 +248,37 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
|
||||
throw(reason: Error): Bluebird<R>;
|
||||
thenThrow(reason: Error): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .catch(function() {
|
||||
* return value;
|
||||
* });
|
||||
* </code>
|
||||
*
|
||||
* in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()`
|
||||
*/
|
||||
catchReturn<U>(value: U): Bluebird<U>;
|
||||
catchReturn<U>(predicate: (error: any) => boolean, value: U): Bluebird<U | R>;
|
||||
catchReturn<E extends Error, U>(ErrorClass: new (...args: any[]) => E, value: U): Bluebird<U | R>;
|
||||
catchReturn<U>(predicate: Object, value: U): Bluebird<U | R>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .catch(function() {
|
||||
* throw reason;
|
||||
* });
|
||||
* </code>
|
||||
* Same limitations apply as with `.catchReturn()`.
|
||||
*/
|
||||
catchThrow(reason: Error): Bluebird<R>;
|
||||
catchThrow(predicate: (error: any) => boolean, reason: Error): Bluebird<R>;
|
||||
catchThrow<E extends Error, U>(ErrorClass: new (...args: any[]) => E, reason: Error): Bluebird<R>;
|
||||
catchThrow(predicate: Object, reason: Error): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Convert to String.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ interface Bookshelf extends Bookshelf.Events<any> {
|
||||
Collection: typeof Bookshelf.Collection;
|
||||
|
||||
plugin(name: string | string[] | Function, options?: any): Bookshelf;
|
||||
transaction<T>(callback: (transaction: knex.Transaction) => T): BlueBird<T>;
|
||||
transaction<T>(callback: (transaction: knex.Transaction) => BlueBird<T>): BlueBird<T>;
|
||||
}
|
||||
|
||||
declare function Bookshelf(knex: knex): Bookshelf;
|
||||
|
||||
@@ -38,7 +38,29 @@ bootbox.prompt({
|
||||
console.log(result);
|
||||
}
|
||||
});
|
||||
|
||||
bootbox.prompt({
|
||||
title: "This is a prompt with a set of checkbox inputs!",
|
||||
inputType: 'checkbox',
|
||||
inputOptions: [
|
||||
{
|
||||
text: 'Choice One',
|
||||
value: '1',
|
||||
group: 'Group 1'
|
||||
},
|
||||
{
|
||||
text: 'Choice Two',
|
||||
value: '2',
|
||||
group: 'Group 1'
|
||||
},
|
||||
{
|
||||
text: 'Choice Three',
|
||||
value: '3'
|
||||
}
|
||||
],
|
||||
callback: function (result) {
|
||||
console.log(result);
|
||||
}
|
||||
});
|
||||
|
||||
bootbox.dialog({
|
||||
title: "Wassup?",
|
||||
|
||||
Vendored
+2
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Bootbox 4.4.0
|
||||
// Project: https://github.com/makeusabrew/bootbox
|
||||
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>
|
||||
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>, Stanny Nuytkens <https://github.com/stannynuytkens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
@@ -44,6 +44,7 @@ interface BootboxPromptOptions extends BootboxBaseOptions {
|
||||
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
|
||||
callback: (result: string) => any;
|
||||
buttons?: BootboxConfirmPromptButtonMap;
|
||||
inputOptions?: { text: string, value: string, group?: string }[];
|
||||
}
|
||||
|
||||
/** Bootbox options available when setting defaults for modals */
|
||||
|
||||
-2
@@ -3,8 +3,6 @@
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
|
||||
declare namespace Validation {
|
||||
interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
|
||||
Vendored
-1
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Source: typings/business-rules-engine/Validation.d.ts
|
||||
/// <reference types="q" />
|
||||
|
||||
import * as Q from "q";
|
||||
|
||||
|
||||
-1
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import Validation = require("business-rules-engine");
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
+3
-1
@@ -368,7 +368,9 @@ function line_examples() {
|
||||
data: {},
|
||||
line: {
|
||||
connectNull: true,
|
||||
step_type: "step-after"
|
||||
step: {
|
||||
type: "step-after"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -145,7 +145,9 @@ declare namespace c3 {
|
||||
/**
|
||||
* Change step type for step chart. 'step', 'step-before' and 'step-after' can be used.
|
||||
*/
|
||||
step_type?: string;
|
||||
step?: {
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
|
||||
area?: {
|
||||
|
||||
Vendored
+6
-1
@@ -3,9 +3,14 @@
|
||||
// Definitions by: Alberto Nuti <https://github.com/anuti>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare class Chart {
|
||||
static readonly Chart: typeof Chart;
|
||||
constructor(context: CanvasRenderingContext2D | HTMLCanvasElement, options: Chart.ChartConfiguration);
|
||||
constructor(
|
||||
context: string | JQuery | CanvasRenderingContext2D | HTMLCanvasElement | string[] | CanvasRenderingContext2D[] | HTMLCanvasElement[],
|
||||
options: Chart.ChartConfiguration
|
||||
);
|
||||
config: Chart.ChartConfiguration;
|
||||
data: Chart.ChartData;
|
||||
destroy: () => {};
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Configuration } from 'webpack';
|
||||
import CompressionPlugin = require('compression-webpack-plugin');
|
||||
|
||||
const c: Configuration = {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
asset: "[path].gz[query]",
|
||||
algorithm: "gzip",
|
||||
test: /\.js$|\.html$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
]
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for compression-webpack-plugin 0.3
|
||||
// Project: https://github.com/webpack-contrib/compression-webpack-plugin
|
||||
// Definitions by: Anton Kandybo <https://github.com/dublicator>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = CompressionPlugin;
|
||||
|
||||
declare class CompressionPlugin extends Plugin {
|
||||
constructor(options?: CompressionPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace CompressionPlugin {
|
||||
export interface Options {
|
||||
asset?: string;
|
||||
algorithm?: string;
|
||||
test?: RegExp | RegExp[];
|
||||
regExp?: RegExp | RegExp[];
|
||||
threshold?: number;
|
||||
minRatio?: number;
|
||||
|
||||
// zopfli options
|
||||
verbose?: boolean;
|
||||
verbose_more?: boolean;
|
||||
numiterations?: number;
|
||||
blocksplitting?: boolean;
|
||||
blocksplittinglast?: boolean;
|
||||
blocksplittingmax?: number;
|
||||
|
||||
// zlib options
|
||||
level?: number;
|
||||
flush?: number;
|
||||
chunkSize?: number;
|
||||
windowBits?: number;
|
||||
memLevel?: number;
|
||||
strategy?: number;
|
||||
dictionary?: any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"compression-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
|
||||
+4
-7
@@ -3,14 +3,11 @@
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="q" />
|
||||
|
||||
interface Cordova {
|
||||
getAppVersion: {
|
||||
getAppName: () => Q.IPromise<string> & JQueryPromise<string>;
|
||||
getPackageName: () => Q.IPromise<string> & JQueryPromise<string>;
|
||||
getVersionCode: () => Q.IPromise<string> & JQueryPromise<string>;
|
||||
getVersionNumber: () => Q.IPromise<string> & JQueryPromise<string>;
|
||||
getAppName: () => Promise<string>;
|
||||
getPackageName: () => Promise<string>;
|
||||
getVersionCode: () => Promise<string>;
|
||||
getVersionNumber: () => Promise<string>;
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+85
-83
@@ -3,95 +3,97 @@
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
import * as Q from "q";
|
||||
|
||||
interface CordovaPlugins {
|
||||
locationManager: BeaconPlugin.LocationManager;
|
||||
}
|
||||
|
||||
declare namespace BeaconPlugin {
|
||||
/**
|
||||
* Beacon Plugin.
|
||||
*/
|
||||
export interface LocationManager {
|
||||
delegate: Delegate;
|
||||
BeaconRegion: BeaconRegion;
|
||||
Region: Region;
|
||||
onDomDelegateReady(): Q.Promise<void>;
|
||||
startMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
stopMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
requestStateForRegion(region: Region): Q.Promise<void>;
|
||||
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
getAuthorizationStatus(): Q.Promise<PluginResult>;
|
||||
requestWhenInUseAuthorization(): Q.Promise<void>;
|
||||
requestAlwaysAuthorization(): Q.Promise<void>;
|
||||
getMonitoredRegions(): Q.Promise<Region[]>;
|
||||
getRangedRegions(): Q.Promise<Region[]>;
|
||||
isRangingAvailable(): Q.Promise<boolean>;
|
||||
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
|
||||
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
|
||||
stopAdvertising(): Q.Promise<void>;
|
||||
isAdvertisingAvailable(): Q.Promise<boolean>;
|
||||
isAdvertising(): Q.Promise<boolean>;
|
||||
disableDebugLogs(): Q.Promise<void>;
|
||||
enableDebugNotifications(): Q.Promise<void>;
|
||||
disableDebugNotifications(): Q.Promise<void>;
|
||||
enableDebugLogs(): Q.Promise<void>;
|
||||
isBluetoothEnabled(): Q.Promise<boolean>;
|
||||
enableBluetooth(): Q.Promise<void>;
|
||||
disableBluetooth(): Q.Promise<void>;
|
||||
appendToDeviceLog(message: string): Q.Promise<string>;
|
||||
declare global {
|
||||
interface CordovaPlugins {
|
||||
locationManager: BeaconPlugin.LocationManager;
|
||||
}
|
||||
|
||||
export interface PluginResult {
|
||||
eventType: string;
|
||||
region: Region;
|
||||
beacons: Beacon[];
|
||||
authorizationStatus: string;
|
||||
state: string;
|
||||
error: string;
|
||||
}
|
||||
namespace BeaconPlugin {
|
||||
/**
|
||||
* Beacon Plugin.
|
||||
*/
|
||||
export interface LocationManager {
|
||||
delegate: Delegate;
|
||||
BeaconRegion: BeaconRegion;
|
||||
Region: Region;
|
||||
onDomDelegateReady(): Q.Promise<void>;
|
||||
startMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
stopMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
requestStateForRegion(region: Region): Q.Promise<void>;
|
||||
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
getAuthorizationStatus(): Q.Promise<PluginResult>;
|
||||
requestWhenInUseAuthorization(): Q.Promise<void>;
|
||||
requestAlwaysAuthorization(): Q.Promise<void>;
|
||||
getMonitoredRegions(): Q.Promise<Region[]>;
|
||||
getRangedRegions(): Q.Promise<Region[]>;
|
||||
isRangingAvailable(): Q.Promise<boolean>;
|
||||
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
|
||||
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
|
||||
stopAdvertising(): Q.Promise<void>;
|
||||
isAdvertisingAvailable(): Q.Promise<boolean>;
|
||||
isAdvertising(): Q.Promise<boolean>;
|
||||
disableDebugLogs(): Q.Promise<void>;
|
||||
enableDebugNotifications(): Q.Promise<void>;
|
||||
disableDebugNotifications(): Q.Promise<void>;
|
||||
enableDebugLogs(): Q.Promise<void>;
|
||||
isBluetoothEnabled(): Q.Promise<boolean>;
|
||||
enableBluetooth(): Q.Promise<void>;
|
||||
disableBluetooth(): Q.Promise<void>;
|
||||
appendToDeviceLog(message: string): Q.Promise<string>;
|
||||
}
|
||||
|
||||
export interface Delegate {
|
||||
didDetermineStateForRegion(pluginResult: PluginResult): void;
|
||||
didStartMonitoringForRegion(pluginResult: PluginResult): void;
|
||||
didExitRegion(pluginResult: PluginResult): void;
|
||||
didEnterRegion(pluginResult: PluginResult): void;
|
||||
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
|
||||
didChangeAuthorizationStatus(authorizationStatus: string): void;
|
||||
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
|
||||
}
|
||||
export interface PluginResult {
|
||||
eventType: string;
|
||||
region: Region;
|
||||
beacons: Beacon[];
|
||||
authorizationStatus: string;
|
||||
state: string;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface Region {
|
||||
identifier: string;
|
||||
new (identifier: string): Region;
|
||||
}
|
||||
export interface Delegate {
|
||||
didDetermineStateForRegion(pluginResult: PluginResult): void;
|
||||
didStartMonitoringForRegion(pluginResult: PluginResult): void;
|
||||
didExitRegion(pluginResult: PluginResult): void;
|
||||
didEnterRegion(pluginResult: PluginResult): void;
|
||||
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
|
||||
didChangeAuthorizationStatus(authorizationStatus: string): void;
|
||||
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
|
||||
}
|
||||
|
||||
export interface BeaconRegion extends Region {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
notifyEntryStateOnDisplay: boolean;
|
||||
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
|
||||
}
|
||||
export interface Region {
|
||||
identifier: string;
|
||||
new (identifier: string): Region;
|
||||
}
|
||||
|
||||
export interface CircularRegion extends Region {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
radius: number;
|
||||
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
|
||||
}
|
||||
export interface BeaconRegion extends Region {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
notifyEntryStateOnDisplay: boolean;
|
||||
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
|
||||
}
|
||||
|
||||
export interface Beacon {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
proximity: string;
|
||||
tx: number;
|
||||
rssi: number;
|
||||
accuracy: number;
|
||||
export interface CircularRegion extends Region {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
radius: number;
|
||||
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
|
||||
}
|
||||
|
||||
export interface Beacon {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
proximity: string;
|
||||
tx: number;
|
||||
rssi: number;
|
||||
accuracy: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import csprng = require("csprng");
|
||||
|
||||
let rngStr: string;
|
||||
|
||||
rngStr = csprng(32, 16);
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for csprng 0.1
|
||||
// Project: https://github.com/jcoglan/node-csprng
|
||||
// Definitions by: Wink Saville <https://github.com/winksaville>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
export = csprng;
|
||||
|
||||
declare function csprng(bits: number, radix: number): string;
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -17,6 +17,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"numbro-tests.ts"
|
||||
"csprng-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
@@ -62,7 +62,7 @@ hook({ extensions: ['.scss', '.sass'] });
|
||||
|
||||
hook({ ignore: (file: string) => false });
|
||||
hook({ ignore: 'unused' });
|
||||
hook({ ignore: /\.test\.(css|scss|sass)/$ });
|
||||
hook({ ignore: /\.test\.(css|scss|sass)$/ });
|
||||
|
||||
//
|
||||
// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#preprocesscss-function
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import resolve = require("dir-resolve");
|
||||
|
||||
resolve("module/package");
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for dir-resolve 1.0
|
||||
// Project: https://github.com/mwinche/dir-resolve
|
||||
// Definitions by: Andy Hanson <https://github.com/andy-ms>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function resolve(path: string): string;
|
||||
export = resolve;
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -17,6 +17,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-form-tests.ts"
|
||||
"dir-resolve-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
-1
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require('stream');
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
Vendored
+7
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Electron v1.4.8
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>, Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>, Daniel Perez Alvarez <https://github.com/unindented>, Markus Olsson <https://github.com/niik>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -2455,7 +2455,11 @@ declare namespace Electron {
|
||||
*/
|
||||
constructor(options: MenuItemOptions);
|
||||
|
||||
click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
|
||||
/**
|
||||
* A function that is fired when the MenuItem receives a click event
|
||||
*/
|
||||
click: (event: Event, browserWindow: BrowserWindow, webContents: WebContents) => void;
|
||||
|
||||
/**
|
||||
* Read-only property.
|
||||
*/
|
||||
@@ -2492,7 +2496,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* Callback when the menu item is clicked.
|
||||
*/
|
||||
click?: (menuItem: MenuItem, browserWindow: BrowserWindow) => void;
|
||||
click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
|
||||
/**
|
||||
* Can be normal, separator, submenu, checkbox or radio.
|
||||
*/
|
||||
|
||||
+11
-4
@@ -531,12 +531,19 @@ var winWindows = new BrowserWindow({
|
||||
// menu-item
|
||||
// https://github.com/atom/electron/blob/master/docs/api/menu-item.md
|
||||
|
||||
var menuItem = new MenuItem({});
|
||||
var menuItem = new MenuItem({
|
||||
click: (menuItem: Electron.MenuItem, browserWindow: Electron.BrowserWindow, event: Electron.Event) => {
|
||||
console.log('click', menuItem, browserWindow, event);
|
||||
}
|
||||
});
|
||||
|
||||
const fakeEvent: Electron.Event = {
|
||||
preventDefault: () => { },
|
||||
sender: winWindows.webContents,
|
||||
}
|
||||
|
||||
menuItem.label = 'Hello World!';
|
||||
menuItem.click = (menuItem, browserWindow) => {
|
||||
console.log('click', menuItem, browserWindow);
|
||||
};
|
||||
menuItem.click(fakeEvent, winWindows, winWindows.webContents)
|
||||
|
||||
// menu
|
||||
// https://github.com/atom/electron/blob/master/docs/api/menu.md
|
||||
|
||||
@@ -37,6 +37,13 @@ namespace ShallowWrapperTest {
|
||||
elementWrapper: ShallowWrapper<HTMLAttributes<{}>, {}>,
|
||||
statelessWrapper: ShallowWrapper<StatelessProps, never>;
|
||||
|
||||
function test_props_state_inferring() {
|
||||
let wrapper: ShallowWrapper<MyComponentProps, MyComponentState>;
|
||||
wrapper = shallow(<MyComponent stringProp="value" />);
|
||||
wrapper.state().stateProperty;
|
||||
wrapper.props().stringProp.toUpperCase();
|
||||
}
|
||||
|
||||
function test_shallow_options() {
|
||||
shallow(<MyComponent stringProp="1"/>, {
|
||||
context: {
|
||||
@@ -337,6 +344,13 @@ namespace ReactWrapperTest {
|
||||
elementWrapper: ReactWrapper<HTMLAttributes<{}>, {}>,
|
||||
statelessWrapper: ReactWrapper<StatelessProps, never>;
|
||||
|
||||
function test_prop_state_inferring() {
|
||||
let wrapper: ReactWrapper<MyComponentProps, MyComponentState>;
|
||||
wrapper = mount(<MyComponent stringProp="value" />);
|
||||
wrapper.state().stateProperty;
|
||||
wrapper.props().stringProp.toUpperCase();
|
||||
}
|
||||
|
||||
function test_unmount() {
|
||||
reactWrapper = reactWrapper.unmount();
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -546,6 +546,7 @@ export interface MountRendererProps {
|
||||
* @param node
|
||||
* @param [options]
|
||||
*/
|
||||
export function shallow<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, any>;
|
||||
export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, S>;
|
||||
|
||||
/**
|
||||
@@ -553,6 +554,7 @@ export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererPr
|
||||
* @param node
|
||||
* @param [options]
|
||||
*/
|
||||
export function mount<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, any>;
|
||||
export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, S>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -52,6 +52,11 @@ resultStr = faker.company.bsAdjective();
|
||||
resultStr = faker.company.bsBuzz();
|
||||
resultStr = faker.company.bsNoun();
|
||||
|
||||
resultStr = faker.database.column();
|
||||
resultStr = faker.database.type();
|
||||
resultStr = faker.database.collation();
|
||||
resultStr = faker.database.engine();
|
||||
|
||||
resultDate = faker.date.past();
|
||||
resultDate = faker.date.future();
|
||||
resultDate = faker.date.between('foo', 'bar');
|
||||
@@ -80,6 +85,8 @@ resultStr = faker.finance.transactionType();
|
||||
resultStr = faker.finance.currencyCode();
|
||||
resultStr = faker.finance.currencyName();
|
||||
resultStr = faker.finance.currencySymbol();
|
||||
resultStr = faker.finance.bitcoinAddress();
|
||||
resultStr = faker.finance.bic();
|
||||
|
||||
resultStr = faker.hacker.abbreviation();
|
||||
resultStr = faker.hacker.adjective();
|
||||
@@ -110,6 +117,8 @@ resultStr = userCard.address.suite;
|
||||
resultStr = faker.internet.avatar();
|
||||
resultStr = faker.internet.email();
|
||||
resultStr = faker.internet.email('foo', 'bar', 'quux');
|
||||
resultStr = faker.internet.exampleEmail();
|
||||
resultStr = faker.internet.exampleEmail('foo', 'bar');
|
||||
resultStr = faker.internet.protocol();
|
||||
resultStr = faker.internet.url();
|
||||
resultStr = faker.internet.domainName();
|
||||
@@ -128,12 +137,18 @@ resultStr = faker.lorem.words();
|
||||
resultStr = faker.lorem.words(0);
|
||||
resultStr = faker.lorem.sentence();
|
||||
resultStr = faker.lorem.sentence(0, 0);
|
||||
resultStr = faker.lorem.slug();
|
||||
resultStr = faker.lorem.slug(0);
|
||||
resultStr = faker.lorem.sentences();
|
||||
resultStr = faker.lorem.sentences(0);
|
||||
resultStr = faker.lorem.paragraph();
|
||||
resultStr = faker.lorem.paragraph(0);
|
||||
resultStr = faker.lorem.paragraphs();
|
||||
resultStr = faker.lorem.paragraphs(0, '');
|
||||
resultStr = faker.lorem.text();
|
||||
resultStr = faker.lorem.text(0);
|
||||
resultStr = faker.lorem.lines();
|
||||
resultStr = faker.lorem.lines(0);
|
||||
|
||||
resultStr = faker.name.firstName();
|
||||
resultStr = faker.name.firstName(0);
|
||||
@@ -169,6 +184,13 @@ resultStr = faker.random.objectElement();
|
||||
resultStr = faker.random.objectElement({foo: 'bar', field: 'foo'});
|
||||
resultStr = faker.random.uuid();
|
||||
resultBool = faker.random.boolean();
|
||||
resultStr = faker.random.word();
|
||||
resultStr = faker.random.words();
|
||||
resultStr = faker.random.words(0);
|
||||
resultStr = faker.random.image();
|
||||
resultStr = faker.random.locale();
|
||||
resultStr = faker.random.alphaNumeric();
|
||||
resultStr = faker.random.alphaNumeric(0);
|
||||
|
||||
resultStr = faker.system.fileName( "foo", "bar" );
|
||||
resultStr = faker.system.commonFileName( "foo", "bar" );
|
||||
|
||||
Vendored
+34
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for faker v3.1
|
||||
// Type definitions for faker v4.1.0
|
||||
// Project: http://marak.com/faker.js/
|
||||
// Definitions by: Bas Pennings <https://github.com/basp/>, Yuki Kokubun <https://github.com/Kuniwak>
|
||||
// Definitions by: Ben Swartz <https://github.com/bensw/>, Bas Pennings <https://github.com/basp/>, Yuki Kokubun <https://github.com/Kuniwak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var fakerStatic: Faker.FakerStatic;
|
||||
@@ -52,6 +52,13 @@ declare namespace Faker {
|
||||
bsNoun(): string;
|
||||
};
|
||||
|
||||
database: {
|
||||
column(): string;
|
||||
type(): string;
|
||||
collation(): string;
|
||||
engine(): string;
|
||||
};
|
||||
|
||||
date: {
|
||||
past(years?: number, refDate?: string|Date): Date;
|
||||
future(years?: number, refDate?: string|Date): Date;
|
||||
@@ -72,6 +79,8 @@ declare namespace Faker {
|
||||
currencyCode(): string;
|
||||
currencyName(): string;
|
||||
currencySymbol(): string;
|
||||
bitcoinAddress(): string;
|
||||
bic(): string
|
||||
};
|
||||
|
||||
hacker: {
|
||||
@@ -116,11 +125,13 @@ declare namespace Faker {
|
||||
sports(width?: number, height?: number): string;
|
||||
technics(width?: number, height?: number): string;
|
||||
transport(width?: number, height?: number): string;
|
||||
dataUri(width?: number, height?: number): string;
|
||||
};
|
||||
|
||||
internet: {
|
||||
avatar(): string;
|
||||
email(firstName?: string, lastName?: string, provider?: string): string;
|
||||
exampleEmail(firstName?: string, lastName?: string): string;
|
||||
userName(firstName?: string, lastName?: string): string;
|
||||
protocol(): string;
|
||||
url(): string;
|
||||
@@ -128,6 +139,7 @@ declare namespace Faker {
|
||||
domainSuffix(): string;
|
||||
domainWord(): string;
|
||||
ip(): string;
|
||||
ipv6(): string;
|
||||
userAgent(): string;
|
||||
color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string;
|
||||
mac(): string;
|
||||
@@ -138,9 +150,12 @@ declare namespace Faker {
|
||||
word(): string;
|
||||
words(num?: number): string;
|
||||
sentence(wordCount?: number, range?: number): string;
|
||||
slug(wordCount?: number): string;
|
||||
sentences(sentenceCount?: number): string;
|
||||
paragraph(sentenceCount?: number): string;
|
||||
paragraphs(paragraphCount?: number, separator?: string): string;
|
||||
text(times?: number): string;
|
||||
lines(lineCount?: number): string;
|
||||
};
|
||||
|
||||
name: {
|
||||
@@ -171,6 +186,11 @@ declare namespace Faker {
|
||||
objectElement<T>(object?: { [key: string]: T }, field?: any): T;
|
||||
uuid(): string;
|
||||
boolean(): boolean;
|
||||
word(): string; // TODO: have ability to return specific type of word? As in: noun, adjective, verb, etc
|
||||
words(count?: number): string;
|
||||
image(): string;
|
||||
locale(): string;
|
||||
alphaNumeric(count?: number): string;
|
||||
};
|
||||
|
||||
system: {
|
||||
@@ -275,6 +295,14 @@ declare module "faker" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/az" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/cz" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/de" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
@@ -351,6 +379,10 @@ declare module "faker/locale/ge" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/id_ID" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/it" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"faker-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
|
||||
|
||||
let resultStr: string;
|
||||
let resultBool: boolean;
|
||||
let resultNum: number;
|
||||
let resultStrArr: string[];
|
||||
let resultDate: Date;
|
||||
|
||||
import faker = require('faker');
|
||||
faker.locale = 'en';
|
||||
|
||||
resultStr = faker.address.zipCode();
|
||||
resultStr = faker.address.zipCode('###');
|
||||
resultStr = faker.address.city();
|
||||
resultStr = faker.address.city(0);
|
||||
resultStr = faker.address.cityPrefix();
|
||||
resultStr = faker.address.citySuffix();
|
||||
resultStr = faker.address.streetName();
|
||||
resultStr = faker.address.streetAddress();
|
||||
resultStr = faker.address.streetAddress(false);;
|
||||
resultStr = faker.address.streetSuffix();
|
||||
resultStr = faker.address.streetPrefix();
|
||||
resultStr = faker.address.secondaryAddress();
|
||||
resultStr = faker.address.county();
|
||||
resultStr = faker.address.country();
|
||||
resultStr = faker.address.countryCode();
|
||||
resultStr = faker.address.state();
|
||||
resultStr = faker.address.state(false);
|
||||
resultStr = faker.address.stateAbbr();
|
||||
resultStr = faker.address.latitude();
|
||||
resultStr = faker.address.longitude();
|
||||
|
||||
resultStr = faker.commerce.color();
|
||||
resultStr = faker.commerce.department();
|
||||
resultStr = faker.commerce.productName();
|
||||
resultStr = faker.commerce.price();
|
||||
resultStr = faker.commerce.price(0, 0, 0, '#');
|
||||
resultStr = faker.commerce.productAdjective();
|
||||
resultStr = faker.commerce.productMaterial();
|
||||
resultStr = faker.commerce.product();
|
||||
|
||||
resultStrArr = faker.company.suffixes();
|
||||
resultStr = faker.company.companyName();
|
||||
resultStr = faker.company.companyName(0);
|
||||
resultStr = faker.company.companySuffix();
|
||||
resultStr = faker.company.catchPhrase();
|
||||
resultStr = faker.company.bs();
|
||||
resultStr = faker.company.catchPhraseAdjective();
|
||||
resultStr = faker.company.catchPhraseDescriptor();
|
||||
resultStr = faker.company.catchPhraseNoun();
|
||||
resultStr = faker.company.bsAdjective();
|
||||
resultStr = faker.company.bsBuzz();
|
||||
resultStr = faker.company.bsNoun();
|
||||
|
||||
resultDate = faker.date.past();
|
||||
resultDate = faker.date.future();
|
||||
resultDate = faker.date.between('foo', 'bar');
|
||||
resultDate = faker.date.between(new Date(), new Date());
|
||||
resultDate = faker.date.recent();
|
||||
resultDate = faker.date.recent(100);
|
||||
resultStr = faker.date.month();
|
||||
resultStr = faker.date.month({
|
||||
abbr: true,
|
||||
context: true
|
||||
});
|
||||
resultStr = faker.date.weekday();
|
||||
resultStr = faker.date.weekday({
|
||||
abbr: true,
|
||||
context: true
|
||||
});
|
||||
|
||||
resultStr = faker.finance.account();
|
||||
resultStr = faker.finance.account(0);
|
||||
resultStr = faker.finance.accountName();
|
||||
resultStr = faker.finance.mask();
|
||||
resultStr = faker.finance.mask(0, false, false);
|
||||
resultStr = faker.finance.amount();
|
||||
resultStr = faker.finance.amount(0, 0, 0, '#');
|
||||
resultStr = faker.finance.transactionType();
|
||||
resultStr = faker.finance.currencyCode();
|
||||
resultStr = faker.finance.currencyName();
|
||||
resultStr = faker.finance.currencySymbol();
|
||||
|
||||
resultStr = faker.hacker.abbreviation();
|
||||
resultStr = faker.hacker.adjective();
|
||||
resultStr = faker.hacker.noun();
|
||||
resultStr = faker.hacker.verb();
|
||||
resultStr = faker.hacker.ingverb();
|
||||
resultStr = faker.hacker.phrase();
|
||||
|
||||
resultStr = faker.helpers.randomize();
|
||||
resultNum = faker.helpers.randomize([1,2,3,4]);
|
||||
resultStr = faker.helpers.randomize(['foo', 'bar', 'quux']);
|
||||
resultStr = faker.helpers.slugify('foo bar quux');
|
||||
resultStr = faker.helpers.replaceSymbolWithNumber('foo# bar#');
|
||||
resultStr = faker.helpers.replaceSymbols('foo# bar? quux#');
|
||||
resultStrArr = faker.helpers.shuffle(['foo', 'bar', 'quux']);
|
||||
resultStr = faker.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'});
|
||||
|
||||
const card = faker.helpers.createCard();
|
||||
resultStr = card.name;
|
||||
resultStr = card.address.streetA;
|
||||
const contextualCard = faker.helpers.contextualCard();
|
||||
resultStr = contextualCard.name;
|
||||
resultStr = contextualCard.address.suite;
|
||||
const userCard = faker.helpers.userCard();
|
||||
resultStr = userCard.name;
|
||||
resultStr = userCard.address.suite;
|
||||
|
||||
resultStr = faker.internet.avatar();
|
||||
resultStr = faker.internet.email();
|
||||
resultStr = faker.internet.email('foo', 'bar', 'quux');
|
||||
resultStr = faker.internet.protocol();
|
||||
resultStr = faker.internet.url();
|
||||
resultStr = faker.internet.domainName();
|
||||
resultStr = faker.internet.domainSuffix();
|
||||
resultStr = faker.internet.domainWord();
|
||||
resultStr = faker.internet.ip();
|
||||
resultStr = faker.internet.userAgent();
|
||||
resultStr = faker.internet.color();
|
||||
resultStr = faker.internet.color(0, 0, 0);
|
||||
resultStr = faker.internet.mac();
|
||||
resultStr = faker.internet.password();
|
||||
resultStr = faker.internet.password(0, false, '#', 'foo');
|
||||
|
||||
resultStr = faker.lorem.word();
|
||||
resultStr = faker.lorem.words();
|
||||
resultStr = faker.lorem.words(0);
|
||||
resultStr = faker.lorem.sentence();
|
||||
resultStr = faker.lorem.sentence(0, 0);
|
||||
resultStr = faker.lorem.sentences();
|
||||
resultStr = faker.lorem.sentences(0);
|
||||
resultStr = faker.lorem.paragraph();
|
||||
resultStr = faker.lorem.paragraph(0);
|
||||
resultStr = faker.lorem.paragraphs();
|
||||
resultStr = faker.lorem.paragraphs(0, '');
|
||||
|
||||
resultStr = faker.name.firstName();
|
||||
resultStr = faker.name.firstName(0);
|
||||
resultStr = faker.name.lastName();
|
||||
resultStr = faker.name.lastName(0);
|
||||
resultStr = faker.name.findName();
|
||||
resultStr = faker.name.findName('', '', 0);
|
||||
resultStr = faker.name.jobTitle();
|
||||
resultStr = faker.name.prefix();
|
||||
resultStr = faker.name.suffix();
|
||||
resultStr = faker.name.title();
|
||||
resultStr = faker.name.jobDescriptor();
|
||||
resultStr = faker.name.jobArea();
|
||||
resultStr = faker.name.jobType();
|
||||
|
||||
resultStr = faker.phone.phoneNumber();
|
||||
resultStr = faker.phone.phoneNumber('#');
|
||||
resultStr = faker.phone.phoneNumberFormat();
|
||||
// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13
|
||||
resultStr = faker.phone.phoneNumberFormat(0);
|
||||
resultStr = faker.phone.phoneFormats();
|
||||
|
||||
resultNum = faker.random.number();
|
||||
resultNum = faker.random.number(0);
|
||||
resultNum = faker.random.number({
|
||||
min: 0,
|
||||
max: 0,
|
||||
precision: 0
|
||||
});
|
||||
resultStr = faker.random.arrayElement();
|
||||
resultStr = faker.random.arrayElement(['foo', 'bar', 'quux'])
|
||||
resultStr = faker.random.objectElement();
|
||||
resultStr = faker.random.objectElement({foo: 'bar', field: 'foo'});
|
||||
resultStr = faker.random.uuid();
|
||||
resultBool = faker.random.boolean();
|
||||
|
||||
resultStr = faker.system.fileName( "foo", "bar" );
|
||||
resultStr = faker.system.commonFileName( "foo", "bar" );
|
||||
resultStr = faker.system.mimeType();
|
||||
resultStr = faker.system.commonFileType();
|
||||
resultStr = faker.system.commonFileExt();
|
||||
resultStr = faker.system.fileType();
|
||||
resultStr = faker.system.fileExt( "foo" );
|
||||
resultStr = faker.system.semver();
|
||||
|
||||
import fakerEn = require('faker/locale/en');
|
||||
resultStr = faker.name.firstName();
|
||||
Vendored
+416
@@ -0,0 +1,416 @@
|
||||
// Type definitions for faker v3.1
|
||||
// Project: http://marak.com/faker.js/
|
||||
// Definitions by: Bas Pennings <https://github.com/basp/>, Yuki Kokubun <https://github.com/Kuniwak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var fakerStatic: Faker.FakerStatic;
|
||||
|
||||
declare namespace Faker {
|
||||
interface FakerStatic {
|
||||
locale: string;
|
||||
|
||||
address: {
|
||||
zipCode(format?: string): string;
|
||||
city(format?: number): string;
|
||||
cityPrefix(): string;
|
||||
citySuffix(): string;
|
||||
streetName(): string;
|
||||
streetAddress(useFullAddress?: boolean): string;
|
||||
streetSuffix(): string;
|
||||
streetPrefix(): string;
|
||||
secondaryAddress(): string;
|
||||
county(): string;
|
||||
country(): string;
|
||||
countryCode(): string;
|
||||
state(useAbbr?: boolean): string;
|
||||
stateAbbr(): string;
|
||||
latitude(): string;
|
||||
longitude(): string;
|
||||
};
|
||||
|
||||
commerce: {
|
||||
color(): string;
|
||||
department(): string;
|
||||
productName(): string;
|
||||
price(min?: number, max?: number, dec?: number, symbol?: string): string;
|
||||
productAdjective(): string;
|
||||
productMaterial(): string;
|
||||
product(): string;
|
||||
};
|
||||
|
||||
company: {
|
||||
suffixes(): string[];
|
||||
companyName(format?: number): string;
|
||||
companySuffix(): string;
|
||||
catchPhrase(): string;
|
||||
bs(): string;
|
||||
catchPhraseAdjective(): string;
|
||||
catchPhraseDescriptor(): string;
|
||||
catchPhraseNoun(): string;
|
||||
bsAdjective(): string;
|
||||
bsBuzz(): string;
|
||||
bsNoun(): string;
|
||||
};
|
||||
|
||||
date: {
|
||||
past(years?: number, refDate?: string|Date): Date;
|
||||
future(years?: number, refDate?: string|Date): Date;
|
||||
between(from: string|number|Date, to: string|Date): Date;
|
||||
recent(days?: number): Date;
|
||||
month(options?: { abbr?: boolean, context?: boolean }): string;
|
||||
weekday(options?: { abbr?: boolean, context?: boolean }): string;
|
||||
};
|
||||
|
||||
fake(str: string): string;
|
||||
|
||||
finance: {
|
||||
account(length?: number): string;
|
||||
accountName(): string;
|
||||
mask(length?: number, parens?: boolean, elipsis?: boolean): string;
|
||||
amount(min?:number, max?: number, dec?: number, symbol?: string): string;
|
||||
transactionType(): string;
|
||||
currencyCode(): string;
|
||||
currencyName(): string;
|
||||
currencySymbol(): string;
|
||||
};
|
||||
|
||||
hacker: {
|
||||
abbreviation(): string;
|
||||
adjective(): string;
|
||||
noun(): string;
|
||||
verb(): string;
|
||||
ingverb(): string;
|
||||
phrase(): string;
|
||||
};
|
||||
|
||||
helpers: {
|
||||
randomize<T>(array: T[]): T;
|
||||
randomize(): string;
|
||||
slugify(string?: string): string;
|
||||
replaceSymbolWithNumber(string?: string, symbol?: string): string;
|
||||
replaceSymbols(string?: string): string;
|
||||
shuffle<T>(o: T[]): T[];
|
||||
shuffle(): string[];
|
||||
mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string;
|
||||
createCard(): Faker.Card;
|
||||
contextualCard(): Faker.ContextualCard;
|
||||
userCard(): Faker.UserCard;
|
||||
createTransaction(): Faker.Transaction;
|
||||
};
|
||||
|
||||
|
||||
image: {
|
||||
image(): string;
|
||||
avatar(): string;
|
||||
imageUrl(width?: number, height?: number, category?: string): string;
|
||||
abstract(width?: number, height?: number): string;
|
||||
animals(width?: number, height?: number): string;
|
||||
business(width?: number, height?: number): string;
|
||||
cats(width?: number, height?: number): string;
|
||||
city(width?: number, height?: number): string;
|
||||
food(width?: number, height?: number): string;
|
||||
nightlife(width?: number, height?: number): string;
|
||||
fashion(width?: number, height?: number): string;
|
||||
people(width?: number, height?: number): string;
|
||||
nature(width?: number, height?: number): string;
|
||||
sports(width?: number, height?: number): string;
|
||||
technics(width?: number, height?: number): string;
|
||||
transport(width?: number, height?: number): string;
|
||||
};
|
||||
|
||||
internet: {
|
||||
avatar(): string;
|
||||
email(firstName?: string, lastName?: string, provider?: string): string;
|
||||
userName(firstName?: string, lastName?: string): string;
|
||||
protocol(): string;
|
||||
url(): string;
|
||||
domainName(): string;
|
||||
domainSuffix(): string;
|
||||
domainWord(): string;
|
||||
ip(): string;
|
||||
userAgent(): string;
|
||||
color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string;
|
||||
mac(): string;
|
||||
password(len?: number, memorable?: boolean, pattern?: string|RegExp, prefix?: string): string;
|
||||
};
|
||||
|
||||
lorem: {
|
||||
word(): string;
|
||||
words(num?: number): string;
|
||||
sentence(wordCount?: number, range?: number): string;
|
||||
sentences(sentenceCount?: number): string;
|
||||
paragraph(sentenceCount?: number): string;
|
||||
paragraphs(paragraphCount?: number, separator?: string): string;
|
||||
};
|
||||
|
||||
name: {
|
||||
firstName(gender?: number): string;
|
||||
lastName(gender?: number): string;
|
||||
findName(firstName?: string, lastName?: string, gender?: number): string;
|
||||
jobTitle(): string;
|
||||
prefix(): string;
|
||||
suffix(): string;
|
||||
title(): string;
|
||||
jobDescriptor(): string;
|
||||
jobArea(): string;
|
||||
jobType(): string;
|
||||
};
|
||||
|
||||
phone: {
|
||||
phoneNumber(format?: string): string;
|
||||
phoneNumberFormat(phoneFormatsArrayIndex?: number): string;
|
||||
phoneFormats(): string;
|
||||
};
|
||||
|
||||
random: {
|
||||
number(max: number): number;
|
||||
number(options?: { min?: number, max?: number, precision?: number }): number;
|
||||
arrayElement(): string;
|
||||
arrayElement<T>(array: T[]): T;
|
||||
objectElement(object?: { [key: string]: any }, field?: "key"): string;
|
||||
objectElement<T>(object?: { [key: string]: T }, field?: any): T;
|
||||
uuid(): string;
|
||||
boolean(): boolean;
|
||||
};
|
||||
|
||||
system: {
|
||||
fileName(ext: string, type: string): string;
|
||||
commonFileName(ext: string, type: string): string;
|
||||
mimeType(): string;
|
||||
commonFileType(): string;
|
||||
commonFileExt(): string;
|
||||
fileType(): string;
|
||||
fileExt(mimeType: string): string;
|
||||
//directoryPath(): string;
|
||||
//filePath(): string;
|
||||
semver(): string;
|
||||
};
|
||||
|
||||
seed(value: number): void;
|
||||
}
|
||||
|
||||
interface Card {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
address: FullAddress;
|
||||
phone: string;
|
||||
website: string;
|
||||
company: Company;
|
||||
posts: Post[];
|
||||
accountHistory: string[];
|
||||
}
|
||||
|
||||
interface FullAddress {
|
||||
streetA: string;
|
||||
streetB: string;
|
||||
streetC: string;
|
||||
streetD: string;
|
||||
city: string;
|
||||
state: string;
|
||||
county: string;
|
||||
zipcode: string;
|
||||
geo: Geo;
|
||||
}
|
||||
|
||||
interface Geo {
|
||||
lat: string;
|
||||
lng: string;
|
||||
}
|
||||
|
||||
interface Company {
|
||||
name: string;
|
||||
catchPhrase: string;
|
||||
bs: string;
|
||||
}
|
||||
|
||||
interface Post {
|
||||
words: string;
|
||||
sentence: string;
|
||||
sentences: string;
|
||||
paragraph: string;
|
||||
}
|
||||
|
||||
interface ContextualCard {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
dob: Date;
|
||||
phone: string;
|
||||
address: Address;
|
||||
website: string;
|
||||
company: Company;
|
||||
}
|
||||
|
||||
interface Address {
|
||||
street: string;
|
||||
suite: string;
|
||||
city: string;
|
||||
state: string;
|
||||
zipcode: string;
|
||||
geo: Geo;
|
||||
}
|
||||
|
||||
interface UserCard {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
address: Address;
|
||||
phone: string;
|
||||
website: string;
|
||||
company: Company;
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
amount: string;
|
||||
date: Date;
|
||||
business: string;
|
||||
name: string;
|
||||
type: string;
|
||||
account: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "faker" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/de" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/de_AT" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/de_CH" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/el_GR" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_AU" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_BORK" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_CA" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_GB" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_IE" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_IND" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_US" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/en_au_ocker" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/es" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/es_MX" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/fa" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/fr" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/fr_CA" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/ge" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/it" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/ja" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/ko" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/nb_NO" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/nep" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/nl" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/pl" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/pt_BR" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/ru" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/sk" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/sv" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/tr" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/uk" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/vi" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/zh_CN" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
|
||||
declare module "faker/locale/zh_TW" {
|
||||
export = fakerStatic;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"faker": [ "faker/v3" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"faker-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -19,16 +19,16 @@ var client = new FirebaseClient({
|
||||
var newUser:User = new User();
|
||||
newUser.name = {
|
||||
first: "Fred",
|
||||
last: "Flinstone"
|
||||
last: "Flinstone"
|
||||
};
|
||||
|
||||
client.push("users", newUser)
|
||||
.then(function (result){
|
||||
console.log(result.name);
|
||||
var newUser2:User = new User();
|
||||
newUser2.name = {
|
||||
first: "Fred",
|
||||
last: "Rockington"
|
||||
newUser2.name = {
|
||||
first: "Fred",
|
||||
last: "Rockington"
|
||||
}
|
||||
return client.update("users/" + result.name, newUser2);
|
||||
}).then(function (result){
|
||||
@@ -36,15 +36,15 @@ client.push("users", newUser)
|
||||
var newUser3:User = new User();
|
||||
newUser3.name = {
|
||||
first: "Axe",
|
||||
last: "Steel"
|
||||
last: "Steel"
|
||||
};
|
||||
return client.set("users/AXESTEEL", newUser3);
|
||||
}).then(function (result){
|
||||
console.log(result.name.first);
|
||||
return client.get();
|
||||
}).then(function (result){
|
||||
}).then(function (result){
|
||||
console.log(result);
|
||||
return client.get<User>("users/AXESTEEL")
|
||||
}).then(function (result){
|
||||
console.log(result.name.first);
|
||||
console.log(result.name.first);
|
||||
});
|
||||
Vendored
+10
-12
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Andrew Breen <https://github.com/fpsscarecrow/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="q" />
|
||||
import * as Q from "q";
|
||||
|
||||
interface PushResponse {
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ interface FirebaseConfig {
|
||||
* path for the Firebase instance
|
||||
*/
|
||||
url : string;
|
||||
|
||||
|
||||
/**
|
||||
* Token for authorisation
|
||||
*/
|
||||
@@ -29,38 +29,38 @@ interface FirebaseClient {
|
||||
* Creates a new FirebaseClient given the provided configuration
|
||||
*/
|
||||
new (config : FirebaseConfig) : FirebaseClient;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves all objects at the base path
|
||||
*/
|
||||
get<T>() : Q.Promise<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves an object
|
||||
* @param path Relative path from the base for the resource
|
||||
*/
|
||||
get<T>(path : string) : Q.Promise<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a promise of the HTTP response from setting the value at the given path
|
||||
* @param path Relative path from the base for the resource
|
||||
* @param data Data to be set as the value for the given path
|
||||
*/
|
||||
set<T>(path : string, data : T) : Q.Promise<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Update a node at a given path
|
||||
* @param path Relative path from the base for the resource
|
||||
* @param value Value of the response
|
||||
*/
|
||||
update<T>(path : string, value : T) : Q.Promise<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Deletes the resource at a given path
|
||||
* @param path Relative path from the base for the resource
|
||||
*/
|
||||
delete(path : string) : Q.Promise<void>;
|
||||
|
||||
|
||||
/**
|
||||
* @param path Relative path from the base for the resource
|
||||
* @param value Object to push to the path
|
||||
@@ -70,7 +70,5 @@ interface FirebaseClient {
|
||||
|
||||
declare var FirebaseClient: FirebaseClient;
|
||||
|
||||
declare module 'firebase-client' {
|
||||
export = FirebaseClient;
|
||||
}
|
||||
|
||||
export = FirebaseClient;
|
||||
export as namespace FirebaseClient;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference types="gapi.people" />
|
||||
|
||||
|
||||
function test_init(){
|
||||
function test_init() {
|
||||
var auth = gapi.auth2.init({
|
||||
client_id: 'my-id',
|
||||
cookie_policy: 'single_host_origin',
|
||||
@@ -9,7 +9,7 @@ function test_init(){
|
||||
});
|
||||
}
|
||||
|
||||
function test_getAuthInstance(){
|
||||
function test_getAuthInstance() {
|
||||
gapi.auth2.init({
|
||||
client_id: 'my-id',
|
||||
cookie_policy: 'single_host_origin',
|
||||
@@ -19,14 +19,14 @@ function test_getAuthInstance(){
|
||||
var auth = gapi.auth2.getAuthInstance();
|
||||
}
|
||||
|
||||
function test_signIn(){
|
||||
function test_signIn() {
|
||||
gapi.auth2.getAuthInstance().signIn({
|
||||
scope: 'email profile',
|
||||
prompt: 'content'
|
||||
});
|
||||
}
|
||||
|
||||
function test_signInOptionsBuild(){
|
||||
function test_signInOptionsBuild() {
|
||||
var options = new gapi.auth2.SigninOptionsBuilder();
|
||||
options.setAppPackageName('com.example.app');
|
||||
options.setFetchBasicProfile(true);
|
||||
@@ -35,13 +35,13 @@ function test_signInOptionsBuild(){
|
||||
gapi.auth2.getAuthInstance().signIn(options);
|
||||
}
|
||||
|
||||
function test_getAuthResponse(){
|
||||
function test_getAuthResponse() {
|
||||
var user = gapi.auth2.getAuthInstance().currentUser.get();
|
||||
var authResponse = user.getAuthResponse();
|
||||
var authResponseWithAuth = user.getAuthResponse(true);
|
||||
}
|
||||
|
||||
function test_render(){
|
||||
function test_render() {
|
||||
var success = (googleUser: gapi.auth2.GoogleUser): void => {
|
||||
console.log(googleUser);
|
||||
};
|
||||
@@ -59,3 +59,87 @@ function test_render(){
|
||||
onfailure: failure
|
||||
});
|
||||
}
|
||||
|
||||
/* Example taken from https://developers.google.com/identity/sign-in/web/ */
|
||||
function onSignIn(googleUser: gapi.auth2.GoogleUser) {
|
||||
// Useful data for your client-side scripts:
|
||||
var profile = googleUser.getBasicProfile();
|
||||
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
|
||||
console.log('Full Name: ' + profile.getName());
|
||||
console.log('Given Name: ' + profile.getGivenName());
|
||||
console.log('Family Name: ' + profile.getFamilyName());
|
||||
console.log("Image URL: " + profile.getImageUrl());
|
||||
console.log("Email: " + profile.getEmail());
|
||||
|
||||
// The ID token you need to pass to your backend:
|
||||
var id_token = googleUser.getAuthResponse().id_token;
|
||||
console.log("ID Token: " + id_token);
|
||||
};
|
||||
|
||||
|
||||
/* Example taken from https://github.com/google/google-api-javascript-client/blob/master/samples/authSample.html */
|
||||
|
||||
// Enter an API key from the Google API Console:
|
||||
// https://console.developers.google.com/apis/credentials
|
||||
var apiKey = 'YOUR_API_KEY';
|
||||
// Enter the API Discovery Docs that describes the APIs you want to
|
||||
// access. In this example, we are accessing the People API, so we load
|
||||
// Discovery Doc found here: https://developers.google.com/people/api/rest/
|
||||
var discoveryDocs = ["https://people.googleapis.com/$discovery/rest?version=v1"];
|
||||
// Enter a client ID for a web application from the Google API Console:
|
||||
// https://console.developers.google.com/apis/credentials?project=_
|
||||
// In your API Console project, add a JavaScript origin that corresponds
|
||||
// to the domain where you will be running the script.
|
||||
var clientId = 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com';
|
||||
// Enter one or more authorization scopes. Refer to the documentation for
|
||||
// the API or https://developers.google.com/people/v1/how-tos/authorizing
|
||||
// for details.
|
||||
var scopes = 'profile';
|
||||
var authorizeButton = document.getElementById('authorize-button');
|
||||
var signoutButton = document.getElementById('signout-button');
|
||||
function handleClientLoad() {
|
||||
// Load the API client and auth2 library
|
||||
gapi.load('client:auth2', initClient);
|
||||
}
|
||||
function initClient() {
|
||||
gapi.client.init({
|
||||
apiKey: apiKey,
|
||||
discoveryDocs: discoveryDocs,
|
||||
clientId: clientId,
|
||||
scope: scopes
|
||||
}).then(function () {
|
||||
// Listen for sign-in state changes.
|
||||
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
|
||||
// Handle the initial sign-in state.
|
||||
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
|
||||
authorizeButton.onclick = handleAuthClick;
|
||||
signoutButton.onclick = handleSignoutClick;
|
||||
});
|
||||
}
|
||||
function updateSigninStatus(isSignedIn: boolean) {
|
||||
if (isSignedIn) {
|
||||
authorizeButton.style.display = 'none';
|
||||
signoutButton.style.display = 'block';
|
||||
makeApiCall();
|
||||
} else {
|
||||
authorizeButton.style.display = 'block';
|
||||
signoutButton.style.display = 'none';
|
||||
}
|
||||
}
|
||||
function handleAuthClick(event: MouseEvent) {
|
||||
gapi.auth2.getAuthInstance().signIn();
|
||||
}
|
||||
function handleSignoutClick(event: MouseEvent) {
|
||||
gapi.auth2.getAuthInstance().signOut();
|
||||
}
|
||||
// Load the API and make an API call. Display the results on the screen.
|
||||
function makeApiCall() {
|
||||
gapi.client.people.people.get({
|
||||
resourceName: 'people/me'
|
||||
}).then(function(resp) {
|
||||
var p = document.createElement('p');
|
||||
var name = resp.result.names[0].givenName;
|
||||
p.appendChild(document.createTextNode('Hello, '+name+'!'));
|
||||
document.getElementById('content').appendChild(p);
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Google Sign-In API
|
||||
// Type definitions for Google Sign-In API 0.0
|
||||
// Project: https://developers.google.com/identity/sign-in/web/
|
||||
// Definitions by: Derek Lawless <https://github.com/flawless2011>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -21,7 +21,7 @@ declare namespace gapi.auth2 {
|
||||
* Calls the onInit function when the GoogleAuth object is fully initialized, or calls the onFailure function if
|
||||
* initialization fails.
|
||||
*/
|
||||
then(onInit: () => any, onFailure: (reason: string) => any): any;
|
||||
then(onInit: () => any, onFailure?: (reason: string) => any): any;
|
||||
|
||||
/**
|
||||
* Signs in the user with the options specified to gapi.auth2.init().
|
||||
@@ -58,7 +58,7 @@ declare namespace gapi.auth2 {
|
||||
onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
|
||||
}
|
||||
|
||||
export interface IsSignedIn{
|
||||
export interface IsSignedIn {
|
||||
/**
|
||||
* Returns whether the current user is currently signed in.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/* Example taken from Google Calendar API JavaScript Quickstart https://developers.google.com/google-apps/calendar/quickstart/js */
|
||||
|
||||
{
|
||||
// Your Client ID can be retrieved from your project in the Google
|
||||
// Developer Console, https://console.developers.google.com
|
||||
var CLIENT_ID = '<YOUR_CLIENT_ID>';
|
||||
|
||||
var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"];
|
||||
|
||||
/**
|
||||
* Check if current user has authorized this application.
|
||||
*/
|
||||
function checkAuth() {
|
||||
gapi.auth.authorize(
|
||||
{
|
||||
'client_id': CLIENT_ID,
|
||||
'scope': SCOPES.join(' '),
|
||||
'immediate': true
|
||||
}, handleAuthResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle response from authorization server.
|
||||
*
|
||||
* @param {Object} authResult Authorization result.
|
||||
*/
|
||||
function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) {
|
||||
var authorizeDiv = document.getElementById('authorize-div')!;
|
||||
if (authResult && !authResult.error) {
|
||||
// Hide auth UI, then load client library.
|
||||
authorizeDiv.style.display = 'none';
|
||||
loadCalendarApi();
|
||||
} else {
|
||||
// Show auth UI, allowing the user to initiate authorization by
|
||||
// clicking authorize button.
|
||||
authorizeDiv.style.display = 'inline';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate auth flow in response to user clicking authorize button.
|
||||
*
|
||||
* @param {Event} event Button click event.
|
||||
*/
|
||||
function handleAuthClick(event: MouseEvent) {
|
||||
gapi.auth.authorize(
|
||||
{client_id: CLIENT_ID, scope: SCOPES, immediate: false},
|
||||
handleAuthResult);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Google Calendar client library. List upcoming events
|
||||
* once client library is loaded.
|
||||
*/
|
||||
function loadCalendarApi() {
|
||||
gapi.client.load('calendar', 'v3', listUpcomingEvents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the summary and start datetime/date of the next ten events in
|
||||
* the authorized user's calendar. If no events are found an
|
||||
* appropriate message is printed.
|
||||
*/
|
||||
function listUpcomingEvents() {
|
||||
var request = gapi.client.calendar.events.list({
|
||||
'calendarId': 'primary',
|
||||
'timeMin': (new Date()).toISOString(),
|
||||
'showDeleted': false,
|
||||
'singleEvents': true,
|
||||
'maxResults': 10,
|
||||
'orderBy': 'startTime'
|
||||
});
|
||||
|
||||
request.execute(function(resp) {
|
||||
var events = resp.items;
|
||||
appendPre('Upcoming events:');
|
||||
|
||||
if (events.length > 0) {
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
var event = events[i];
|
||||
var when = event.start.dateTime;
|
||||
if (!when) {
|
||||
when = event.start.date;
|
||||
}
|
||||
appendPre(event.summary + ' (' + when + ')')
|
||||
}
|
||||
} else {
|
||||
appendPre('No upcoming events found.');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a pre element to the body containing the given message
|
||||
* as its text node.
|
||||
*
|
||||
* @param {string} message Text to be placed in pre element.
|
||||
*/
|
||||
function appendPre(message: string) {
|
||||
var pre = document.getElementById('output')!;
|
||||
var textContent = document.createTextNode(message + '\n');
|
||||
pre.appendChild(textContent);
|
||||
}
|
||||
}
|
||||
|
||||
/* Example taken from https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples */
|
||||
|
||||
{
|
||||
// Refer to the JavaScript quickstart on how to setup the environment:
|
||||
// https://developers.google.com/google-apps/calendar/quickstart/js
|
||||
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
|
||||
// stored credentials.
|
||||
|
||||
const event = {
|
||||
'summary': 'Google I/O 2015',
|
||||
'location': '800 Howard St., San Francisco, CA 94103',
|
||||
'description': 'A chance to hear more about Google\'s developer products.',
|
||||
'start': {
|
||||
'dateTime': '2015-05-28T09:00:00-07:00',
|
||||
'timeZone': 'America/Los_Angeles'
|
||||
},
|
||||
'end': {
|
||||
'dateTime': '2015-05-28T17:00:00-07:00',
|
||||
'timeZone': 'America/Los_Angeles'
|
||||
},
|
||||
'recurrence': [
|
||||
'RRULE:FREQ=DAILY;COUNT=2'
|
||||
],
|
||||
'attendees': [
|
||||
{'email': 'lpage@example.com'},
|
||||
{'email': 'sbrin@example.com'}
|
||||
],
|
||||
'reminders': {
|
||||
'useDefault': false,
|
||||
'overrides': [
|
||||
{'method': 'email', 'minutes': 24 * 60},
|
||||
{'method': 'popup', 'minutes': 10}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var request = gapi.client.calendar.events.insert({
|
||||
'calendarId': 'primary',
|
||||
'resource': event
|
||||
});
|
||||
|
||||
request.execute(function(event) {
|
||||
appendPre('Event created: ' + event.htmlLink);
|
||||
});
|
||||
}
|
||||
Vendored
+675
@@ -0,0 +1,675 @@
|
||||
// Type definitions for Google Calendar API 3.0
|
||||
// Project: https://developers.google.com/google-apps/calendar/
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="gapi" />
|
||||
|
||||
declare namespace gapi.client.calendar {
|
||||
export class freebusy {
|
||||
static query(parameters: FreeBusyQueryParameters): HttpRequest<FreeBusy>;
|
||||
}
|
||||
|
||||
interface FreeBusyQueryParameters {
|
||||
timeMin: datetime;
|
||||
timeMax: datetime;
|
||||
timeZone?: string;
|
||||
groupExpansionMax?: integer;
|
||||
calendarExpansionMax?: integer;
|
||||
items: {id: string}[];
|
||||
}
|
||||
|
||||
interface FreeBusy {
|
||||
kind: 'calendar#freeBusy';
|
||||
timeMin: datetime;
|
||||
timeMax: datetime;
|
||||
groups: {
|
||||
(key: string): {
|
||||
errors?: {
|
||||
domain: string;
|
||||
reason: string;
|
||||
}[];
|
||||
calendars: string[];
|
||||
}
|
||||
};
|
||||
calendars: {
|
||||
(key: string): {
|
||||
errors?: {
|
||||
domain: string;
|
||||
reason: string;
|
||||
}[];
|
||||
busy: {
|
||||
start: datetime;
|
||||
end: datetime;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export class acl {
|
||||
static insert(parameters: AclInsertParameters): HttpRequest<Acl>;
|
||||
static get(parameters: AclGetParameters): HttpRequest<Acl>;
|
||||
static update(parameters: AclUpdateParameters): HttpRequest<Acl>;
|
||||
static delete(parameters: AclDeleteParameters): HttpRequest<void>;
|
||||
}
|
||||
|
||||
// The type of the scope. Possible values are:
|
||||
type ScopeType =
|
||||
// The public scope. This is the default value.
|
||||
// Note: The permissions granted to the "default", or public, scope apply to any user, authenticated or not.
|
||||
'default' |
|
||||
// Limits the scope to a single user.
|
||||
'user' |
|
||||
// Limits the scope to a group.
|
||||
'group' |
|
||||
// Limits the scope to a domain.
|
||||
'domain';
|
||||
|
||||
interface Acl {
|
||||
kind: 'calendar#aclRule';
|
||||
etag: etag;
|
||||
id: string;
|
||||
scope: {
|
||||
type: ScopeType;
|
||||
value: string;
|
||||
};
|
||||
role: AccessRole;
|
||||
}
|
||||
|
||||
interface AclInsertParameters {
|
||||
calendarId: string;
|
||||
|
||||
// Acl resource
|
||||
role: AccessRole;
|
||||
scope: {
|
||||
type: ScopeType;
|
||||
value?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface AclGetParameters {
|
||||
calendarId: string;
|
||||
ruleId: string;
|
||||
}
|
||||
|
||||
interface AclUpdateParameters extends AclInsertParameters {
|
||||
ruleId: string;
|
||||
}
|
||||
|
||||
interface AclDeleteParameters extends AclGetParameters {
|
||||
}
|
||||
|
||||
export class calendarList {
|
||||
static list(parameters?: CalendarListListParameters): HttpRequest<CalendarList>;
|
||||
static insert(parameters: CalendarListInsertParameters): HttpRequest<CalendarListEntry>;
|
||||
}
|
||||
|
||||
type AccessRoleWithoutNone =
|
||||
// The user has read access to free/busy information.
|
||||
'freeBusyReader' |
|
||||
// The user has read access to the calendar. Private events will appear to users with reader access, but event details will be hidden.
|
||||
'reader' |
|
||||
// The user has read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible.
|
||||
'writer' |
|
||||
// The user has ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to see and manipulate ACLs.
|
||||
'owner';
|
||||
|
||||
// The user's access role for this calendar. Read-only. Possible values are:
|
||||
type AccessRole =
|
||||
// The user has no access.
|
||||
'none' |
|
||||
AccessRoleWithoutNone;
|
||||
|
||||
interface CalendarListListParameters {
|
||||
maxResults?: integer;
|
||||
// The minimum access role for the user in the returned entries. Optional. The default is no restriction. Acceptable values are:
|
||||
minAccessRole?: AccessRoleWithoutNone;
|
||||
pageToken?: string;
|
||||
showDeleted?: boolean;
|
||||
showHidden?: boolean;
|
||||
syncToken?: string;
|
||||
}
|
||||
|
||||
interface CalendarListInsertParameters {
|
||||
// Parameters
|
||||
// Optional query parameters
|
||||
colorRgbFormat?: boolean;
|
||||
|
||||
// CalendarList resource
|
||||
resource: CalendarListInput;
|
||||
}
|
||||
|
||||
interface CalendarListInput {
|
||||
// Required Properties
|
||||
id: string;
|
||||
|
||||
// Optional Properties
|
||||
backgroundColor?: string;
|
||||
colorId?: string;
|
||||
defaultReminders?: {
|
||||
method: ReminderMethod;
|
||||
minutes: integer;
|
||||
}[];
|
||||
foregroundColor?: string;
|
||||
hidden?: boolean;
|
||||
notificationSettings?: {
|
||||
notifications: {
|
||||
type: NotificationType;
|
||||
method: string;
|
||||
}[];
|
||||
};
|
||||
selected?: boolean;
|
||||
summaryOverride?: string;
|
||||
}
|
||||
|
||||
interface CalendarList {
|
||||
kind: 'calendar#calendarList';
|
||||
etag: etag;
|
||||
|
||||
/**
|
||||
* Token used to access the next page of this result.
|
||||
* Omitted if no further results are available, in which case nextSyncToken is provided.
|
||||
*/
|
||||
nextPageToken?: string;
|
||||
|
||||
/**
|
||||
* Token used at a later point in time to retrieve only the entries that have changed since this result was returned.
|
||||
* Omitted if further results are available, in which case nextPageToken is provided.
|
||||
*/
|
||||
nextSyncToken?: string;
|
||||
|
||||
items: CalendarListEntry[];
|
||||
}
|
||||
|
||||
// The type of notification. Possible values are:
|
||||
type NotificationType =
|
||||
// Notification sent when a new event is put on the calendar.
|
||||
'eventCreation' |
|
||||
// Notification sent when an event is changed.
|
||||
'eventChange' |
|
||||
// Notification sent when an event is cancelled.
|
||||
'eventCancellation' |
|
||||
// Notification sent when an event is changed.
|
||||
'eventResponse' |
|
||||
// An agenda with the events of the day (sent out in the morning).
|
||||
'agenda';
|
||||
|
||||
interface CalendarListEntry {
|
||||
kind: 'calendar#calendarListEntry';
|
||||
etag: etag;
|
||||
id: string;
|
||||
summary: string;
|
||||
description?: string;
|
||||
location?: string;
|
||||
timeZone?: string;
|
||||
summaryOverride?: string;
|
||||
colorId?: string;
|
||||
backgroundColor?: string;
|
||||
foregroundColor?: string;
|
||||
hidden?: boolean;
|
||||
selected?: boolean;
|
||||
// The effective access role that the authenticated user has on the calendar. Read-only.
|
||||
accessRole: AccessRoleWithoutNone;
|
||||
defaultReminders: {
|
||||
method: ReminderMethod;
|
||||
minutes: integer;
|
||||
}[];
|
||||
notificationSettings?: {
|
||||
notifications: {
|
||||
type: NotificationType;
|
||||
method: string;
|
||||
}[];
|
||||
};
|
||||
primary?: boolean;
|
||||
deleted?: boolean;
|
||||
}
|
||||
|
||||
export class calendars {
|
||||
static insert(parameters: CalendarsInsertParameters): HttpRequest<Calendar>;
|
||||
static update(parameters: CalendarsUpdateParameters): HttpRequest<Calendar>;
|
||||
static delete(parameters: CalendarsDeleteParameters): HttpRequest<void>;
|
||||
}
|
||||
|
||||
interface CalendarsUpdateParameters {
|
||||
calendarId: string;
|
||||
|
||||
// Calendars resource
|
||||
// Optional Properties
|
||||
description?: string;
|
||||
location?: string;
|
||||
summary?: string;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface CalendarsInsertParameters {
|
||||
// Calendars resource
|
||||
// Required Properties
|
||||
summary: string;
|
||||
|
||||
description?: string;
|
||||
location?: string;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface CalendarsDeleteParameters {
|
||||
calendarId: string;
|
||||
}
|
||||
|
||||
interface Calendar {
|
||||
kind: 'calendar#calendar';
|
||||
etag: etag;
|
||||
id: string;
|
||||
summary: string;
|
||||
description?: string;
|
||||
location?: string;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
export class events {
|
||||
static list(parameters: EventsListParameters): HttpRequest<Events>;
|
||||
static insert(parameters: EventsInsertParameters): HttpRequest<Event>;
|
||||
static update(parameters: EventsUpdateParameters): HttpRequest<Event>;
|
||||
static get(parameters: EventsGetParameters): HttpRequest<Event>;
|
||||
}
|
||||
|
||||
interface EventsGetParameters {
|
||||
calendarId: string;
|
||||
eventId: string;
|
||||
|
||||
alwaysIncludeEmail?: boolean;
|
||||
maxAttendees?: integer;
|
||||
timeZone?: string;
|
||||
}
|
||||
|
||||
interface EventsInsertParameters {
|
||||
calendarId: string;
|
||||
|
||||
maxAttendees?: integer;
|
||||
sendNotifications?: boolean;
|
||||
supportsAttachments?: boolean;
|
||||
|
||||
// Event resource
|
||||
resource: EventInput;
|
||||
}
|
||||
|
||||
interface EventsUpdateParameters {
|
||||
calendarId: string;
|
||||
eventId: string;
|
||||
|
||||
alwaysIncludeEmail?: boolean;
|
||||
maxAttendees?: integer;
|
||||
sendNotifications?: boolean;
|
||||
supportsAttachments?: boolean;
|
||||
|
||||
// Event resource
|
||||
resource: EventInput;
|
||||
}
|
||||
|
||||
interface EventInput {
|
||||
// Required Properties
|
||||
attachments?: {
|
||||
fileUrl: string;
|
||||
}[];
|
||||
attendees?: {
|
||||
email: string;
|
||||
displayName?: string;
|
||||
optional?: boolean;
|
||||
responseStatus?: AttendeeResponseStatus;
|
||||
comment?: string;
|
||||
additionalGuests?: integer;
|
||||
}[];
|
||||
end: {
|
||||
date?: date;
|
||||
dateTime?: datetime;
|
||||
timeZone?: string
|
||||
};
|
||||
reminders?: {
|
||||
overrides: {
|
||||
method: string;
|
||||
minutes: integer;
|
||||
}[];
|
||||
useDefault: boolean;
|
||||
};
|
||||
start: {
|
||||
date?: date;
|
||||
dateTime?: datetime;
|
||||
timeZone: string;
|
||||
};
|
||||
|
||||
// Optional Properties
|
||||
anyoneCanAddSelf?: boolean;
|
||||
colorId?: string;
|
||||
description?: string;
|
||||
extendedProperties?: {
|
||||
private: {
|
||||
(key: string): string
|
||||
};
|
||||
shared: {
|
||||
(key: string): string
|
||||
}
|
||||
};
|
||||
gadget?: {
|
||||
display?: GadgetDisplayMode;
|
||||
height: integer;
|
||||
iconLink: string;
|
||||
link: string;
|
||||
preferences: {
|
||||
(key: string): string
|
||||
}
|
||||
title: string;
|
||||
type: string;
|
||||
width: integer;
|
||||
};
|
||||
guestsCanInviteOthers?: boolean;
|
||||
guestsCanSeeOtherGuests?: boolean;
|
||||
id?: string;
|
||||
location?: string;
|
||||
originalStartTime?: {
|
||||
date: date;
|
||||
dateTime: datetime;
|
||||
timeZone: string
|
||||
};
|
||||
recurrence?: string[];
|
||||
sequence?: integer;
|
||||
source?: {
|
||||
url: string;
|
||||
title: string
|
||||
};
|
||||
status?: EventStatus;
|
||||
summary?: string;
|
||||
transparency?: EventTransparency;
|
||||
visibility?: EventVisibility;
|
||||
}
|
||||
|
||||
// The order of the events returned in the result. Optional. The default is an unspecified, stable order.
|
||||
// Acceptable values are:
|
||||
type EventsOrder =
|
||||
// Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True)
|
||||
'startTime' |
|
||||
// Order by last modification time (ascending).
|
||||
'updated';
|
||||
|
||||
// Token obtained from the nextSyncToken field returned on the last page of results from the previous list request.
|
||||
// It makes the result of this list request contain only entries that have changed since then.
|
||||
// All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.
|
||||
// There are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state.
|
||||
// These are:
|
||||
type SyncToken =
|
||||
'iCalUID' |
|
||||
'orderBy' |
|
||||
'privateExtendedProperty' |
|
||||
'q' |
|
||||
'sharedExtendedProperty' |
|
||||
'timeMin' |
|
||||
'timeMax' |
|
||||
'updatedMin';
|
||||
|
||||
interface EventsListParameters {
|
||||
calendarId: string;
|
||||
alwaysIncludeEmail?: boolean;
|
||||
iCalUID?: string;
|
||||
maxAttendees?: integer;
|
||||
maxResults?: integer;
|
||||
orderBy?: EventsOrder;
|
||||
pageToken?: string;
|
||||
privateExtendedProperty?: string;
|
||||
q?: string;
|
||||
sharedExtendedProperty?: string;
|
||||
showDeleted?: boolean;
|
||||
showHiddenInvitations?: boolean;
|
||||
singleEvents?: boolean;
|
||||
syncToken?: SyncToken;
|
||||
timeMax?: datetime;
|
||||
timeMin?: datetime;
|
||||
timeZone?: string;
|
||||
updatedMin?: datetime;
|
||||
}
|
||||
|
||||
interface Events {
|
||||
kind: 'calendar#events';
|
||||
etag: etag;
|
||||
summary: string;
|
||||
description: string;
|
||||
updated: datetime;
|
||||
timeZone: string;
|
||||
// The user's access role for this calendar. Read-only. Possible values are:
|
||||
accessRole: AccessRole;
|
||||
defaultReminders: {
|
||||
method: ReminderMethod;
|
||||
minutes: integer;
|
||||
}[];
|
||||
nextPageToken?: string;
|
||||
nextSyncToken?: string;
|
||||
items: Event[];
|
||||
}
|
||||
|
||||
type etag = string;
|
||||
type datetime = string;
|
||||
type date = string;
|
||||
type integer = number;
|
||||
|
||||
// The attendee's response status. Possible values are:
|
||||
type AttendeeResponseStatus =
|
||||
// The attendee has not responded to the invitation.
|
||||
'needsAction' |
|
||||
// The attendee has declined the invitation.
|
||||
'declined' |
|
||||
// The attendee has tentatively accepted the invitation.
|
||||
'tentative' |
|
||||
// The attendee has accepted the invitation.
|
||||
'accepted';
|
||||
|
||||
// The gadget's display mode. Optional. Possible values are:
|
||||
type GadgetDisplayMode =
|
||||
// The gadget displays next to the event's title in the calendar view.
|
||||
'icon' |
|
||||
// The gadget displays when the event is clicked.
|
||||
'chip';
|
||||
|
||||
// The method used by this reminder. Possible values are:
|
||||
type ReminderMethod =
|
||||
// Reminders are sent via email.
|
||||
'email' |
|
||||
// Reminders are sent via SMS. These are only available for Google Apps for Work, Education, and Government customers. Requests to set SMS reminders for other account types are ignored.
|
||||
'sms' |
|
||||
// Reminders are sent via a UI popup.
|
||||
'popup';
|
||||
|
||||
// Status of the event. Optional. Possible values are:
|
||||
type EventStatus =
|
||||
// The event is confirmed. This is the default status.
|
||||
'confirmed' |
|
||||
// The event is tentatively confirmed.
|
||||
'tentative' |
|
||||
// The event is cancelled.
|
||||
'cancelled';
|
||||
|
||||
// Whether the event blocks time on the calendar. Optional. Possible values are:
|
||||
type EventTransparency =
|
||||
// The event blocks time on the calendar. This is the default value.
|
||||
'opaque' |
|
||||
// The event does not block time on the calendar.
|
||||
'transparent';
|
||||
|
||||
// Visibility of the event. Optional. Possible values are:
|
||||
type EventVisibility =
|
||||
// Uses the default visibility for events on the calendar. This is the default value.
|
||||
'default' |
|
||||
// The event is public and event details are visible to all readers of the calendar.
|
||||
'public' |
|
||||
// The event is private and only event attendees may view event details.
|
||||
'private' |
|
||||
// The event is private. This value is provided for compatibility reasons.
|
||||
'confidential';
|
||||
|
||||
class Event {
|
||||
kind: 'calendar#event';
|
||||
etag: etag;
|
||||
id: string;
|
||||
status?: EventStatus;
|
||||
htmlLink: string;
|
||||
created: datetime;
|
||||
updated: datetime;
|
||||
summary: string;
|
||||
description: string;
|
||||
location?: string;
|
||||
colorId?: string;
|
||||
|
||||
// The creator of the event. Read-only.
|
||||
creator: {
|
||||
// The creator's Profile ID, if available.
|
||||
id?: string;
|
||||
|
||||
// The creator's email address, if available.
|
||||
email?: string;
|
||||
|
||||
// The creator's name, if available.
|
||||
displayName?: string;
|
||||
|
||||
// Whether the creator corresponds to the calendar on which this copy of the event appears. Read-only. The default is False.
|
||||
self?: boolean;
|
||||
};
|
||||
|
||||
// The organizer of the event.
|
||||
organizer: {
|
||||
// The organizer's Profile ID, if available.
|
||||
id?: string;
|
||||
|
||||
// The organizer's email address, if available.
|
||||
email?: string;
|
||||
|
||||
// The organizer's name, if available.
|
||||
displayName?: string;
|
||||
|
||||
// Whether the organizer corresponds to the calendar on which this copy of the event appears. Read-only. The default is False.
|
||||
self?: boolean;
|
||||
};
|
||||
|
||||
// The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance.
|
||||
start: {
|
||||
// The date, in the format "yyyy-mm-dd", if this is an all-day event.
|
||||
date?: date;
|
||||
|
||||
// The time, as a combined date-time value (formatted according to RFC3339).
|
||||
// A time zone offset is required unless a time zone is explicitly specified in timeZone.
|
||||
dateTime?: datetime;
|
||||
|
||||
// The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".)
|
||||
// For recurring events this field is required and specifies the time zone in which the recurrence is expanded.
|
||||
// For single events this field is optional and indicates a custom time zone for the event start/end.
|
||||
timeZone?: string;
|
||||
};
|
||||
|
||||
// The (exclusive) end time of the event. For a recurring event, this is the end time of the first instance.
|
||||
end: {
|
||||
// The date, in the format "yyyy-mm-dd", if this is an all-day event.
|
||||
date?: date;
|
||||
|
||||
// The time, as a combined date-time value (formatted according to RFC3339).
|
||||
// A time zone offset is required unless a time zone is explicitly specified in timeZone.
|
||||
dateTime?: datetime;
|
||||
|
||||
// The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".)
|
||||
// For recurring events this field is required and specifies the time zone in which the recurrence is expanded.
|
||||
// For single events this field is optional and indicates a custom time zone for the event start/end.
|
||||
timeZone?: string;
|
||||
};
|
||||
|
||||
// Whether the end time is actually unspecified. An end time is still provided for compatibility reasons, even if this attribute is set to True.
|
||||
// The default is False.
|
||||
endTimeUnspecified?: boolean;
|
||||
|
||||
recurrence: string[];
|
||||
|
||||
// For an instance of a recurring event, this is the id of the recurring event to which this instance belongs. Immutable.
|
||||
recurringEventId?: string;
|
||||
|
||||
// Whether the organizer corresponds to the calendar on which this copy of the event appears. Read-only. The default is False.
|
||||
originalStartTime?: {
|
||||
date: date;
|
||||
dateTime: datetime;
|
||||
timeZone?: string;
|
||||
};
|
||||
|
||||
transparency?: EventTransparency;
|
||||
visibility?: EventVisibility;
|
||||
iCalUID: string;
|
||||
sequence: integer;
|
||||
|
||||
// The attendees of the event.
|
||||
attendees?: {
|
||||
id: string;
|
||||
email: string;
|
||||
displayName?: string;
|
||||
organizer: boolean;
|
||||
self: boolean;
|
||||
resource: boolean;
|
||||
optional?: boolean;
|
||||
responseStatus: AttendeeResponseStatus;
|
||||
comment?: string;
|
||||
additionalGuests?: integer;
|
||||
}[];
|
||||
|
||||
attendeesOmitted?: boolean;
|
||||
|
||||
// Extended properties of the event.
|
||||
extendedProperties?: {
|
||||
private: {
|
||||
(key: string): string;
|
||||
};
|
||||
shared: {
|
||||
(key: string): string;
|
||||
}
|
||||
};
|
||||
|
||||
// An absolute link to the Google+ hangout associated with this event. Read-only.
|
||||
hangoutLink?: string;
|
||||
|
||||
// A gadget that extends this event.
|
||||
gadget?: {
|
||||
type: string;
|
||||
title: string;
|
||||
link: string;
|
||||
iconLink: string;
|
||||
width?: integer;
|
||||
height?: integer;
|
||||
display?: GadgetDisplayMode;
|
||||
preferences: {
|
||||
(key: string): string;
|
||||
}
|
||||
};
|
||||
|
||||
anyoneCanAddSelf?: boolean;
|
||||
guestsCanInviteOthers?: boolean;
|
||||
guestsCanModify?: boolean;
|
||||
guestsCanSeeOtherGuests?: boolean;
|
||||
privateCopy?: boolean;
|
||||
|
||||
// Whether this is a locked event copy where no changes can be made to the main event fields "summary", "description", "location", "start", "end" or "recurrence". The default is False. Read-Only.
|
||||
locked?: boolean;
|
||||
|
||||
reminders: {
|
||||
useDefault: boolean;
|
||||
overrides?: {
|
||||
method: ReminderMethod;
|
||||
minutes: integer;
|
||||
}[];
|
||||
};
|
||||
|
||||
// Source from which the event was created. For example, a web page, an email message or any document identifiable by an URL with HTTP or HTTPS scheme.
|
||||
// Can only be seen or modified by the creator of the event.
|
||||
source?: {
|
||||
url: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
// File attachments for the event. Currently only Google Drive attachments are supported.
|
||||
attachments?: {
|
||||
fileUrl: string;
|
||||
title: string;
|
||||
mimeType: string;
|
||||
iconLink: string;
|
||||
fileId: string;
|
||||
}[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gapi.calendar-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/* Example taken from Google People API JavaScript Quickstart https://developers.google.com/people/quickstart/js */
|
||||
|
||||
{
|
||||
// Your Client ID can be retrieved from your project in the Google
|
||||
// Developer Console, https://console.developers.google.com
|
||||
var CLIENT_ID = '<YOUR_CLIENT_ID>';
|
||||
|
||||
var SCOPES = ["https://www.googleapis.com/auth/contacts.readonly"];
|
||||
|
||||
/**
|
||||
* Check if current user has authorized this application.
|
||||
*/
|
||||
function checkAuth() {
|
||||
gapi.auth.authorize(
|
||||
{
|
||||
'client_id': CLIENT_ID,
|
||||
'scope': SCOPES.join(' '),
|
||||
'immediate': true
|
||||
}, handleAuthResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle response from authorization server.
|
||||
*
|
||||
* @param {Object} authResult Authorization result.
|
||||
*/
|
||||
function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) {
|
||||
var authorizeDiv = document.getElementById('authorize-div')!;
|
||||
if (authResult && !authResult.error) {
|
||||
// Hide auth UI, then load client library.
|
||||
authorizeDiv.style.display = 'none';
|
||||
loadPeopleApi();
|
||||
} else {
|
||||
// Show auth UI, allowing the user to initiate authorization by
|
||||
// clicking authorize button.
|
||||
authorizeDiv.style.display = 'inline';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate auth flow in response to user clicking authorize button.
|
||||
*
|
||||
* @param {Event} event Button click event.
|
||||
*/
|
||||
function handleAuthClick(event: MouseEvent) {
|
||||
gapi.auth.authorize(
|
||||
{client_id: CLIENT_ID, scope: SCOPES, immediate: false},
|
||||
handleAuthResult);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Google People client library. List names if available
|
||||
* of 10 connections.
|
||||
*/
|
||||
function loadPeopleApi() {
|
||||
gapi.client.load('https://people.googleapis.com/$discovery/rest', 'v1', listConnectionNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the display name if available for 10 connections.
|
||||
*/
|
||||
function listConnectionNames() {
|
||||
var request = gapi.client.people.people.connections.list({
|
||||
'resourceName': 'people/me',
|
||||
'pageSize': 10,
|
||||
});
|
||||
|
||||
request.execute(function(resp) {
|
||||
var connections = resp.connections;
|
||||
appendPre('Connections:');
|
||||
|
||||
if (connections.length > 0) {
|
||||
for (var i = 0; i < connections.length; i++) {
|
||||
var person = connections[i];
|
||||
if (person.names && person.names.length > 0) {
|
||||
appendPre(person.names[0].displayName)
|
||||
} else {
|
||||
appendPre("No display name found for connection.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
appendPre('No upcoming events found.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a pre element to the body containing the given message
|
||||
* as its text node.
|
||||
*
|
||||
* @param {string} message Text to be placed in pre element.
|
||||
*/
|
||||
function appendPre(message: string) {
|
||||
var pre = document.getElementById('output')!;
|
||||
var textContent = document.createTextNode(message + '\n');
|
||||
pre.appendChild(textContent);
|
||||
}
|
||||
}
|
||||
Vendored
+246
@@ -0,0 +1,246 @@
|
||||
// Type definitions for Google People API 1.0
|
||||
// Project: https://developers.google.com/people/
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="gapi" />
|
||||
|
||||
declare namespace gapi.client.people {
|
||||
export namespace people {
|
||||
|
||||
interface GetParameters {
|
||||
resourceName: string;
|
||||
|
||||
// Query parameters
|
||||
requestMask?: RequestMask;
|
||||
}
|
||||
|
||||
function get(parameters: GetParameters): HttpRequest<Person>;
|
||||
|
||||
interface GetBatchGetParameters {
|
||||
// Query parameters
|
||||
resourcesName?: string;
|
||||
requestMask?: RequestMask;
|
||||
}
|
||||
|
||||
function getBatchGet(parameters: GetBatchGetParameters): HttpRequest<BatchGetResponse>;
|
||||
|
||||
interface BatchGetResponse {
|
||||
responses: PersonResponse[];
|
||||
}
|
||||
|
||||
interface PersonResponse {
|
||||
httpStatusCode: number;
|
||||
person: Person;
|
||||
requestedResourceName: string;
|
||||
}
|
||||
|
||||
namespace connections {
|
||||
function list(parameters: ListParameters): HttpRequest<Response>;
|
||||
|
||||
type SortOrder = 'LAST_MODIFIED_ASCENDING' | 'FIRST_NAME_ASCENDING' | 'LAST_NAME_ASCENDING';
|
||||
|
||||
interface ListParameters {
|
||||
resourceName: string;
|
||||
|
||||
// Query parameters
|
||||
pageToken?: string;
|
||||
pageSize?: number;
|
||||
sortOrder?: SortOrder;
|
||||
syncToken?: string;
|
||||
requestMask?: RequestMask;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
connections: Person[];
|
||||
nextPageToken: string;
|
||||
nextSyncToken: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface RequestMask {
|
||||
includeField: string;
|
||||
}
|
||||
|
||||
type SourceType = 'SOURCE_TYPE_UNSPECIFIED' | 'ACCOUNT' | 'PROFILE' | 'DOMAIN_PROFILE' | 'CONTACT';
|
||||
|
||||
interface Source {
|
||||
type: SourceType;
|
||||
id: string;
|
||||
etag: string;
|
||||
resourceName: string;
|
||||
}
|
||||
|
||||
type ObjectType = 'OBJECT_TYPE_UNSPECIFIED' | 'PERSON' | 'PAGE';
|
||||
|
||||
interface PersonMetadata {
|
||||
sources: Source[];
|
||||
previousResourceNames: string[];
|
||||
linkedPeopleResourceNames: string[];
|
||||
deleted: boolean;
|
||||
objectType: ObjectType;
|
||||
}
|
||||
|
||||
interface FieldMetadata {
|
||||
primary: boolean;
|
||||
verified: boolean;
|
||||
source: Source;
|
||||
}
|
||||
|
||||
interface Locale {
|
||||
metadata: FieldMetadata;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Name {
|
||||
metadata: FieldMetadata;
|
||||
displayName: string;
|
||||
displayNameLastFirst: string;
|
||||
familyName: string;
|
||||
givenName: string;
|
||||
middleName: string;
|
||||
honorificPrefix: string;
|
||||
honorificSuffix: string;
|
||||
phoneticFullName: string;
|
||||
phoneticFamilyName: string;
|
||||
phoneticGivenName: string;
|
||||
phoneticMiddleName: string;
|
||||
phoneticHonorificPrefix: string;
|
||||
phoneticHonorificSuffix: string;
|
||||
}
|
||||
|
||||
type NicknameType = 'DEFAULT' | 'MAIDEN_NAME' | 'INITIALS' | 'GPLUS' | 'OTHER_NAME';
|
||||
|
||||
interface Nickname {
|
||||
metadata: FieldMetadata;
|
||||
value: string;
|
||||
type: NicknameType;
|
||||
}
|
||||
|
||||
interface CoverPhoto {
|
||||
}
|
||||
|
||||
interface Photo {
|
||||
}
|
||||
|
||||
interface Gender {
|
||||
}
|
||||
|
||||
interface AgeRange {
|
||||
}
|
||||
|
||||
interface Birthday {
|
||||
}
|
||||
|
||||
interface Event {
|
||||
}
|
||||
|
||||
interface Address {
|
||||
metadata: FieldMetadata;
|
||||
formattedValue: string;
|
||||
type: string;
|
||||
formattedType: string;
|
||||
poBox: string;
|
||||
streetAddress: string;
|
||||
extendedAddress: string;
|
||||
city: string;
|
||||
region: string;
|
||||
postalCode: string;
|
||||
country: string;
|
||||
countryCode: string;
|
||||
}
|
||||
|
||||
interface Residence {
|
||||
metadata: FieldMetadata;
|
||||
value: string;
|
||||
current: boolean;
|
||||
}
|
||||
|
||||
interface EmailAddress {
|
||||
metadata: FieldMetadata;
|
||||
value: string;
|
||||
type: string;
|
||||
formattedType: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
interface PhoneNumber {
|
||||
metadata: FieldMetadata;
|
||||
value: string;
|
||||
canonicalForm: string;
|
||||
type: string;
|
||||
formattedType: string;
|
||||
}
|
||||
|
||||
interface ImClient {
|
||||
}
|
||||
|
||||
interface Tagline {
|
||||
}
|
||||
|
||||
interface Biography {
|
||||
}
|
||||
|
||||
interface Url {
|
||||
}
|
||||
|
||||
interface Organization {
|
||||
}
|
||||
|
||||
interface Occupation {
|
||||
}
|
||||
|
||||
interface Interest {
|
||||
}
|
||||
|
||||
interface Skill {
|
||||
}
|
||||
|
||||
interface BraggingRights {
|
||||
}
|
||||
|
||||
interface Relation {
|
||||
}
|
||||
|
||||
interface RelationshipInterest {
|
||||
}
|
||||
|
||||
interface RelationshipStatus {
|
||||
}
|
||||
|
||||
interface Membership {
|
||||
}
|
||||
|
||||
interface Person {
|
||||
resourceName: string;
|
||||
etag: string;
|
||||
metadata: PersonMetadata;
|
||||
locales: Locale[];
|
||||
names: Name[];
|
||||
nicknames?: Nickname[];
|
||||
coverPhotos: CoverPhoto[];
|
||||
photos?: Photo[];
|
||||
genders?: Gender[];
|
||||
ageRange?: AgeRange;
|
||||
birthdays?: Birthday[];
|
||||
events?: Event[];
|
||||
addresses?: Address[];
|
||||
residences?: Residence[];
|
||||
emailAddresses?: EmailAddress[];
|
||||
phoneNumbers?: PhoneNumber[];
|
||||
imClients?: ImClient[];
|
||||
taglines?: Tagline[];
|
||||
biographies?: Biography[];
|
||||
urls?: Url[];
|
||||
organizations?: Organization[];
|
||||
occupations?: Occupation[];
|
||||
interests?: Interest[];
|
||||
skills?: Skill[];
|
||||
BraggingRights?: BraggingRights[];
|
||||
relations?: Relation[];
|
||||
relationshipInterests?: RelationshipInterest[];
|
||||
relationshipStatuses?: RelationshipStatus[];
|
||||
memberships?: Membership[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gapi.people-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* Example taken from https://developers.google.com/+/web/people/ */
|
||||
|
||||
gapi.client.load('plus','v1', function(){
|
||||
var request = gapi.client.plus.people.get({
|
||||
'userId': 'me'
|
||||
});
|
||||
request.execute(function(resp) {
|
||||
console.log('Retrieved profile for:' + resp.displayName);
|
||||
});
|
||||
});
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
// Type definitions for Google+ Platform API 1.0
|
||||
// Project: https://developers.google.com/+/web/people/
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="gapi" />
|
||||
|
||||
// See Google+ REST API Reference https://developers.google.com/+/web/api/rest/latest/
|
||||
declare namespace gapi.client.plus {
|
||||
export namespace people {
|
||||
|
||||
interface GetParameters {
|
||||
userId: string;
|
||||
}
|
||||
function get(parameters: GetParameters): HttpRequest<Person>;
|
||||
|
||||
interface SearchParameters {
|
||||
query: string;
|
||||
language?: string;
|
||||
maxResults?: number;
|
||||
pageToken?: string;
|
||||
}
|
||||
function search(parameters: SearchParameters): HttpRequest<PeopleFeed>;
|
||||
|
||||
// Search response
|
||||
interface PeopleFeed {
|
||||
kind: 'plus#peopleFeed';
|
||||
etag: string;
|
||||
selfLink: string;
|
||||
title: string;
|
||||
nextPageToken: string;
|
||||
totalItems: number;
|
||||
items: Person[];
|
||||
}
|
||||
|
||||
interface Person {
|
||||
kind: 'plus#person';
|
||||
etag: string;
|
||||
nickname: string;
|
||||
occupation: string;
|
||||
skills: string;
|
||||
birthday: string;
|
||||
gender: string;
|
||||
emails: {
|
||||
value: string;
|
||||
type: string;
|
||||
}[];
|
||||
urls: {
|
||||
value: string;
|
||||
type: string;
|
||||
label: string;
|
||||
}[];
|
||||
objectType: string;
|
||||
id: string;
|
||||
displayName: string;
|
||||
name: {
|
||||
formatted: string;
|
||||
familyName: string;
|
||||
givenName: string;
|
||||
middleName: string;
|
||||
honorificPrefix: string;
|
||||
honorificSuffix: string;
|
||||
};
|
||||
tagline: string;
|
||||
braggingRights: string;
|
||||
aboutMe: string;
|
||||
relationshipStatus: string;
|
||||
url: string;
|
||||
image: {
|
||||
url: string;
|
||||
};
|
||||
organizations: {
|
||||
name: string;
|
||||
department: string;
|
||||
title: string;
|
||||
type: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
location: string;
|
||||
description: string;
|
||||
primary: boolean;
|
||||
}[];
|
||||
placesLived: {
|
||||
value: string;
|
||||
primary: boolean;
|
||||
}[];
|
||||
isPlusUser: boolean;
|
||||
language: string;
|
||||
ageRange: {
|
||||
min: number;
|
||||
max: number;
|
||||
};
|
||||
plusOneCount: number;
|
||||
circledByCount: number;
|
||||
verified: boolean;
|
||||
cover: {
|
||||
layout: string;
|
||||
coverPhoto: {
|
||||
url: string;
|
||||
height: number;
|
||||
width: number;
|
||||
};
|
||||
coverInfo: {
|
||||
topImageOffset: number;
|
||||
leftImageOffset: number;
|
||||
}
|
||||
};
|
||||
domain: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gapi.plus-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/// <reference types="gapi.people" />
|
||||
/// <reference types="gapi.plus" />
|
||||
|
||||
/* Examples taken from https://developers.google.com/api-client-library/javascript/start/start-js */
|
||||
|
||||
{
|
||||
function start1() {
|
||||
// 2. Initialize the JavaScript client library.
|
||||
gapi.client.init({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
|
||||
// clientId and scope are optional if auth is not required.
|
||||
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
|
||||
'scope': 'profile',
|
||||
}).then(function() {
|
||||
// 3. Initialize and make the API request.
|
||||
return gapi.client.people.people.get({
|
||||
resourceName: 'people/me'
|
||||
});
|
||||
}).then(function(response) {
|
||||
console.log(response.result);
|
||||
}, function(reason) {
|
||||
console.log('Error: ' + reason.result.error.message);
|
||||
});
|
||||
};
|
||||
// 1. Load the JavaScript client library.
|
||||
gapi.load('client', start1);
|
||||
}
|
||||
|
||||
{
|
||||
function start2() {
|
||||
// 2. Initialize the JavaScript client library.
|
||||
gapi.client.init({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
// clientId and scope are optional if auth is not required.
|
||||
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
|
||||
'scope': 'profile',
|
||||
}).then(function() {
|
||||
// 3. Initialize and make the API request.
|
||||
return gapi.client.request({
|
||||
'path': 'https://people.googleapis.com/v1/people/me',
|
||||
})
|
||||
}).then(function(response) {
|
||||
console.log(response.result);
|
||||
}, function(reason) {
|
||||
console.log('Error: ' + reason.result.error.message);
|
||||
});
|
||||
};
|
||||
// 1. Load the JavaScript client library.
|
||||
gapi.load('client', start2);
|
||||
}
|
||||
|
||||
|
||||
/* Examples taken from https://developers.google.com/api-client-library/javascript/features/promises */
|
||||
|
||||
gapi.client.request({'path': '/plus/v1/people', 'params': {'query': 'John'}}).then(function(response) {
|
||||
// Handle response
|
||||
}, function(reason) {
|
||||
// Handle error
|
||||
});
|
||||
|
||||
gapi.client.load('plus', 'v1').then(function() {
|
||||
gapi.client.plus.people.search({'query': ''}).then(response => { });
|
||||
});
|
||||
|
||||
var personFetcher = {
|
||||
results: [],
|
||||
|
||||
// Why this: any? Check https://github.com/Microsoft/TypeScript/issues/10835
|
||||
|
||||
fetch: function(this: any, name: string) {
|
||||
gapi.client.request({path: '/plus/v1/people', params:{query: name}}).then(function(this: any, response) {
|
||||
this.results.push(response.result);
|
||||
}, function(reason) {
|
||||
console.error(name, 'was not fetched:', reason.result.error.message);
|
||||
}, this);
|
||||
}
|
||||
};
|
||||
personFetcher.fetch('John');
|
||||
|
||||
gapi.client.request({
|
||||
'path': 'plus/v1/people',
|
||||
'params': {'query': name}
|
||||
}).execute(function(resp, rawResp) {
|
||||
processResponse(resp);
|
||||
});
|
||||
|
||||
gapi.client.request({
|
||||
'path': 'plus/v1/people',
|
||||
'params': {'query': name}
|
||||
}).then(function(resp) {
|
||||
processResponse(resp.result);
|
||||
});
|
||||
|
||||
function processResponse(response: any) {
|
||||
// Stub
|
||||
}
|
||||
Vendored
+102
-58
@@ -1,8 +1,8 @@
|
||||
// Type definitions for Google API Client
|
||||
// Type definitions for Google API Client 0.0
|
||||
// Project: https://code.google.com/p/google-api-javascript-client/
|
||||
// Definitions by: Frank M <https://github.com/sgtfrankieboy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/**
|
||||
* The OAuth 2.0 token object represents the OAuth 2.0 token and any associated data.
|
||||
@@ -38,7 +38,7 @@ declare namespace gapi {
|
||||
/**
|
||||
* Pragmatically initialize gapi class member.
|
||||
*/
|
||||
export function load(object: string, fn: any) : any;
|
||||
export function load(apiName: string, callback: () => void): void;
|
||||
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ declare namespace gapi.auth {
|
||||
/**
|
||||
* A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes.
|
||||
*/
|
||||
callback?: Function;
|
||||
callback?: () => void;
|
||||
/**
|
||||
* If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority.
|
||||
*/
|
||||
@@ -127,6 +127,30 @@ declare namespace gapi.auth {
|
||||
}
|
||||
|
||||
declare namespace gapi.client {
|
||||
/**
|
||||
* Initializes the JavaScript client with API key, OAuth client ID, scope, and API discovery document(s).
|
||||
* If OAuth client ID and scope are provided, this function will load the gapi.auth2 module to perform OAuth.
|
||||
* The gapi.client.init function can be run multiple times, such as to set up more APIs, to change API key, or initialize OAuth lazily.
|
||||
*/
|
||||
export function init(args: {
|
||||
/**
|
||||
* The API Key to use.
|
||||
*/
|
||||
apiKey?: string;
|
||||
/**
|
||||
* An array of discovery doc URLs or discovery doc JSON objects.
|
||||
*/
|
||||
discoveryDocs?: string[];
|
||||
/**
|
||||
* The app's client ID, found and created in the Google Developers Console.
|
||||
*/
|
||||
clientId?: string;
|
||||
/**
|
||||
* The scopes to request, as a space-delimited string.
|
||||
*/
|
||||
scope?: string
|
||||
}): Promise<void>;
|
||||
|
||||
interface RequestOptions {
|
||||
/**
|
||||
* The URL to handle the request
|
||||
@@ -155,43 +179,79 @@ declare namespace gapi.client {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the client library interface to a particular API. If a callback is not provided, a promise is returned.
|
||||
* @param name The name of the API to load.
|
||||
* @param version The version of the API to load.
|
||||
* @return promise The promise that get's resolved after the request is finished.
|
||||
*/
|
||||
export function load(name: string, version: string): Promise<void>
|
||||
* Loads the client library interface to a particular API. If a callback is not provided, a promise is returned.
|
||||
* @param name The name of the API to load.
|
||||
* @param version The version of the API to load.
|
||||
* @return promise The promise that get's resolved after the request is finished.
|
||||
*/
|
||||
export function load(name: string, version: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method.
|
||||
* @param name The name of the API to load.
|
||||
* @param version The version of the API to load
|
||||
* @param callback the function that is called once the API interface is loaded
|
||||
* @param url optional, the url of your app - if using Google's APIs, don't set it
|
||||
*/
|
||||
* Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method.
|
||||
* @param name The name of the API to load.
|
||||
* @param version The version of the API to load
|
||||
* @param callback the function that is called once the API interface is loaded
|
||||
* @param url optional, the url of your app - if using Google's APIs, don't set it
|
||||
*/
|
||||
export function load(name: string, version: string, callback: () => any, url?: string): void;
|
||||
/**
|
||||
* Creates a HTTP request for making RESTful requests.
|
||||
* An object encapsulating the various arguments for this method.
|
||||
*/
|
||||
* Creates a HTTP request for making RESTful requests.
|
||||
* An object encapsulating the various arguments for this method.
|
||||
*/
|
||||
export function request(args: RequestOptions): HttpRequest<any>;
|
||||
/**
|
||||
* Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation.
|
||||
* @param method The method to be executed.
|
||||
* @param version The version of the API which defines the method to be executed. Defaults to v1
|
||||
* @param rpcParams A key-value pair of the params to supply to this RPC
|
||||
*/
|
||||
* Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation.
|
||||
* @param method The method to be executed.
|
||||
* @param version The version of the API which defines the method to be executed. Defaults to v1
|
||||
* @param rpcParams A key-value pair of the params to supply to this RPC
|
||||
*/
|
||||
export function rpcRequest(method: string, version?: string, rpcParams?: any): RpcRequest;
|
||||
/**
|
||||
* Sets the API key for the application.
|
||||
* @param apiKey The API key to set
|
||||
*/
|
||||
* Sets the API key for the application.
|
||||
* @param apiKey The API key to set
|
||||
*/
|
||||
export function setApiKey(apiKey: string): void;
|
||||
|
||||
interface HttpRequestFulfilled<T> {
|
||||
result: T;
|
||||
body: string;
|
||||
headers?: any[];
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
}
|
||||
|
||||
interface HttpRequestRejected {
|
||||
result: {
|
||||
error: {
|
||||
message: string;
|
||||
}
|
||||
};
|
||||
body: string;
|
||||
headers?: any[];
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* HttpRequest supports promises.
|
||||
* See Google API Client JavaScript Using Promises https://developers.google.com/api-client-library/javascript/features/promises
|
||||
*
|
||||
* TODO This should be updated when TypeScript 2.3 is released
|
||||
* See https://github.com/Microsoft/TypeScript/issues/12409
|
||||
* See https://github.com/Microsoft/TypeScript/blob/65da012527937a3074c62655d60ee08fee809f7f/lib/lib.es5.d.ts#L1339
|
||||
*/
|
||||
class HttpRequestPromise<T> {
|
||||
then<TResult>(
|
||||
opt_onFulfilled?: ((response: HttpRequestFulfilled<T>) => void) | null,
|
||||
opt_onRejected?: ((reason: HttpRequestRejected) => void) | null,
|
||||
opt_context?: any
|
||||
): Promise<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object encapsulating an HTTP request. This object is not instantiated directly, rather it is returned by gapi.client.request.
|
||||
*/
|
||||
export class HttpRequest<T> {
|
||||
export class HttpRequest<T> extends HttpRequestPromise<T> {
|
||||
/**
|
||||
* Executes the request and runs the supplied callback on response.
|
||||
* @param callback The callback function which executes when the request succeeds or fails.
|
||||
@@ -210,25 +270,9 @@ declare namespace gapi.client {
|
||||
status: number;
|
||||
statusText: string;
|
||||
}
|
||||
) => any):void;
|
||||
/**
|
||||
* HttpRequest supports promises.
|
||||
*/
|
||||
then(success:(response:{
|
||||
result:T;
|
||||
body:string;
|
||||
headers?: any[];
|
||||
status?: number;
|
||||
statusText?: string
|
||||
})=>void,
|
||||
failure:(response:{
|
||||
result:T;
|
||||
body:string;
|
||||
headers?: any[];
|
||||
status?: number;
|
||||
statusText?: string
|
||||
})=>void): void;
|
||||
) => any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute.
|
||||
*/
|
||||
@@ -244,16 +288,16 @@ declare namespace gapi.client {
|
||||
*/
|
||||
id: string;
|
||||
callback: (
|
||||
/**
|
||||
* is the response for this request only. Its format is defined by the API method being called.
|
||||
*/
|
||||
individualResponse: any,
|
||||
/**
|
||||
* is the raw batch ID-response map as a string. It contains all responses to all requests in the batch.
|
||||
*/
|
||||
rawBatchResponse: any
|
||||
) => any
|
||||
}):void;
|
||||
/**
|
||||
* is the response for this request only. Its format is defined by the API method being called.
|
||||
*/
|
||||
individualResponse: any,
|
||||
/**
|
||||
* is the raw batch ID-response map as a string. It contains all responses to all requests in the batch.
|
||||
*/
|
||||
rawBatchResponse: any
|
||||
) => any
|
||||
}): void;
|
||||
/**
|
||||
* Executes all requests in the batch. The supplied callback is executed on success or failure.
|
||||
* @param callback The callback to execute when the batch returns.
|
||||
@@ -267,7 +311,7 @@ declare namespace gapi.client {
|
||||
* is the same response, but as an unparsed JSON-string.
|
||||
*/
|
||||
rawBatchResponse: string
|
||||
) => any):void;
|
||||
) => any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,7 +332,7 @@ declare namespace gapi.client {
|
||||
* is the same as jsonResp, except it is a raw string that has not been parsed. It is typically used when the response is not JSON.
|
||||
*/
|
||||
rawResp: string
|
||||
) => void ):void;
|
||||
) => void): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-4
@@ -2,11 +2,12 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -16,6 +17,7 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"gapi-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2276,7 +2276,7 @@ declare namespace google.maps {
|
||||
}
|
||||
|
||||
export interface PlaceDetailsRequest {
|
||||
placeId: string;
|
||||
placeid: string;
|
||||
}
|
||||
|
||||
export interface PlaceGeometry {
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as gulp from "gulp";
|
||||
import * as batch from "gulp-batch";
|
||||
|
||||
gulp.task('default', function() {
|
||||
gulp.task('default', () => {
|
||||
gulp.watch([ 'lib/**', 'test/**' ], batch((events: any, cb: any) => {
|
||||
events.on('data', console.log).on('end', cb);
|
||||
}));
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user