mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #1 from DefinitelyTyped/master
jquery.slick & jquery.mmenu
This commit is contained in:
Vendored
+12
-1
@@ -301,6 +301,17 @@ declare module AngularFormly {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This allows you to place attributes with string values on the ng-model element.
|
||||
* Easy to use alternative to ngModelAttrs option.
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#ngmodelelattrs-object
|
||||
*/
|
||||
ngModelElAttrs?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Used to tell angular-formly to not attempt to add the formControl property to your object. This is useful
|
||||
* for things like validation, but not necessary if your "field" doesn't use ng-model (if it's just a horizontal
|
||||
@@ -572,4 +583,4 @@ declare module AngularFormly {
|
||||
messages: { [key: string]: ($viewValue: any, $modelValue: any, scope: ITemplateScope) => string };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-modal.d.ts" />
|
||||
|
||||
var btfModal: angularModal.AngularModalFactory;
|
||||
|
||||
// Using template URL
|
||||
function withTemplateUrl() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'some-template.html'
|
||||
});
|
||||
}
|
||||
|
||||
// Using template
|
||||
function withTemplate() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// Using controller function
|
||||
function withControllerAsFunction() {
|
||||
btfModal({
|
||||
controller: function () {},
|
||||
template: '<div></div>'
|
||||
})
|
||||
}
|
||||
|
||||
// Using constructor function
|
||||
function withControllerClass() {
|
||||
class TestController {
|
||||
constructor(dependency1:any, dependency2:any) {}
|
||||
}
|
||||
btfModal({
|
||||
controller: TestController,
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as selector
|
||||
function withContainerAsString() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: '.container'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as jQuery element
|
||||
function withContainerAsJquery() {
|
||||
var container: JQuery = $('body');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element
|
||||
function withContainerAsDom() {
|
||||
var container: Element = document.getElementById('container');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element Array
|
||||
function withContainerAsDomArray() {
|
||||
var container: Element[] = [document.getElementById('container'), document.getElementById('container2')];
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as function
|
||||
function withContainerAsFunction() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: function() {}
|
||||
});
|
||||
}
|
||||
|
||||
// With container as array
|
||||
function withContainerAsArray() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: ['1', 2]
|
||||
});
|
||||
}
|
||||
|
||||
// Calling return values
|
||||
function callingValues() {
|
||||
var modal: angularModal.AngularModal = btfModal({
|
||||
template: '<div></div>'
|
||||
});
|
||||
modal.activate().then(() => {}, () => {});
|
||||
modal.deactivate().then(() => {}, () => {});
|
||||
var isActive: boolean = modal.active();
|
||||
}
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for angular-modal 0.5.0
|
||||
// Project: https://github.com/btford/angular-modal
|
||||
// Definitions by: Paul Lessing <https://github.com/paullessing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module angularModal {
|
||||
|
||||
type AngularModalControllerDefinition = (new (...args: any[]) => any) | Function | string; // Possible arguments to IControllerService
|
||||
|
||||
type AngularModalJQuerySelector = string | Element | Element[] | JQuery | Function | any[] | {}; // Possible arguments to IAugmentedJQueryStatic
|
||||
|
||||
interface AngularModalSettings {
|
||||
controller?: AngularModalControllerDefinition;
|
||||
controllerAs?: string;
|
||||
container?: AngularModalJQuerySelector;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplate extends AngularModalSettings {
|
||||
template: any;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplateUrl extends AngularModalSettings {
|
||||
templateUrl: string;
|
||||
}
|
||||
|
||||
export interface AngularModal {
|
||||
activate(): angular.IPromise<void>;
|
||||
deactivate(): angular.IPromise<void>;
|
||||
active(): boolean;
|
||||
}
|
||||
|
||||
export interface AngularModalFactory {
|
||||
(settings: AngularModalSettingsWithTemplate | AngularModalSettingsWithTemplateUrl): AngularModal;
|
||||
}
|
||||
}
|
||||
Vendored
+2
-1
@@ -774,7 +774,7 @@ declare module angular {
|
||||
* @param reverse Reverse the order of the array.
|
||||
* @return Reverse the order of the array.
|
||||
*/
|
||||
<T>(array: T[], expression: string|string[]|((value: T) => any)|((value: T) => any)[], reverse?: boolean): T[];
|
||||
<T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1660,6 +1660,7 @@ declare module angular {
|
||||
restrict?: string;
|
||||
scope?: any;
|
||||
template?: any;
|
||||
templateNamespace?: string;
|
||||
templateUrl?: any;
|
||||
terminal?: boolean;
|
||||
transclude?: any;
|
||||
|
||||
Vendored
+3
-2
@@ -16,12 +16,13 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
import * as STREAM from 'stream';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver {
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
@@ -38,4 +39,4 @@ declare module "archiver" {
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/// <reference path="bignum.d.ts" />
|
||||
|
||||
var bignum = require('bignum');
|
||||
|
||||
// Test constructors.
|
||||
var instance = bignum(16);
|
||||
bignum('16');
|
||||
bignum(instance);
|
||||
|
||||
// Test `toNumber` function.
|
||||
instance.toNumber();
|
||||
|
||||
bignum.toNumber(4);
|
||||
bignum.toNumber('4');
|
||||
bignum.toNumber(bignum(4));
|
||||
|
||||
// Test `toBuffer` function.
|
||||
instance.toBuffer();
|
||||
|
||||
bignum.toBuffer(4);
|
||||
bignum.toBuffer('4');
|
||||
bignum.toBuffer(bignum(4));
|
||||
|
||||
// Test `add` function.
|
||||
instance.add(4);
|
||||
instance.add('4');
|
||||
instance.add(bignum(4));
|
||||
|
||||
bignum.add(instance, 4);
|
||||
bignum.add(instance, '4');
|
||||
bignum.add(instance, bignum(4));
|
||||
|
||||
// Test `sub` function.
|
||||
instance.sub(4);
|
||||
instance.sub('4');
|
||||
instance.sub(bignum(4));
|
||||
|
||||
bignum.sub(instance, 4);
|
||||
bignum.sub(instance, '4');
|
||||
bignum.sub(instance, bignum(4));
|
||||
|
||||
// Test `mul` function.
|
||||
instance.mul(4);
|
||||
instance.mul('4');
|
||||
instance.mul(bignum(4));
|
||||
|
||||
bignum.mul(instance, 4);
|
||||
bignum.mul(instance, '4');
|
||||
bignum.mul(instance, bignum(4));
|
||||
|
||||
// Test `div` function.
|
||||
instance.div(4);
|
||||
instance.div('4');
|
||||
instance.div(bignum(4));
|
||||
|
||||
bignum.div(instance, 4);
|
||||
bignum.div(instance, '4');
|
||||
bignum.div(instance, bignum(4));
|
||||
|
||||
// Test `abs` function.
|
||||
instance.abs();
|
||||
bignum.abs(instance);
|
||||
|
||||
// Test `neg` function.
|
||||
instance.neg();
|
||||
bignum.neg(instance);
|
||||
|
||||
// Test `cmp` function.
|
||||
instance.cmp(4);
|
||||
instance.cmp('4');
|
||||
instance.cmp(bignum(4));
|
||||
|
||||
bignum.cmp(instance, 4);
|
||||
bignum.cmp(instance, '4');
|
||||
bignum.cmp(instance, bignum(4));
|
||||
|
||||
// Test `gt` function.
|
||||
instance.gt(4);
|
||||
instance.gt('4');
|
||||
instance.gt(bignum(4));
|
||||
|
||||
bignum.gt(instance, 4);
|
||||
bignum.gt(instance, '4');
|
||||
bignum.gt(instance, bignum(4));
|
||||
|
||||
// Test `ge` function.
|
||||
instance.ge(4);
|
||||
instance.ge('4');
|
||||
instance.ge(bignum(4));
|
||||
|
||||
bignum.ge(instance, 4);
|
||||
bignum.ge(instance, '4');
|
||||
bignum.ge(instance, bignum(4));
|
||||
|
||||
// Test `eq` function.
|
||||
instance.eq(4);
|
||||
instance.eq('4');
|
||||
instance.eq(bignum(4));
|
||||
|
||||
bignum.eq(instance, 4);
|
||||
bignum.eq(instance, '4');
|
||||
bignum.eq(instance, bignum(4));
|
||||
|
||||
// Test `lt` function.
|
||||
instance.lt(4);
|
||||
instance.lt('4');
|
||||
instance.lt(bignum(4));
|
||||
|
||||
bignum.lt(instance, 4);
|
||||
bignum.lt(instance, '4');
|
||||
bignum.lt(instance, bignum(4));
|
||||
|
||||
// Test `le` function.
|
||||
instance.le(4);
|
||||
instance.le('4');
|
||||
instance.le(bignum(4));
|
||||
|
||||
bignum.le(instance, 4);
|
||||
bignum.le(instance, '4');
|
||||
bignum.le(instance, bignum(4));
|
||||
|
||||
// Test `and` function.
|
||||
instance.and(4);
|
||||
instance.and('4');
|
||||
instance.and(bignum(4));
|
||||
|
||||
bignum.and(instance, 4);
|
||||
bignum.and(instance, '4');
|
||||
bignum.and(instance, bignum(4));
|
||||
|
||||
// Test `or` function.
|
||||
instance.or(4);
|
||||
instance.or('4');
|
||||
instance.or(bignum(4));
|
||||
|
||||
bignum.or(instance, 4);
|
||||
bignum.or(instance, '4');
|
||||
bignum.or(instance, bignum(4));
|
||||
|
||||
// Test `xor` function.
|
||||
instance.xor(4);
|
||||
instance.xor('4');
|
||||
instance.xor(bignum(4));
|
||||
|
||||
bignum.xor(instance, 4);
|
||||
bignum.xor(instance, '4');
|
||||
bignum.xor(instance, bignum(4));
|
||||
|
||||
// Test `mod` function.
|
||||
instance.mod(4);
|
||||
instance.mod('4');
|
||||
instance.mod(bignum(4));
|
||||
|
||||
bignum.mod(instance, 4);
|
||||
bignum.mod(instance, '4');
|
||||
bignum.mod(instance, bignum(4));
|
||||
|
||||
// Test `pow` function.
|
||||
instance.pow(4);
|
||||
instance.pow('4');
|
||||
instance.pow(bignum(4));
|
||||
|
||||
bignum.pow(instance, 4);
|
||||
bignum.pow(instance, '4');
|
||||
bignum.pow(instance, bignum(4));
|
||||
|
||||
// Test `powm` function.
|
||||
instance.powm(4, 4);
|
||||
instance.powm('4', 4);
|
||||
instance.powm(bignum(4), 4);
|
||||
|
||||
bignum.powm(instance, 4, 4);
|
||||
bignum.powm(instance, '4', 4);
|
||||
bignum.powm(instance, bignum(4), 4);
|
||||
|
||||
instance.powm(4, '4');
|
||||
instance.powm('4', '4');
|
||||
instance.powm(bignum(4), '4');
|
||||
|
||||
bignum.powm(instance, 4, '4');
|
||||
bignum.powm(instance, '4', '4');
|
||||
bignum.powm(instance, bignum(4), '4');
|
||||
|
||||
instance.powm(4, bignum(4));
|
||||
instance.powm('4', bignum(4));
|
||||
instance.powm(bignum(4), bignum(4));
|
||||
|
||||
bignum.powm(instance, 4, bignum(4));
|
||||
bignum.powm(instance, '4', bignum(4));
|
||||
bignum.powm(instance, bignum(4), bignum(4));
|
||||
|
||||
// Test `invertm` function.
|
||||
instance.invertm(4);
|
||||
instance.invertm('4');
|
||||
instance.invertm(bignum(4));
|
||||
|
||||
bignum.invertm(instance, 4);
|
||||
bignum.invertm(instance, '4');
|
||||
bignum.invertm(instance, bignum(4));
|
||||
|
||||
// Test `rand` function.
|
||||
instance.rand();
|
||||
instance.rand(20);
|
||||
instance.rand('20');
|
||||
instance.rand(bignum(20));
|
||||
|
||||
bignum.rand(instance);
|
||||
bignum.rand(instance, 20);
|
||||
bignum.rand(instance, '20');
|
||||
bignum.rand(instance, bignum(20));
|
||||
|
||||
// Test `probPrime` function.
|
||||
instance.probPrime();
|
||||
|
||||
bignum.probPrime(instance);
|
||||
|
||||
// Test `shiftLeft` function.
|
||||
instance.shiftLeft(4);
|
||||
instance.shiftLeft('4');
|
||||
instance.shiftLeft(bignum(4));
|
||||
|
||||
bignum.shiftLeft(instance, 4);
|
||||
bignum.shiftLeft(instance, '4');
|
||||
bignum.shiftLeft(instance, bignum(4));
|
||||
|
||||
// Test `shiftRight` function.
|
||||
instance.shiftRight(4);
|
||||
instance.shiftRight('4');
|
||||
instance.shiftRight(bignum(4));
|
||||
|
||||
bignum.shiftRight(instance, 4);
|
||||
bignum.shiftRight(instance, '4');
|
||||
bignum.shiftRight(instance, bignum(4));
|
||||
|
||||
// Test `gcd` function.
|
||||
instance.gcd(bignum(4));
|
||||
|
||||
bignum.gcd(instance, bignum(4));
|
||||
|
||||
// Test `jacobi` function.
|
||||
instance.jacobi(bignum(17));
|
||||
|
||||
bignum.jacobi(instance, bignum(17));
|
||||
|
||||
// Test `bitLength` function.
|
||||
instance.bitLength();
|
||||
|
||||
bignum.bitLength(instance);
|
||||
Vendored
+269
@@ -0,0 +1,269 @@
|
||||
// Type definitions for BigNum
|
||||
// Project: https://github.com/justmoon/node-BigNum
|
||||
// Definitions by: Pat Smuk <https://github.com/Patman64>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare class BigNum {
|
||||
/** Create a new BigNum from n. */
|
||||
constructor(n: number|BigNum);
|
||||
|
||||
/** Create a new BigNum from n and a base. */
|
||||
constructor(n: string, base?: number);
|
||||
|
||||
/**
|
||||
* Create a new BigNum from a Buffer.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
static fromBuffer(buffer: Buffer, options?: BigNum.BufferOptions): BigNum;
|
||||
|
||||
/**
|
||||
* Generate a probable prime of length bits.
|
||||
*
|
||||
* If safe is true, it will be a "safe" prime of the form p=2p'+1 where p' is also prime.
|
||||
*/
|
||||
static prime(bits: number, safe?: boolean): BigNum;
|
||||
|
||||
/** Return true if num is identified as a BigNum instance. Otherwise, return false. */
|
||||
static isBigNum(num: any): boolean;
|
||||
|
||||
/** Print out the BigNum instance in the requested base as a string. Default: base 10 */
|
||||
toString(base?: number): string;
|
||||
|
||||
/**
|
||||
* Turn a BigNum into a Number.
|
||||
*
|
||||
* If the BigNum is too big you'll lose precision or you'll get ±Infinity.
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Return a new Buffer with the data from the BigNum.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
toBuffer(options?: BigNum.BufferOptions): Buffer;
|
||||
|
||||
/** Return a new BigNum containing the instance value plus n. */
|
||||
add(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value minus n. */
|
||||
sub(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value multiplied by n. */
|
||||
mul(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value integrally divided by n. */
|
||||
div(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the absolute value of the instance. */
|
||||
abs(): BigNum;
|
||||
|
||||
/** Return a new BigNum with the negative of the instance value. */
|
||||
neg(): BigNum;
|
||||
|
||||
/**
|
||||
* Compare the instance value to n.
|
||||
*
|
||||
* Return a positive integer if > n, a negative integer if < n, and 0 if == n.
|
||||
*/
|
||||
cmp(n: BigNum.BigNumCompatible): number;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than n (> n). */
|
||||
gt(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */
|
||||
ge(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is equal to n (== n). */
|
||||
eq(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than n (< n). */
|
||||
lt(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than or equal to n (<= n). */
|
||||
le(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise AND (&)-ed with n. */
|
||||
and(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise inclusive-OR (|)-ed with n. */
|
||||
or(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise exclusive-OR (^)-ed with n. */
|
||||
xor(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value modulo n. */
|
||||
mod(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power. */
|
||||
pow(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power modulo m. */
|
||||
powm(n: BigNum.BigNumCompatible, m: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Compute the multiplicative inverse modulo m. */
|
||||
invertm(m: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.
|
||||
* Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.
|
||||
*/
|
||||
rand(upperBound?: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Return whether the BigNum is:
|
||||
* - certainly prime (true)
|
||||
* - probably prime ('maybe')
|
||||
* - certainly composite (false)
|
||||
*/
|
||||
probPrime(): boolean | string;
|
||||
|
||||
/** Return a new BigNum that is the 2^n multiple. Equivalent of the << operator. */
|
||||
shiftLeft(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum of the value integer divided by 2^n. Equivalent of the >> operator. */
|
||||
shiftRight(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return the greatest common divisor of the current BigNum with n as a new BigNum. */
|
||||
gcd(n: BigNum): BigNum;
|
||||
|
||||
/**
|
||||
* Return the Jacobi symbol (or Legendre symbol if n is prime) of the current BigNum (= a) over n.
|
||||
* Note that n must be odd and >= 3. 0 <= a < n.
|
||||
*
|
||||
* Returns -1 or 1 as an int (NOT a BigNum). Throws an error on failure.
|
||||
*/
|
||||
jacobi(n: BigNum): number;
|
||||
|
||||
/** Return the number of bits used to represent the current BigNum. */
|
||||
bitLength(): number;
|
||||
}
|
||||
|
||||
declare namespace BigNum {
|
||||
/** Anything that can be converted to BigNum. */
|
||||
type BigNumCompatible = BigNum | number | string;
|
||||
|
||||
export interface BufferOptions {
|
||||
/** Can be either 'big' or 'little'. Also accepts 1 for big and -1 for little. Doesn't matter when size = 1. */
|
||||
endian: string | number;
|
||||
|
||||
/** Number of bytes per word, or 'auto' to flip entire Buffer. */
|
||||
size: number | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a BigNum into a Number.
|
||||
*
|
||||
* If the BigNum is too big you'll lose precision or you'll get ±Infinity.
|
||||
*/
|
||||
export function toNumber(n: BigNumCompatible): number;
|
||||
|
||||
/**
|
||||
* Return a new Buffer with the data from the BigNum.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
export function toBuffer(n: BigNumCompatible, options?: BufferOptions): Buffer;
|
||||
|
||||
/** Return a new BigNum containing the instance value plus n. */
|
||||
export function add(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value minus n. */
|
||||
export function sub(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value multiplied by n. */
|
||||
export function mul(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value integrally divided by n. */
|
||||
export function div(dividend: BigNumCompatible, divisor: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the absolute value of the instance. */
|
||||
export function abs(n: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the negative of the instance value. */
|
||||
export function neg(n: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Compare the instance value to n.
|
||||
*
|
||||
* Return a positive integer if > n, a negative integer if < n, and 0 if == n.
|
||||
*/
|
||||
export function cmp(left: BigNumCompatible, right: BigNumCompatible): number;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than n (> n). */
|
||||
export function gt(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */
|
||||
export function ge(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is equal to n (== n). */
|
||||
export function eq(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than n (< n). */
|
||||
export function lt(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than or equal to n (<= n). */
|
||||
export function le(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise AND (&)-ed with n. */
|
||||
export function and(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise inclusive-OR (|)-ed with n. */
|
||||
export function or(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise exclusive-OR (^)-ed with n. */
|
||||
export function xor(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value modulo n. */
|
||||
export function mod(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power. */
|
||||
export function pow(base: BigNumCompatible, exponent: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power modulo m. */
|
||||
export function powm(base: BigNumCompatible, exponent: BigNumCompatible, m: BigNumCompatible): BigNum;
|
||||
|
||||
/** Compute the multiplicative inverse modulo m. */
|
||||
export function invertm(n: BigNumCompatible, m: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.
|
||||
* Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.
|
||||
*/
|
||||
export function rand(n: BigNumCompatible, upperBound?: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Return whether the BigNum is:
|
||||
* - certainly prime (true)
|
||||
* - probably prime ('maybe')
|
||||
* - certainly composite (false)
|
||||
*/
|
||||
export function probPrime(n: BigNumCompatible): boolean | string;
|
||||
|
||||
/** Return a new BigNum that is the 2^bits multiple. Equivalent of the << operator. */
|
||||
export function shiftLeft(n: BigNumCompatible, bits: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum of the value integer divided by 2^bits. Equivalent of the >> operator. */
|
||||
export function shiftRight(n: BigNumCompatible, bits: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return the greatest common divisor of the current BigNum with n as a new BigNum. */
|
||||
export function gcd(left: BigNumCompatible, right: BigNum): BigNum;
|
||||
|
||||
/**
|
||||
* Return the Jacobi symbol (or Legendre symbol if n is prime) of the current BigNum (= a) over n.
|
||||
* Note that n must be odd and >= 3. 0 <= a < n.
|
||||
*
|
||||
* Returns -1 or 1 as an int (NOT a BigNum). Throws an error on failure.
|
||||
*/
|
||||
export function jacobi(a: BigNumCompatible, n: BigNum): number;
|
||||
|
||||
/** Return the number of bits used to represent the current BigNum. */
|
||||
export function bitLength(n: BigNumCompatible): number;
|
||||
}
|
||||
|
||||
declare module "bignum" {
|
||||
export = BigNum;
|
||||
}
|
||||
+88
-10
@@ -80,6 +80,7 @@ var voidProm: Promise<void>;
|
||||
|
||||
var fooProm: Promise<Foo>;
|
||||
var barProm: Promise<Bar>;
|
||||
var fooOrBarProm: Promise<Foo|Bar>;
|
||||
var bazProm: Promise<Baz>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
@@ -150,6 +151,7 @@ var BlueBird: typeof Promise;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {}
|
||||
var nodeCallbackFuncErrorOnly = (callback: (err: any) => void) => {}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -225,6 +227,21 @@ barProm = fooProm.then((value: Foo) => {
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return barProm;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
@@ -236,36 +253,96 @@ barProm = barProm.then((value: Bar) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooProm = fooProm.caught((reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
|
||||
fooProm = fooProm.caught((reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
fooProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
fooProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
//handle multiple valid return types simultaneously
|
||||
if (true) {
|
||||
return;
|
||||
} else if (false) {
|
||||
return voidProm;
|
||||
} else if (foo) {
|
||||
return foo;
|
||||
}
|
||||
});
|
||||
|
||||
fooOrBarProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
fooOrBarProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
fooOrBarProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
fooOrBarProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch(Error, (reason: any) => {
|
||||
fooProm = fooProm.catch(Error, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught(Error, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooOrBarProm = fooProm.catch(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
fooOrBarProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Error, (reason: any) => {
|
||||
fooOrBarProm = fooProm.caught(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
@@ -678,6 +755,7 @@ func = Promise.promisify(f, obj);
|
||||
|
||||
obj = Promise.promisifyAll(obj);
|
||||
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
|
||||
anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback));
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
Vendored
+19
-18
@@ -25,19 +25,19 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => U|Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => void|Promise.Thenable<void>, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(onReject?: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(onReject?: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
catch<U>(onReject?: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(onReject?: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
@@ -46,17 +46,18 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.
|
||||
@@ -426,7 +427,7 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Returns a promise that is resolved by a node style callback function.
|
||||
*/
|
||||
static fromNode(resolver: (callback: (err: any, result: any) => void) => void): Promise<any>;
|
||||
static fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise<any>;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
@@ -671,8 +672,8 @@ declare module Promise {
|
||||
export function OperationalError(): OperationalError;
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => U|Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => void|Thenable<void>): Thenable<U>;
|
||||
}
|
||||
|
||||
export interface Resolver<R> {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/// <reference path="bookshelf.d.ts" />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
|
||||
import * as Knex from 'knex';
|
||||
import * as Bookshelf from 'bookshelf';
|
||||
|
||||
var knex = Knex({
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: ':memory:',
|
||||
},
|
||||
});
|
||||
|
||||
// Examples
|
||||
|
||||
var bookshelf = Bookshelf(knex);
|
||||
|
||||
class User extends bookshelf.Model<User> {
|
||||
get tableName() { return 'users'; }
|
||||
messages() : Bookshelf.Collection<Posts> {
|
||||
return this.hasMany(Posts);
|
||||
}
|
||||
}
|
||||
|
||||
class Posts extends bookshelf.Model<Posts> {
|
||||
get tableName() { return 'messages'; }
|
||||
tags() : Bookshelf.Collection<Tag> {
|
||||
return this.belongsToMany(Tag);
|
||||
}
|
||||
}
|
||||
|
||||
class Tag extends bookshelf.Model<Tag> {
|
||||
get tableName() { return 'tags'; }
|
||||
}
|
||||
|
||||
new User({}).where('id', 1).fetch({withRelated: ['posts.tags']})
|
||||
.then(user => {
|
||||
console.log(user.related('posts').toJSON());
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
// Associations
|
||||
|
||||
class Book extends bookshelf.Model<Book> {
|
||||
get tableName() { return 'books'; }
|
||||
summary() {
|
||||
return this.hasOne(Summary);
|
||||
}
|
||||
pages() {
|
||||
return this.hasMany(Pages);
|
||||
}
|
||||
authors() {
|
||||
return this.belongsToMany(Author);
|
||||
}
|
||||
}
|
||||
|
||||
class Summary extends bookshelf.Model<Summary> {
|
||||
get tableName() { return 'summaries'; }
|
||||
book() : Book {
|
||||
return this.belongsTo(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Pages extends bookshelf.Model<Pages> {
|
||||
get tableName() { return 'pages'; }
|
||||
book() {
|
||||
return this.belongsTo(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Author extends bookshelf.Model<Author> {
|
||||
get tableName() { return 'author'; }
|
||||
books() {
|
||||
return this.belongsToMany(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Site extends bookshelf.Model<Site> {
|
||||
get tableName() { return 'sites'; }
|
||||
photo() {
|
||||
return this.morphOne(Photo, 'imageable');
|
||||
}
|
||||
}
|
||||
|
||||
class Post extends bookshelf.Model<Post> {
|
||||
get tableName() { return 'posts'; }
|
||||
photos() {
|
||||
return this.morphMany(Photo, 'imageable');
|
||||
}
|
||||
}
|
||||
|
||||
class Photo extends bookshelf.Model<Photo> {
|
||||
get tableName() { return 'photos'; }
|
||||
imageable() {
|
||||
return this.morphTo('imageable', Site, Post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
Vendored
+313
@@ -0,0 +1,313 @@
|
||||
// Type definitions for bookshelfjs v0.8.2
|
||||
// Project: http://bookshelfjs.org/
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../lodash/lodash.d.ts" />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
|
||||
declare module 'bookshelf' {
|
||||
import knex = require('knex');
|
||||
import Promise = require('bluebird');
|
||||
import Lodash = require('lodash');
|
||||
|
||||
interface Bookshelf extends Bookshelf.Events<any> {
|
||||
VERSION : string;
|
||||
knex : knex;
|
||||
Model : typeof Bookshelf.Model;
|
||||
Collection : typeof Bookshelf.Collection;
|
||||
|
||||
transaction<T>(callback : (transaction : knex.Transaction) => T) : Promise<T>;
|
||||
}
|
||||
|
||||
function Bookshelf(knex : knex) : Bookshelf;
|
||||
|
||||
namespace Bookshelf {
|
||||
abstract class Events<T> {
|
||||
on(event? : string, callback? : EventFunction<T>, context? : any) : void;
|
||||
off(event? : string) : void;
|
||||
trigger(event? : string, ...args : any[]) : void;
|
||||
triggerThen(name : string, ...args : any[]) : Promise<any>;
|
||||
once(event : string, callback : EventFunction<T>, context? : any) : void;
|
||||
}
|
||||
|
||||
interface IModelBase {
|
||||
/** Should be declared as a getter instead of a plain property. */
|
||||
hasTimestamps? : boolean|string[];
|
||||
/** Should be declared as a getter instead of a plain property. Should be required, but cannot have abstract properties yet. */
|
||||
tableName? : string;
|
||||
}
|
||||
|
||||
abstract class ModelBase<T extends Model<any>> extends Events<T|Collection<T>> implements IModelBase {
|
||||
/** If overriding, must use a getter instead of a plain property. */
|
||||
idAttribute : string;
|
||||
|
||||
constructor(attributes? : any, options? : ModelOptions);
|
||||
|
||||
clear() : T;
|
||||
clone() : T;
|
||||
escape(attribute : string) : string;
|
||||
format(attributes : any) : any;
|
||||
get(attribute : string) : any;
|
||||
has(attribute : string) : boolean;
|
||||
hasChanged(attribute? : string) : boolean;
|
||||
isNew() : boolean;
|
||||
parse(response : any) : any;
|
||||
previousAttributes() : any;
|
||||
previous(attribute : string) : any;
|
||||
related<R extends Model<any>>(relation : string) : R | Collection<R>;
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(attribute?: {[key : string] : any}, options? : SetOptions) : T;
|
||||
set(attribute : string, value? : any, options? : SetOptions) : T;
|
||||
timestamp(options? : TimestampOptions) : any;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unset(attribute : string) : T;
|
||||
|
||||
// lodash methods
|
||||
invert<R extends {}>() : R;
|
||||
keys() : string[];
|
||||
omit<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
omit<R extends {}>(...attributes : string[]) : R;
|
||||
pairs() : any[][];
|
||||
pick<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
pick<R extends {}>(...attributes : string[]) : R;
|
||||
values() : any[];
|
||||
}
|
||||
|
||||
class Model<T extends Model<any>> extends ModelBase<T> {
|
||||
static collection<T extends Model<any>>(models? : T[], options? : CollectionOptions<T>) : Collection<T>;
|
||||
static count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T extends Model<any>>(prototypeProperties? : any, classProperties? : any) : Function; // should return a type
|
||||
static fetchAll<T extends Model<any>>() : Promise<Collection<T>>;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
destroy(options : SyncOptions) : void;
|
||||
fetch(options? : FetchOptions) : Promise<T>;
|
||||
fetchAll(options? : FetchAllOptions) : Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : Collection<R>;
|
||||
hasOne<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
load(relations : string|string[], options? : LoadOptions) : Promise<T>;
|
||||
morphMany<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : Collection<R>;
|
||||
morphOne<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : R;
|
||||
morphTo(name : string, columnNames? : string[], ...target : typeof Model[]) : T;
|
||||
morphTo(name : string, ...target : typeof Model[]) : T;
|
||||
query(...query : string[]) : T;
|
||||
query(query : {[key : string] : any}) : T;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : T;
|
||||
query() : knex.QueryBuilder;
|
||||
refresh(options? : FetchOptions) : Promise<T>;
|
||||
resetQuery() : T;
|
||||
save(key? : string, val? : string, options? : SaveOptions) : Promise<T>;
|
||||
save(attrs? : {[key : string] : any}, options? : SaveOptions) : Promise<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
where(properties : {[key : string] : any}) : T;
|
||||
where(key : string, operatorOrValue : string|number|boolean, valueIfOperator? : string|number|boolean) : T;
|
||||
}
|
||||
|
||||
abstract class CollectionBase<T extends Model<any>> extends Events<T> {
|
||||
add(models : T[]|{[key : string] : any}[], options? : CollectionAddOptions) : Collection<T>;
|
||||
at(index : number) : T;
|
||||
clone() : Collection<T>;
|
||||
fetch(options? : CollectionFetchOptions) : Promise<Collection<T>>;
|
||||
findWhere(match : {[key : string] : any}) : T;
|
||||
get(id : any) : T;
|
||||
invokeThen(name : string, ...args : any[]) : Promise<any>;
|
||||
parse(response : any) : any;
|
||||
pluck(attribute : string) : any[];
|
||||
pop() : void;
|
||||
push(model : any) : Collection<T>;
|
||||
reduceThen<R>(iterator : (prev : R, cur : T, idx : number, array : T[]) => R, initialValue : R, context : any) : Promise<R>;
|
||||
remove(model : T, options? : EventOptions) : T;
|
||||
remove(model : T[], options? : EventOptions) : T[];
|
||||
reset(model : any[], options? : CollectionAddOptions) : T[];
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(models : T[]|{[key : string] : any}[], options? : CollectionSetOptions) : Collection<T>;
|
||||
shift(options? : EventOptions) : void;
|
||||
slice(begin? : number, end? : number) : void;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unshift(model : any, options? : CollectionAddOptions) : void;
|
||||
where(match : {[key : string] : any}, firstOnly : boolean) : T|Collection<T>;
|
||||
|
||||
// lodash methods
|
||||
all(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
all<R extends {}>(predicate? : R) : boolean;
|
||||
any(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
any<R extends {}>(predicate? : R) : boolean;
|
||||
chain() : Lodash.LoDashExplicitObjectWrapper<T>;
|
||||
collect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
collect<R extends {}>(predicate? : R) : T[];
|
||||
contains(value : any, fromIndex? : number) : boolean;
|
||||
countBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<number>;
|
||||
countBy<R extends {}>(predicate? : R) : Lodash.Dictionary<number>;
|
||||
detect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
detect<R extends {}>(predicate? : R) : T;
|
||||
difference(...values : T[]) : T[];
|
||||
drop(n? : number) : T[];
|
||||
each(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
each(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
each(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
every(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
every<R extends {}>(predicate? : R) : boolean;
|
||||
filter(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
filter<R extends {}>(predicate? : R) : T[];
|
||||
find(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
find<R extends {}>(predicate? : R) : T;
|
||||
first() : T;
|
||||
foldl<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
foldr<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
forEach(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
forEach(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
forEach(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
groupBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<T[]>;
|
||||
groupBy<R extends {}>(predicate? : R) : Lodash.Dictionary<T[]>;
|
||||
head() : T;
|
||||
include(value : any, fromIndex? : number) : boolean;
|
||||
indexOf(value : any, fromIndex? : number) : number;
|
||||
initial() : T[];
|
||||
inject<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
invoke(methodName : string|Function, ...args : any[]) : any;
|
||||
isEmpty() : boolean;
|
||||
keys() : string[];
|
||||
last() : T;
|
||||
lastIndexOf(value : any, fromIndex? : number) : number;
|
||||
map(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
map<R extends {}>(predicate? : R) : T[];
|
||||
max(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
max<R extends {}>(predicate? : R) : T;
|
||||
min(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
min<R extends {}>(predicate? : R) : T;
|
||||
reduce<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reduceRight<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reject(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
reject<R extends {}>(predicate? : R) : T[];
|
||||
rest() : T[];
|
||||
select(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
select<R extends {}>(predicate? : R) : T[];
|
||||
shuffle() : T[];
|
||||
size() : number;
|
||||
some(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
some<R extends {}>(predicate? : R) : boolean;
|
||||
sortBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
sortBy<R extends {}>(predicate? : R) : T[];
|
||||
tail() : T[];
|
||||
take(n? : number) : T[];
|
||||
toArray() : T[];
|
||||
without(...values : any[]) : T[];
|
||||
}
|
||||
|
||||
class Collection<T extends Model<any>> extends CollectionBase<T> {
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T>(prototypeProperties? : any, classProperties? : any) : Function;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
attach(ids : any[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
create(model : {[key : string] : any}, options? : CollectionCreateOptions) : Promise<T>;
|
||||
detach(ids : any[], options? : SyncOptions) : Promise<any>;
|
||||
fetchOne(options? : CollectionFetchOneOptions) : Promise<T>;
|
||||
load(relations : string|string[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
query(...query : string[]) : Collection<T>;
|
||||
query(query : {[key : string] : any}) : Collection<T>;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : Collection<T>;
|
||||
query() : knex.QueryBuilder;
|
||||
resetQuery() : Collection<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
updatePivot(attributes : any, options? : PivotOptions) : Promise<number>;
|
||||
withPivot(columns : string[]) : Collection<T>;
|
||||
}
|
||||
|
||||
interface ModelOptions {
|
||||
tableName? : string;
|
||||
hasTimestamps? : boolean;
|
||||
parse? : boolean;
|
||||
}
|
||||
|
||||
interface LoadOptions extends SyncOptions {
|
||||
withRelated: string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
withRelated? : string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchAllOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SaveOptions extends SyncOptions {
|
||||
method? : string;
|
||||
defaults? : string;
|
||||
patch? : boolean;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SerializeOptions {
|
||||
shallow? : boolean;
|
||||
omitPivot? : boolean;
|
||||
}
|
||||
|
||||
interface SetOptions {
|
||||
unset? : boolean;
|
||||
}
|
||||
|
||||
interface TimestampOptions {
|
||||
method? : string;
|
||||
}
|
||||
|
||||
interface SyncOptions {
|
||||
transacting? : knex.Transaction;
|
||||
debug? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionOptions<T> {
|
||||
comparator? : boolean|string|((a : T, b : T) => number);
|
||||
}
|
||||
|
||||
interface CollectionAddOptions extends EventOptions {
|
||||
at? : number;
|
||||
merge? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionFetchOptions {
|
||||
require? : boolean;
|
||||
withRelated? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionFetchOneOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionSetOptions extends EventOptions {
|
||||
add? : boolean;
|
||||
remove? : boolean;
|
||||
merge?: boolean;
|
||||
}
|
||||
|
||||
interface PivotOptions {
|
||||
query? : Function|any;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface EventOptions {
|
||||
silent? : boolean;
|
||||
}
|
||||
|
||||
interface EventFunction<T> {
|
||||
(model: T, attrs: any, options: any) : Promise<any>|void;
|
||||
}
|
||||
|
||||
interface CollectionCreateOptions extends ModelOptions, SyncOptions, CollectionAddOptions, SaveOptions {}
|
||||
}
|
||||
|
||||
export = Bookshelf;
|
||||
}
|
||||
Vendored
+198
-198
@@ -2251,782 +2251,782 @@ declare module "core-js/web/immediate" {
|
||||
declare module "core-js/web/timers" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary" {
|
||||
declare module "core-js/library" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/shim" {
|
||||
declare module "core-js/library/shim" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core" {
|
||||
declare module "core-js/library/core" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core/$for" {
|
||||
declare module "core-js/library/core/$for" {
|
||||
import $for = core.$for;
|
||||
export = $for;
|
||||
}
|
||||
declare module "core-js/libary/core/_" {
|
||||
declare module "core-js/library/core/_" {
|
||||
var _: typeof core._;
|
||||
export = _;
|
||||
}
|
||||
declare module "core-js/libary/core/array" {
|
||||
declare module "core-js/library/core/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/core/date" {
|
||||
declare module "core-js/library/core/date" {
|
||||
var Date: typeof core.Date;
|
||||
export = Date;
|
||||
}
|
||||
declare module "core-js/libary/core/delay" {
|
||||
declare module "core-js/library/core/delay" {
|
||||
var delay: typeof core.delay;
|
||||
export = delay;
|
||||
}
|
||||
declare module "core-js/libary/core/dict" {
|
||||
declare module "core-js/library/core/dict" {
|
||||
var Dict: typeof core.Dict;
|
||||
export = Dict;
|
||||
}
|
||||
declare module "core-js/libary/core/function" {
|
||||
declare module "core-js/library/core/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/core/global" {
|
||||
declare module "core-js/library/core/global" {
|
||||
var global: typeof core.global;
|
||||
export = global;
|
||||
}
|
||||
declare module "core-js/libary/core/log" {
|
||||
declare module "core-js/library/core/log" {
|
||||
var log: typeof core.log;
|
||||
export = log;
|
||||
}
|
||||
declare module "core-js/libary/core/number" {
|
||||
declare module "core-js/library/core/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/core/object" {
|
||||
declare module "core-js/library/core/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/core/string" {
|
||||
declare module "core-js/library/core/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/fn/$for" {
|
||||
declare module "core-js/library/fn/$for" {
|
||||
import $for = core.$for;
|
||||
export = $for;
|
||||
}
|
||||
declare module "core-js/libary/fn/_" {
|
||||
declare module "core-js/library/fn/_" {
|
||||
var _: typeof core._;
|
||||
export = _;
|
||||
}
|
||||
declare module "core-js/libary/fn/clear-immediate" {
|
||||
declare module "core-js/library/fn/clear-immediate" {
|
||||
var clearImmediate: typeof core.clearImmediate;
|
||||
export = clearImmediate;
|
||||
}
|
||||
declare module "core-js/libary/fn/delay" {
|
||||
declare module "core-js/library/fn/delay" {
|
||||
var delay: typeof core.delay;
|
||||
export = delay;
|
||||
}
|
||||
declare module "core-js/libary/fn/dict" {
|
||||
declare module "core-js/library/fn/dict" {
|
||||
var Dict: typeof core.Dict;
|
||||
export = Dict;
|
||||
}
|
||||
declare module "core-js/libary/fn/get-iterator" {
|
||||
declare module "core-js/library/fn/get-iterator" {
|
||||
var getIterator: typeof core.getIterator;
|
||||
export = getIterator;
|
||||
}
|
||||
declare module "core-js/libary/fn/global" {
|
||||
declare module "core-js/library/fn/global" {
|
||||
var global: typeof core.global;
|
||||
export = global;
|
||||
}
|
||||
declare module "core-js/libary/fn/is-iterable" {
|
||||
declare module "core-js/library/fn/is-iterable" {
|
||||
var isIterable: typeof core.isIterable;
|
||||
export = isIterable;
|
||||
}
|
||||
declare module "core-js/libary/fn/log" {
|
||||
declare module "core-js/library/fn/log" {
|
||||
var log: typeof core.log;
|
||||
export = log;
|
||||
}
|
||||
declare module "core-js/libary/fn/map" {
|
||||
declare module "core-js/library/fn/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/fn/promise" {
|
||||
declare module "core-js/library/fn/promise" {
|
||||
var Promise: typeof core.Promise;
|
||||
export = Promise;
|
||||
}
|
||||
declare module "core-js/libary/fn/set" {
|
||||
declare module "core-js/library/fn/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-immediate" {
|
||||
declare module "core-js/library/fn/set-immediate" {
|
||||
var setImmediate: typeof core.setImmediate;
|
||||
export = setImmediate;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-interval" {
|
||||
declare module "core-js/library/fn/set-interval" {
|
||||
var setInterval: typeof core.setInterval;
|
||||
export = setInterval;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-timeout" {
|
||||
declare module "core-js/library/fn/set-timeout" {
|
||||
var setTimeout: typeof core.setTimeout;
|
||||
export = setTimeout;
|
||||
}
|
||||
declare module "core-js/libary/fn/weak-map" {
|
||||
declare module "core-js/library/fn/weak-map" {
|
||||
var WeakMap: typeof core.WeakMap;
|
||||
export = WeakMap;
|
||||
}
|
||||
declare module "core-js/libary/fn/weak-set" {
|
||||
declare module "core-js/library/fn/weak-set" {
|
||||
var WeakSet: typeof core.WeakSet;
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/fn/array" {
|
||||
declare module "core-js/library/fn/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/concat" {
|
||||
declare module "core-js/library/fn/array/concat" {
|
||||
var concat: typeof core.Array.concat;
|
||||
export = concat;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/copy-within" {
|
||||
declare module "core-js/library/fn/array/copy-within" {
|
||||
var copyWithin: typeof core.Array.copyWithin;
|
||||
export = copyWithin;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/entries" {
|
||||
declare module "core-js/library/fn/array/entries" {
|
||||
var entries: typeof core.Array.entries;
|
||||
export = entries;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/every" {
|
||||
declare module "core-js/library/fn/array/every" {
|
||||
var every: typeof core.Array.every;
|
||||
export = every;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/fill" {
|
||||
declare module "core-js/library/fn/array/fill" {
|
||||
var fill: typeof core.Array.fill;
|
||||
export = fill;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/filter" {
|
||||
declare module "core-js/library/fn/array/filter" {
|
||||
var filter: typeof core.Array.filter;
|
||||
export = filter;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/find" {
|
||||
declare module "core-js/library/fn/array/find" {
|
||||
var find: typeof core.Array.find;
|
||||
export = find;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/find-index" {
|
||||
declare module "core-js/library/fn/array/find-index" {
|
||||
var findIndex: typeof core.Array.findIndex;
|
||||
export = findIndex;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/for-each" {
|
||||
declare module "core-js/library/fn/array/for-each" {
|
||||
var forEach: typeof core.Array.forEach;
|
||||
export = forEach;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/from" {
|
||||
declare module "core-js/library/fn/array/from" {
|
||||
var from: typeof core.Array.from;
|
||||
export = from;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/includes" {
|
||||
declare module "core-js/library/fn/array/includes" {
|
||||
var includes: typeof core.Array.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/index-of" {
|
||||
declare module "core-js/library/fn/array/index-of" {
|
||||
var indexOf: typeof core.Array.indexOf;
|
||||
export = indexOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/join" {
|
||||
declare module "core-js/library/fn/array/join" {
|
||||
var join: typeof core.Array.join;
|
||||
export = join;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/keys" {
|
||||
declare module "core-js/library/fn/array/keys" {
|
||||
var keys: typeof core.Array.keys;
|
||||
export = keys;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/last-index-of" {
|
||||
declare module "core-js/library/fn/array/last-index-of" {
|
||||
var lastIndexOf: typeof core.Array.lastIndexOf;
|
||||
export = lastIndexOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/map" {
|
||||
declare module "core-js/library/fn/array/map" {
|
||||
var map: typeof core.Array.map;
|
||||
export = map;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/of" {
|
||||
declare module "core-js/library/fn/array/of" {
|
||||
var of: typeof core.Array.of;
|
||||
export = of;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/pop" {
|
||||
declare module "core-js/library/fn/array/pop" {
|
||||
var pop: typeof core.Array.pop;
|
||||
export = pop;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/push" {
|
||||
declare module "core-js/library/fn/array/push" {
|
||||
var push: typeof core.Array.push;
|
||||
export = push;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reduce" {
|
||||
declare module "core-js/library/fn/array/reduce" {
|
||||
var reduce: typeof core.Array.reduce;
|
||||
export = reduce;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reduce-right" {
|
||||
declare module "core-js/library/fn/array/reduce-right" {
|
||||
var reduceRight: typeof core.Array.reduceRight;
|
||||
export = reduceRight;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reverse" {
|
||||
declare module "core-js/library/fn/array/reverse" {
|
||||
var reverse: typeof core.Array.reverse;
|
||||
export = reverse;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/shift" {
|
||||
declare module "core-js/library/fn/array/shift" {
|
||||
var shift: typeof core.Array.shift;
|
||||
export = shift;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/slice" {
|
||||
declare module "core-js/library/fn/array/slice" {
|
||||
var slice: typeof core.Array.slice;
|
||||
export = slice;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/some" {
|
||||
declare module "core-js/library/fn/array/some" {
|
||||
var some: typeof core.Array.some;
|
||||
export = some;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/sort" {
|
||||
declare module "core-js/library/fn/array/sort" {
|
||||
var sort: typeof core.Array.sort;
|
||||
export = sort;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/splice" {
|
||||
declare module "core-js/library/fn/array/splice" {
|
||||
var splice: typeof core.Array.splice;
|
||||
export = splice;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/turn" {
|
||||
declare module "core-js/library/fn/array/turn" {
|
||||
var turn: typeof core.Array.turn;
|
||||
export = turn;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/unshift" {
|
||||
declare module "core-js/library/fn/array/unshift" {
|
||||
var unshift: typeof core.Array.unshift;
|
||||
export = unshift;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/values" {
|
||||
declare module "core-js/library/fn/array/values" {
|
||||
var values: typeof core.Array.values;
|
||||
export = values;
|
||||
}
|
||||
declare module "core-js/libary/fn/date" {
|
||||
declare module "core-js/library/fn/date" {
|
||||
var Date: typeof core.Date;
|
||||
export = Date;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/add-locale" {
|
||||
declare module "core-js/library/fn/date/add-locale" {
|
||||
var addLocale: typeof core.addLocale;
|
||||
export = addLocale;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/format" {
|
||||
declare module "core-js/library/fn/date/format" {
|
||||
var format: typeof core.Date.format;
|
||||
export = format;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/formatUTC" {
|
||||
declare module "core-js/library/fn/date/formatUTC" {
|
||||
var formatUTC: typeof core.Date.formatUTC;
|
||||
export = formatUTC;
|
||||
}
|
||||
declare module "core-js/libary/fn/function" {
|
||||
declare module "core-js/library/fn/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/fn/function/has-instance" {
|
||||
declare module "core-js/library/fn/function/has-instance" {
|
||||
var hasInstance: (value: any) => boolean;
|
||||
export = hasInstance;
|
||||
}
|
||||
declare module "core-js/libary/fn/function/name" {
|
||||
declare module "core-js/library/fn/function/name" {
|
||||
}
|
||||
declare module "core-js/libary/fn/function/part" {
|
||||
declare module "core-js/library/fn/function/part" {
|
||||
var part: typeof core.Function.part;
|
||||
export = part;
|
||||
}
|
||||
declare module "core-js/libary/fn/math" {
|
||||
declare module "core-js/library/fn/math" {
|
||||
var Math: typeof core.Math;
|
||||
export = Math;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/acosh" {
|
||||
declare module "core-js/library/fn/math/acosh" {
|
||||
var acosh: typeof core.Math.acosh;
|
||||
export = acosh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/asinh" {
|
||||
declare module "core-js/library/fn/math/asinh" {
|
||||
var asinh: typeof core.Math.asinh;
|
||||
export = asinh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/atanh" {
|
||||
declare module "core-js/library/fn/math/atanh" {
|
||||
var atanh: typeof core.Math.atanh;
|
||||
export = atanh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/cbrt" {
|
||||
declare module "core-js/library/fn/math/cbrt" {
|
||||
var cbrt: typeof core.Math.cbrt;
|
||||
export = cbrt;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/clz32" {
|
||||
declare module "core-js/library/fn/math/clz32" {
|
||||
var clz32: typeof core.Math.clz32;
|
||||
export = clz32;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/cosh" {
|
||||
declare module "core-js/library/fn/math/cosh" {
|
||||
var cosh: typeof core.Math.cosh;
|
||||
export = cosh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/expm1" {
|
||||
declare module "core-js/library/fn/math/expm1" {
|
||||
var expm1: typeof core.Math.expm1;
|
||||
export = expm1;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/fround" {
|
||||
declare module "core-js/library/fn/math/fround" {
|
||||
var fround: typeof core.Math.fround;
|
||||
export = fround;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/hypot" {
|
||||
declare module "core-js/library/fn/math/hypot" {
|
||||
var hypot: typeof core.Math.hypot;
|
||||
export = hypot;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/imul" {
|
||||
declare module "core-js/library/fn/math/imul" {
|
||||
var imul: typeof core.Math.imul;
|
||||
export = imul;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log10" {
|
||||
declare module "core-js/library/fn/math/log10" {
|
||||
var log10: typeof core.Math.log10;
|
||||
export = log10;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log1p" {
|
||||
declare module "core-js/library/fn/math/log1p" {
|
||||
var log1p: typeof core.Math.log1p;
|
||||
export = log1p;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log2" {
|
||||
declare module "core-js/library/fn/math/log2" {
|
||||
var log2: typeof core.Math.log2;
|
||||
export = log2;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/sign" {
|
||||
declare module "core-js/library/fn/math/sign" {
|
||||
var sign: typeof core.Math.sign;
|
||||
export = sign;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/sinh" {
|
||||
declare module "core-js/library/fn/math/sinh" {
|
||||
var sinh: typeof core.Math.sinh;
|
||||
export = sinh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/tanh" {
|
||||
declare module "core-js/library/fn/math/tanh" {
|
||||
var tanh: typeof core.Math.tanh;
|
||||
export = tanh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/trunc" {
|
||||
declare module "core-js/library/fn/math/trunc" {
|
||||
var trunc: typeof core.Math.trunc;
|
||||
export = trunc;
|
||||
}
|
||||
declare module "core-js/libary/fn/number" {
|
||||
declare module "core-js/library/fn/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/epsilon" {
|
||||
declare module "core-js/library/fn/number/epsilon" {
|
||||
var EPSILON: typeof core.Number.EPSILON;
|
||||
export = EPSILON;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-finite" {
|
||||
declare module "core-js/library/fn/number/is-finite" {
|
||||
var isFinite: typeof core.Number.isFinite;
|
||||
export = isFinite;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-integer" {
|
||||
declare module "core-js/library/fn/number/is-integer" {
|
||||
var isInteger: typeof core.Number.isInteger;
|
||||
export = isInteger;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-nan" {
|
||||
declare module "core-js/library/fn/number/is-nan" {
|
||||
var isNaN: typeof core.Number.isNaN;
|
||||
export = isNaN;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-safe-integer" {
|
||||
declare module "core-js/library/fn/number/is-safe-integer" {
|
||||
var isSafeInteger: typeof core.Number.isSafeInteger;
|
||||
export = isSafeInteger;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/max-safe-integer" {
|
||||
declare module "core-js/library/fn/number/max-safe-integer" {
|
||||
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
|
||||
export = MAX_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/min-safe-interger" {
|
||||
declare module "core-js/library/fn/number/min-safe-interger" {
|
||||
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
|
||||
export = MIN_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/parse-float" {
|
||||
declare module "core-js/library/fn/number/parse-float" {
|
||||
var parseFloat: typeof core.Number.parseFloat;
|
||||
export = parseFloat;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/parse-int" {
|
||||
declare module "core-js/library/fn/number/parse-int" {
|
||||
var parseInt: typeof core.Number.parseInt;
|
||||
export = parseInt;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/random" {
|
||||
declare module "core-js/library/fn/number/random" {
|
||||
var random: typeof core.Number.random;
|
||||
export = random;
|
||||
}
|
||||
declare module "core-js/libary/fn/object" {
|
||||
declare module "core-js/library/fn/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/assign" {
|
||||
declare module "core-js/library/fn/object/assign" {
|
||||
var assign: typeof core.Object.assign;
|
||||
export = assign;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/classof" {
|
||||
declare module "core-js/library/fn/object/classof" {
|
||||
var classof: typeof core.Object.classof;
|
||||
export = classof;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/create" {
|
||||
declare module "core-js/library/fn/object/create" {
|
||||
var create: typeof core.Object.create;
|
||||
export = create;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define" {
|
||||
declare module "core-js/library/fn/object/define" {
|
||||
var define: typeof core.Object.define;
|
||||
export = define;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define-properties" {
|
||||
declare module "core-js/library/fn/object/define-properties" {
|
||||
var defineProperties: typeof core.Object.defineProperties;
|
||||
export = defineProperties;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define-property" {
|
||||
declare module "core-js/library/fn/object/define-property" {
|
||||
var defineProperty: typeof core.Object.defineProperty;
|
||||
export = defineProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/entries" {
|
||||
declare module "core-js/library/fn/object/entries" {
|
||||
var entries: typeof core.Object.entries;
|
||||
export = entries;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/freeze" {
|
||||
declare module "core-js/library/fn/object/freeze" {
|
||||
var freeze: typeof core.Object.freeze;
|
||||
export = freeze;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-descriptor" {
|
||||
declare module "core-js/library/fn/object/get-own-property-descriptor" {
|
||||
var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor;
|
||||
export = getOwnPropertyDescriptor;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-descriptors" {
|
||||
declare module "core-js/library/fn/object/get-own-property-descriptors" {
|
||||
var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors;
|
||||
export = getOwnPropertyDescriptors;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-names" {
|
||||
declare module "core-js/library/fn/object/get-own-property-names" {
|
||||
var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames;
|
||||
export = getOwnPropertyNames;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-symbols" {
|
||||
declare module "core-js/library/fn/object/get-own-property-symbols" {
|
||||
var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols;
|
||||
export = getOwnPropertySymbols;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-prototype-of" {
|
||||
declare module "core-js/library/fn/object/get-prototype-of" {
|
||||
var getPrototypeOf: typeof core.Object.getPrototypeOf;
|
||||
export = getPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is" {
|
||||
declare module "core-js/library/fn/object/is" {
|
||||
var is: typeof core.Object.is;
|
||||
export = is;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-extensible" {
|
||||
declare module "core-js/library/fn/object/is-extensible" {
|
||||
var isExtensible: typeof core.Object.isExtensible;
|
||||
export = isExtensible;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-frozen" {
|
||||
declare module "core-js/library/fn/object/is-frozen" {
|
||||
var isFrozen: typeof core.Object.isFrozen;
|
||||
export = isFrozen;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-object" {
|
||||
declare module "core-js/library/fn/object/is-object" {
|
||||
var isObject: typeof core.Object.isObject;
|
||||
export = isObject;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-sealed" {
|
||||
declare module "core-js/library/fn/object/is-sealed" {
|
||||
var isSealed: typeof core.Object.isSealed;
|
||||
export = isSealed;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/keys" {
|
||||
declare module "core-js/library/fn/object/keys" {
|
||||
var keys: typeof core.Object.keys;
|
||||
export = keys;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/make" {
|
||||
declare module "core-js/library/fn/object/make" {
|
||||
var make: typeof core.Object.make;
|
||||
export = make;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/prevent-extensions" {
|
||||
declare module "core-js/library/fn/object/prevent-extensions" {
|
||||
var preventExtensions: typeof core.Object.preventExtensions;
|
||||
export = preventExtensions;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/seal" {
|
||||
declare module "core-js/library/fn/object/seal" {
|
||||
var seal: typeof core.Object.seal;
|
||||
export = seal;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/set-prototype-of" {
|
||||
declare module "core-js/library/fn/object/set-prototype-of" {
|
||||
var setPrototypeOf: typeof core.Object.setPrototypeOf;
|
||||
export = setPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/values" {
|
||||
declare module "core-js/library/fn/object/values" {
|
||||
var values: typeof core.Object.values;
|
||||
export = values;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect" {
|
||||
declare module "core-js/library/fn/reflect" {
|
||||
var Reflect: typeof core.Reflect;
|
||||
export = Reflect;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/apply" {
|
||||
declare module "core-js/library/fn/reflect/apply" {
|
||||
var apply: typeof core.Reflect.apply;
|
||||
export = apply;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/construct" {
|
||||
declare module "core-js/library/fn/reflect/construct" {
|
||||
var construct: typeof core.Reflect.construct;
|
||||
export = construct;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/define-property" {
|
||||
declare module "core-js/library/fn/reflect/define-property" {
|
||||
var defineProperty: typeof core.Reflect.defineProperty;
|
||||
export = defineProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/delete-property" {
|
||||
declare module "core-js/library/fn/reflect/delete-property" {
|
||||
var deleteProperty: typeof core.Reflect.deleteProperty;
|
||||
export = deleteProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/enumerate" {
|
||||
declare module "core-js/library/fn/reflect/enumerate" {
|
||||
var enumerate: typeof core.Reflect.enumerate;
|
||||
export = enumerate;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get" {
|
||||
declare module "core-js/library/fn/reflect/get" {
|
||||
var get: typeof core.Reflect.get;
|
||||
export = get;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get-own-property-descriptor" {
|
||||
declare module "core-js/library/fn/reflect/get-own-property-descriptor" {
|
||||
var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor;
|
||||
export = getOwnPropertyDescriptor;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get-prototype-of" {
|
||||
declare module "core-js/library/fn/reflect/get-prototype-of" {
|
||||
var getPrototypeOf: typeof core.Reflect.getPrototypeOf;
|
||||
export = getPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/has" {
|
||||
declare module "core-js/library/fn/reflect/has" {
|
||||
var has: typeof core.Reflect.has;
|
||||
export = has;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/is-extensible" {
|
||||
declare module "core-js/library/fn/reflect/is-extensible" {
|
||||
var isExtensible: typeof core.Reflect.isExtensible;
|
||||
export = isExtensible;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/own-keys" {
|
||||
declare module "core-js/library/fn/reflect/own-keys" {
|
||||
var ownKeys: typeof core.Reflect.ownKeys;
|
||||
export = ownKeys;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/prevent-extensions" {
|
||||
declare module "core-js/library/fn/reflect/prevent-extensions" {
|
||||
var preventExtensions: typeof core.Reflect.preventExtensions;
|
||||
export = preventExtensions;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/set" {
|
||||
declare module "core-js/library/fn/reflect/set" {
|
||||
var set: typeof core.Reflect.set;
|
||||
export = set;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/set-prototype-of" {
|
||||
declare module "core-js/library/fn/reflect/set-prototype-of" {
|
||||
var setPrototypeOf: typeof core.Reflect.setPrototypeOf;
|
||||
export = setPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/regexp" {
|
||||
declare module "core-js/library/fn/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/fn/regexp/escape" {
|
||||
declare module "core-js/library/fn/regexp/escape" {
|
||||
var escape: typeof core.RegExp.escape;
|
||||
export = escape;
|
||||
}
|
||||
declare module "core-js/libary/fn/string" {
|
||||
declare module "core-js/library/fn/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/at" {
|
||||
declare module "core-js/library/fn/string/at" {
|
||||
var at: typeof core.String.at;
|
||||
export = at;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/code-point-at" {
|
||||
declare module "core-js/library/fn/string/code-point-at" {
|
||||
var codePointAt: typeof core.String.codePointAt;
|
||||
export = codePointAt;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/ends-with" {
|
||||
declare module "core-js/library/fn/string/ends-with" {
|
||||
var endsWith: typeof core.String.endsWith;
|
||||
export = endsWith;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/escape-html" {
|
||||
declare module "core-js/library/fn/string/escape-html" {
|
||||
var escapeHTML: typeof core.String.escapeHTML;
|
||||
export = escapeHTML;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/from-code-point" {
|
||||
declare module "core-js/library/fn/string/from-code-point" {
|
||||
var fromCodePoint: typeof core.String.fromCodePoint;
|
||||
export = fromCodePoint;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/includes" {
|
||||
declare module "core-js/library/fn/string/includes" {
|
||||
var includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/lpad" {
|
||||
declare module "core-js/library/fn/string/lpad" {
|
||||
var lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/raw" {
|
||||
declare module "core-js/library/fn/string/raw" {
|
||||
var raw: typeof core.String.raw;
|
||||
export = raw;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/repeat" {
|
||||
declare module "core-js/library/fn/string/repeat" {
|
||||
var repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/rpad" {
|
||||
declare module "core-js/library/fn/string/rpad" {
|
||||
var rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/starts-with" {
|
||||
declare module "core-js/library/fn/string/starts-with" {
|
||||
var startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/unescape-html" {
|
||||
declare module "core-js/library/fn/string/unescape-html" {
|
||||
var unescapeHTML: typeof core.String.unescapeHTML;
|
||||
export = unescapeHTML;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol" {
|
||||
declare module "core-js/library/fn/symbol" {
|
||||
var Symbol: typeof core.Symbol;
|
||||
export = Symbol;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/for" {
|
||||
declare module "core-js/library/fn/symbol/for" {
|
||||
var _for: typeof core.Symbol.for;
|
||||
export = _for;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/has-instance" {
|
||||
declare module "core-js/library/fn/symbol/has-instance" {
|
||||
var hasInstance: typeof core.Symbol.hasInstance;
|
||||
export = hasInstance;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/is-concat-spreadable" {
|
||||
declare module "core-js/library/fn/symbol/is-concat-spreadable" {
|
||||
var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable;
|
||||
export = isConcatSpreadable;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/iterator" {
|
||||
declare module "core-js/library/fn/symbol/iterator" {
|
||||
var iterator: typeof core.Symbol.iterator;
|
||||
export = iterator;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/key-for" {
|
||||
declare module "core-js/library/fn/symbol/key-for" {
|
||||
var keyFor: typeof core.Symbol.keyFor;
|
||||
export = keyFor;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/match" {
|
||||
declare module "core-js/library/fn/symbol/match" {
|
||||
var match: typeof core.Symbol.match;
|
||||
export = match;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/replace" {
|
||||
declare module "core-js/library/fn/symbol/replace" {
|
||||
var replace: typeof core.Symbol.replace;
|
||||
export = replace;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/search" {
|
||||
declare module "core-js/library/fn/symbol/search" {
|
||||
var search: typeof core.Symbol.search;
|
||||
export = search;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/species" {
|
||||
declare module "core-js/library/fn/symbol/species" {
|
||||
var species: typeof core.Symbol.species;
|
||||
export = species;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/split" {
|
||||
declare module "core-js/library/fn/symbol/split" {
|
||||
var split: typeof core.Symbol.split;
|
||||
export = split;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/to-primitive" {
|
||||
declare module "core-js/library/fn/symbol/to-primitive" {
|
||||
var toPrimitive: typeof core.Symbol.toPrimitive;
|
||||
export = toPrimitive;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/to-string-tag" {
|
||||
declare module "core-js/library/fn/symbol/to-string-tag" {
|
||||
var toStringTag: typeof core.Symbol.toStringTag;
|
||||
export = toStringTag;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/unscopables" {
|
||||
declare module "core-js/library/fn/symbol/unscopables" {
|
||||
var unscopables: typeof core.Symbol.unscopables;
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/libary/es5" {
|
||||
declare module "core-js/library/es5" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6" {
|
||||
declare module "core-js/library/es6" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6/array" {
|
||||
declare module "core-js/library/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/es6/function" {
|
||||
declare module "core-js/library/es6/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/es6/map" {
|
||||
declare module "core-js/library/es6/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/es6/math" {
|
||||
declare module "core-js/library/es6/math" {
|
||||
var Math: typeof core.Math;
|
||||
export = Math;
|
||||
}
|
||||
declare module "core-js/libary/es6/number" {
|
||||
declare module "core-js/library/es6/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/es6/object" {
|
||||
declare module "core-js/library/es6/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/es6/promise" {
|
||||
declare module "core-js/library/es6/promise" {
|
||||
var Promise: typeof core.Promise;
|
||||
export = Promise;
|
||||
}
|
||||
declare module "core-js/libary/es6/reflect" {
|
||||
declare module "core-js/library/es6/reflect" {
|
||||
var Reflect: typeof core.Reflect;
|
||||
export = Reflect;
|
||||
}
|
||||
declare module "core-js/libary/es6/regexp" {
|
||||
declare module "core-js/library/es6/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/es6/set" {
|
||||
declare module "core-js/library/es6/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/es6/string" {
|
||||
declare module "core-js/library/es6/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/es6/symbol" {
|
||||
declare module "core-js/library/es6/symbol" {
|
||||
var Symbol: typeof core.Symbol;
|
||||
export = Symbol;
|
||||
}
|
||||
declare module "core-js/libary/es6/weak-map" {
|
||||
declare module "core-js/library/es6/weak-map" {
|
||||
var WeakMap: typeof core.WeakMap;
|
||||
export = WeakMap;
|
||||
}
|
||||
declare module "core-js/libary/es6/weak-set" {
|
||||
declare module "core-js/library/es6/weak-set" {
|
||||
var WeakSet: typeof core.WeakSet;
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/es7" {
|
||||
declare module "core-js/library/es7" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es7/array" {
|
||||
declare module "core-js/library/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/es7/map" {
|
||||
declare module "core-js/library/es7/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/es7/object" {
|
||||
declare module "core-js/library/es7/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/es7/regexp" {
|
||||
declare module "core-js/library/es7/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/es7/set" {
|
||||
declare module "core-js/library/es7/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/es7/string" {
|
||||
declare module "core-js/library/es7/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/js" {
|
||||
declare module "core-js/library/js" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/js/array" {
|
||||
declare module "core-js/library/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/web" {
|
||||
declare module "core-js/library/web" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/dom" {
|
||||
declare module "core-js/library/web/dom" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/immediate" {
|
||||
declare module "core-js/library/web/immediate" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/timers" {
|
||||
declare module "core-js/library/web/timers" {
|
||||
export = core;
|
||||
}
|
||||
|
||||
Vendored
+6572
File diff suppressed because it is too large
Load Diff
Vendored
+47
-39
@@ -1,4 +1,4 @@
|
||||
// Type definitions for DevExtreme 15.1.7
|
||||
// Type definitions for DevExtreme 15.1.8
|
||||
// Project: http://js.devexpress.com/
|
||||
// Definitions by: DevExpress Inc. <http://devexpress.com/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -35,7 +35,7 @@ declare module DevExpress {
|
||||
brokenRules: any[];
|
||||
validators: IValidator[];
|
||||
}
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
group: any;
|
||||
validators: IValidator[];
|
||||
validate(): ValidationGroupValidationResult;
|
||||
@@ -56,7 +56,7 @@ declare module DevExpress {
|
||||
/** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */
|
||||
export function validateModel(model: Object): ValidationGroupValidationResult;
|
||||
/** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */
|
||||
export function registerModelForValidation(model: Object): void;
|
||||
export function registerModelForValidation(model: Object) : void;
|
||||
}
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
/** Processes the hardware back button click. */
|
||||
@@ -223,10 +223,14 @@ declare module DevExpress {
|
||||
endUpdate(): void;
|
||||
/** Returns an instance of this component class. */
|
||||
instance(): Component;
|
||||
/** Sets one or more options of this component. */
|
||||
option(options: Object): void;
|
||||
/** Returns the configuration options of this component. */
|
||||
option(): Object;
|
||||
option(): {
|
||||
[optionKey: string]: any;
|
||||
};
|
||||
/** Sets one or more options of this component. */
|
||||
option(options: {
|
||||
[optionKey: string]: any;
|
||||
}): void;
|
||||
/** Gets the value of the specified configuration option of this component. */
|
||||
option(optionName: string): any;
|
||||
/** Sets a value to the specified configuration option of this component. */
|
||||
@@ -1384,11 +1388,11 @@ declare module DevExpress.ui {
|
||||
};
|
||||
/** A handler for the click event. */
|
||||
onClick?: any;
|
||||
clickAction?: any;
|
||||
clickAction?: any;
|
||||
/** Specifies whether or not map widget controls are available. */
|
||||
controls?: boolean;
|
||||
/** Specifies the height of the widget. */
|
||||
height?: number;
|
||||
height?: any;
|
||||
/** A key used to authenticate the application within the required map provider. */
|
||||
key?: {
|
||||
/** A key used to authenticate the application within the "Bing" map provider. */
|
||||
@@ -1400,31 +1404,31 @@ declare module DevExpress.ui {
|
||||
}
|
||||
/** A handler for the markerAdded event. */
|
||||
onMarkerAdded?: Function;
|
||||
markerAddedAction?: Function;
|
||||
markerAddedAction?: Function;
|
||||
/** A URL pointing to the custom icon to be used for map markers. */
|
||||
markerIconSrc?: string;
|
||||
/** A handler for the markerRemoved event. */
|
||||
onMarkerRemoved?: Function;
|
||||
markerRemovedAction?: Function;
|
||||
markerRemovedAction?: Function;
|
||||
/** An array of markers displayed on a map. */
|
||||
markers?: Array<any>;
|
||||
/** The name of the current map data provider. */
|
||||
provider?: string;
|
||||
/** A handler for the ready event. */
|
||||
onReady?: Function;
|
||||
readyAction?: Function;
|
||||
readyAction?: Function;
|
||||
/** A handler for the routeAdded event. */
|
||||
onRouteAdded?: Function;
|
||||
routeAddedAction?: Function;
|
||||
routeAddedAction?: Function;
|
||||
/** A handler for the routeRemoved event. */
|
||||
onRouteRemoved?: Function;
|
||||
routeRemovedAction?: Function;
|
||||
routeRemovedAction?: Function;
|
||||
/** An array of routes shown on the map. */
|
||||
routes?: Array<any>;
|
||||
/** The type of a map to display. */
|
||||
type?: string;
|
||||
/** Specifies the width of the widget. */
|
||||
width?: number;
|
||||
width?: any;
|
||||
/** The zoom level of the map. */
|
||||
zoom?: number;
|
||||
}
|
||||
@@ -1435,7 +1439,7 @@ declare module DevExpress.ui {
|
||||
/** Adds a marker to the map. */
|
||||
addMarker(markerOptions: Object): JQueryPromise<Object>;
|
||||
/** Adds a route to the map. */
|
||||
addRoute(options: Object): JQueryPromise<Object>;
|
||||
addRoute(routeOptions: Object): JQueryPromise<Object>;
|
||||
/** Removes a marker from the map. */
|
||||
removeMarker(marker: Object): JQueryPromise<void>;
|
||||
/** Removes a route from the map. */
|
||||
@@ -1787,7 +1791,7 @@ declare module DevExpress.ui {
|
||||
interval?: number;
|
||||
/** Specifies the maximum zoom level of a calendar, which is used to pick the date. */
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
minZoomLevel?: string;
|
||||
/** Specifies the type of date/time picker. */
|
||||
pickerType?: string;
|
||||
@@ -1825,8 +1829,8 @@ declare module DevExpress.ui {
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimum zoom level of the calendar. */
|
||||
minZoomLevel?: string;
|
||||
/** The template to be used for rendering calendar cells. */
|
||||
cellTemplate?: any;
|
||||
/** The template to be used for rendering calendar cells. */
|
||||
cellTemplate?: any;
|
||||
}
|
||||
/** A calendar widget. */
|
||||
export class dxCalendar extends Editor {
|
||||
@@ -1976,6 +1980,8 @@ declare module DevExpress.ui {
|
||||
onProgress?: Function;
|
||||
/** A handler for the uploadError event. */
|
||||
onUploadError?: Function;
|
||||
/** A handler for the valueChanged event. */
|
||||
onValueChanged?: Function;
|
||||
}
|
||||
/** A widget used to select and upload a file or multiple files. */
|
||||
export class dxFileUploader extends Editor {
|
||||
@@ -2145,6 +2151,11 @@ interface JQuery {
|
||||
dxSelectBox(options: string): any;
|
||||
dxSelectBox(options: string, ...params: any[]): any;
|
||||
dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxTagBox(): JQuery;
|
||||
dxTagBox(options: "instance"): DevExpress.ui.dxTagBox;
|
||||
dxTagBox(options: string): any;
|
||||
dxTagBox(options: string, ...params: any[]): any;
|
||||
dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery;
|
||||
dxScrollView(): JQuery;
|
||||
dxScrollView(options: "instance"): DevExpress.ui.dxScrollView;
|
||||
dxScrollView(options: string): any;
|
||||
@@ -3036,9 +3047,6 @@ declare module DevExpress.ui {
|
||||
showInColumnChooser?: boolean;
|
||||
/** Specifies the identifier of the column. */
|
||||
name?: string;
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
text?: string;
|
||||
value?: any;
|
||||
}
|
||||
export interface dxDataGridOptions extends WidgetOptions {
|
||||
/** Specifies whether the outer borders of the grid are visible or not. */
|
||||
@@ -4291,16 +4299,16 @@ declare module DevExpress.viz.core {
|
||||
}) => void;
|
||||
/** A handler for the incidentOccurred event. */
|
||||
onIncidentOccurred?: (
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
) => void;
|
||||
/** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */
|
||||
pathModified?: boolean;
|
||||
@@ -5194,9 +5202,9 @@ declare module DevExpress.viz.charts {
|
||||
export interface BaseChartOptions<TPoint> extends viz.core.BaseWidgetOptions {
|
||||
/** Specifies adaptive layout options. */
|
||||
adaptiveLayout?: {
|
||||
/** Specifies the width of the widget container that is small enough for the layout to begin adapting. */
|
||||
/** Specifies the width of the widget that is small enough for the layout to begin adapting. */
|
||||
width?: number;
|
||||
/** Specifies the height of the widget container that is small enough for the layout to begin adapting. */
|
||||
/** Specifies the height of the widget that is small enough for the layout to begin adapting. */
|
||||
height?: number;
|
||||
/** Specifies whether or not point labels can be hidden when the layout is adapting. */
|
||||
keepLabels?: boolean;
|
||||
@@ -6049,8 +6057,8 @@ declare module DevExpress.viz.rangeSelector {
|
||||
useTicksAutoArrangement?: boolean;
|
||||
/** Specifies the type of values on the scale. */
|
||||
valueType?: string;
|
||||
/** Specifies the order of arguments on a discrete scale. */
|
||||
categories?: Array<any>;
|
||||
/** Specifies the order of arguments on a discrete scale. */
|
||||
categories?: Array<any>;
|
||||
};
|
||||
/** Specifies the range to be selected when displaying the dxRangeSelector. */
|
||||
selectedRange?: {
|
||||
@@ -6351,9 +6359,9 @@ declare module DevExpress.viz.map {
|
||||
centerChanged?: (center: Array<number>) => void;
|
||||
/** A handler for the centerChanged event. */
|
||||
onCenterChanged?: (e: {
|
||||
center: Array<number>;
|
||||
component: dxVectorMap;
|
||||
element: Element;
|
||||
center: Array<number>;
|
||||
component: dxVectorMap;
|
||||
element: Element;
|
||||
}) => void;
|
||||
/** A handler for the tooltipShown event. */
|
||||
onTooltipShown?: (e: {
|
||||
@@ -6569,4 +6577,4 @@ interface JQuery {
|
||||
dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery;
|
||||
dxSparkline(methodName: string, ...params: any[]): any;
|
||||
dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline;
|
||||
}
|
||||
}
|
||||
Vendored
+995
-995
File diff suppressed because it is too large
Load Diff
Vendored
+642
-642
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,8 @@ function ModuleTest(): void {
|
||||
|
||||
var myTypedArray = new Uint8Array(10);
|
||||
var buf = Module._malloc(myTypedArray.length*myTypedArray.BYTES_PER_ELEMENT);
|
||||
Module.setValue(buf, 10, 'i32');
|
||||
var x = Module.getValue(buf, 'i32') + 123;
|
||||
Module.HEAPU8.set(myTypedArray, buf);
|
||||
Module.ccall('my_function', 'number', ['number'], [buf]);
|
||||
Module._free(buf);
|
||||
|
||||
Vendored
+2
-2
@@ -22,8 +22,8 @@ declare module Module {
|
||||
function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any;
|
||||
function cwrap(ident: string, returnType: string, argTypes: string[]): any;
|
||||
|
||||
function setValue(ptr: number, value: any, type: string, noSafe: boolean): void;
|
||||
function getValue(ptr: number, type: string, noSafe: boolean): any;
|
||||
function setValue(ptr: number, value: any, type: string, noSafe?: boolean): void;
|
||||
function getValue(ptr: number, type: string, noSafe?: boolean): number;
|
||||
|
||||
var ALLOC_NORMAL: number;
|
||||
var ALLOC_STACK: number;
|
||||
|
||||
Vendored
+5
-1
@@ -149,13 +149,17 @@ interface FBSDKCanvas{
|
||||
stopTimer(handler?: (fbResponseObject : Object) => any) : void;
|
||||
}
|
||||
|
||||
interface FBResponseObject {
|
||||
error: any;
|
||||
}
|
||||
|
||||
interface FBSDK{
|
||||
/* This method is used to initialize and setup the SDK. */
|
||||
init(fbInitObject : FBInitParams) : void;
|
||||
|
||||
/* This method lets you make calls to the Graph API. */
|
||||
api(path : string, method : string, callback : (fbResponseObject : Object) => any) : Object;
|
||||
api(path : string, params : Object, callback : (fbResponseObject : Object) => any) : Object;
|
||||
api(path : string, params : Object, callback : (fbResponseObject : FBResponseObject) => any) : Object;
|
||||
api(path : string, method : string, params : Object, callback : (fbResponseObject : Object) => any) : Object;
|
||||
|
||||
/* This method is used to trigger different forms of Facebook created UI dialogs. */
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copied from https://github.com/sindresorhus/file-url/blob/14c7a69ae3798f50b3a4a21823c86e10b38160fe/readme.md
|
||||
|
||||
/// <reference path="file-url.d.ts" />
|
||||
|
||||
fileUrl('unicorn.jpg');
|
||||
//=> 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
|
||||
|
||||
fileUrl('/Users/pony/pics/unicorn.jpg');
|
||||
//=> 'file:///Users/pony/pics/unicorn.jpg'
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for file-url v1.0.1
|
||||
// Project: https://github.com/sindresorhus/file-url
|
||||
// Definitions by: MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Convert a path to a file URL.
|
||||
*/
|
||||
declare function fileUrl(path:string):string;
|
||||
|
||||
/**
|
||||
* Convert a path to a file URL.
|
||||
*/
|
||||
declare module "file-url" {
|
||||
export = fileUrl;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
License Notices:
|
||||
|
||||
The API definitions and documents are from Google Apps Script reference site [1].
|
||||
|
||||
The document comments are reproduced from work created and shared by Google [2]
|
||||
and used according to terms described in the Creative Commons 3.0 Attribution License [3].
|
||||
|
||||
The code samples in the documents and the test code are licensed under the Apache 2.0 License [4].
|
||||
|
||||
[1] https://developers.google.com/apps-script/
|
||||
[2] https://developers.google.com/readme/policies/
|
||||
[3] http://creativecommons.org/licenses/by/3.0/
|
||||
[4] http://www.apache.org/licenses/LICENSE-2.0
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="google-apps-script.document.d.ts" />
|
||||
/// <reference path="google-apps-script.gmail.d.ts" />
|
||||
|
||||
// from https://developers.google.com/apps-script/overview
|
||||
|
||||
function createAndSendDocument() {
|
||||
// Create a new Google Doc named 'Hello, world!'
|
||||
var doc = DocumentApp.create('Hello, world!');
|
||||
|
||||
// Access the body of the document, then add a paragraph.
|
||||
doc.getBody().appendParagraph('This document was created by Google Apps Script.');
|
||||
|
||||
// Get the URL of the document.
|
||||
var url = doc.getUrl();
|
||||
|
||||
// Get the email address of the active user - that's you.
|
||||
var email = Session.getActiveUser().getEmail();
|
||||
|
||||
// Get the name of the document to use as an email subject line.
|
||||
var subject = doc.getName();
|
||||
|
||||
// Append a new string to the "url" variable to use as an email body.
|
||||
var body = 'Link to your doc: ' + url;
|
||||
|
||||
// Send yourself an email with a link to the document.
|
||||
GmailApp.sendEmail(email, subject, body);
|
||||
}
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Base {
|
||||
/**
|
||||
* A data interchange object for Apps Script services.
|
||||
*/
|
||||
export interface Blob {
|
||||
copyBlob(): Blob;
|
||||
getAs(contentType: string): Blob;
|
||||
getBytes(): Byte[];
|
||||
getContentType(): string;
|
||||
getDataAsString(): string;
|
||||
getDataAsString(charset: string): string;
|
||||
getName(): string;
|
||||
isGoogleType(): boolean;
|
||||
setBytes(data: Byte[]): Blob;
|
||||
setContentType(contentType: string): Blob;
|
||||
setContentTypeFromExtension(): Blob;
|
||||
setDataFromString(string: string): Blob;
|
||||
setDataFromString(string: string, charset: string): Blob;
|
||||
setName(name: string): Blob;
|
||||
getAllBlobs(): Blob[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for objects that can export their data as a Blob.
|
||||
* Implementing classes
|
||||
*
|
||||
* NameBrief description
|
||||
*
|
||||
* AttachmentA Sites Attachment such as a file attached to a page.
|
||||
*
|
||||
* BlobA data interchange object for Apps Script services.
|
||||
*
|
||||
* ChartA Chart object, which can be embedded into documents, UI elements, or used as a static image.
|
||||
*
|
||||
* DocumentA document, containing rich text and elements such as tables and lists.
|
||||
*
|
||||
* EmbeddedChartRepresents a chart that has been embedded into a Spreadsheet.
|
||||
*
|
||||
* FileA file in Google Drive.
|
||||
*
|
||||
* GmailAttachmentAn attachment from Gmail.
|
||||
*
|
||||
* HTTPResponseThis class allows users to access specific information on HTTP responses.
|
||||
*
|
||||
* HtmlOutputAn HtmlOutput object that can be served from a script.
|
||||
*
|
||||
* InlineImageAn element representing an embedded image.
|
||||
*
|
||||
* JdbcBlobA JDBC Blob.
|
||||
*
|
||||
* JdbcClobA JDBC Clob.
|
||||
*
|
||||
* SpreadsheetThis class allows users to access and modify Google Sheets files.
|
||||
*
|
||||
* StaticMapAllows for the creation and decoration of static map images.
|
||||
*/
|
||||
export interface BlobSource {
|
||||
getAs(contentType: string): Blob;
|
||||
getBlob(): Blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides access to Google Apps specific dialog boxes.
|
||||
*
|
||||
* The methods in this class are only available for use in the context of a Google Spreadsheet.
|
||||
* See also
|
||||
*
|
||||
* ButtonSet
|
||||
*/
|
||||
export interface Browser {
|
||||
Buttons: ButtonSet
|
||||
inputBox(prompt: string): string;
|
||||
inputBox(prompt: string, buttons: ButtonSet): string;
|
||||
inputBox(title: string, prompt: string, buttons: ButtonSet): string;
|
||||
msgBox(prompt: string): string;
|
||||
msgBox(prompt: string, buttons: ButtonSet): string;
|
||||
msgBox(title: string, prompt: string, buttons: ButtonSet): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing predetermined, localized dialog buttons returned by an
|
||||
* alert or PromptResponse.getSelectedButton() to
|
||||
* indicate which button in a dialog the user clicked. These values cannot be set; to add buttons to
|
||||
* an alert or
|
||||
* prompt, use ButtonSet instead.
|
||||
*
|
||||
* // Display a dialog box with a message and "Yes" and "No" buttons.
|
||||
* var ui = DocumentApp.getUi();
|
||||
* var response = ui.alert('Are you sure you want to continue?', ui.ButtonSet.YES_NO);
|
||||
*
|
||||
* // Process the user's response.
|
||||
* if (response == ui.Button.YES) {
|
||||
* Logger.log('The user clicked "Yes."');
|
||||
* } else {
|
||||
* Logger.log('The user clicked "No" or the dialog\'s close button.');
|
||||
* }
|
||||
*/
|
||||
export enum Button { CLOSE, OK, CANCEL, YES, NO }
|
||||
|
||||
/**
|
||||
* An enum representing predetermined, localized sets of one or more dialog buttons that can be
|
||||
* added to an alert or a
|
||||
* prompt. To determine which button the user
|
||||
* clicked, use Button.
|
||||
*
|
||||
* // Display a dialog box with a message and "Yes" and "No" buttons.
|
||||
* var ui = DocumentApp.getUi();
|
||||
* var response = ui.alert('Are you sure you want to continue?', ui.ButtonSet.YES_NO);
|
||||
*
|
||||
* // Process the user's response.
|
||||
* if (response == ui.Button.YES) {
|
||||
* Logger.log('The user clicked "Yes."');
|
||||
* } else {
|
||||
* Logger.log('The user clicked "No" or the dialog\'s close button.');
|
||||
* }
|
||||
*/
|
||||
export enum ButtonSet { OK, OK_CANCEL, YES_NO, YES_NO_CANCEL }
|
||||
|
||||
/**
|
||||
* This class allows the developer to write out text to the debugging logs.
|
||||
*/
|
||||
export interface Logger {
|
||||
clear(): void;
|
||||
getLog(): string;
|
||||
log(data: Object): Logger;
|
||||
log(format: string, ...values: Object[]): Logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom menu in an instance of the user interface for a Google App. A script can only interact
|
||||
* with the UI for the current instance of an open document or form, and only if the script is
|
||||
* container-bound to the document or form. For more
|
||||
* information, see the guide to menus.
|
||||
*
|
||||
* // Add a custom menu to the active spreadsheet, including a separator and a sub-menu.
|
||||
* function onOpen(e) {
|
||||
* SpreadsheetApp.getUi()
|
||||
* .createMenu('My Menu')
|
||||
* .addItem('My Menu Item', 'myFunction')
|
||||
* .addSeparator()
|
||||
* .addSubMenu(SpreadsheetApp.getUi().createMenu('My Submenu')
|
||||
* .addItem('One Submenu Item', 'mySecondFunction')
|
||||
* .addItem('Another Submenu Item', 'myThirdFunction'))
|
||||
* .addToUi();
|
||||
* }
|
||||
*/
|
||||
export interface Menu {
|
||||
addItem(caption: string, functionName: string): Menu;
|
||||
addSeparator(): Menu;
|
||||
addSubMenu(menu: Menu): Menu;
|
||||
addToUi(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration that provides access to MIME-type declarations without typing the strings
|
||||
* explicitly. Any method that expects a MIME type rendered as a string (for example,
|
||||
* 'image/png') will also accept one of the values below, so long as the method
|
||||
* supports the underlying MIME type.
|
||||
*
|
||||
* // Use MimeType enum to log the name of every Google Doc in the user's Drive.
|
||||
* var docs = DriveApp.getFilesByType(MimeType.GOOGLE_DOCS);
|
||||
* while (docs.hasNext()) {
|
||||
* var doc = docs.next();
|
||||
* Logger.log(doc.getName())
|
||||
* }
|
||||
*
|
||||
* // Use plain string to log the size of every PNG in the user's Drive.
|
||||
* var pngs = DriveApp.getFilesByType('image/png');
|
||||
* while (pngs.hasNext()) {
|
||||
* var png = pngs.next();
|
||||
* Logger.log(png.getSize());
|
||||
* }
|
||||
*/
|
||||
export enum MimeType { GOOGLE_APPS_SCRIPT, GOOGLE_DRAWINGS, GOOGLE_DOCS, GOOGLE_FORMS, GOOGLE_SHEETS, GOOGLE_SLIDES, FOLDER, BMP, GIF, JPEG, PNG, SVG, PDF, CSS, CSV, HTML, JAVASCRIPT, PLAIN_TEXT, RTF, OPENDOCUMENT_GRAPHICS, OPENDOCUMENT_PRESENTATION, OPENDOCUMENT_SPREADSHEET, OPENDOCUMENT_TEXT, MICROSOFT_EXCEL, MICROSOFT_EXCEL_LEGACY, MICROSOFT_POWERPOINT, MICROSOFT_POWERPOINT_LEGACY, MICROSOFT_WORD, MICROSOFT_WORD_LEGACY, ZIP }
|
||||
|
||||
/**
|
||||
* An enum representing the months of the year.
|
||||
*/
|
||||
export enum Month { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER }
|
||||
|
||||
/**
|
||||
* A response to a prompt dialog displayed in the
|
||||
* user-interface environment for a Google App. The response contains any text the user entered in
|
||||
* the dialog's input field and indicates which button the user clicked to dismiss the dialog.
|
||||
*
|
||||
* // Display a dialog box with a title, message, input field, and "Yes" and "No" buttons. The
|
||||
* // user can also close the dialog by clicking the close button in its title bar.
|
||||
* var ui = DocumentApp.getUi();
|
||||
* var response = ui.prompt('Getting to know you', 'May I know your name?', ui.ButtonSet.YES_NO);
|
||||
*
|
||||
* // Process the user's response.
|
||||
* if (response.getSelectedButton() == ui.Button.YES) {
|
||||
* Logger.log('The user\'s name is %s.', response.getResponseText());
|
||||
* } else if (response.getSelectedButton() == ui.Button.NO) {
|
||||
* Logger.log('The user didn\'t want to provide a name.');
|
||||
* } else {
|
||||
* Logger.log('The user clicked the close button in the dialog\'s title bar.');
|
||||
* }
|
||||
*/
|
||||
export interface PromptResponse {
|
||||
getResponseText(): string;
|
||||
getSelectedButton(): Button;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Session class provides access to session information, such as the user's email address (in
|
||||
* some circumstances) and language setting.
|
||||
*/
|
||||
export interface Session {
|
||||
getActiveUser(): User;
|
||||
getActiveUserLocale(): string;
|
||||
getEffectiveUser(): User;
|
||||
getScriptTimeZone(): string;
|
||||
getTimeZone(): string;
|
||||
getUser(): User;
|
||||
}
|
||||
|
||||
/**
|
||||
* An instance of the user-interface environment for a Google App that allows the script to add
|
||||
* features like menus, dialogs, and sidebars. A script can only interact with the UI for the
|
||||
* current instance of an open editor, and only if the script is
|
||||
* container-bound to the editor.
|
||||
*
|
||||
* // Display a dialog box with a title, message, input field, and "Yes" and "No" buttons. The
|
||||
* // user can also close the dialog by clicking the close button in its title bar.
|
||||
* var ui = SpreadsheetApp.getUi();
|
||||
* var response = ui.prompt('Getting to know you', 'May I know your name?', ui.ButtonSet.YES_NO);
|
||||
*
|
||||
* // Process the user's response.
|
||||
* if (response.getSelectedButton() == ui.Button.YES) {
|
||||
* Logger.log('The user\'s name is %s.', response.getResponseText());
|
||||
* } else if (response.getSelectedButton() == ui.Button.NO) {
|
||||
* Logger.log('The user didn\'t want to provide a name.');
|
||||
* } else {
|
||||
* Logger.log('The user clicked the close button in the dialog\'s title bar.');
|
||||
* }
|
||||
*/
|
||||
export interface Ui {
|
||||
Button: Button
|
||||
ButtonSet: ButtonSet
|
||||
alert(prompt: string): Button;
|
||||
alert(prompt: string, buttons: ButtonSet): Button;
|
||||
alert(title: string, prompt: string, buttons: ButtonSet): Button;
|
||||
createAddonMenu(): Menu;
|
||||
createMenu(caption: string): Menu;
|
||||
prompt(prompt: string): PromptResponse;
|
||||
prompt(prompt: string, buttons: ButtonSet): PromptResponse;
|
||||
prompt(title: string, prompt: string, buttons: ButtonSet): PromptResponse;
|
||||
showModalDialog(userInterface: Object, title: string): void;
|
||||
showModelessDialog(userInterface: Object, title: string): void;
|
||||
showSidebar(userInterface: Object): void;
|
||||
showDialog(userInterface: Object): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Representation of a user, suitable for scripting.
|
||||
*/
|
||||
export interface User {
|
||||
getEmail(): string;
|
||||
getUserLoginId(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the days of the week.
|
||||
*/
|
||||
export enum Weekday { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var Browser: GoogleAppsScript.Base.Browser;
|
||||
declare var Logger: GoogleAppsScript.Base.Logger;
|
||||
// conflicts with MimeType in lib.d.ts
|
||||
// declare var MimeType: GoogleAppsScript.Base.MimeType;
|
||||
declare var Session: GoogleAppsScript.Base.Session;
|
||||
@@ -0,0 +1,57 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Cache {
|
||||
/**
|
||||
* A reference to a particular cache.
|
||||
*
|
||||
* This class allows you to insert, retrieve, and remove items from a cache. This can be
|
||||
* particularly useful when you want frequent access to an expensive or slow resource. For
|
||||
* example, say you have an RSS feed at example.com that takes 20 seconds to fetch, but you want
|
||||
* to speed up access on an average request.
|
||||
*
|
||||
* function getRssFeed() {
|
||||
* var cache = CacheService.getPublicCache();
|
||||
* var cached = cache.get("rss-feed-contents");
|
||||
* if (cached != null) {
|
||||
* return cached;
|
||||
* }
|
||||
* var result = UrlFetchApp.fetch("http://example.com/my-slow-rss-feed.xml"); // takes 20 seconds
|
||||
* var contents = result.getContentText();
|
||||
* cache.put("rss-feed-contents", contents, 1500); // cache for 25 minutes
|
||||
* return contents;
|
||||
* }
|
||||
*/
|
||||
export interface Cache {
|
||||
get(key: string): string;
|
||||
getAll(keys: String[]): Object;
|
||||
put(key: string, value: string): void;
|
||||
put(key: string, value: string, expirationInSeconds: Integer): void;
|
||||
putAll(values: Object): void;
|
||||
putAll(values: Object, expirationInSeconds: Integer): void;
|
||||
remove(key: string): void;
|
||||
removeAll(keys: String[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* CacheService allows you to access a cache for short term storage of data.
|
||||
*
|
||||
* This class lets you get a specific cache instance. Public caches are for things that are not
|
||||
* dependent on which user is accessing your script. Private caches are for things which are
|
||||
* user-specific, like settings or recent activity.
|
||||
*/
|
||||
export interface CacheService {
|
||||
getDocumentCache(): Cache;
|
||||
getScriptCache(): Cache;
|
||||
getUserCache(): Cache;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var CacheService: GoogleAppsScript.Cache.CacheService;
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Calendar {
|
||||
/**
|
||||
* Represents a calendar that the user owns or is subscribed to.
|
||||
*/
|
||||
export interface Calendar {
|
||||
createAllDayEvent(title: string, date: Date): CalendarEvent;
|
||||
createAllDayEvent(title: string, date: Date, options: Object): CalendarEvent;
|
||||
createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence): CalendarEventSeries;
|
||||
createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence, options: Object): CalendarEventSeries;
|
||||
createEvent(title: string, startTime: Date, endTime: Date): CalendarEvent;
|
||||
createEvent(title: string, startTime: Date, endTime: Date, options: Object): CalendarEvent;
|
||||
createEventFromDescription(description: string): CalendarEvent;
|
||||
createEventSeries(title: string, startTime: Date, endTime: Date, recurrence: EventRecurrence): CalendarEventSeries;
|
||||
createEventSeries(title: string, startTime: Date, endTime: Date, recurrence: EventRecurrence, options: Object): CalendarEventSeries;
|
||||
deleteCalendar(): void;
|
||||
getColor(): string;
|
||||
getDescription(): string;
|
||||
getEventSeriesById(iCalId: string): CalendarEventSeries;
|
||||
getEvents(startTime: Date, endTime: Date): CalendarEvent[];
|
||||
getEvents(startTime: Date, endTime: Date, options: Object): CalendarEvent[];
|
||||
getEventsForDay(date: Date): CalendarEvent[];
|
||||
getEventsForDay(date: Date, options: Object): CalendarEvent[];
|
||||
getId(): string;
|
||||
getName(): string;
|
||||
getTimeZone(): string;
|
||||
isHidden(): boolean;
|
||||
isMyPrimaryCalendar(): boolean;
|
||||
isOwnedByMe(): boolean;
|
||||
isSelected(): boolean;
|
||||
setColor(color: string): Calendar;
|
||||
setDescription(description: string): Calendar;
|
||||
setHidden(hidden: boolean): Calendar;
|
||||
setName(name: string): Calendar;
|
||||
setSelected(selected: boolean): Calendar;
|
||||
setTimeZone(timeZone: string): Calendar;
|
||||
unsubscribeFromCalendar(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows a script to read and update the user's Google Calendar. This class provides direct
|
||||
* access to the user's default calendar, as well as the ability to retrieve additional calendars
|
||||
* that the user owns or is subscribed to.
|
||||
*/
|
||||
export interface CalendarApp {
|
||||
Color: Color
|
||||
GuestStatus: GuestStatus
|
||||
Month: Base.Month
|
||||
Visibility: Visibility
|
||||
Weekday: Base.Weekday
|
||||
createAllDayEvent(title: string, date: Date): CalendarEvent;
|
||||
createAllDayEvent(title: string, date: Date, options: Object): CalendarEvent;
|
||||
createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence): CalendarEventSeries;
|
||||
createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence, options: Object): CalendarEventSeries;
|
||||
createCalendar(name: string): Calendar;
|
||||
createCalendar(name: string, options: Object): Calendar;
|
||||
createEvent(title: string, startTime: Date, endTime: Date): CalendarEvent;
|
||||
createEvent(title: string, startTime: Date, endTime: Date, options: Object): CalendarEvent;
|
||||
createEventFromDescription(description: string): CalendarEvent;
|
||||
createEventSeries(title: string, startTime: Date, endTime: Date, recurrence: EventRecurrence): CalendarEventSeries;
|
||||
createEventSeries(title: string, startTime: Date, endTime: Date, recurrence: EventRecurrence, options: Object): CalendarEventSeries;
|
||||
getAllCalendars(): Calendar[];
|
||||
getAllOwnedCalendars(): Calendar[];
|
||||
getCalendarById(id: string): Calendar;
|
||||
getCalendarsByName(name: string): Calendar[];
|
||||
getColor(): string;
|
||||
getDefaultCalendar(): Calendar;
|
||||
getDescription(): string;
|
||||
getEventSeriesById(iCalId: string): CalendarEventSeries;
|
||||
getEvents(startTime: Date, endTime: Date): CalendarEvent[];
|
||||
getEvents(startTime: Date, endTime: Date, options: Object): CalendarEvent[];
|
||||
getEventsForDay(date: Date): CalendarEvent[];
|
||||
getEventsForDay(date: Date, options: Object): CalendarEvent[];
|
||||
getId(): string;
|
||||
getName(): string;
|
||||
getOwnedCalendarById(id: string): Calendar;
|
||||
getOwnedCalendarsByName(name: string): Calendar[];
|
||||
getTimeZone(): string;
|
||||
isHidden(): boolean;
|
||||
isMyPrimaryCalendar(): boolean;
|
||||
isOwnedByMe(): boolean;
|
||||
isSelected(): boolean;
|
||||
newRecurrence(): EventRecurrence;
|
||||
setColor(color: string): Calendar;
|
||||
setDescription(description: string): Calendar;
|
||||
setHidden(hidden: boolean): Calendar;
|
||||
setName(name: string): Calendar;
|
||||
setSelected(selected: boolean): Calendar;
|
||||
setTimeZone(timeZone: string): Calendar;
|
||||
subscribeToCalendar(id: string): Calendar;
|
||||
subscribeToCalendar(id: string, options: Object): Calendar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a single calendar event.
|
||||
*/
|
||||
export interface CalendarEvent {
|
||||
addEmailReminder(minutesBefore: Integer): CalendarEvent;
|
||||
addGuest(email: string): CalendarEvent;
|
||||
addPopupReminder(minutesBefore: Integer): CalendarEvent;
|
||||
addSmsReminder(minutesBefore: Integer): CalendarEvent;
|
||||
anyoneCanAddSelf(): boolean;
|
||||
deleteEvent(): void;
|
||||
deleteTag(key: string): CalendarEvent;
|
||||
getAllDayEndDate(): Date;
|
||||
getAllDayStartDate(): Date;
|
||||
getAllTagKeys(): String[];
|
||||
getCreators(): String[];
|
||||
getDateCreated(): Date;
|
||||
getDescription(): string;
|
||||
getEmailReminders(): Integer[];
|
||||
getEndTime(): Date;
|
||||
getEventSeries(): CalendarEventSeries;
|
||||
getGuestByEmail(email: string): EventGuest;
|
||||
getGuestList(): EventGuest[];
|
||||
getGuestList(includeOwner: boolean): EventGuest[];
|
||||
getId(): string;
|
||||
getLastUpdated(): Date;
|
||||
getLocation(): string;
|
||||
getMyStatus(): GuestStatus;
|
||||
getOriginalCalendarId(): string;
|
||||
getPopupReminders(): Integer[];
|
||||
getSmsReminders(): Integer[];
|
||||
getStartTime(): Date;
|
||||
getTag(key: string): string;
|
||||
getTitle(): string;
|
||||
getVisibility(): Visibility;
|
||||
guestsCanInviteOthers(): boolean;
|
||||
guestsCanModify(): boolean;
|
||||
guestsCanSeeGuests(): boolean;
|
||||
isAllDayEvent(): boolean;
|
||||
isOwnedByMe(): boolean;
|
||||
isRecurringEvent(): boolean;
|
||||
removeAllReminders(): CalendarEvent;
|
||||
removeGuest(email: string): CalendarEvent;
|
||||
resetRemindersToDefault(): CalendarEvent;
|
||||
setAllDayDate(date: Date): CalendarEvent;
|
||||
setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEvent;
|
||||
setDescription(description: string): CalendarEvent;
|
||||
setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEvent;
|
||||
setGuestsCanModify(guestsCanModify: boolean): CalendarEvent;
|
||||
setGuestsCanSeeGuests(guestsCanSeeGuests: boolean): CalendarEvent;
|
||||
setLocation(location: string): CalendarEvent;
|
||||
setMyStatus(status: GuestStatus): CalendarEvent;
|
||||
setTag(key: string, value: string): CalendarEvent;
|
||||
setTime(startTime: Date, endTime: Date): CalendarEvent;
|
||||
setTitle(title: string): CalendarEvent;
|
||||
setVisibility(visibility: Visibility): CalendarEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a series of events (a recurring event).
|
||||
*/
|
||||
export interface CalendarEventSeries {
|
||||
addEmailReminder(minutesBefore: Integer): CalendarEventSeries;
|
||||
addGuest(email: string): CalendarEventSeries;
|
||||
addPopupReminder(minutesBefore: Integer): CalendarEventSeries;
|
||||
addSmsReminder(minutesBefore: Integer): CalendarEventSeries;
|
||||
anyoneCanAddSelf(): boolean;
|
||||
deleteEventSeries(): void;
|
||||
deleteTag(key: string): CalendarEventSeries;
|
||||
getAllTagKeys(): String[];
|
||||
getCreators(): String[];
|
||||
getDateCreated(): Date;
|
||||
getDescription(): string;
|
||||
getEmailReminders(): Integer[];
|
||||
getGuestByEmail(email: string): EventGuest;
|
||||
getGuestList(): EventGuest[];
|
||||
getGuestList(includeOwner: boolean): EventGuest[];
|
||||
getId(): string;
|
||||
getLastUpdated(): Date;
|
||||
getLocation(): string;
|
||||
getMyStatus(): GuestStatus;
|
||||
getOriginalCalendarId(): string;
|
||||
getPopupReminders(): Integer[];
|
||||
getSmsReminders(): Integer[];
|
||||
getTag(key: string): string;
|
||||
getTitle(): string;
|
||||
getVisibility(): Visibility;
|
||||
guestsCanInviteOthers(): boolean;
|
||||
guestsCanModify(): boolean;
|
||||
guestsCanSeeGuests(): boolean;
|
||||
isOwnedByMe(): boolean;
|
||||
removeAllReminders(): CalendarEventSeries;
|
||||
removeGuest(email: string): CalendarEventSeries;
|
||||
resetRemindersToDefault(): CalendarEventSeries;
|
||||
setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEventSeries;
|
||||
setDescription(description: string): CalendarEventSeries;
|
||||
setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEventSeries;
|
||||
setGuestsCanModify(guestsCanModify: boolean): CalendarEventSeries;
|
||||
setGuestsCanSeeGuests(guestsCanSeeGuests: boolean): CalendarEventSeries;
|
||||
setLocation(location: string): CalendarEventSeries;
|
||||
setMyStatus(status: GuestStatus): CalendarEventSeries;
|
||||
setRecurrence(recurrence: EventRecurrence, startDate: Date): CalendarEventSeries;
|
||||
setRecurrence(recurrence: EventRecurrence, startTime: Date, endTime: Date): CalendarEventSeries;
|
||||
setTag(key: string, value: string): CalendarEventSeries;
|
||||
setTitle(title: string): CalendarEventSeries;
|
||||
setVisibility(visibility: Visibility): CalendarEventSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the named colors available in the Calendar service.
|
||||
*/
|
||||
export enum Color { BLUE, BROWN, CHARCOAL, CHESTNUT, GRAY, GREEN, INDIGO, LIME, MUSTARD, OLIVE, ORANGE, PINK, PLUM, PURPLE, RED, RED_ORANGE, SEA_BLUE, SLATE, TEAL, TURQOISE, YELLOW }
|
||||
|
||||
/**
|
||||
* Represents a guest of an event.
|
||||
*/
|
||||
export interface EventGuest {
|
||||
getAdditionalGuests(): Integer;
|
||||
getEmail(): string;
|
||||
getGuestStatus(): GuestStatus;
|
||||
getName(): string;
|
||||
getStatus(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the recurrence settings for an event series.
|
||||
*/
|
||||
export interface EventRecurrence {
|
||||
addDailyExclusion(): RecurrenceRule;
|
||||
addDailyRule(): RecurrenceRule;
|
||||
addDate(date: Date): EventRecurrence;
|
||||
addDateExclusion(date: Date): EventRecurrence;
|
||||
addMonthlyExclusion(): RecurrenceRule;
|
||||
addMonthlyRule(): RecurrenceRule;
|
||||
addWeeklyExclusion(): RecurrenceRule;
|
||||
addWeeklyRule(): RecurrenceRule;
|
||||
addYearlyExclusion(): RecurrenceRule;
|
||||
addYearlyRule(): RecurrenceRule;
|
||||
setTimeZone(timeZone: string): EventRecurrence;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the statuses a guest can have for an event.
|
||||
*/
|
||||
export enum GuestStatus { INVITED, MAYBE, NO, OWNER, YES }
|
||||
|
||||
/**
|
||||
* Represents a recurrence rule for an event series.
|
||||
*
|
||||
* Note that this class also behaves like the EventRecurrence that it belongs
|
||||
* to, allowing you to chain rule creation together like so:
|
||||
*
|
||||
* recurrence.addDailyRule().times(3).interval(2).addWeeklyExclusion().times(2);
|
||||
*
|
||||
* times(times)
|
||||
* interval(interval)
|
||||
*/
|
||||
export interface RecurrenceRule {
|
||||
addDailyExclusion(): RecurrenceRule;
|
||||
addDailyRule(): RecurrenceRule;
|
||||
addDate(date: Date): EventRecurrence;
|
||||
addDateExclusion(date: Date): EventRecurrence;
|
||||
addMonthlyExclusion(): RecurrenceRule;
|
||||
addMonthlyRule(): RecurrenceRule;
|
||||
addWeeklyExclusion(): RecurrenceRule;
|
||||
addWeeklyRule(): RecurrenceRule;
|
||||
addYearlyExclusion(): RecurrenceRule;
|
||||
addYearlyRule(): RecurrenceRule;
|
||||
interval(interval: Integer): RecurrenceRule;
|
||||
onlyInMonth(month: Base.Month): RecurrenceRule;
|
||||
onlyInMonths(months: Base.Month[]): RecurrenceRule;
|
||||
onlyOnMonthDay(day: Integer): RecurrenceRule;
|
||||
onlyOnMonthDays(days: Integer[]): RecurrenceRule;
|
||||
onlyOnWeek(week: Integer): RecurrenceRule;
|
||||
onlyOnWeekday(day: Base.Weekday): RecurrenceRule;
|
||||
onlyOnWeekdays(days: Base.Weekday[]): RecurrenceRule;
|
||||
onlyOnWeeks(weeks: Integer[]): RecurrenceRule;
|
||||
onlyOnYearDay(day: Integer): RecurrenceRule;
|
||||
onlyOnYearDays(days: Integer[]): RecurrenceRule;
|
||||
setTimeZone(timeZone: string): EventRecurrence;
|
||||
times(times: Integer): RecurrenceRule;
|
||||
until(endDate: Date): RecurrenceRule;
|
||||
weekStartsOn(day: Base.Weekday): RecurrenceRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the visibility of an event.
|
||||
*/
|
||||
export enum Visibility { CONFIDENTIAL, DEFAULT, PRIVATE, PUBLIC }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var CalendarApp: GoogleAppsScript.Calendar.CalendarApp;
|
||||
+975
@@ -0,0 +1,975 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
/// <reference path="google-apps-script.ui.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Charts {
|
||||
/**
|
||||
* Builder for area charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build an area chart.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Create a data table with some sample data.
|
||||
* var sampleData = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Month")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Dining")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Total")
|
||||
* .addRow(["Jan", 60, 520])
|
||||
* .addRow(["Feb", 50, 430])
|
||||
* .addRow(["Mar", 53, 440])
|
||||
* .addRow(["Apr", 70, 410])
|
||||
* .addRow(["May", 80, 390])
|
||||
* .addRow(["Jun", 60, 500])
|
||||
* .addRow(["Jul", 100, 450])
|
||||
* .addRow(["Aug", 140, 431])
|
||||
* .addRow(["Sep", 75, 488])
|
||||
* .addRow(["Oct", 70, 521])
|
||||
* .addRow(["Nov", 58, 388])
|
||||
* .addRow(["Dec", 63, 400])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newAreaChart()
|
||||
* .setTitle('Yearly Spending')
|
||||
* .setXAxisTitle('Month')
|
||||
* .setYAxisTitle('Spending (USD)')
|
||||
* .setDimensions(600, 500)
|
||||
* .setStacked()
|
||||
* .setColors(['red', 'green'])
|
||||
* .setDataTable(sampleData)
|
||||
* .build();
|
||||
*
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface AreaChartBuilder {
|
||||
build(): Chart;
|
||||
reverseCategories(): AreaChartBuilder;
|
||||
setBackgroundColor(cssValue: string): AreaChartBuilder;
|
||||
setColors(cssValues: String[]): AreaChartBuilder;
|
||||
setDataSourceUrl(url: string): AreaChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): AreaChartBuilder;
|
||||
setDataTable(table: DataTableSource): AreaChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): AreaChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): AreaChartBuilder;
|
||||
setLegendPosition(position: Position): AreaChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
setOption(option: string, value: Object): AreaChartBuilder;
|
||||
setPointStyle(style: PointStyle): AreaChartBuilder;
|
||||
setRange(start: Number, end: Number): AreaChartBuilder;
|
||||
setStacked(): AreaChartBuilder;
|
||||
setTitle(chartTitle: string): AreaChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
setXAxisTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
setXAxisTitle(title: string): AreaChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
setYAxisTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
setYAxisTitle(title: string): AreaChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: TextStyle): AreaChartBuilder;
|
||||
useLogScale(): AreaChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for bar charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build a bar chart. The data is
|
||||
*
|
||||
* imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=B1%3AC11' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=0&headers=-1';
|
||||
*
|
||||
* var chartBuilder = Charts.newBarChart()
|
||||
* .setTitle('Top Grossing Films in US and Canada')
|
||||
* .setXAxisTitle('USD')
|
||||
* .setYAxisTitle('Film')
|
||||
* .setDimensions(600, 500)
|
||||
* .setLegendPosition(Charts.Position.BOTTOM)
|
||||
* .setDataSourceUrl(dataSourceUrl);
|
||||
*
|
||||
* var chart = chartBuilder.build();
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface BarChartBuilder {
|
||||
build(): Chart;
|
||||
reverseCategories(): BarChartBuilder;
|
||||
reverseDirection(): BarChartBuilder;
|
||||
setBackgroundColor(cssValue: string): BarChartBuilder;
|
||||
setColors(cssValues: String[]): BarChartBuilder;
|
||||
setDataSourceUrl(url: string): BarChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): BarChartBuilder;
|
||||
setDataTable(table: DataTableSource): BarChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): BarChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): BarChartBuilder;
|
||||
setLegendPosition(position: Position): BarChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
setOption(option: string, value: Object): BarChartBuilder;
|
||||
setRange(start: Number, end: Number): BarChartBuilder;
|
||||
setStacked(): BarChartBuilder;
|
||||
setTitle(chartTitle: string): BarChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
setXAxisTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
setXAxisTitle(title: string): BarChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
setYAxisTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
setYAxisTitle(title: string): BarChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: TextStyle): BarChartBuilder;
|
||||
useLogScale(): BarChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for category filter controls.
|
||||
*
|
||||
* A category filter is a picker to choose one or more between a set of defined values.
|
||||
* Given a column of type string, this control will filter out the rows that
|
||||
* don't match any of the picked values.
|
||||
*
|
||||
* Here is an example that creates a table chart a binds a category filter to it. This allows the
|
||||
* user to filter the data the table displays.
|
||||
*
|
||||
* function doGet() {
|
||||
* var app = UiApp.createApplication();
|
||||
* var sampleData = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Month")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Dining")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Total")
|
||||
* .addRow(["Jan", 60, 520])
|
||||
* .addRow(["Feb", 50, 430])
|
||||
* .addRow(["Mar", 53, 440])
|
||||
* .addRow(["Apr", 70, 410])
|
||||
* .addRow(["May", 80, 390])
|
||||
* .addRow(["Jun", 60, 500])
|
||||
* .addRow(["Jul", 100, 450])
|
||||
* .addRow(["Aug", 140, 431])
|
||||
* .addRow(["Sep", 75, 488])
|
||||
* .addRow(["Oct", 70, 521])
|
||||
* .addRow(["Nov", 58, 388])
|
||||
* .addRow(["Dec", 63, 400])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newTableChart()
|
||||
* .setDimensions(600, 500)
|
||||
* .build();
|
||||
*
|
||||
* var categoryFilter = Charts.newCategoryFilter()
|
||||
* .setFilterColumnLabel("Month")
|
||||
* .setAllowMultiple(true)
|
||||
* .setSortValues(true)
|
||||
* .setLabelStacking(Charts.Orientation.VERTICAL)
|
||||
* .setCaption('Choose categories...')
|
||||
* .build();
|
||||
*
|
||||
* var panel = app.createVerticalPanel().setSpacing(10);
|
||||
* panel.add(categoryFilter).add(chart);
|
||||
*
|
||||
* var dashboard = Charts.newDashboardPanel()
|
||||
* .setDataTable(sampleData)
|
||||
* .bind(categoryFilter, chart)
|
||||
* .build();
|
||||
*
|
||||
* dashboard.add(panel);
|
||||
* app.add(dashboard);
|
||||
* return app;
|
||||
* }
|
||||
*
|
||||
* documentation
|
||||
*/
|
||||
export interface CategoryFilterBuilder {
|
||||
build(): Control;
|
||||
setAllowMultiple(allowMultiple: boolean): CategoryFilterBuilder;
|
||||
setAllowNone(allowNone: boolean): CategoryFilterBuilder;
|
||||
setAllowTyping(allowTyping: boolean): CategoryFilterBuilder;
|
||||
setCaption(caption: string): CategoryFilterBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): CategoryFilterBuilder;
|
||||
setDataTable(table: DataTableSource): CategoryFilterBuilder;
|
||||
setFilterColumnIndex(columnIndex: Integer): CategoryFilterBuilder;
|
||||
setFilterColumnLabel(columnLabel: string): CategoryFilterBuilder;
|
||||
setLabel(label: string): CategoryFilterBuilder;
|
||||
setLabelSeparator(labelSeparator: string): CategoryFilterBuilder;
|
||||
setLabelStacking(orientation: Orientation): CategoryFilterBuilder;
|
||||
setSelectedValuesLayout(layout: PickerValuesLayout): CategoryFilterBuilder;
|
||||
setSortValues(sortValues: boolean): CategoryFilterBuilder;
|
||||
setValues(values: String[]): CategoryFilterBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Chart object, which can be embedded into documents, UI elements, or used as a static image. For
|
||||
* charts embedded in spreadsheets, see
|
||||
* EmbeddedChart.
|
||||
*/
|
||||
export interface Chart {
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getId(): string;
|
||||
getOptions(): ChartOptions;
|
||||
getType(): string;
|
||||
setId(id: string): Chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes options currently configured for a Chart, such as height, color, etc.
|
||||
*
|
||||
* Please see the visualization
|
||||
* reference documentation for information on what options are available. Specific options for
|
||||
* each chart can be found by clicking on the specific chart in the chart gallery.
|
||||
*
|
||||
* These options are immutable.
|
||||
*/
|
||||
export interface ChartOptions {
|
||||
get(option: string): Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chart types supported by the Charts service.
|
||||
*/
|
||||
export enum ChartType { AREA, BAR, COLUMN, LINE, PIE, SCATTER, TABLE }
|
||||
|
||||
/**
|
||||
* Entry point for creating Charts in scripts.
|
||||
*
|
||||
* This example creates a basic data table, populates an area chart with the data, and adds it into
|
||||
* a UiApp:
|
||||
*
|
||||
* function doGet() {
|
||||
* var data = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Month")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "In Store")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Online")
|
||||
* .addRow(["January", 10, 1])
|
||||
* .addRow(["February", 12, 1])
|
||||
* .addRow(["March", 20, 2])
|
||||
* .addRow(["April", 25, 3])
|
||||
* .addRow(["May", 30, 4])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newAreaChart()
|
||||
* .setDataTable(data)
|
||||
* .setStacked()
|
||||
* .setRange(0, 40)
|
||||
* .setTitle("Sales per Month")
|
||||
* .build();
|
||||
*
|
||||
* var uiApp = UiApp.createApplication().setTitle("My Chart");
|
||||
* uiApp.add(chart);
|
||||
* return uiApp;
|
||||
* }
|
||||
*/
|
||||
export interface Charts {
|
||||
ChartType: ChartType
|
||||
ColumnType: ColumnType
|
||||
CurveStyle: CurveStyle
|
||||
MatchType: MatchType
|
||||
Orientation: Orientation
|
||||
PickerValuesLayout: PickerValuesLayout
|
||||
PointStyle: PointStyle
|
||||
Position: Position
|
||||
newAreaChart(): AreaChartBuilder;
|
||||
newBarChart(): BarChartBuilder;
|
||||
newCategoryFilter(): CategoryFilterBuilder;
|
||||
newColumnChart(): ColumnChartBuilder;
|
||||
newDashboardPanel(): DashboardPanelBuilder;
|
||||
newDataTable(): DataTableBuilder;
|
||||
newDataViewDefinition(): DataViewDefinitionBuilder;
|
||||
newLineChart(): LineChartBuilder;
|
||||
newNumberRangeFilter(): NumberRangeFilterBuilder;
|
||||
newPieChart(): PieChartBuilder;
|
||||
newScatterChart(): ScatterChartBuilder;
|
||||
newStringFilter(): StringFilterBuilder;
|
||||
newTableChart(): TableChartBuilder;
|
||||
newTextStyle(): TextStyleBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for column charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* This example shows how to create a column chart with data from a data table.
|
||||
*
|
||||
* function doGet() {
|
||||
* var sampleData = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Year")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Sales")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Expenses")
|
||||
* .addRow(["2004", 1000, 400])
|
||||
* .addRow(["2005", 1170, 460])
|
||||
* .addRow(["2006", 660, 1120])
|
||||
* .addRow(["2007", 1030, 540])
|
||||
* .addRow(["2008", 800, 600])
|
||||
* .addRow(["2009", 943, 678])
|
||||
* .addRow(["2010", 1020, 550])
|
||||
* .addRow(["2011", 910, 700])
|
||||
* .addRow(["2012", 1230, 840])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newColumnChart()
|
||||
* .setTitle('Sales vs. Expenses')
|
||||
* .setXAxisTitle('Year')
|
||||
* .setYAxisTitle('Amount (USD)')
|
||||
* .setDimensions(600, 500)
|
||||
* .setDataTable(sampleData)
|
||||
* .build();
|
||||
*
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface ColumnChartBuilder {
|
||||
build(): Chart;
|
||||
reverseCategories(): ColumnChartBuilder;
|
||||
setBackgroundColor(cssValue: string): ColumnChartBuilder;
|
||||
setColors(cssValues: String[]): ColumnChartBuilder;
|
||||
setDataSourceUrl(url: string): ColumnChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): ColumnChartBuilder;
|
||||
setDataTable(table: DataTableSource): ColumnChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): ColumnChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): ColumnChartBuilder;
|
||||
setLegendPosition(position: Position): ColumnChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
setOption(option: string, value: Object): ColumnChartBuilder;
|
||||
setRange(start: Number, end: Number): ColumnChartBuilder;
|
||||
setStacked(): ColumnChartBuilder;
|
||||
setTitle(chartTitle: string): ColumnChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
setXAxisTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
setXAxisTitle(title: string): ColumnChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
setYAxisTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
setYAxisTitle(title: string): ColumnChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: TextStyle): ColumnChartBuilder;
|
||||
useLogScale(): ColumnChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of the valid data types for columns in a DataTable.
|
||||
*/
|
||||
export enum ColumnType { DATE, NUMBER, STRING }
|
||||
|
||||
/**
|
||||
* A user interface control object, that drives the data displayed by a DashboardPanel.
|
||||
*
|
||||
* A control can be embedded in a UI application. Controls are user interface widgets (category
|
||||
* pickers, range sliders, autocompleters, etc.) users interact with in order to drive the data
|
||||
* managed by a dashboard and the charts that are part of it.
|
||||
* Controls collect user input and use the information to decide which of the data the
|
||||
* dashboard is managing should be made available to the charts that are part of it.
|
||||
* Given a data table, a control will filter out the data that doesn't comply with the
|
||||
* conditions implied by its current state, and will expose the filtered data table as
|
||||
* an output.
|
||||
*
|
||||
* For more details, see the Gviz
|
||||
*
|
||||
* documentation.
|
||||
*/
|
||||
export interface Control {
|
||||
getId(): string;
|
||||
getType(): string;
|
||||
setId(id: string): Control;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of the styles for curves in a chart.
|
||||
*/
|
||||
export enum CurveStyle { NORMAL, SMOOTH }
|
||||
|
||||
/**
|
||||
* A dashboard is a visual structure that enables the organization and management
|
||||
* of multiple charts that share the same underlying data.
|
||||
*
|
||||
* Controls are user interface widgets (category pickers, range sliders, autocompleters, etc.)
|
||||
* users interact with in order to drive the data managed by a dashboard and the charts that
|
||||
* are part of it. For example, a string filter control is a simple text input field that lets
|
||||
* the user filter data via string matching. Given a column and matching options, the control
|
||||
* will filter out the rows that don't match the term that's in the input field.
|
||||
*
|
||||
* The Gviz API defines a dashboard as a set of charts and controls bound together. The
|
||||
* bindings between the different components define the data flow, the state of the
|
||||
* controls filters views of the data which propagate in the dashboard and are
|
||||
* eventually visualized with charts. For more details, see the Gviz
|
||||
*
|
||||
* documentation.
|
||||
*
|
||||
* The dashboard panel has two purposes, one is being a container for the charts and
|
||||
* controls objects that compose the dashboard, and the other is holding the data and use
|
||||
* as an interface for binding controls to charts.
|
||||
*
|
||||
* Here's an example of creating a dashboard and showing it in a UI app:
|
||||
*
|
||||
* function doGet() {
|
||||
* // Create a data table with some sample data.
|
||||
* var data = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Name")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Age")
|
||||
* .addRow(["Michael", 18])
|
||||
* .addRow(["Elisa", 12])
|
||||
* .addRow(["John", 20])
|
||||
* .addRow(["Jessica", 25])
|
||||
* .addRow(["Aaron", 14])
|
||||
* .addRow(["Margareth", 19])
|
||||
* .addRow(["Miranda", 22])
|
||||
* .addRow(["May", 20])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newBarChart()
|
||||
* .setTitle("Ages")
|
||||
* .build();
|
||||
*
|
||||
* var control = Charts.newStringFilter()
|
||||
* .setFilterColumnLabel("Name")
|
||||
* .build();
|
||||
*
|
||||
* // Bind the control to the chart in a dashboard panel.
|
||||
* var dashboard = Charts.newDashboardPanel()
|
||||
* .setDataTable(data)
|
||||
* .bind(control, chart)
|
||||
* .build();
|
||||
*
|
||||
* var uiApp = UiApp.createApplication().setTitle("My Dashboard");
|
||||
*
|
||||
* var panel = uiApp.createHorizontalPanel()
|
||||
* .setVerticalAlignment(UiApp.VerticalAlignment.MIDDLE)
|
||||
* .setSpacing(50);
|
||||
*
|
||||
* panel.add(control);
|
||||
* panel.add(chart);
|
||||
* dashboard.add(panel);
|
||||
* uiApp.add(dashboard);
|
||||
* return uiApp;
|
||||
* }
|
||||
*/
|
||||
export interface DashboardPanel {
|
||||
add(widget: UI.Widget): DashboardPanel;
|
||||
getId(): string;
|
||||
getType(): string;
|
||||
setId(id: string): DashboardPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for a dashboard panel object. For an example of how to use
|
||||
* DashboardPanelBuilder, refer to DashboardPanel.
|
||||
*
|
||||
* For more details, see the Gviz
|
||||
*
|
||||
* documentation.
|
||||
*/
|
||||
export interface DashboardPanelBuilder {
|
||||
bind(control: Control, chart: Chart, controls: Control[], charts: Chart[]): DashboardPanelBuilder;
|
||||
bind(control: Control, chart: Chart, controls: Control[], charts: Chart[]): DashboardPanelBuilder;
|
||||
build(): DashboardPanel;
|
||||
setDataTable(tableBuilder: DataTableBuilder): DashboardPanelBuilder;
|
||||
setDataTable(source: DataTableSource): DashboardPanelBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Data Table to be used in charts. A DataTable can come from sources such as Google
|
||||
* Sheets or specified data-table URLs, or can be filled in by hand. This class intentionally has no
|
||||
* methods: a DataTable can be passed around, but not manipulated directly.
|
||||
*/
|
||||
export interface DataTable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder of DataTable objects. Building a data table consists of first specifying its columns,
|
||||
* and then adding its rows, one at a time. Example:
|
||||
*
|
||||
* var data = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Month")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "In Store")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Online")
|
||||
* .addRow(["January", 10, 1])
|
||||
* .addRow(["February", 12, 1])
|
||||
* .addRow(["March", 20, 2])
|
||||
* .addRow(["April", 25, 3])
|
||||
* .addRow(["May", 30, 4])
|
||||
* .build();
|
||||
*/
|
||||
export interface DataTableBuilder {
|
||||
addColumn(type: ColumnType, label: string): DataTableBuilder;
|
||||
addRow(values: Object[]): DataTableBuilder;
|
||||
build(): DataTable;
|
||||
setValue(row: Integer, column: Integer, value: Object): DataTableBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for objects that can represent their data as a DataTable.
|
||||
* Implementing classes
|
||||
*
|
||||
* NameBrief description
|
||||
*
|
||||
* DataTableA Data Table to be used in charts.
|
||||
*
|
||||
* RangeAccess and modify spreadsheet ranges.
|
||||
*/
|
||||
export interface DataTableSource {
|
||||
getDataTable(): DataTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* A data view definition for visualizing chart data.
|
||||
*
|
||||
* Data view definition can be set for charts to visualize a view derived from the given data table
|
||||
* and not the data table itself. For example if the view definition of a chart states that the view
|
||||
* columns are [0, 3], only the first and the third columns of the data table will be taken into
|
||||
* consideration when drawing the chart. See DataViewDefinitionBuilder for an example on how
|
||||
* to define and use a DataViewDefinition.
|
||||
*/
|
||||
export interface DataViewDefinition {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for DataViewDefinition objects.
|
||||
*
|
||||
* Here's an example of using the builder. The data is imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // This example creates two table charts side by side. One uses a data view definition to
|
||||
* // restrict the number of displayed columns.
|
||||
* var app = UiApp.createApplication();
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';
|
||||
*
|
||||
* // Create a chart to display all of the data.
|
||||
* var originalChart = Charts.newTableChart()
|
||||
* .setDimensions(600, 500)
|
||||
* .setDataSourceUrl(dataSourceUrl)
|
||||
* .build();
|
||||
*
|
||||
* // Create another chart to display a subset of the data (only columns 1 and 4).
|
||||
* var dataViewDefinition = Charts.newDataViewDefinition().setColumns([0, 3]);
|
||||
* var limitedChart = Charts.newTableChart()
|
||||
* .setDimensions(200, 500)
|
||||
* .setDataSourceUrl(dataSourceUrl)
|
||||
* .setDataViewDefinition(dataViewDefinition)
|
||||
* .build();
|
||||
*
|
||||
* var panel = app.createHorizontalPanel().setSpacing(15);
|
||||
* panel.add(originalChart).add(limitedChart);
|
||||
* return app.add(panel);
|
||||
* }
|
||||
*/
|
||||
export interface DataViewDefinitionBuilder {
|
||||
build(): DataViewDefinition;
|
||||
setColumns(columns: Object[]): DataViewDefinitionBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for line charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build a line chart. The data is
|
||||
* imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AG5' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=2&headers=-1';
|
||||
*
|
||||
* var chartBuilder = Charts.newLineChart()
|
||||
* .setTitle('Yearly Rainfall')
|
||||
* .setXAxisTitle('Month')
|
||||
* .setYAxisTitle('Rainfall (in)')
|
||||
* .setDimensions(600, 500)
|
||||
* .setCurveStyle(Charts.CurveStyle.SMOOTH)
|
||||
* .setPointStyle(Charts.PointStyle.MEDIUM)
|
||||
* .setDataSourceUrl(dataSourceUrl);
|
||||
*
|
||||
* var chart = chartBuilder.build();
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface LineChartBuilder {
|
||||
build(): Chart;
|
||||
reverseCategories(): LineChartBuilder;
|
||||
setBackgroundColor(cssValue: string): LineChartBuilder;
|
||||
setColors(cssValues: String[]): LineChartBuilder;
|
||||
setCurveStyle(style: CurveStyle): LineChartBuilder;
|
||||
setDataSourceUrl(url: string): LineChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): LineChartBuilder;
|
||||
setDataTable(table: DataTableSource): LineChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): LineChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): LineChartBuilder;
|
||||
setLegendPosition(position: Position): LineChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
setOption(option: string, value: Object): LineChartBuilder;
|
||||
setPointStyle(style: PointStyle): LineChartBuilder;
|
||||
setRange(start: Number, end: Number): LineChartBuilder;
|
||||
setTitle(chartTitle: string): LineChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
setXAxisTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
setXAxisTitle(title: string): LineChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
setYAxisTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
setYAxisTitle(title: string): LineChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: TextStyle): LineChartBuilder;
|
||||
useLogScale(): LineChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of how a string value should be matched.
|
||||
* Matching a string is a boolean operation. Given a string, a match term (string), and a match
|
||||
* type, the operation will output true in the following cases:
|
||||
*
|
||||
* If the match type equals EXACT and the match term equals the string.
|
||||
* If the match type equals PREFIX and the match term is a prefix of the string.
|
||||
* If the match type equals ANY and the match term is a substring of the string.
|
||||
*
|
||||
* This enumeration can be used in by a string filter control to decide which rows to filter out
|
||||
* of the data table. Given a column to filter on, leave only the rows that match the value
|
||||
* entered in the filter input box, using one of the above matching types.
|
||||
*/
|
||||
export enum MatchType { EXACT, PREFIX, ANY }
|
||||
|
||||
/**
|
||||
* A builder for number range filter controls.
|
||||
*
|
||||
* A number range filter is a slider with two thumbs that lets the user select ranges of
|
||||
* numeric values. Given a column of type number and matching options, this control will
|
||||
* filter out the rows that don't match the range that was selected.
|
||||
*
|
||||
* This example creates a table chart bound to a number range filter:
|
||||
*
|
||||
* function doGet() {
|
||||
* var app = UiApp.createApplication();
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';
|
||||
* var data = SpreadsheetApp.openByUrl(dataSourceUrl).getSheetByName('US_GDP').getRange("A1:F");
|
||||
*
|
||||
* var chart = Charts.newTableChart()
|
||||
* .setDimensions(600, 500)
|
||||
* .build();
|
||||
*
|
||||
* var numberRangeFilter = Charts.newNumberRangeFilter()
|
||||
* .setFilterColumnLabel("Year")
|
||||
* .setShowRangeValues(true)
|
||||
* .setLabel("Restrict year range")
|
||||
* .build();
|
||||
*
|
||||
* var panel = app.createVerticalPanel().setSpacing(10);
|
||||
* panel.add(numberRangeFilter).add(chart);
|
||||
*
|
||||
* // Create a new dashboard panel to bind the filter and chart together.
|
||||
* var dashboard = Charts.newDashboardPanel()
|
||||
* .setDataTable(data)
|
||||
* .bind(numberRangeFilter, chart)
|
||||
* .build();
|
||||
*
|
||||
* dashboard.add(panel);
|
||||
* app.add(dashboard);
|
||||
* return app;
|
||||
* }
|
||||
*
|
||||
* documentation
|
||||
*/
|
||||
export interface NumberRangeFilterBuilder {
|
||||
build(): Control;
|
||||
setDataTable(tableBuilder: DataTableBuilder): NumberRangeFilterBuilder;
|
||||
setDataTable(table: DataTableSource): NumberRangeFilterBuilder;
|
||||
setFilterColumnIndex(columnIndex: Integer): NumberRangeFilterBuilder;
|
||||
setFilterColumnLabel(columnLabel: string): NumberRangeFilterBuilder;
|
||||
setLabel(label: string): NumberRangeFilterBuilder;
|
||||
setLabelSeparator(labelSeparator: string): NumberRangeFilterBuilder;
|
||||
setLabelStacking(orientation: Orientation): NumberRangeFilterBuilder;
|
||||
setMaxValue(maxValue: Integer): NumberRangeFilterBuilder;
|
||||
setMinValue(minValue: Integer): NumberRangeFilterBuilder;
|
||||
setOrientation(orientation: Orientation): NumberRangeFilterBuilder;
|
||||
setShowRangeValues(showRangeValues: boolean): NumberRangeFilterBuilder;
|
||||
setTicks(ticks: Integer): NumberRangeFilterBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of the orientation of an object.
|
||||
*/
|
||||
export enum Orientation { HORIZONTAL, VERTICAL }
|
||||
|
||||
/**
|
||||
* An enumeration of how to display selected values in picker widget.
|
||||
*/
|
||||
export enum PickerValuesLayout { ASIDE, BELOW, BELOW_WRAPPING, BELOW_STACKED }
|
||||
|
||||
/**
|
||||
* A builder for pie charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build a pie chart. The data is
|
||||
* imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AB8' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=3&headers=-1';
|
||||
*
|
||||
* var chartBuilder = Charts.newPieChart()
|
||||
* .setTitle('World Population by Continent')
|
||||
* .setDimensions(600, 500)
|
||||
* .set3D()
|
||||
* .setDataSourceUrl(dataSourceUrl);
|
||||
*
|
||||
* var chart = chartBuilder.build();
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface PieChartBuilder {
|
||||
build(): Chart;
|
||||
reverseCategories(): PieChartBuilder;
|
||||
set3D(): PieChartBuilder;
|
||||
setBackgroundColor(cssValue: string): PieChartBuilder;
|
||||
setColors(cssValues: String[]): PieChartBuilder;
|
||||
setDataSourceUrl(url: string): PieChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): PieChartBuilder;
|
||||
setDataTable(table: DataTableSource): PieChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): PieChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): PieChartBuilder;
|
||||
setLegendPosition(position: Position): PieChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): PieChartBuilder;
|
||||
setOption(option: string, value: Object): PieChartBuilder;
|
||||
setTitle(chartTitle: string): PieChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): PieChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of the styles of points in a line.
|
||||
*/
|
||||
export enum PointStyle { NONE, TINY, MEDIUM, LARGE, HUGE }
|
||||
|
||||
/**
|
||||
* An enumeration of legend positions within a chart.
|
||||
*/
|
||||
export enum Position { TOP, RIGHT, BOTTOM, NONE }
|
||||
|
||||
/**
|
||||
* Builder for scatter charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build a scatter chart. The data is
|
||||
* imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=C1%3AD' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';
|
||||
*
|
||||
* var chartBuilder = Charts.newScatterChart()
|
||||
* .setTitle('Adjusted GDP vs. U.S. Population')
|
||||
* .setXAxisTitle('U.S. Population (millions)')
|
||||
* .setYAxisTitle('Adjusted GDP ($ billions)')
|
||||
* .setDimensions(600, 500)
|
||||
* .setLegendPosition(Charts.Position.NONE)
|
||||
* .setDataSourceUrl(dataSourceUrl);
|
||||
*
|
||||
* var chart = chartBuilder.build();
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface ScatterChartBuilder {
|
||||
build(): Chart;
|
||||
setBackgroundColor(cssValue: string): ScatterChartBuilder;
|
||||
setColors(cssValues: String[]): ScatterChartBuilder;
|
||||
setDataSourceUrl(url: string): ScatterChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): ScatterChartBuilder;
|
||||
setDataTable(table: DataTableSource): ScatterChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): ScatterChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): ScatterChartBuilder;
|
||||
setLegendPosition(position: Position): ScatterChartBuilder;
|
||||
setLegendTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
setOption(option: string, value: Object): ScatterChartBuilder;
|
||||
setPointStyle(style: PointStyle): ScatterChartBuilder;
|
||||
setTitle(chartTitle: string): ScatterChartBuilder;
|
||||
setTitleTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
setXAxisLogScale(): ScatterChartBuilder;
|
||||
setXAxisRange(start: Number, end: Number): ScatterChartBuilder;
|
||||
setXAxisTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
setXAxisTitle(title: string): ScatterChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
setYAxisLogScale(): ScatterChartBuilder;
|
||||
setYAxisRange(start: Number, end: Number): ScatterChartBuilder;
|
||||
setYAxisTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
setYAxisTitle(title: string): ScatterChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: TextStyle): ScatterChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for string filter controls.
|
||||
*
|
||||
* A string filter is a simple text input field that lets the user filter data via string matching.
|
||||
* Given a column of type string and matching options, this control will filter out the rows that
|
||||
* don't match the term that's in the input field.
|
||||
*
|
||||
* This example creates a table chart and binds it to a string filter. Using the filter, it is
|
||||
* possible to change the table chart to display a subset of its data.
|
||||
*
|
||||
* function doGet() {
|
||||
* var app = UiApp.createApplication();
|
||||
* var sampleData = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Month")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Dining")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Total")
|
||||
* .addRow(["Jan", 60, 520])
|
||||
* .addRow(["Feb", 50, 430])
|
||||
* .addRow(["Mar", 53, 440])
|
||||
* .addRow(["Apr", 70, 410])
|
||||
* .addRow(["May", 80, 390])
|
||||
* .addRow(["Jun", 60, 500])
|
||||
* .addRow(["Jul", 100, 450])
|
||||
* .addRow(["Aug", 140, 431])
|
||||
* .addRow(["Sep", 75, 488])
|
||||
* .addRow(["Oct", 70, 521])
|
||||
* .addRow(["Nov", 58, 388])
|
||||
* .addRow(["Dec", 63, 400])
|
||||
* .build();
|
||||
*
|
||||
* var chart = Charts.newTableChart()
|
||||
* .setDimensions(600, 500)
|
||||
* .build();
|
||||
*
|
||||
* var stringFilter = Charts.newStringFilter()
|
||||
* .setFilterColumnLabel("Month")
|
||||
* .setRealtimeTrigger(true)
|
||||
* .setCaseSensitive(true)
|
||||
* .setLabel("Filter months shown")
|
||||
* .build();
|
||||
*
|
||||
* var panel = app.createVerticalPanel().setSpacing(10);
|
||||
* panel.add(stringFilter).add(chart);
|
||||
*
|
||||
* // Create a dashboard panel to bind the filter and the chart together.
|
||||
* var dashboard = Charts.newDashboardPanel()
|
||||
* .setDataTable(sampleData)
|
||||
* .bind(stringFilter, chart)
|
||||
* .build();
|
||||
*
|
||||
* dashboard.add(panel);
|
||||
* app.add(dashboard);
|
||||
* return app;
|
||||
* }
|
||||
*
|
||||
* documentation
|
||||
*/
|
||||
export interface StringFilterBuilder {
|
||||
build(): Control;
|
||||
setCaseSensitive(caseSensitive: boolean): StringFilterBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): StringFilterBuilder;
|
||||
setDataTable(table: DataTableSource): StringFilterBuilder;
|
||||
setFilterColumnIndex(columnIndex: Integer): StringFilterBuilder;
|
||||
setFilterColumnLabel(columnLabel: string): StringFilterBuilder;
|
||||
setLabel(label: string): StringFilterBuilder;
|
||||
setLabelSeparator(labelSeparator: string): StringFilterBuilder;
|
||||
setLabelStacking(orientation: Orientation): StringFilterBuilder;
|
||||
setMatchType(matchType: MatchType): StringFilterBuilder;
|
||||
setRealtimeTrigger(realtimeTrigger: boolean): StringFilterBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for table charts. For more details, see the
|
||||
* Google Charts documentation.
|
||||
*
|
||||
* Here is an example that shows how to build a table chart. The data is
|
||||
* imported from a Google spreadsheet.
|
||||
*
|
||||
* function doGet() {
|
||||
* // Get sample data from a spreadsheet.
|
||||
* var dataSourceUrl = 'https://docs.google.com/spreadsheet/tq?range=A1%3AF' +
|
||||
* '&key=0Aq4s9w_HxMs7dHpfX05JdmVSb1FpT21sbXd4NVE3UEE&gid=4&headers=-1';
|
||||
*
|
||||
* var chartBuilder = Charts.newTableChart()
|
||||
* .setDimensions(600, 500)
|
||||
* .enablePaging(20)
|
||||
* .setDataSourceUrl(dataSourceUrl);
|
||||
*
|
||||
* var chart = chartBuilder.build();
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface TableChartBuilder {
|
||||
build(): Chart;
|
||||
enablePaging(enablePaging: boolean): TableChartBuilder;
|
||||
enablePaging(pageSize: Integer): TableChartBuilder;
|
||||
enablePaging(pageSize: Integer, startPage: Integer): TableChartBuilder;
|
||||
enableRtlTable(rtlEnabled: boolean): TableChartBuilder;
|
||||
enableSorting(enableSorting: boolean): TableChartBuilder;
|
||||
setDataSourceUrl(url: string): TableChartBuilder;
|
||||
setDataTable(tableBuilder: DataTableBuilder): TableChartBuilder;
|
||||
setDataTable(table: DataTableSource): TableChartBuilder;
|
||||
setDataViewDefinition(dataViewDefinition: DataViewDefinition): TableChartBuilder;
|
||||
setDimensions(width: Integer, height: Integer): TableChartBuilder;
|
||||
setFirstRowNumber(number: Integer): TableChartBuilder;
|
||||
setInitialSortingAscending(column: Integer): TableChartBuilder;
|
||||
setInitialSortingDescending(column: Integer): TableChartBuilder;
|
||||
setOption(option: string, value: Object): TableChartBuilder;
|
||||
showRowNumberColumn(showRowNumber: boolean): TableChartBuilder;
|
||||
useAlternatingRowStyle(alternate: boolean): TableChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A text style configuration object. Used in charts options to configure text style for
|
||||
* elements that accepts it, such as title, horizontal axis, vertical axis, legend and tooltip.
|
||||
*
|
||||
* // This example creates a chart specifying different text styles for the title and axes.
|
||||
* function doGet() {
|
||||
* var sampleData = Charts.newDataTable()
|
||||
* .addColumn(Charts.ColumnType.STRING, "Seasons")
|
||||
* .addColumn(Charts.ColumnType.NUMBER, "Rainy Days")
|
||||
* .addRow(["Winter", 5])
|
||||
* .addRow(["Spring", 12])
|
||||
* .addRow(["Summer", 8])
|
||||
* .addRow(["Fall", 8])
|
||||
* .build();
|
||||
*
|
||||
* var titleTextStyleBuilder = Charts.newTextStyle()
|
||||
* .setColor('#0000FF').setFontSize(26).setFontName('Ariel');
|
||||
* var axisTextStyleBuilder = Charts.newTextStyle()
|
||||
* .setColor('#3A3A3A').setFontSize(20).setFontName('Ariel');
|
||||
* var titleTextStyle = titleTextStyleBuilder.build();
|
||||
* var axisTextStyle = axisTextStyleBuilder.build();
|
||||
*
|
||||
* var chart = Charts.newLineChart()
|
||||
* .setTitleTextStyle(titleTextStyle)
|
||||
* .setXAxisTitleTextStyle(axisTextStyle)
|
||||
* .setYAxisTitleTextStyle(axisTextStyle)
|
||||
* .setTitle('Rainy Days Per Season')
|
||||
* .setXAxisTitle('Season')
|
||||
* .setYAxisTitle('Number of Rainy Days')
|
||||
* .setDataTable(sampleData)
|
||||
* .build();
|
||||
*
|
||||
* return UiApp.createApplication().add(chart);
|
||||
* }
|
||||
*/
|
||||
export interface TextStyle {
|
||||
getColor(): string;
|
||||
getFontName(): string;
|
||||
getFontSize(): Number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder used to create TextStyle objects. It allows configuration of the text's
|
||||
* properties such as name, color, and size.
|
||||
*
|
||||
* The following example shows how to create a text style using the builder. For a more complete
|
||||
* example, refer to the documentation for TextStyle.
|
||||
*
|
||||
* // Creates a new text style that uses 26-point, blue, Ariel font.
|
||||
* var textStyleBuilder = Charts.newTextStyle()
|
||||
* .setColor('#0000FF').setFontName('Ariel').setFontSize(26);
|
||||
* var style = textStyleBuilder.build();
|
||||
*/
|
||||
export interface TextStyleBuilder {
|
||||
build(): TextStyle;
|
||||
setColor(cssValue: string): TextStyleBuilder;
|
||||
setFontName(fontName: string): TextStyleBuilder;
|
||||
setFontSize(fontSize: Number): TextStyleBuilder;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var Charts: GoogleAppsScript.Charts.Charts;
|
||||
+299
@@ -0,0 +1,299 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Contacts {
|
||||
/**
|
||||
* Address field in a contact.
|
||||
*/
|
||||
export interface AddressField {
|
||||
deleteAddressField(): void;
|
||||
getAddress(): string;
|
||||
getLabel(): Object;
|
||||
isPrimary(): boolean;
|
||||
setAddress(address: string): AddressField;
|
||||
setAsPrimary(): AddressField;
|
||||
setLabel(field: Field): AddressField;
|
||||
setLabel(label: string): AddressField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Company field in a Contact.
|
||||
*/
|
||||
export interface CompanyField {
|
||||
deleteCompanyField(): void;
|
||||
getCompanyName(): string;
|
||||
getJobTitle(): string;
|
||||
isPrimary(): boolean;
|
||||
setAsPrimary(): CompanyField;
|
||||
setCompanyName(company: string): CompanyField;
|
||||
setJobTitle(title: string): CompanyField;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Contact contains the name, address, and various contact details of a contact.
|
||||
*/
|
||||
export interface Contact {
|
||||
addAddress(label: Object, address: string): AddressField;
|
||||
addCompany(company: string, title: string): CompanyField;
|
||||
addCustomField(label: Object, content: Object): CustomField;
|
||||
addDate(label: Object, month: Base.Month, day: Integer, year: Integer): DateField;
|
||||
addEmail(label: Object, address: string): EmailField;
|
||||
addIM(label: Object, address: string): IMField;
|
||||
addPhone(label: Object, number: string): PhoneField;
|
||||
addToGroup(group: ContactGroup): Contact;
|
||||
addUrl(label: Object, url: string): UrlField;
|
||||
deleteContact(): void;
|
||||
getAddresses(): AddressField[];
|
||||
getAddresses(label: Object): AddressField[];
|
||||
getCompanies(): CompanyField[];
|
||||
getContactGroups(): ContactGroup[];
|
||||
getCustomFields(): CustomField[];
|
||||
getCustomFields(label: Object): CustomField[];
|
||||
getDates(): DateField[];
|
||||
getDates(label: Object): DateField[];
|
||||
getEmails(): EmailField[];
|
||||
getEmails(label: Object): EmailField[];
|
||||
getFamilyName(): string;
|
||||
getFullName(): string;
|
||||
getGivenName(): string;
|
||||
getIMs(): IMField[];
|
||||
getIMs(label: Object): IMField[];
|
||||
getId(): string;
|
||||
getInitials(): string;
|
||||
getLastUpdated(): Date;
|
||||
getMaidenName(): string;
|
||||
getMiddleName(): string;
|
||||
getNickname(): string;
|
||||
getNotes(): string;
|
||||
getPhones(): PhoneField[];
|
||||
getPhones(label: Object): PhoneField[];
|
||||
getPrefix(): string;
|
||||
getPrimaryEmail(): string;
|
||||
getShortName(): string;
|
||||
getSuffix(): string;
|
||||
getUrls(): UrlField[];
|
||||
getUrls(label: Object): UrlField[];
|
||||
removeFromGroup(group: ContactGroup): Contact;
|
||||
setFamilyName(familyName: string): Contact;
|
||||
setFullName(fullName: string): Contact;
|
||||
setGivenName(givenName: string): Contact;
|
||||
setInitials(initials: string): Contact;
|
||||
setMaidenName(maidenName: string): Contact;
|
||||
setMiddleName(middleName: string): Contact;
|
||||
setNickname(nickname: string): Contact;
|
||||
setNotes(notes: string): Contact;
|
||||
setPrefix(prefix: string): Contact;
|
||||
setShortName(shortName: string): Contact;
|
||||
setSuffix(suffix: string): Contact;
|
||||
getEmailAddresses(): String[];
|
||||
getHomeAddress(): string;
|
||||
getHomeFax(): string;
|
||||
getHomePhone(): string;
|
||||
getMobilePhone(): string;
|
||||
getPager(): string;
|
||||
getUserDefinedField(key: string): string;
|
||||
getUserDefinedFields(): Object;
|
||||
getWorkAddress(): string;
|
||||
getWorkFax(): string;
|
||||
getWorkPhone(): string;
|
||||
setHomeAddress(addr: string): void;
|
||||
setHomeFax(phone: string): void;
|
||||
setHomePhone(phone: string): void;
|
||||
setMobilePhone(phone: string): void;
|
||||
setPager(phone: string): void;
|
||||
setPrimaryEmail(primaryEmail: string): void;
|
||||
setUserDefinedField(key: string, value: string): void;
|
||||
setUserDefinedFields(o: Object): void;
|
||||
setWorkAddress(addr: string): void;
|
||||
setWorkFax(phone: string): void;
|
||||
setWorkPhone(phone: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ContactGroup is is a group of contacts.
|
||||
*/
|
||||
export interface ContactGroup {
|
||||
addContact(contact: Contact): ContactGroup;
|
||||
deleteGroup(): void;
|
||||
getContacts(): Contact[];
|
||||
getId(): string;
|
||||
getName(): string;
|
||||
isSystemGroup(): boolean;
|
||||
removeContact(contact: Contact): ContactGroup;
|
||||
setName(name: string): ContactGroup;
|
||||
getGroupName(): string;
|
||||
setGroupName(name: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows users to access their own Google Contacts and create, remove, and update
|
||||
* contacts listed therein.
|
||||
*/
|
||||
export interface ContactsApp {
|
||||
ExtendedField: ExtendedField
|
||||
Field: Field
|
||||
Gender: Gender
|
||||
Month: Base.Month
|
||||
Priority: Priority
|
||||
Sensitivity: Sensitivity
|
||||
createContact(givenName: string, familyName: string, email: string): Contact;
|
||||
createContactGroup(name: string): ContactGroup;
|
||||
deleteContact(contact: Contact): void;
|
||||
deleteContactGroup(group: ContactGroup): void;
|
||||
getContact(emailAddress: string): Contact;
|
||||
getContactById(id: string): Contact;
|
||||
getContactGroup(name: string): ContactGroup;
|
||||
getContactGroupById(id: string): ContactGroup;
|
||||
getContactGroups(): ContactGroup[];
|
||||
getContacts(): Contact[];
|
||||
getContactsByAddress(query: string): Contact[];
|
||||
getContactsByAddress(query: string, label: Field): Contact[];
|
||||
getContactsByAddress(query: string, label: string): Contact[];
|
||||
getContactsByCompany(query: string): Contact[];
|
||||
getContactsByCustomField(query: Object, label: ExtendedField): Contact[];
|
||||
getContactsByDate(month: Base.Month, day: Integer, label: Field): Contact[];
|
||||
getContactsByDate(month: Base.Month, day: Integer, year: Integer, label: Field): Contact[];
|
||||
getContactsByDate(month: Base.Month, day: Integer, year: Integer, label: string): Contact[];
|
||||
getContactsByDate(month: Base.Month, day: Integer, label: string): Contact[];
|
||||
getContactsByEmailAddress(query: string): Contact[];
|
||||
getContactsByEmailAddress(query: string, label: Field): Contact[];
|
||||
getContactsByEmailAddress(query: string, label: string): Contact[];
|
||||
getContactsByGroup(group: ContactGroup): Contact[];
|
||||
getContactsByIM(query: string): Contact[];
|
||||
getContactsByIM(query: string, label: Field): Contact[];
|
||||
getContactsByIM(query: string, label: string): Contact[];
|
||||
getContactsByJobTitle(query: string): Contact[];
|
||||
getContactsByName(query: string): Contact[];
|
||||
getContactsByName(query: string, label: Field): Contact[];
|
||||
getContactsByNotes(query: string): Contact[];
|
||||
getContactsByPhone(query: string): Contact[];
|
||||
getContactsByPhone(query: string, label: Field): Contact[];
|
||||
getContactsByPhone(query: string, label: string): Contact[];
|
||||
getContactsByUrl(query: string): Contact[];
|
||||
getContactsByUrl(query: string, label: Field): Contact[];
|
||||
getContactsByUrl(query: string, label: string): Contact[];
|
||||
findByEmailAddress(email: string): Contact;
|
||||
findContactGroup(name: string): ContactGroup;
|
||||
getAllContacts(): Contact[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom field in a Contact.
|
||||
*/
|
||||
export interface CustomField {
|
||||
deleteCustomField(): void;
|
||||
getLabel(): Object;
|
||||
getValue(): Object;
|
||||
setLabel(field: ExtendedField): CustomField;
|
||||
setLabel(label: string): CustomField;
|
||||
setValue(value: Object): CustomField;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date field in a Contact.
|
||||
*/
|
||||
export interface DateField {
|
||||
deleteDateField(): void;
|
||||
getDay(): Integer;
|
||||
getLabel(): Object;
|
||||
getMonth(): Base.Month;
|
||||
getYear(): Integer;
|
||||
setDate(month: Base.Month, day: Integer): DateField;
|
||||
setDate(month: Base.Month, day: Integer, year: Integer): DateField;
|
||||
setLabel(label: Field): DateField;
|
||||
setLabel(label: string): DateField;
|
||||
}
|
||||
|
||||
/**
|
||||
* An email field in a Contact.
|
||||
*/
|
||||
export interface EmailField {
|
||||
deleteEmailField(): void;
|
||||
getAddress(): string;
|
||||
getDisplayName(): string;
|
||||
getLabel(): Object;
|
||||
isPrimary(): boolean;
|
||||
setAddress(address: string): EmailField;
|
||||
setAsPrimary(): EmailField;
|
||||
setDisplayName(name: string): EmailField;
|
||||
setLabel(field: Field): EmailField;
|
||||
setLabel(label: string): EmailField;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum for extended contacts fields.
|
||||
*/
|
||||
export enum ExtendedField { HOBBY, MILEAGE, LANGUAGE, GENDER, BILLING_INFORMATION, DIRECTORY_SERVER, SENSITIVITY, PRIORITY, HOME, WORK, USER, OTHER }
|
||||
|
||||
/**
|
||||
* An enum for contacts fields.
|
||||
*/
|
||||
export enum Field { FULL_NAME, GIVEN_NAME, MIDDLE_NAME, FAMILY_NAME, MAIDEN_NAME, NICKNAME, SHORT_NAME, INITIALS, PREFIX, SUFFIX, HOME_EMAIL, WORK_EMAIL, BIRTHDAY, ANNIVERSARY, HOME_ADDRESS, WORK_ADDRESS, ASSISTANT_PHONE, CALLBACK_PHONE, MAIN_PHONE, PAGER, HOME_FAX, WORK_FAX, HOME_PHONE, WORK_PHONE, MOBILE_PHONE, GOOGLE_VOICE, NOTES, GOOGLE_TALK, AIM, YAHOO, SKYPE, QQ, MSN, ICQ, JABBER, BLOG, FTP, PROFILE, HOME_PAGE, WORK_WEBSITE, HOME_WEBSITE, JOB_TITLE, COMPANY }
|
||||
|
||||
/**
|
||||
* An enum for contact gender.
|
||||
*/
|
||||
export enum Gender { MALE, FEMALE }
|
||||
|
||||
/**
|
||||
* An instant messaging field in a Contact.
|
||||
*/
|
||||
export interface IMField {
|
||||
deleteIMField(): void;
|
||||
getAddress(): string;
|
||||
getLabel(): Object;
|
||||
isPrimary(): boolean;
|
||||
setAddress(address: string): IMField;
|
||||
setAsPrimary(): IMField;
|
||||
setLabel(field: Field): IMField;
|
||||
setLabel(label: string): IMField;
|
||||
}
|
||||
|
||||
/**
|
||||
* A phone number field in a Contact.
|
||||
*/
|
||||
export interface PhoneField {
|
||||
deletePhoneField(): void;
|
||||
getLabel(): Object;
|
||||
getPhoneNumber(): string;
|
||||
isPrimary(): boolean;
|
||||
setAsPrimary(): PhoneField;
|
||||
setLabel(field: Field): PhoneField;
|
||||
setLabel(label: string): PhoneField;
|
||||
setPhoneNumber(number: string): PhoneField;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum for contact priority.
|
||||
*/
|
||||
export enum Priority { HIGH, LOW, NORMAL }
|
||||
|
||||
/**
|
||||
* An enum for contact sensitivity.
|
||||
*/
|
||||
export enum Sensitivity { CONFIDENTIAL, NORMAL, PERSONAL, PRIVATE }
|
||||
|
||||
/**
|
||||
* A URL field in a Contact.
|
||||
*/
|
||||
export interface UrlField {
|
||||
deleteUrlField(): void;
|
||||
getAddress(): string;
|
||||
getLabel(): Object;
|
||||
isPrimary(): boolean;
|
||||
setAddress(address: string): UrlField;
|
||||
setAsPrimary(): UrlField;
|
||||
setLabel(field: Field): UrlField;
|
||||
setLabel(label: string): UrlField;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var ContactsApp: GoogleAppsScript.Contacts.ContactsApp;
|
||||
@@ -0,0 +1,59 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Content {
|
||||
/**
|
||||
* Service for returning text content from a script.
|
||||
*
|
||||
* You can serve up text in various forms. For example, publish this script as a web app.
|
||||
*
|
||||
* function doGet() {
|
||||
* return ContentService.createTextOutput("Hello World");
|
||||
* }
|
||||
*/
|
||||
export interface ContentService {
|
||||
MimeType: MimeType
|
||||
createTextOutput(): TextOutput;
|
||||
createTextOutput(content: string): TextOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum for mime types that can be served from a script.
|
||||
*/
|
||||
export enum MimeType { ATOM, CSV, ICAL, JAVASCRIPT, JSON, RSS, TEXT, VCARD, XML }
|
||||
|
||||
/**
|
||||
* A TextOutput object that can be served from a script.
|
||||
*
|
||||
* Due to security considerations, scripts cannot directly return text content to a browser.
|
||||
* Instead, the browser is redirected to googleusercontent.com, which will display it without any
|
||||
* further sanitization or manipulation.
|
||||
*
|
||||
* You can return text content like this:
|
||||
*
|
||||
* function doGet() {
|
||||
* return ContentService.createPlainTextOutput("hello world!");
|
||||
* }
|
||||
*
|
||||
* ContentService
|
||||
*/
|
||||
export interface TextOutput {
|
||||
append(addedContent: string): TextOutput;
|
||||
clear(): TextOutput;
|
||||
downloadAsFile(filename: string): TextOutput;
|
||||
getContent(): string;
|
||||
getFileName(): string;
|
||||
getMimeType(): MimeType;
|
||||
setContent(content: string): TextOutput;
|
||||
setMimeType(mimeType: MimeType): TextOutput;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var ContentService: GoogleAppsScript.Content.ContentService;
|
||||
+1482
File diff suppressed because it is too large
Load Diff
+266
@@ -0,0 +1,266 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Drive {
|
||||
/**
|
||||
* An enum representing classes of users who can access a file or folder, besides any individual
|
||||
* users who have been explicitly given access. These properties can be accessed from
|
||||
* DriveApp.Access.
|
||||
*
|
||||
* // Creates a folder that anyone on the Internet can read from and write to. (Domain
|
||||
* // administrators can prohibit this setting for users of Google Apps for Business, Google Apps
|
||||
* // for Education, or Google Apps for Your Domain.)
|
||||
* var folder = DriveApp.createFolder('Shared Folder');
|
||||
* folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
|
||||
*/
|
||||
export enum Access { ANYONE, ANYONE_WITH_LINK, DOMAIN, DOMAIN_WITH_LINK, PRIVATE }
|
||||
|
||||
/**
|
||||
* Allows scripts to create, find, and modify files and folders in Google Drive.
|
||||
*
|
||||
* // Log the name of every file in the user's Drive.
|
||||
* var files = DriveApp.getFiles();
|
||||
* while (files.hasNext()) {
|
||||
* var file = files.next();
|
||||
* Logger.log(file.getName());
|
||||
* }
|
||||
*/
|
||||
export interface DriveApp {
|
||||
Access: Access
|
||||
Permission: Permission
|
||||
addFile(child: File): Folder;
|
||||
addFolder(child: Folder): Folder;
|
||||
continueFileIterator(continuationToken: string): FileIterator;
|
||||
continueFolderIterator(continuationToken: string): FolderIterator;
|
||||
createFile(blob: Base.BlobSource): File;
|
||||
createFile(name: string, content: string): File;
|
||||
createFile(name: string, content: string, mimeType: string): File;
|
||||
createFolder(name: string): Folder;
|
||||
getFileById(id: string): File;
|
||||
getFiles(): FileIterator;
|
||||
getFilesByName(name: string): FileIterator;
|
||||
getFilesByType(mimeType: string): FileIterator;
|
||||
getFolderById(id: string): Folder;
|
||||
getFolders(): FolderIterator;
|
||||
getFoldersByName(name: string): FolderIterator;
|
||||
getRootFolder(): Folder;
|
||||
getStorageLimit(): Integer;
|
||||
getStorageUsed(): Integer;
|
||||
getTrashedFiles(): FileIterator;
|
||||
getTrashedFolders(): FolderIterator;
|
||||
removeFile(child: File): Folder;
|
||||
removeFolder(child: Folder): Folder;
|
||||
searchFiles(params: string): FileIterator;
|
||||
searchFolders(params: string): FolderIterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file in Google Drive. Files can be accessed or created from DriveApp.
|
||||
*
|
||||
* // Trash every untitled spreadsheet that hasn't been updated in a week.
|
||||
* var files = DriveApp.getFilesByName('Untitled spreadsheet');
|
||||
* while (files.hasNext()) {
|
||||
* var file = files.next();
|
||||
* if (new Date() - file.getLastUpdated() > 7 * 24 * 60 * 60 * 1000) {
|
||||
* file.setTrashed(true);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
export interface File {
|
||||
addCommenter(emailAddress: string): File;
|
||||
addCommenter(user: Base.User): File;
|
||||
addCommenters(emailAddresses: String[]): File;
|
||||
addEditor(emailAddress: string): File;
|
||||
addEditor(user: Base.User): File;
|
||||
addEditors(emailAddresses: String[]): File;
|
||||
addViewer(emailAddress: string): File;
|
||||
addViewer(user: Base.User): File;
|
||||
addViewers(emailAddresses: String[]): File;
|
||||
getAccess(email: string): Permission;
|
||||
getAccess(user: Base.User): Permission;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getDateCreated(): Date;
|
||||
getDescription(): string;
|
||||
getDownloadUrl(): string;
|
||||
getEditors(): User[];
|
||||
getId(): string;
|
||||
getLastUpdated(): Date;
|
||||
getMimeType(): string;
|
||||
getName(): string;
|
||||
getOwner(): User;
|
||||
getParents(): FolderIterator;
|
||||
getSharingAccess(): Access;
|
||||
getSharingPermission(): Permission;
|
||||
getSize(): Integer;
|
||||
getThumbnail(): Base.Blob;
|
||||
getUrl(): string;
|
||||
getViewers(): User[];
|
||||
isShareableByEditors(): boolean;
|
||||
isStarred(): boolean;
|
||||
isTrashed(): boolean;
|
||||
makeCopy(): File;
|
||||
makeCopy(destination: Folder): File;
|
||||
makeCopy(name: string): File;
|
||||
makeCopy(name: string, destination: Folder): File;
|
||||
removeCommenter(emailAddress: string): File;
|
||||
removeCommenter(user: Base.User): File;
|
||||
removeEditor(emailAddress: string): File;
|
||||
removeEditor(user: Base.User): File;
|
||||
removeViewer(emailAddress: string): File;
|
||||
removeViewer(user: Base.User): File;
|
||||
revokePermissions(user: string): File;
|
||||
revokePermissions(user: Base.User): File;
|
||||
setContent(content: string): File;
|
||||
setDescription(description: string): File;
|
||||
setName(name: string): File;
|
||||
setOwner(emailAddress: string): File;
|
||||
setOwner(user: Base.User): File;
|
||||
setShareableByEditors(shareable: boolean): File;
|
||||
setSharing(accessType: Access, permissionType: Permission): File;
|
||||
setStarred(starred: boolean): File;
|
||||
setTrashed(trashed: boolean): File;
|
||||
}
|
||||
|
||||
/**
|
||||
* An iterator that allows scripts to iterate over a potentially large collection of files. File
|
||||
* iterators can be acccessed from DriveApp or a Folder.
|
||||
*
|
||||
* // Log the name of every file in the user's Drive.
|
||||
* var files = DriveApp.getFiles();
|
||||
* while (files.hasNext()) {
|
||||
* var file = files.next();
|
||||
* Logger.log(file.getName());
|
||||
* }
|
||||
*/
|
||||
export interface FileIterator {
|
||||
getContinuationToken(): string;
|
||||
hasNext(): boolean;
|
||||
next(): File;
|
||||
}
|
||||
|
||||
/**
|
||||
* A folder in Google Drive. Folders can be accessed or created from DriveApp.
|
||||
*
|
||||
* // Log the name of every folder in the user's Drive.
|
||||
* var folders = DriveApp.getFolders();
|
||||
* while (folders.hasNext()) {
|
||||
* var folder = folders.next();
|
||||
* Logger.log(folder.getName());
|
||||
* }
|
||||
*/
|
||||
export interface Folder {
|
||||
addEditor(emailAddress: string): Folder;
|
||||
addEditor(user: Base.User): Folder;
|
||||
addEditors(emailAddresses: String[]): Folder;
|
||||
addFile(child: File): Folder;
|
||||
addFolder(child: Folder): Folder;
|
||||
addViewer(emailAddress: string): Folder;
|
||||
addViewer(user: Base.User): Folder;
|
||||
addViewers(emailAddresses: String[]): Folder;
|
||||
createFile(blob: Base.BlobSource): File;
|
||||
createFile(name: string, content: string): File;
|
||||
createFile(name: string, content: string, mimeType: string): File;
|
||||
createFolder(name: string): Folder;
|
||||
getAccess(email: string): Permission;
|
||||
getAccess(user: Base.User): Permission;
|
||||
getDateCreated(): Date;
|
||||
getDescription(): string;
|
||||
getEditors(): User[];
|
||||
getFiles(): FileIterator;
|
||||
getFilesByName(name: string): FileIterator;
|
||||
getFilesByType(mimeType: string): FileIterator;
|
||||
getFolders(): FolderIterator;
|
||||
getFoldersByName(name: string): FolderIterator;
|
||||
getId(): string;
|
||||
getLastUpdated(): Date;
|
||||
getName(): string;
|
||||
getOwner(): User;
|
||||
getParents(): FolderIterator;
|
||||
getSharingAccess(): Access;
|
||||
getSharingPermission(): Permission;
|
||||
getSize(): Integer;
|
||||
getUrl(): string;
|
||||
getViewers(): User[];
|
||||
isShareableByEditors(): boolean;
|
||||
isStarred(): boolean;
|
||||
isTrashed(): boolean;
|
||||
removeEditor(emailAddress: string): Folder;
|
||||
removeEditor(user: Base.User): Folder;
|
||||
removeFile(child: File): Folder;
|
||||
removeFolder(child: Folder): Folder;
|
||||
removeViewer(emailAddress: string): Folder;
|
||||
removeViewer(user: Base.User): Folder;
|
||||
revokePermissions(user: string): Folder;
|
||||
revokePermissions(user: Base.User): Folder;
|
||||
searchFiles(params: string): FileIterator;
|
||||
searchFolders(params: string): FolderIterator;
|
||||
setDescription(description: string): Folder;
|
||||
setName(name: string): Folder;
|
||||
setOwner(emailAddress: string): Folder;
|
||||
setOwner(user: Base.User): Folder;
|
||||
setShareableByEditors(shareable: boolean): Folder;
|
||||
setSharing(accessType: Access, permissionType: Permission): Folder;
|
||||
setStarred(starred: boolean): Folder;
|
||||
setTrashed(trashed: boolean): Folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that allows scripts to iterate over a potentially large collection of folders. Folder
|
||||
* iterators can be acccessed from DriveApp, a File, or a Folder.
|
||||
*
|
||||
* // Log the name of every folder in the user's Drive.
|
||||
* var folders = DriveApp.getFolders();
|
||||
* while (folders.hasNext()) {
|
||||
* var folder = folders.next();
|
||||
* Logger.log(folder.getName());
|
||||
* }
|
||||
*/
|
||||
export interface FolderIterator {
|
||||
getContinuationToken(): string;
|
||||
hasNext(): boolean;
|
||||
next(): Folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the permissions granted to users who can access a file or folder, besides
|
||||
* any individual users who have been explicitly given access. These properties can be accessed from
|
||||
* DriveApp.Permission.
|
||||
*
|
||||
* // Creates a folder that anyone on the Internet can read from and write to. (Domain
|
||||
* // administrators can prohibit this setting for users of Google Apps for Business, Google Apps
|
||||
* // for Education, or Google Apps for Your Domain.)
|
||||
* var folder = DriveApp.createFolder('Shared Folder');
|
||||
* folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
|
||||
*/
|
||||
export enum Permission { VIEW, EDIT, COMMENT, OWNER, NONE }
|
||||
|
||||
/**
|
||||
* A user associated with a file in Google Drive. Users can be accessed from
|
||||
* File.getEditors(), Folder.getViewers(), and other methods.
|
||||
*
|
||||
* // Log the email address of all users who have edit access to a file.
|
||||
* var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var editors = file.getEditors();
|
||||
* for (var i = 0; i < editors.length; i++) {
|
||||
* Logger.log(editors[i].getEmail());
|
||||
* }
|
||||
*/
|
||||
export interface User {
|
||||
getDomain(): string;
|
||||
getEmail(): string;
|
||||
getName(): string;
|
||||
getPhotoUrl(): string;
|
||||
getUserLoginId(): string;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var DriveApp: GoogleAppsScript.Drive.DriveApp;
|
||||
+754
@@ -0,0 +1,754 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Forms {
|
||||
/**
|
||||
* An enum representing the supported types of image alignment. Alignment types can be accessed from
|
||||
* FormApp.Alignment.
|
||||
*
|
||||
* // Open a form by ID and add a new image item with alignment
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var img = UrlFetchApp.fetch('https://www.google.com/images/srpr/logo4w.png');
|
||||
* form.addImageItem()
|
||||
* .setImage(img)
|
||||
* .setAlignment(FormApp.Alignment.CENTER);
|
||||
*/
|
||||
export enum Alignment { LEFT, CENTER, RIGHT }
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to select one or more checkboxes, as well as an
|
||||
* optional "other" field. Items can be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new checkbox item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addCheckboxItem();
|
||||
* item.setTitle('What condiments would you like on your hot dog?')
|
||||
* .setChoices([
|
||||
* item.createChoice('Ketchup'),
|
||||
* item.createChoice('Mustard'),
|
||||
* item.createChoice('Relish')
|
||||
* ])
|
||||
* .showOtherOption(true);
|
||||
*/
|
||||
export interface CheckboxItem {
|
||||
createChoice(value: string): Choice;
|
||||
createResponse(responses: String[]): ItemResponse;
|
||||
duplicate(): CheckboxItem;
|
||||
getChoices(): Choice[];
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
hasOtherOption(): boolean;
|
||||
isRequired(): boolean;
|
||||
setChoiceValues(values: String[]): CheckboxItem;
|
||||
setChoices(choices: Choice[]): CheckboxItem;
|
||||
setHelpText(text: string): CheckboxItem;
|
||||
setRequired(enabled: boolean): CheckboxItem;
|
||||
setTitle(title: string): CheckboxItem;
|
||||
showOtherOption(enabled: boolean): CheckboxItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single choice associated with a type of Item that supports choices, like
|
||||
* CheckboxItem, ListItem, or MultipleChoiceItem.
|
||||
*
|
||||
* // Create a new form and add a multiple-choice item.
|
||||
* var form = FormApp.create('Form Name');
|
||||
* var item = form.addMultipleChoiceItem();
|
||||
* item.setTitle('Do you prefer cats or dogs?')
|
||||
* .setChoices([
|
||||
* item.createChoice('Cats', FormApp.PageNavigationType.CONTINUE),
|
||||
* item.createChoice('Dogs', FormApp.PageNavigationType.RESTART)
|
||||
* ]);
|
||||
*
|
||||
* // Add another page because navigation has no effect on the last page.
|
||||
* form.addPageBreakItem().setTitle('You chose well!');
|
||||
*
|
||||
* // Log the navigation types that each choice results in.
|
||||
* var choices = item.getChoices();
|
||||
* for (var i = 0; i < choices.length; i++) {
|
||||
* Logger.log('If the respondent chooses "%s", the form will %s.',
|
||||
* choices[i].getValue(),
|
||||
* choices[i].getPageNavigationType());
|
||||
* }
|
||||
*/
|
||||
export interface Choice {
|
||||
getGotoPage(): PageBreakItem;
|
||||
getPageNavigationType(): PageNavigationType;
|
||||
getValue(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to indicate a date. Items can be accessed or created
|
||||
* from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new date item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addDateItem();
|
||||
* item.setTitle('When were you born?');
|
||||
*/
|
||||
export interface DateItem {
|
||||
createResponse(response: Date): ItemResponse;
|
||||
duplicate(): DateItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
includesYear(): boolean;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): DateItem;
|
||||
setIncludesYear(enableYear: boolean): DateItem;
|
||||
setRequired(enabled: boolean): DateItem;
|
||||
setTitle(title: string): DateItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to indicate a date and time. Items can be accessed or
|
||||
* created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new date-time item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addDateTimeItem();
|
||||
* item.setTitle('When do you want to meet?');
|
||||
*/
|
||||
export interface DateTimeItem {
|
||||
createResponse(response: Date): ItemResponse;
|
||||
duplicate(): DateTimeItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
includesYear(): boolean;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): DateTimeItem;
|
||||
setIncludesYear(enableYear: boolean): DateTimeItem;
|
||||
setRequired(enabled: boolean): DateTimeItem;
|
||||
setTitle(title: string): DateTimeItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the supported types of form-response destinations. All forms, including
|
||||
* those that do not have a destination set explicitly,
|
||||
* save
|
||||
* a copy of responses in the form's response store. Destination types can be accessed from
|
||||
* FormApp.DestinationType.
|
||||
*
|
||||
* // Open a form by ID and create a new spreadsheet.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var ss = SpreadsheetApp.create('Spreadsheet Name');
|
||||
*
|
||||
* // Update the form's response destination.
|
||||
* form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
|
||||
*/
|
||||
export enum DestinationType { SPREADSHEET }
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to indicate a length of time. Items can be accessed or
|
||||
* created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new duration item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addDurationItem();
|
||||
* item.setTitle('How long can you hold your breath?');
|
||||
*/
|
||||
export interface DurationItem {
|
||||
createResponse(hours: Integer, minutes: Integer, seconds: Integer): ItemResponse;
|
||||
duplicate(): DurationItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): DurationItem;
|
||||
setRequired(enabled: boolean): DurationItem;
|
||||
setTitle(title: string): DurationItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A form that contains overall properties (such as title, settings, and where responses are stored)
|
||||
* and items (which includes question items like checkboxes and layout items like page breaks).
|
||||
* Forms can be accessed or created from FormApp.
|
||||
*
|
||||
* // Open a form by ID and create a new spreadsheet.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var ss = SpreadsheetApp.create('Spreadsheet Name');
|
||||
*
|
||||
* // Update form properties via chaining.
|
||||
* form.setTitle('Form Name')
|
||||
* .setDescription('Description of form')
|
||||
* .setConfirmationMessage('Thanks for responding!')
|
||||
* .setAllowResponseEdits(true)
|
||||
* .setAcceptingResponses(false);
|
||||
*
|
||||
* // Update the form's response destination.
|
||||
* form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
|
||||
*/
|
||||
export interface Form {
|
||||
addCheckboxItem(): CheckboxItem;
|
||||
addDateItem(): DateItem;
|
||||
addDateTimeItem(): DateTimeItem;
|
||||
addDurationItem(): DurationItem;
|
||||
addEditor(emailAddress: string): Form;
|
||||
addEditor(user: Base.User): Form;
|
||||
addEditors(emailAddresses: String[]): Form;
|
||||
addGridItem(): GridItem;
|
||||
addImageItem(): ImageItem;
|
||||
addListItem(): ListItem;
|
||||
addMultipleChoiceItem(): MultipleChoiceItem;
|
||||
addPageBreakItem(): PageBreakItem;
|
||||
addParagraphTextItem(): ParagraphTextItem;
|
||||
addScaleItem(): ScaleItem;
|
||||
addSectionHeaderItem(): SectionHeaderItem;
|
||||
addTextItem(): TextItem;
|
||||
addTimeItem(): TimeItem;
|
||||
addVideoItem(): VideoItem;
|
||||
canEditResponse(): boolean;
|
||||
collectsEmail(): boolean;
|
||||
createResponse(): FormResponse;
|
||||
deleteAllResponses(): Form;
|
||||
deleteItem(index: Integer): void;
|
||||
deleteItem(item: Item): void;
|
||||
getConfirmationMessage(): string;
|
||||
getCustomClosedFormMessage(): string;
|
||||
getDescription(): string;
|
||||
getDestinationId(): string;
|
||||
getDestinationType(): DestinationType;
|
||||
getEditUrl(): string;
|
||||
getEditors(): Base.User[];
|
||||
getId(): string;
|
||||
getItemById(id: Integer): Item;
|
||||
getItems(): Item[];
|
||||
getItems(itemType: ItemType): Item[];
|
||||
getPublishedUrl(): string;
|
||||
getResponse(responseId: string): FormResponse;
|
||||
getResponses(): FormResponse[];
|
||||
getResponses(timestamp: Date): FormResponse[];
|
||||
getShuffleQuestions(): boolean;
|
||||
getSummaryUrl(): string;
|
||||
getTitle(): string;
|
||||
hasLimitOneResponsePerUser(): boolean;
|
||||
hasProgressBar(): boolean;
|
||||
hasRespondAgainLink(): boolean;
|
||||
isAcceptingResponses(): boolean;
|
||||
isPublishingSummary(): boolean;
|
||||
moveItem(from: Integer, to: Integer): Item;
|
||||
moveItem(item: Item, toIndex: Integer): Item;
|
||||
removeDestination(): Form;
|
||||
removeEditor(emailAddress: string): Form;
|
||||
removeEditor(user: Base.User): Form;
|
||||
requiresLogin(): boolean;
|
||||
setAcceptingResponses(enabled: boolean): Form;
|
||||
setAllowResponseEdits(enabled: boolean): Form;
|
||||
setCollectEmail(collect: boolean): Form;
|
||||
setConfirmationMessage(message: string): Form;
|
||||
setCustomClosedFormMessage(message: string): Form;
|
||||
setDescription(description: string): Form;
|
||||
setDestination(type: DestinationType, id: string): Form;
|
||||
setLimitOneResponsePerUser(enabled: boolean): Form;
|
||||
setProgressBar(enabled: boolean): Form;
|
||||
setPublishingSummary(enabled: boolean): Form;
|
||||
setRequireLogin(requireLogin: boolean): Form;
|
||||
setShowLinkToRespondAgain(enabled: boolean): Form;
|
||||
setShuffleQuestions(shuffle: boolean): Form;
|
||||
setTitle(title: string): Form;
|
||||
shortenFormUrl(url: string): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows a script to open existing Forms or create new ones.
|
||||
*
|
||||
* // Open a form by ID.
|
||||
* var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
*
|
||||
* // Create and open a form.
|
||||
* var newForm = FormApp.create('Form Name');
|
||||
*/
|
||||
export interface FormApp {
|
||||
Alignment: Alignment
|
||||
DestinationType: DestinationType
|
||||
ItemType: ItemType
|
||||
PageNavigationType: PageNavigationType
|
||||
create(title: string): Form;
|
||||
getActiveForm(): Form;
|
||||
getUi(): Base.Ui;
|
||||
openById(id: string): Form;
|
||||
openByUrl(url: string): Form;
|
||||
}
|
||||
|
||||
/**
|
||||
* A response to the form as a whole. Form responses have three main uses: they contain the answers
|
||||
* submitted by a respondent (see getItemResponses(), they can be used to programmatically
|
||||
* respond to the form (see withItemResponse(response) and submit()), and they
|
||||
* can be used as a template to create a URL for the form with pre-filled answers. Form responses
|
||||
* can be created or accessed from a Form.
|
||||
*
|
||||
* // Open a form by ID and log the responses to each question.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var formResponses = form.getResponses();
|
||||
* for (var i = 0; i < formResponses.length; i++) {
|
||||
* var formResponse = formResponses[i];
|
||||
* var itemResponses = formResponse.getItemResponses();
|
||||
* for (var j = 0; j < itemResponses.length; j++) {
|
||||
* var itemResponse = itemResponses[j];
|
||||
* Logger.log('Response #%s to the question "%s" was "%s"',
|
||||
* (i + 1).toString(),
|
||||
* itemResponse.getItem().getTitle(),
|
||||
* itemResponse.getResponse());
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
export interface FormResponse {
|
||||
getEditResponseUrl(): string;
|
||||
getId(): string;
|
||||
getItemResponses(): ItemResponse[];
|
||||
getRespondentEmail(): string;
|
||||
getResponseForItem(item: Item): ItemResponse;
|
||||
getTimestamp(): Date;
|
||||
submit(): FormResponse;
|
||||
toPrefilledUrl(): string;
|
||||
withItemResponse(response: ItemResponse): FormResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item, presented as a grid of columns and rows, that allows the respondent to select
|
||||
* one choice per row from a sequence of radio buttons. Items can be accessed or created from a
|
||||
* Form.
|
||||
*
|
||||
* // Open a form by ID and add a new grid item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addGridItem();
|
||||
* item.setTitle('Rate your interests')
|
||||
* .setRows(['Cars', 'Computers', 'Celebrities'])
|
||||
* .setColumns(['Boring', 'So-so', 'Interesting']);
|
||||
*/
|
||||
export interface GridItem {
|
||||
createResponse(responses: String[]): ItemResponse;
|
||||
duplicate(): GridItem;
|
||||
getColumns(): String[];
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getRows(): String[];
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setColumns(columns: String[]): GridItem;
|
||||
setHelpText(text: string): GridItem;
|
||||
setRequired(enabled: boolean): GridItem;
|
||||
setRows(rows: String[]): GridItem;
|
||||
setTitle(title: string): GridItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A layout item that displays an image. Items can be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new image item
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var img = UrlFetchApp.fetch('https://www.google.com/images/srpr/logo4w.png');
|
||||
* form.addImageItem()
|
||||
* .setTitle('Google')
|
||||
* .setHelpText('Google Logo') // The help text is the image description
|
||||
* .setImage(img);
|
||||
*/
|
||||
export interface ImageItem {
|
||||
duplicate(): ImageItem;
|
||||
getAlignment(): Alignment;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getImage(): Base.Blob;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
getWidth(): Integer;
|
||||
setAlignment(alignment: Alignment): ImageItem;
|
||||
setHelpText(text: string): ImageItem;
|
||||
setImage(image: Base.BlobSource): ImageItem;
|
||||
setTitle(title: string): ImageItem;
|
||||
setWidth(width: Integer): ImageItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic form item that contains properties common to all items, such as title and help text.
|
||||
* Items can be accessed or created from a Form.
|
||||
*
|
||||
* To operate on type-specific properties, use getType() to check the item's
|
||||
* ItemType, then cast the item to the
|
||||
* appropriate class using a method like asCheckboxItem().
|
||||
*
|
||||
* // Create a new form and add a text item.
|
||||
* var form = FormApp.create('Form Name');
|
||||
* form.addTextItem();
|
||||
*
|
||||
* // Access the text item as a generic item.
|
||||
* var items = form.getItems();
|
||||
* var item = items[0];
|
||||
*
|
||||
* // Cast the generic item to the text-item class.
|
||||
* if (item.getType() == 'TEXT') {
|
||||
* var textItem = item.asTextItem();
|
||||
* textItem.setRequired(false);
|
||||
* }
|
||||
*/
|
||||
export interface Item {
|
||||
asCheckboxItem(): CheckboxItem;
|
||||
asDateItem(): DateItem;
|
||||
asDateTimeItem(): DateTimeItem;
|
||||
asDurationItem(): DurationItem;
|
||||
asGridItem(): GridItem;
|
||||
asImageItem(): ImageItem;
|
||||
asListItem(): ListItem;
|
||||
asMultipleChoiceItem(): MultipleChoiceItem;
|
||||
asPageBreakItem(): PageBreakItem;
|
||||
asParagraphTextItem(): ParagraphTextItem;
|
||||
asScaleItem(): ScaleItem;
|
||||
asSectionHeaderItem(): SectionHeaderItem;
|
||||
asTextItem(): TextItem;
|
||||
asTimeItem(): TimeItem;
|
||||
asVideoItem(): VideoItem;
|
||||
duplicate(): Item;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
setHelpText(text: string): Item;
|
||||
setTitle(title: string): Item;
|
||||
}
|
||||
|
||||
/**
|
||||
* A response to one question item within a form. Item responses can be accessed from
|
||||
* FormResponse and created from any Item that asks the respondent to answer a
|
||||
* question.
|
||||
*
|
||||
* // Open a form by ID and log the responses to each question.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var formResponses = form.getResponses();
|
||||
* for (var i = 0; i < formResponses.length; i++) {
|
||||
* var formResponse = formResponses[i];
|
||||
* var itemResponses = formResponse.getItemResponses();
|
||||
* for (var j = 0; j < itemResponses.length; j++) {
|
||||
* var itemResponse = itemResponses[j];
|
||||
* Logger.log('Response #%s to the question "%s" was "%s"',
|
||||
* (i + 1).toString(),
|
||||
* itemResponse.getItem().getTitle(),
|
||||
* itemResponse.getResponse());
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
export interface ItemResponse {
|
||||
getItem(): Item;
|
||||
getResponse(): Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the supported types of form items. Item types can be accessed from
|
||||
* FormApp.ItemType.
|
||||
*
|
||||
* // Open a form by ID and add a new section header.
|
||||
* var form = FormApp.create('Form Name');
|
||||
* var item = form.addSectionHeaderItem();
|
||||
* item.setTitle('Title of new section');
|
||||
*
|
||||
* // Check the item type.
|
||||
* if (item.getType() == FormApp.ItemType.SECTION_HEADER) {
|
||||
* item.setHelpText('Description of new section.');
|
||||
* }
|
||||
*/
|
||||
export enum ItemType { CHECKBOX, DATE, DATETIME, DURATION, GRID, IMAGE, LIST, MULTIPLE_CHOICE, PAGE_BREAK, PARAGRAPH_TEXT, SCALE, SECTION_HEADER, TEXT, TIME }
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to select one choice from a drop-down list. Items can
|
||||
* be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new list item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addListItem();
|
||||
* item.setTitle('Do you prefer cats or dogs?')
|
||||
* .setChoices([
|
||||
* item.createChoice('Cats'),
|
||||
* item.createChoice('Dogs')
|
||||
* ]);
|
||||
*/
|
||||
export interface ListItem {
|
||||
createChoice(value: string): Choice;
|
||||
createChoice(value: string, navigationItem: PageBreakItem): Choice;
|
||||
createChoice(value: string, navigationType: PageNavigationType): Choice;
|
||||
createResponse(response: string): ItemResponse;
|
||||
duplicate(): ListItem;
|
||||
getChoices(): Choice[];
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setChoiceValues(values: String[]): ListItem;
|
||||
setChoices(choices: Choice[]): ListItem;
|
||||
setHelpText(text: string): ListItem;
|
||||
setRequired(enabled: boolean): ListItem;
|
||||
setTitle(title: string): ListItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to select one choice from a list of radio buttons or
|
||||
* an optional "other" field. Items can be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new multiple choice item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addMultipleChoiceItem();
|
||||
* item.setTitle('Do you prefer cats or dogs?')
|
||||
* .setChoices([
|
||||
* item.createChoice('Cats'),
|
||||
* item.createChoice('Dogs')
|
||||
* ])
|
||||
* .showOtherOption(true);
|
||||
*/
|
||||
export interface MultipleChoiceItem {
|
||||
createChoice(value: string): Choice;
|
||||
createChoice(value: string, navigationItem: PageBreakItem): Choice;
|
||||
createChoice(value: string, navigationType: PageNavigationType): Choice;
|
||||
createResponse(response: string): ItemResponse;
|
||||
duplicate(): MultipleChoiceItem;
|
||||
getChoices(): Choice[];
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
hasOtherOption(): boolean;
|
||||
isRequired(): boolean;
|
||||
setChoiceValues(values: String[]): MultipleChoiceItem;
|
||||
setChoices(choices: Choice[]): MultipleChoiceItem;
|
||||
setHelpText(text: string): MultipleChoiceItem;
|
||||
setRequired(enabled: boolean): MultipleChoiceItem;
|
||||
setTitle(title: string): MultipleChoiceItem;
|
||||
showOtherOption(enabled: boolean): MultipleChoiceItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A layout item that marks the start of a page. Items can be accessed or
|
||||
* created from a Form.
|
||||
*
|
||||
* // Create a form and add three page-break items.
|
||||
* var form = FormApp.create('Form Name');
|
||||
* var pageTwo = form.addPageBreakItem().setTitle('Page Two');
|
||||
* var pageThree = form.addPageBreakItem().setTitle('Page Three');
|
||||
*
|
||||
* // Make the first two pages navigate elsewhere upon completion.
|
||||
* pageTwo.setGoToPage(pageThree); // At end of page one (start of page two), jump to page three
|
||||
* pageThree.setGoToPage(FormApp.PageNavigationType.RESTART); // At end of page two, restart form
|
||||
*/
|
||||
export interface PageBreakItem {
|
||||
duplicate(): PageBreakItem;
|
||||
getGoToPage(): PageBreakItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getPageNavigationType(): PageNavigationType;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
setGoToPage(goToPageItem: PageBreakItem): PageBreakItem;
|
||||
setGoToPage(navigationType: PageNavigationType): PageBreakItem;
|
||||
setHelpText(text: string): PageBreakItem;
|
||||
setTitle(title: string): PageBreakItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the supported types of page navigation. Page navigation types can be
|
||||
* accessed from FormApp.PageNavigationType.
|
||||
*
|
||||
* The page navigation occurs after the respondent completes a page that contains the option, and
|
||||
* only if the respondent chose that option. If the respondent chose multiple options with
|
||||
* page-navigation instructions on the same page, only the last navigation option has any effect.
|
||||
* Page navigation also has no effect on the last page of a form.
|
||||
* Choices that use page navigation cannot be combined in the same item with choices that do not
|
||||
* use page navigation.
|
||||
*
|
||||
* // Create a form and add a new multiple-choice item and a page-break item.
|
||||
* var form = FormApp.create('Form Name');
|
||||
* var item = form.addMultipleChoiceItem();
|
||||
* var pageBreak = form.addPageBreakItem();
|
||||
*
|
||||
* // Set some choices with go-to-page logic.
|
||||
* var rightChoice = item.createChoice('Vanilla', FormApp.PageNavigationType.SUBMIT);
|
||||
* var wrongChoice = item.createChoice('Chocolate', FormApp.PageNavigationType.RESTART);
|
||||
*
|
||||
* // For GO_TO_PAGE, just pass in the page break item. For CONTINUE (normally the default), pass in
|
||||
* // CONTINUE explicitly because page navigation cannot be mixed with non-navigation choices.
|
||||
* var iffyChoice = item.createChoice('Peanut', pageBreak);
|
||||
* var otherChoice = item.createChoice('Strawberry', FormApp.PageNavigationType.CONTINUE);
|
||||
* item.setChoices([rightChoice, wrongChoice, iffyChoice, otherChoice]);
|
||||
*/
|
||||
export enum PageNavigationType { CONTINUE, GO_TO_PAGE, RESTART, SUBMIT }
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to enter a block of text. Items can be accessed or
|
||||
* created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new paragraph text item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addParagraphTextItem();
|
||||
* item.setTitle('What is your address?');
|
||||
*/
|
||||
export interface ParagraphTextItem {
|
||||
createResponse(response: string): ItemResponse;
|
||||
duplicate(): ParagraphTextItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): ParagraphTextItem;
|
||||
setRequired(enabled: boolean): ParagraphTextItem;
|
||||
setTitle(title: string): ParagraphTextItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to choose one option from a numbered sequence of radio
|
||||
* buttons. Items can be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new scale item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addScaleItem();
|
||||
* item.setTitle('Pick a number between 1 and 10')
|
||||
* .setBounds(1, 10);
|
||||
*/
|
||||
export interface ScaleItem {
|
||||
createResponse(response: Integer): ItemResponse;
|
||||
duplicate(): ScaleItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getLeftLabel(): string;
|
||||
getLowerBound(): Integer;
|
||||
getRightLabel(): string;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
getUpperBound(): Integer;
|
||||
isRequired(): boolean;
|
||||
setBounds(lower: Integer, upper: Integer): ScaleItem;
|
||||
setHelpText(text: string): ScaleItem;
|
||||
setLabels(lower: string, upper: string): ScaleItem;
|
||||
setRequired(enabled: boolean): ScaleItem;
|
||||
setTitle(title: string): ScaleItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A layout item that visually indicates the start of a section. Items can be accessed or created
|
||||
* from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new section header.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addSectionHeaderItem();
|
||||
* item.setTitle('Title of new section');
|
||||
*/
|
||||
export interface SectionHeaderItem {
|
||||
duplicate(): SectionHeaderItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
setHelpText(text: string): SectionHeaderItem;
|
||||
setTitle(title: string): SectionHeaderItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to enter a single line of text. Items can be accessed
|
||||
* or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new text item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addTextItem();
|
||||
* item.setTitle('What is your name?');
|
||||
*/
|
||||
export interface TextItem {
|
||||
createResponse(response: string): ItemResponse;
|
||||
duplicate(): TextItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): TextItem;
|
||||
setRequired(enabled: boolean): TextItem;
|
||||
setTitle(title: string): TextItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A question item that allows the respondent to indicate a time of day. Items can be accessed or
|
||||
* created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add a new time item.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* var item = form.addTimeItem();
|
||||
* item.setTitle('What time do you usually wake up in the morning?');
|
||||
*/
|
||||
export interface TimeItem {
|
||||
createResponse(hour: Integer, minute: Integer): ItemResponse;
|
||||
duplicate(): TimeItem;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
isRequired(): boolean;
|
||||
setHelpText(text: string): TimeItem;
|
||||
setRequired(enabled: boolean): TimeItem;
|
||||
setTitle(title: string): TimeItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A layout item that displays a video. Items can be accessed or created from a Form.
|
||||
*
|
||||
* // Open a form by ID and add three new video items, using a long URL,
|
||||
* // a short URL, and a video ID.
|
||||
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
|
||||
* form.addVideoItem()
|
||||
* .setTitle('Video Title')
|
||||
* .setHelpText('Video Caption')
|
||||
* .setVideoUrl('www.youtube.com/watch?v=1234abcdxyz');
|
||||
*
|
||||
* form.addVideoItem()
|
||||
* .setTitle('Video Title')
|
||||
* .setHelpText('Video Caption')
|
||||
* .setVideoUrl('youtu.be/1234abcdxyz');
|
||||
*
|
||||
* form.addVideoItem()
|
||||
* .setTitle('Video Title')
|
||||
* .setHelpText('Video Caption')
|
||||
* .setVideoUrl('1234abcdxyz');
|
||||
*/
|
||||
export interface VideoItem {
|
||||
duplicate(): VideoItem;
|
||||
getAlignment(): Alignment;
|
||||
getHelpText(): string;
|
||||
getId(): Integer;
|
||||
getIndex(): Integer;
|
||||
getTitle(): string;
|
||||
getType(): ItemType;
|
||||
getWidth(): Integer;
|
||||
setAlignment(alignment: Alignment): VideoItem;
|
||||
setHelpText(text: string): VideoItem;
|
||||
setTitle(title: string): VideoItem;
|
||||
setVideoUrl(youtubeUrl: string): VideoItem;
|
||||
setWidth(width: Integer): VideoItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var FormApp: GoogleAppsScript.Forms.FormApp;
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Gmail {
|
||||
/**
|
||||
* Provides access to Gmail threads, messages, and labels.
|
||||
*/
|
||||
export interface GmailApp {
|
||||
createLabel(name: string): GmailLabel;
|
||||
deleteLabel(label: GmailLabel): GmailApp;
|
||||
getAliases(): String[];
|
||||
getChatThreads(): GmailThread[];
|
||||
getChatThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getDraftMessages(): GmailMessage[];
|
||||
getInboxThreads(): GmailThread[];
|
||||
getInboxThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getInboxUnreadCount(): Integer;
|
||||
getMessageById(id: string): GmailMessage;
|
||||
getMessagesForThread(thread: GmailThread): GmailMessage[];
|
||||
getMessagesForThreads(threads: GmailThread[]): GmailMessage[][];
|
||||
getPriorityInboxThreads(): GmailThread[];
|
||||
getPriorityInboxThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getPriorityInboxUnreadCount(): Integer;
|
||||
getSpamThreads(): GmailThread[];
|
||||
getSpamThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getSpamUnreadCount(): Integer;
|
||||
getStarredThreads(): GmailThread[];
|
||||
getStarredThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getStarredUnreadCount(): Integer;
|
||||
getThreadById(id: string): GmailThread;
|
||||
getTrashThreads(): GmailThread[];
|
||||
getTrashThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getUserLabelByName(name: string): GmailLabel;
|
||||
getUserLabels(): GmailLabel[];
|
||||
markMessageRead(message: GmailMessage): GmailApp;
|
||||
markMessageUnread(message: GmailMessage): GmailApp;
|
||||
markMessagesRead(messages: GmailMessage[]): GmailApp;
|
||||
markMessagesUnread(messages: GmailMessage[]): GmailApp;
|
||||
markThreadImportant(thread: GmailThread): GmailApp;
|
||||
markThreadRead(thread: GmailThread): GmailApp;
|
||||
markThreadUnimportant(thread: GmailThread): GmailApp;
|
||||
markThreadUnread(thread: GmailThread): GmailApp;
|
||||
markThreadsImportant(threads: GmailThread[]): GmailApp;
|
||||
markThreadsRead(threads: GmailThread[]): GmailApp;
|
||||
markThreadsUnimportant(threads: GmailThread[]): GmailApp;
|
||||
markThreadsUnread(threads: GmailThread[]): GmailApp;
|
||||
moveMessageToTrash(message: GmailMessage): GmailApp;
|
||||
moveMessagesToTrash(messages: GmailMessage[]): GmailApp;
|
||||
moveThreadToArchive(thread: GmailThread): GmailApp;
|
||||
moveThreadToInbox(thread: GmailThread): GmailApp;
|
||||
moveThreadToSpam(thread: GmailThread): GmailApp;
|
||||
moveThreadToTrash(thread: GmailThread): GmailApp;
|
||||
moveThreadsToArchive(threads: GmailThread[]): GmailApp;
|
||||
moveThreadsToInbox(threads: GmailThread[]): GmailApp;
|
||||
moveThreadsToSpam(threads: GmailThread[]): GmailApp;
|
||||
moveThreadsToTrash(threads: GmailThread[]): GmailApp;
|
||||
refreshMessage(message: GmailMessage): GmailApp;
|
||||
refreshMessages(messages: GmailMessage[]): GmailApp;
|
||||
refreshThread(thread: GmailThread): GmailApp;
|
||||
refreshThreads(threads: GmailThread[]): GmailApp;
|
||||
search(query: string): GmailThread[];
|
||||
search(query: string, start: Integer, max: Integer): GmailThread[];
|
||||
sendEmail(recipient: string, subject: string, body: string): GmailApp;
|
||||
sendEmail(recipient: string, subject: string, body: string, options: Object): GmailApp;
|
||||
starMessage(message: GmailMessage): GmailApp;
|
||||
starMessages(messages: GmailMessage[]): GmailApp;
|
||||
unstarMessage(message: GmailMessage): GmailApp;
|
||||
unstarMessages(messages: GmailMessage[]): GmailApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* An attachment from Gmail. This is a regular
|
||||
* Blob except that it has an extra
|
||||
* getSize() method that is faster than calling getBytes().length and does
|
||||
* not count against the Gmail read quota.
|
||||
*
|
||||
* // Logs information about any attachments in the first 100 inbox threads.
|
||||
* var threads = GmailApp.getInboxThreads(0, 100);
|
||||
* var msgs = GmailApp.getMessagesForThreads(threads);
|
||||
* for (var i = 0 ; i < msgs.length; i++) {
|
||||
* for (var j = 0; j < msgs[i].length; j++) {
|
||||
* var attachments = msgs[i][j].getAttachments();
|
||||
* for (var k = 0; k < attachments.length; k++) {
|
||||
* Logger.log('Message "%s" contains the attachment "%s" (%s bytes)',
|
||||
* msgs[i][j].getSubject(), attachments[k].getName(), attachments[k].getSize());
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
export interface GmailAttachment {
|
||||
copyBlob(): Base.Blob;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBytes(): Byte[];
|
||||
getContentType(): string;
|
||||
getDataAsString(): string;
|
||||
getDataAsString(charset: string): string;
|
||||
getName(): string;
|
||||
getSize(): Integer;
|
||||
isGoogleType(): boolean;
|
||||
setBytes(data: Byte[]): Base.Blob;
|
||||
setContentType(contentType: string): Base.Blob;
|
||||
setContentTypeFromExtension(): Base.Blob;
|
||||
setDataFromString(string: string): Base.Blob;
|
||||
setDataFromString(string: string, charset: string): Base.Blob;
|
||||
setName(name: string): Base.Blob;
|
||||
getAllBlobs(): Base.Blob[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A user-created label in a user's Gmail account.
|
||||
*/
|
||||
export interface GmailLabel {
|
||||
addToThread(thread: GmailThread): GmailLabel;
|
||||
addToThreads(threads: GmailThread[]): GmailLabel;
|
||||
deleteLabel(): void;
|
||||
getName(): string;
|
||||
getThreads(): GmailThread[];
|
||||
getThreads(start: Integer, max: Integer): GmailThread[];
|
||||
getUnreadCount(): Integer;
|
||||
removeFromThread(thread: GmailThread): GmailLabel;
|
||||
removeFromThreads(threads: GmailThread[]): GmailLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* A message in a user's Gmail account.
|
||||
*/
|
||||
export interface GmailMessage {
|
||||
forward(recipient: string): GmailMessage;
|
||||
forward(recipient: string, options: Object): GmailMessage;
|
||||
getAttachments(): GmailAttachment[];
|
||||
getBcc(): string;
|
||||
getBody(): string;
|
||||
getCc(): string;
|
||||
getDate(): Date;
|
||||
getFrom(): string;
|
||||
getId(): string;
|
||||
getPlainBody(): string;
|
||||
getRawContent(): string;
|
||||
getReplyTo(): string;
|
||||
getSubject(): string;
|
||||
getThread(): GmailThread;
|
||||
getTo(): string;
|
||||
isDraft(): boolean;
|
||||
isInChats(): boolean;
|
||||
isInInbox(): boolean;
|
||||
isInTrash(): boolean;
|
||||
isStarred(): boolean;
|
||||
isUnread(): boolean;
|
||||
markRead(): GmailMessage;
|
||||
markUnread(): GmailMessage;
|
||||
moveToTrash(): GmailMessage;
|
||||
refresh(): GmailMessage;
|
||||
reply(body: string): GmailMessage;
|
||||
reply(body: string, options: Object): GmailMessage;
|
||||
replyAll(body: string): GmailMessage;
|
||||
replyAll(body: string, options: Object): GmailMessage;
|
||||
star(): GmailMessage;
|
||||
unstar(): GmailMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* A thread in a user's Gmail account.
|
||||
*/
|
||||
export interface GmailThread {
|
||||
addLabel(label: GmailLabel): GmailThread;
|
||||
getFirstMessageSubject(): string;
|
||||
getId(): string;
|
||||
getLabels(): GmailLabel[];
|
||||
getLastMessageDate(): Date;
|
||||
getMessageCount(): Integer;
|
||||
getMessages(): GmailMessage[];
|
||||
getPermalink(): string;
|
||||
hasStarredMessages(): boolean;
|
||||
isImportant(): boolean;
|
||||
isInChats(): boolean;
|
||||
isInInbox(): boolean;
|
||||
isInSpam(): boolean;
|
||||
isInTrash(): boolean;
|
||||
isUnread(): boolean;
|
||||
markImportant(): GmailThread;
|
||||
markRead(): GmailThread;
|
||||
markUnimportant(): GmailThread;
|
||||
markUnread(): GmailThread;
|
||||
moveToArchive(): GmailThread;
|
||||
moveToInbox(): GmailThread;
|
||||
moveToSpam(): GmailThread;
|
||||
moveToTrash(): GmailThread;
|
||||
refresh(): GmailThread;
|
||||
removeLabel(label: GmailLabel): GmailThread;
|
||||
reply(body: string): GmailThread;
|
||||
reply(body: string, options: Object): GmailThread;
|
||||
replyAll(body: string): GmailThread;
|
||||
replyAll(body: string, options: Object): GmailThread;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var GmailApp: GoogleAppsScript.Gmail.GmailApp;
|
||||
@@ -0,0 +1,67 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Groups {
|
||||
/**
|
||||
* A group object whose members and those members' roles within the group
|
||||
* can be queried.
|
||||
*
|
||||
* Here's an example which shows the members of a group. Before running it,
|
||||
* replace the email address of the group with that of one on your domain.
|
||||
*
|
||||
* function listGroupMembers() {
|
||||
* var group = GroupsApp.getGroupByEmail("example@googlegroups.com");
|
||||
* var s = group.getEmail() + ': ';
|
||||
* var users = group.getUsers();
|
||||
* for (var i = 0; i < users.length; i++) {
|
||||
* var user = users[i];
|
||||
* s = s + user.getEmail() + ", ";
|
||||
* }
|
||||
* Logger.log(s);
|
||||
* }
|
||||
*/
|
||||
export interface Group {
|
||||
getEmail(): string;
|
||||
getRole(email: string): Role;
|
||||
getRole(user: Base.User): Role;
|
||||
getUsers(): Base.User[];
|
||||
hasUser(email: string): boolean;
|
||||
hasUser(user: Base.User): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides access to Google Groups information. It can be used to
|
||||
* query information such as a group's email address, or the list of groups in
|
||||
* which the user is a direct member.
|
||||
*
|
||||
* Here's an example that shows how many groups the current user is a member of:
|
||||
*
|
||||
* var groups = GroupsApp.getGroups();
|
||||
* Logger.log('You belong to ' + groups.length + ' groups.');
|
||||
*/
|
||||
export interface GroupsApp {
|
||||
Role: Role
|
||||
getGroupByEmail(email: string): Group;
|
||||
getGroups(): Group[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible roles of a user within a group, such as owner or ordinary member.
|
||||
* Users subscribed to a group have exactly one role within the context of that
|
||||
* group.
|
||||
* See also
|
||||
*
|
||||
* Group.getRole(email)
|
||||
*/
|
||||
export enum Role { OWNER, MANAGER, MEMBER, INVITED, PENDING }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var GroupsApp: GoogleAppsScript.Groups.GroupsApp;
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module HTML {
|
||||
/**
|
||||
* An HtmlOutput object that can be served from a script. Due to security considerations,
|
||||
* scripts cannot directly return HTML to a browser. Instead, they must sanitize it so that it
|
||||
* cannot perform malicious actions. You can return sanitized HTML like this:
|
||||
*
|
||||
* function doGet() {
|
||||
* return HtmlService.createHtmlOutput('<b>Hello, world!</b>');
|
||||
* }
|
||||
*
|
||||
* HtmlOutput
|
||||
* Google Caja
|
||||
* guide to restrictions in HTML service
|
||||
*/
|
||||
export interface HtmlOutput {
|
||||
append(addedContent: string): HtmlOutput;
|
||||
appendUntrusted(addedContent: string): HtmlOutput;
|
||||
asTemplate(): HtmlTemplate;
|
||||
clear(): HtmlOutput;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getContent(): string;
|
||||
getHeight(): Integer;
|
||||
getTitle(): string;
|
||||
getWidth(): Integer;
|
||||
setContent(content: string): HtmlOutput;
|
||||
setHeight(height: Integer): HtmlOutput;
|
||||
setSandboxMode(mode: SandboxMode): HtmlOutput;
|
||||
setTitle(title: string): HtmlOutput;
|
||||
setWidth(width: Integer): HtmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Service for returning HTML and other text content from a script.
|
||||
*
|
||||
* Due to security considerations, scripts cannot directly return content to a browser. Instead,
|
||||
* they must sanitize the HTML so that it cannot perform malicious actions. See the description of
|
||||
* HtmlOutput for what limitations this implies on what can be returned.
|
||||
*/
|
||||
export interface HtmlService {
|
||||
SandboxMode: SandboxMode
|
||||
createHtmlOutput(): HtmlOutput;
|
||||
createHtmlOutput(blob: Base.BlobSource): HtmlOutput;
|
||||
createHtmlOutput(html: string): HtmlOutput;
|
||||
createHtmlOutputFromFile(filename: string): HtmlOutput;
|
||||
createTemplate(blob: Base.BlobSource): HtmlTemplate;
|
||||
createTemplate(html: string): HtmlTemplate;
|
||||
createTemplateFromFile(filename: string): HtmlTemplate;
|
||||
getUserAgent(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A template object for dynamically constructing HTML. For more information, see the
|
||||
* guide to templates.
|
||||
*/
|
||||
export interface HtmlTemplate {
|
||||
evaluate(): HtmlOutput;
|
||||
getCode(): string;
|
||||
getCodeWithComments(): string;
|
||||
getRawContent(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the sandbox modes that can be used for client-side HtmlService
|
||||
* scripts. These values can be accessed from HtmlService.SandboxMode, and set by calling
|
||||
* HtmlOutput.setSandboxMode(mode).
|
||||
*
|
||||
* To protect users from being served malicious HTML or JavaScript, client-side code served from
|
||||
* HTML service executes in a security sandbox that imposes restrictions on the code. The method
|
||||
* HtmlOutput.setSandboxMode(mode) allows script authors to choose between
|
||||
* different versions of the sandbox. For more information, see the
|
||||
* guide to restrictions in HTML service.
|
||||
* If a script does not set a sandbox mode, Apps Script uses NATIVE mode as the default.
|
||||
* Prior to February 2014, the default was EMULATED. The default is subject to change.
|
||||
* The IFRAME mode imposes many fewer restrictions than the other sandbox modes and runs
|
||||
* fastest, but does not work at all in certain older browsers, including Internet Explorer 9. By
|
||||
* contrast, EMULATED mode is more likely to work in
|
||||
* older browsers that do not support ECMAScript 5 strict
|
||||
* mode, most notably Internet Explorer 9. NATIVE mode is the middle ground. If
|
||||
* NATIVE mode is set but not supported in the user's browser, the sandbox mode falls back
|
||||
* to EMULATED mode for that user.
|
||||
*
|
||||
* // Serve HTML with a defined sandbox mode (in Apps Script server-side code).
|
||||
* var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
|
||||
* output.setSandboxMode(HtmlService.SandboxMode.IFRAME);
|
||||
*
|
||||
* google.script.sandbox.mode
|
||||
*
|
||||
* <!-- Read the sandbox mode (in a client-side script). -->
|
||||
* <script>
|
||||
* alert(google.script.sandbox.mode);
|
||||
* </script>
|
||||
*/
|
||||
export enum SandboxMode { EMULATED, IFRAME, NATIVE }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var HtmlService: GoogleAppsScript.HTML.HtmlService;
|
||||
+902
@@ -0,0 +1,902 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module JDBC {
|
||||
/**
|
||||
* The JDBC service allows scripts to connect to Google Cloud SQL, MySQL,
|
||||
* Microsoft SQL Server, and Oracle databases. For more information, see the
|
||||
* guide to JDBC.
|
||||
*/
|
||||
export interface Jdbc {
|
||||
getCloudSqlConnection(url: string): JdbcConnection;
|
||||
getCloudSqlConnection(url: string, info: Object): JdbcConnection;
|
||||
getCloudSqlConnection(url: string, userName: string, password: string): JdbcConnection;
|
||||
getConnection(url: string): JdbcConnection;
|
||||
getConnection(url: string, info: Object): JdbcConnection;
|
||||
getConnection(url: string, userName: string, password: string): JdbcConnection;
|
||||
newDate(milliseconds: Integer): JdbcDate;
|
||||
newTime(milliseconds: Integer): JdbcTime;
|
||||
newTimestamp(milliseconds: Integer): JdbcTimestamp;
|
||||
parseDate(date: string): JdbcDate;
|
||||
parseTime(time: string): JdbcTime;
|
||||
parseTimestamp(timestamp: string): JdbcTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Array. For documentation of this class, see java.sql.Array.
|
||||
*/
|
||||
export interface JdbcArray {
|
||||
free(): void;
|
||||
getArray(): Object;
|
||||
getArray(index: Integer, count: Integer): Object;
|
||||
getBaseType(): Integer;
|
||||
getBaseTypeName(): string;
|
||||
getResultSet(): JdbcResultSet;
|
||||
getResultSet(index: Integer, count: Integer): JdbcResultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Blob. For documentation of this class, see java.sql.Blob.
|
||||
*/
|
||||
export interface JdbcBlob {
|
||||
free(): void;
|
||||
getAppsScriptBlob(): Base.Blob;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBytes(position: Integer, length: Integer): Byte[];
|
||||
length(): Integer;
|
||||
position(pattern: Byte[], start: Integer): Integer;
|
||||
position(pattern: JdbcBlob, start: Integer): Integer;
|
||||
setBytes(position: Integer, blobSource: Base.BlobSource): Integer;
|
||||
setBytes(position: Integer, blobSource: Base.BlobSource, offset: Integer, length: Integer): Integer;
|
||||
setBytes(position: Integer, bytes: Byte[]): Integer;
|
||||
setBytes(position: Integer, bytes: Byte[], offset: Integer, length: Integer): Integer;
|
||||
truncate(length: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC CallableStatement. For documentation of this class, see
|
||||
* java.sql.CallableStatement.
|
||||
* See also
|
||||
*
|
||||
* CallableStatement
|
||||
*/
|
||||
export interface JdbcCallableStatement {
|
||||
addBatch(): void;
|
||||
addBatch(sql: string): void;
|
||||
cancel(): void;
|
||||
clearBatch(): void;
|
||||
clearParameters(): void;
|
||||
clearWarnings(): void;
|
||||
close(): void;
|
||||
execute(): boolean;
|
||||
execute(sql: string): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, columnNames: String[]): boolean;
|
||||
executeBatch(): Integer[];
|
||||
executeQuery(): JdbcResultSet;
|
||||
executeQuery(sql: string): JdbcResultSet;
|
||||
executeUpdate(): Integer;
|
||||
executeUpdate(sql: string): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, columnNames: String[]): Integer;
|
||||
getArray(parameterIndex: Integer): JdbcArray;
|
||||
getArray(parameterName: string): JdbcArray;
|
||||
getBigDecimal(parameterIndex: Integer): BigNumber;
|
||||
getBigDecimal(parameterName: string): BigNumber;
|
||||
getBlob(parameterIndex: Integer): JdbcBlob;
|
||||
getBlob(parameterName: string): JdbcBlob;
|
||||
getBoolean(parameterIndex: Integer): boolean;
|
||||
getBoolean(parameterName: string): boolean;
|
||||
getByte(parameterIndex: Integer): Byte;
|
||||
getByte(parameterName: string): Byte;
|
||||
getBytes(parameterIndex: Integer): Byte[];
|
||||
getBytes(parameterName: string): Byte[];
|
||||
getClob(parameterIndex: Integer): JdbcClob;
|
||||
getClob(parameterName: string): JdbcClob;
|
||||
getConnection(): JdbcConnection;
|
||||
getDate(parameterIndex: Integer): JdbcDate;
|
||||
getDate(parameterIndex: Integer, timeZone: string): JdbcDate;
|
||||
getDate(parameterName: string): JdbcDate;
|
||||
getDate(parameterName: string, timeZone: string): JdbcDate;
|
||||
getDouble(parameterIndex: Integer): Number;
|
||||
getDouble(parameterName: string): Number;
|
||||
getFetchDirection(): Integer;
|
||||
getFetchSize(): Integer;
|
||||
getFloat(parameterIndex: Integer): Number;
|
||||
getFloat(parameterName: string): Number;
|
||||
getGeneratedKeys(): JdbcResultSet;
|
||||
getInt(parameterIndex: Integer): Integer;
|
||||
getInt(parameterName: string): Integer;
|
||||
getLong(parameterIndex: Integer): Integer;
|
||||
getLong(parameterName: string): Integer;
|
||||
getMaxFieldSize(): Integer;
|
||||
getMaxRows(): Integer;
|
||||
getMetaData(): JdbcResultSetMetaData;
|
||||
getMoreResults(): boolean;
|
||||
getMoreResults(current: Integer): boolean;
|
||||
getNClob(parameterIndex: Integer): JdbcClob;
|
||||
getNClob(parameterName: string): JdbcClob;
|
||||
getNString(parameterIndex: Integer): string;
|
||||
getNString(parameterName: string): string;
|
||||
getObject(parameterIndex: Integer): Object;
|
||||
getObject(parameterName: string): Object;
|
||||
getParameterMetaData(): JdbcParameterMetaData;
|
||||
getQueryTimeout(): Integer;
|
||||
getRef(parameterIndex: Integer): JdbcRef;
|
||||
getRef(parameterName: string): JdbcRef;
|
||||
getResultSet(): JdbcResultSet;
|
||||
getResultSetConcurrency(): Integer;
|
||||
getResultSetHoldability(): Integer;
|
||||
getResultSetType(): Integer;
|
||||
getRowId(parameterIndex: Integer): JdbcRowId;
|
||||
getRowId(parameterName: string): JdbcRowId;
|
||||
getSQLXML(parameterIndex: Integer): JdbcSQLXML;
|
||||
getSQLXML(parameterName: string): JdbcSQLXML;
|
||||
getShort(parameterIndex: Integer): Integer;
|
||||
getShort(parameterName: string): Integer;
|
||||
getString(parameterIndex: Integer): string;
|
||||
getString(parameterName: string): string;
|
||||
getTime(parameterIndex: Integer): JdbcTime;
|
||||
getTime(parameterIndex: Integer, timeZone: string): JdbcTime;
|
||||
getTime(parameterName: string): JdbcTime;
|
||||
getTime(parameterName: string, timeZone: string): JdbcTime;
|
||||
getTimestamp(parameterIndex: Integer): JdbcTimestamp;
|
||||
getTimestamp(parameterIndex: Integer, timeZone: string): JdbcTimestamp;
|
||||
getTimestamp(parameterName: string): JdbcTimestamp;
|
||||
getTimestamp(parameterName: string, timeZone: string): JdbcTimestamp;
|
||||
getURL(parameterIndex: Integer): string;
|
||||
getURL(parameterName: string): string;
|
||||
getUpdateCount(): Integer;
|
||||
getWarnings(): String[];
|
||||
isClosed(): boolean;
|
||||
isPoolable(): boolean;
|
||||
registerOutParameter(parameterIndex: Integer, sqlType: Integer): void;
|
||||
registerOutParameter(parameterIndex: Integer, sqlType: Integer, scale: Integer): void;
|
||||
registerOutParameter(parameterIndex: Integer, sqlType: Integer, typeName: string): void;
|
||||
registerOutParameter(parameterName: string, sqlType: Integer): void;
|
||||
registerOutParameter(parameterName: string, sqlType: Integer, scale: Integer): void;
|
||||
registerOutParameter(parameterName: string, sqlType: Integer, typeName: string): void;
|
||||
setArray(parameterIndex: Integer, x: JdbcArray): void;
|
||||
setBigDecimal(parameterIndex: Integer, x: BigNumber): void;
|
||||
setBigDecimal(parameterName: string, x: BigNumber): void;
|
||||
setBlob(parameterIndex: Integer, x: JdbcBlob): void;
|
||||
setBlob(parameterName: string, x: JdbcBlob): void;
|
||||
setBoolean(parameterIndex: Integer, x: boolean): void;
|
||||
setBoolean(parameterName: string, x: boolean): void;
|
||||
setByte(parameterIndex: Integer, x: Byte): void;
|
||||
setByte(parameterName: string, x: Byte): void;
|
||||
setBytes(parameterIndex: Integer, x: Byte[]): void;
|
||||
setBytes(parameterName: string, x: Byte[]): void;
|
||||
setClob(parameterIndex: Integer, x: JdbcClob): void;
|
||||
setClob(parameterName: string, x: JdbcClob): void;
|
||||
setCursorName(name: string): void;
|
||||
setDate(parameterIndex: Integer, x: JdbcDate): void;
|
||||
setDate(parameterIndex: Integer, x: JdbcDate, timeZone: string): void;
|
||||
setDate(parameterName: string, x: JdbcDate): void;
|
||||
setDate(parameterName: string, x: JdbcDate, timeZone: string): void;
|
||||
setDouble(parameterIndex: Integer, x: Number): void;
|
||||
setDouble(parameterName: string, x: Number): void;
|
||||
setEscapeProcessing(enable: boolean): void;
|
||||
setFetchDirection(direction: Integer): void;
|
||||
setFetchSize(rows: Integer): void;
|
||||
setFloat(parameterIndex: Integer, x: Number): void;
|
||||
setFloat(parameterName: string, x: Number): void;
|
||||
setInt(parameterIndex: Integer, x: Integer): void;
|
||||
setInt(parameterName: string, x: Integer): void;
|
||||
setLong(parameterIndex: Integer, x: Integer): void;
|
||||
setLong(parameterName: string, x: Integer): void;
|
||||
setMaxFieldSize(max: Integer): void;
|
||||
setMaxRows(max: Integer): void;
|
||||
setNClob(parameterIndex: Integer, x: JdbcClob): void;
|
||||
setNClob(parameterName: string, value: JdbcClob): void;
|
||||
setNString(parameterIndex: Integer, x: string): void;
|
||||
setNString(parameterName: string, value: string): void;
|
||||
setNull(parameterIndex: Integer, sqlType: Integer): void;
|
||||
setNull(parameterIndex: Integer, sqlType: Integer, typeName: string): void;
|
||||
setNull(parameterName: string, sqlType: Integer): void;
|
||||
setNull(parameterName: string, sqlType: Integer, typeName: string): void;
|
||||
setObject(index: Integer, x: Object): void;
|
||||
setObject(parameterIndex: Integer, x: Object, targetSqlType: Integer): void;
|
||||
setObject(parameterIndex: Integer, x: Object, targetSqlType: Integer, scaleOrLength: Integer): void;
|
||||
setObject(parameterName: string, x: Object): void;
|
||||
setObject(parameterName: string, x: Object, targetSqlType: Integer): void;
|
||||
setObject(parameterName: string, x: Object, targetSqlType: Integer, scale: Integer): void;
|
||||
setPoolable(poolable: boolean): void;
|
||||
setQueryTimeout(seconds: Integer): void;
|
||||
setRef(parameterIndex: Integer, x: JdbcRef): void;
|
||||
setRowId(parameterIndex: Integer, x: JdbcRowId): void;
|
||||
setRowId(parameterName: string, x: JdbcRowId): void;
|
||||
setSQLXML(parameterIndex: Integer, x: JdbcSQLXML): void;
|
||||
setSQLXML(parameterName: string, xmlObject: JdbcSQLXML): void;
|
||||
setShort(parameterIndex: Integer, x: Integer): void;
|
||||
setShort(parameterName: string, x: Integer): void;
|
||||
setString(parameterIndex: Integer, x: string): void;
|
||||
setString(parameterName: string, x: string): void;
|
||||
setTime(parameterIndex: Integer, x: JdbcTime): void;
|
||||
setTime(parameterIndex: Integer, x: JdbcTime, timeZone: string): void;
|
||||
setTime(parameterName: string, x: JdbcTime): void;
|
||||
setTime(parameterName: string, x: JdbcTime, timeZone: string): void;
|
||||
setTimestamp(parameterIndex: Integer, x: JdbcTimestamp): void;
|
||||
setTimestamp(parameterIndex: Integer, x: JdbcTimestamp, timeZone: string): void;
|
||||
setTimestamp(parameterName: string, x: JdbcTimestamp): void;
|
||||
setTimestamp(parameterName: string, x: JdbcTimestamp, timeZone: string): void;
|
||||
setURL(parameterIndex: Integer, x: string): void;
|
||||
setURL(parameterName: string, val: string): void;
|
||||
wasNull(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Clob. For documentation of this class, see java.sql.Clob.
|
||||
*/
|
||||
export interface JdbcClob {
|
||||
free(): void;
|
||||
getAppsScriptBlob(): Base.Blob;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getSubString(position: Integer, length: Integer): string;
|
||||
length(): Integer;
|
||||
position(search: JdbcClob, start: Integer): Integer;
|
||||
position(search: string, start: Integer): Integer;
|
||||
setString(position: Integer, blobSource: Base.BlobSource): Integer;
|
||||
setString(position: Integer, blobSource: Base.BlobSource, offset: Integer, len: Integer): Integer;
|
||||
setString(position: Integer, value: string): Integer;
|
||||
setString(position: Integer, value: string, offset: Integer, len: Integer): Integer;
|
||||
truncate(length: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Connection. For documentation of this class, see java.sql.Connection.
|
||||
*/
|
||||
export interface JdbcConnection {
|
||||
clearWarnings(): void;
|
||||
close(): void;
|
||||
commit(): void;
|
||||
createArrayOf(typeName: string, elements: Object[]): JdbcArray;
|
||||
createBlob(): JdbcBlob;
|
||||
createClob(): JdbcClob;
|
||||
createNClob(): JdbcClob;
|
||||
createSQLXML(): JdbcSQLXML;
|
||||
createStatement(): JdbcStatement;
|
||||
createStatement(resultSetType: Integer, resultSetConcurrency: Integer): JdbcStatement;
|
||||
createStatement(resultSetType: Integer, resultSetConcurrency: Integer, resultSetHoldability: Integer): JdbcStatement;
|
||||
createStruct(typeName: string, attributes: Object[]): JdbcStruct;
|
||||
getAutoCommit(): boolean;
|
||||
getCatalog(): string;
|
||||
getHoldability(): Integer;
|
||||
getMetaData(): JdbcDatabaseMetaData;
|
||||
getTransactionIsolation(): Integer;
|
||||
getWarnings(): String[];
|
||||
isClosed(): boolean;
|
||||
isReadOnly(): boolean;
|
||||
isValid(timeout: Integer): boolean;
|
||||
nativeSQL(sql: string): string;
|
||||
prepareCall(sql: string): JdbcCallableStatement;
|
||||
prepareCall(sql: string, resultSetType: Integer, resultSetConcurrency: Integer): JdbcCallableStatement;
|
||||
prepareCall(sql: string, resultSetType: Integer, resultSetConcurrency: Integer, resultSetHoldability: Integer): JdbcCallableStatement;
|
||||
prepareStatement(sql: string): JdbcPreparedStatement;
|
||||
prepareStatement(sql: string, autoGeneratedKeys: Integer): JdbcPreparedStatement;
|
||||
prepareStatement(sql: string, resultSetType: Integer, resultSetConcurrency: Integer): JdbcPreparedStatement;
|
||||
prepareStatement(sql: string, resultSetType: Integer, resultSetConcurrency: Integer, resultSetHoldability: Integer): JdbcPreparedStatement;
|
||||
prepareStatementByIndex(sql: string, indices: Integer[]): JdbcPreparedStatement;
|
||||
prepareStatementByName(sql: string, columnNames: String[]): JdbcPreparedStatement;
|
||||
releaseSavepoint(savepoint: JdbcSavepoint): void;
|
||||
rollback(): void;
|
||||
rollback(savepoint: JdbcSavepoint): void;
|
||||
setAutoCommit(autoCommit: boolean): void;
|
||||
setCatalog(catalog: string): void;
|
||||
setHoldability(holdability: Integer): void;
|
||||
setReadOnly(readOnly: boolean): void;
|
||||
setSavepoint(): JdbcSavepoint;
|
||||
setSavepoint(name: string): JdbcSavepoint;
|
||||
setTransactionIsolation(level: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC DatabaseMetaData. For documentation of this class, see
|
||||
* java.sql.DatabaseMetaData.
|
||||
*/
|
||||
export interface JdbcDatabaseMetaData {
|
||||
allProceduresAreCallable(): boolean;
|
||||
allTablesAreSelectable(): boolean;
|
||||
autoCommitFailureClosesAllResultSets(): boolean;
|
||||
dataDefinitionCausesTransactionCommit(): boolean;
|
||||
dataDefinitionIgnoredInTransactions(): boolean;
|
||||
deletesAreDetected(type: Integer): boolean;
|
||||
doesMaxRowSizeIncludeBlobs(): boolean;
|
||||
getAttributes(catalog: string, schemaPattern: string, typeNamePattern: string, attributeNamePattern: string): JdbcResultSet;
|
||||
getBestRowIdentifier(catalog: string, schema: string, table: string, scope: Integer, nullable: boolean): JdbcResultSet;
|
||||
getCatalogSeparator(): string;
|
||||
getCatalogTerm(): string;
|
||||
getCatalogs(): JdbcResultSet;
|
||||
getClientInfoProperties(): JdbcResultSet;
|
||||
getColumnPrivileges(catalog: string, schema: string, table: string, columnNamePattern: string): JdbcResultSet;
|
||||
getColumns(catalog: string, schemaPattern: string, tableNamePattern: string, columnNamePattern: string): JdbcResultSet;
|
||||
getConnection(): JdbcConnection;
|
||||
getCrossReference(parentCatalog: string, parentSchema: string, parentTable: string, foreignCatalog: string, foreignSchema: string, foreignTable: string): JdbcResultSet;
|
||||
getDatabaseMajorVersion(): Integer;
|
||||
getDatabaseMinorVersion(): Integer;
|
||||
getDatabaseProductName(): string;
|
||||
getDatabaseProductVersion(): string;
|
||||
getDefaultTransactionIsolation(): Integer;
|
||||
getDriverMajorVersion(): Integer;
|
||||
getDriverMinorVersion(): Integer;
|
||||
getDriverName(): string;
|
||||
getDriverVersion(): string;
|
||||
getExportedKeys(catalog: string, schema: string, table: string): JdbcResultSet;
|
||||
getExtraNameCharacters(): string;
|
||||
getFunctionColumns(catalog: string, schemaPattern: string, functionNamePattern: string, columnNamePattern: string): JdbcResultSet;
|
||||
getFunctions(catalog: string, schemaPattern: string, functionNamePattern: string): JdbcResultSet;
|
||||
getIdentifierQuoteString(): string;
|
||||
getImportedKeys(catalog: string, schema: string, table: string): JdbcResultSet;
|
||||
getIndexInfo(catalog: string, schema: string, table: string, unique: boolean, approximate: boolean): JdbcResultSet;
|
||||
getJDBCMajorVersion(): Integer;
|
||||
getJDBCMinorVersion(): Integer;
|
||||
getMaxBinaryLiteralLength(): Integer;
|
||||
getMaxCatalogNameLength(): Integer;
|
||||
getMaxCharLiteralLength(): Integer;
|
||||
getMaxColumnNameLength(): Integer;
|
||||
getMaxColumnsInGroupBy(): Integer;
|
||||
getMaxColumnsInIndex(): Integer;
|
||||
getMaxColumnsInOrderBy(): Integer;
|
||||
getMaxColumnsInSelect(): Integer;
|
||||
getMaxColumnsInTable(): Integer;
|
||||
getMaxConnections(): Integer;
|
||||
getMaxCursorNameLength(): Integer;
|
||||
getMaxIndexLength(): Integer;
|
||||
getMaxProcedureNameLength(): Integer;
|
||||
getMaxRowSize(): Integer;
|
||||
getMaxSchemaNameLength(): Integer;
|
||||
getMaxStatementLength(): Integer;
|
||||
getMaxStatements(): Integer;
|
||||
getMaxTableNameLength(): Integer;
|
||||
getMaxTablesInSelect(): Integer;
|
||||
getMaxUserNameLength(): Integer;
|
||||
getNumericFunctions(): string;
|
||||
getPrimaryKeys(catalog: string, schema: string, table: string): JdbcResultSet;
|
||||
getProcedureColumns(catalog: string, schemaPattern: string, procedureNamePattern: string, columnNamePattern: string): JdbcResultSet;
|
||||
getProcedureTerm(): string;
|
||||
getProcedures(catalog: string, schemaPattern: string, procedureNamePattern: string): JdbcResultSet;
|
||||
getResultSetHoldability(): Integer;
|
||||
getRowIdLifetime(): Integer;
|
||||
getSQLKeywords(): string;
|
||||
getSQLStateType(): Integer;
|
||||
getSchemaTerm(): string;
|
||||
getSchemas(): JdbcResultSet;
|
||||
getSchemas(catalog: string, schemaPattern: string): JdbcResultSet;
|
||||
getSearchStringEscape(): string;
|
||||
getStringFunctions(): string;
|
||||
getSuperTables(catalog: string, schemaPattern: string, tableNamePattern: string): JdbcResultSet;
|
||||
getSuperTypes(catalog: string, schemaPattern: string, typeNamePattern: string): JdbcResultSet;
|
||||
getSystemFunctions(): string;
|
||||
getTablePrivileges(catalog: string, schemaPattern: string, tableNamePattern: string): JdbcResultSet;
|
||||
getTableTypes(): JdbcResultSet;
|
||||
getTables(catalog: string, schemaPattern: string, tableNamePattern: string, types: String[]): JdbcResultSet;
|
||||
getTimeDateFunctions(): string;
|
||||
getTypeInfo(): JdbcResultSet;
|
||||
getUDTs(catalog: string, schemaPattern: string, typeNamePattern: string, types: Integer[]): JdbcResultSet;
|
||||
getURL(): string;
|
||||
getUserName(): string;
|
||||
getVersionColumns(catalog: string, schema: string, table: string): JdbcResultSet;
|
||||
insertsAreDetected(type: Integer): boolean;
|
||||
isCatalogAtStart(): boolean;
|
||||
isReadOnly(): boolean;
|
||||
locatorsUpdateCopy(): boolean;
|
||||
nullPlusNonNullIsNull(): boolean;
|
||||
nullsAreSortedAtEnd(): boolean;
|
||||
nullsAreSortedAtStart(): boolean;
|
||||
nullsAreSortedHigh(): boolean;
|
||||
nullsAreSortedLow(): boolean;
|
||||
othersDeletesAreVisible(type: Integer): boolean;
|
||||
othersInsertsAreVisible(type: Integer): boolean;
|
||||
othersUpdatesAreVisible(type: Integer): boolean;
|
||||
ownDeletesAreVisible(type: Integer): boolean;
|
||||
ownInsertsAreVisible(type: Integer): boolean;
|
||||
ownUpdatesAreVisible(type: Integer): boolean;
|
||||
storesLowerCaseIdentifiers(): boolean;
|
||||
storesLowerCaseQuotedIdentifiers(): boolean;
|
||||
storesMixedCaseIdentifiers(): boolean;
|
||||
storesMixedCaseQuotedIdentifiers(): boolean;
|
||||
storesUpperCaseIdentifiers(): boolean;
|
||||
storesUpperCaseQuotedIdentifiers(): boolean;
|
||||
supportsANSI92EntryLevelSQL(): boolean;
|
||||
supportsANSI92FullSQL(): boolean;
|
||||
supportsANSI92IntermediateSQL(): boolean;
|
||||
supportsAlterTableWithAddColumn(): boolean;
|
||||
supportsAlterTableWithDropColumn(): boolean;
|
||||
supportsBatchUpdates(): boolean;
|
||||
supportsCatalogsInDataManipulation(): boolean;
|
||||
supportsCatalogsInIndexDefinitions(): boolean;
|
||||
supportsCatalogsInPrivilegeDefinitions(): boolean;
|
||||
supportsCatalogsInProcedureCalls(): boolean;
|
||||
supportsCatalogsInTableDefinitions(): boolean;
|
||||
supportsColumnAliasing(): boolean;
|
||||
supportsConvert(): boolean;
|
||||
supportsConvert(fromType: Integer, toType: Integer): boolean;
|
||||
supportsCoreSQLGrammar(): boolean;
|
||||
supportsCorrelatedSubqueries(): boolean;
|
||||
supportsDataDefinitionAndDataManipulationTransactions(): boolean;
|
||||
supportsDataManipulationTransactionsOnly(): boolean;
|
||||
supportsDifferentTableCorrelationNames(): boolean;
|
||||
supportsExpressionsInOrderBy(): boolean;
|
||||
supportsExtendedSQLGrammar(): boolean;
|
||||
supportsFullOuterJoins(): boolean;
|
||||
supportsGetGeneratedKeys(): boolean;
|
||||
supportsGroupBy(): boolean;
|
||||
supportsGroupByBeyondSelect(): boolean;
|
||||
supportsGroupByUnrelated(): boolean;
|
||||
supportsIntegrityEnhancementFacility(): boolean;
|
||||
supportsLikeEscapeClause(): boolean;
|
||||
supportsLimitedOuterJoins(): boolean;
|
||||
supportsMinimumSQLGrammar(): boolean;
|
||||
supportsMixedCaseIdentifiers(): boolean;
|
||||
supportsMixedCaseQuotedIdentifiers(): boolean;
|
||||
supportsMultipleOpenResults(): boolean;
|
||||
supportsMultipleResultSets(): boolean;
|
||||
supportsMultipleTransactions(): boolean;
|
||||
supportsNamedParameters(): boolean;
|
||||
supportsNonNullableColumns(): boolean;
|
||||
supportsOpenCursorsAcrossCommit(): boolean;
|
||||
supportsOpenCursorsAcrossRollback(): boolean;
|
||||
supportsOpenStatementsAcrossCommit(): boolean;
|
||||
supportsOpenStatementsAcrossRollback(): boolean;
|
||||
supportsOrderByUnrelated(): boolean;
|
||||
supportsOuterJoins(): boolean;
|
||||
supportsPositionedDelete(): boolean;
|
||||
supportsPositionedUpdate(): boolean;
|
||||
supportsResultSetConcurrency(type: Integer, concurrency: Integer): boolean;
|
||||
supportsResultSetHoldability(holdability: Integer): boolean;
|
||||
supportsResultSetType(type: Integer): boolean;
|
||||
supportsSavepoints(): boolean;
|
||||
supportsSchemasInDataManipulation(): boolean;
|
||||
supportsSchemasInIndexDefinitions(): boolean;
|
||||
supportsSchemasInPrivilegeDefinitions(): boolean;
|
||||
supportsSchemasInProcedureCalls(): boolean;
|
||||
supportsSchemasInTableDefinitions(): boolean;
|
||||
supportsSelectForUpdate(): boolean;
|
||||
supportsStatementPooling(): boolean;
|
||||
supportsStoredFunctionsUsingCallSyntax(): boolean;
|
||||
supportsStoredProcedures(): boolean;
|
||||
supportsSubqueriesInComparisons(): boolean;
|
||||
supportsSubqueriesInExists(): boolean;
|
||||
supportsSubqueriesInIns(): boolean;
|
||||
supportsSubqueriesInQuantifieds(): boolean;
|
||||
supportsTableCorrelationNames(): boolean;
|
||||
supportsTransactionIsolationLevel(level: Integer): boolean;
|
||||
supportsTransactions(): boolean;
|
||||
supportsUnion(): boolean;
|
||||
supportsUnionAll(): boolean;
|
||||
updatesAreDetected(type: Integer): boolean;
|
||||
usesLocalFilePerTable(): boolean;
|
||||
usesLocalFiles(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Date. For documentation of this class, see java.sql.Date.
|
||||
*/
|
||||
export interface JdbcDate {
|
||||
after(when: JdbcDate): boolean;
|
||||
before(when: JdbcDate): boolean;
|
||||
getDate(): Integer;
|
||||
getMonth(): Integer;
|
||||
getTime(): Integer;
|
||||
getYear(): Integer;
|
||||
setDate(date: Integer): void;
|
||||
setMonth(month: Integer): void;
|
||||
setTime(milliseconds: Integer): void;
|
||||
setYear(year: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC ParameterMetaData. For documentation of this class, see
|
||||
* java.sql.ParameterMetaData.
|
||||
*/
|
||||
export interface JdbcParameterMetaData {
|
||||
getParameterClassName(param: Integer): string;
|
||||
getParameterCount(): Integer;
|
||||
getParameterMode(param: Integer): Integer;
|
||||
getParameterType(param: Integer): Integer;
|
||||
getParameterTypeName(param: Integer): string;
|
||||
getPrecision(param: Integer): Integer;
|
||||
getScale(param: Integer): Integer;
|
||||
isNullable(param: Integer): Integer;
|
||||
isSigned(param: Integer): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC PreparedStatement. For documentation of this class, see
|
||||
* java.sql.PreparedStatement.
|
||||
*/
|
||||
export interface JdbcPreparedStatement {
|
||||
addBatch(): void;
|
||||
addBatch(sql: string): void;
|
||||
cancel(): void;
|
||||
clearBatch(): void;
|
||||
clearParameters(): void;
|
||||
clearWarnings(): void;
|
||||
close(): void;
|
||||
execute(): boolean;
|
||||
execute(sql: string): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, columnNames: String[]): boolean;
|
||||
executeBatch(): Integer[];
|
||||
executeQuery(): JdbcResultSet;
|
||||
executeQuery(sql: string): JdbcResultSet;
|
||||
executeUpdate(): Integer;
|
||||
executeUpdate(sql: string): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, columnNames: String[]): Integer;
|
||||
getConnection(): JdbcConnection;
|
||||
getFetchDirection(): Integer;
|
||||
getFetchSize(): Integer;
|
||||
getGeneratedKeys(): JdbcResultSet;
|
||||
getMaxFieldSize(): Integer;
|
||||
getMaxRows(): Integer;
|
||||
getMetaData(): JdbcResultSetMetaData;
|
||||
getMoreResults(): boolean;
|
||||
getMoreResults(current: Integer): boolean;
|
||||
getParameterMetaData(): JdbcParameterMetaData;
|
||||
getQueryTimeout(): Integer;
|
||||
getResultSet(): JdbcResultSet;
|
||||
getResultSetConcurrency(): Integer;
|
||||
getResultSetHoldability(): Integer;
|
||||
getResultSetType(): Integer;
|
||||
getUpdateCount(): Integer;
|
||||
getWarnings(): String[];
|
||||
isClosed(): boolean;
|
||||
isPoolable(): boolean;
|
||||
setArray(parameterIndex: Integer, x: JdbcArray): void;
|
||||
setBigDecimal(parameterIndex: Integer, x: BigNumber): void;
|
||||
setBlob(parameterIndex: Integer, x: JdbcBlob): void;
|
||||
setBoolean(parameterIndex: Integer, x: boolean): void;
|
||||
setByte(parameterIndex: Integer, x: Byte): void;
|
||||
setBytes(parameterIndex: Integer, x: Byte[]): void;
|
||||
setClob(parameterIndex: Integer, x: JdbcClob): void;
|
||||
setCursorName(name: string): void;
|
||||
setDate(parameterIndex: Integer, x: JdbcDate): void;
|
||||
setDate(parameterIndex: Integer, x: JdbcDate, timeZone: string): void;
|
||||
setDouble(parameterIndex: Integer, x: Number): void;
|
||||
setEscapeProcessing(enable: boolean): void;
|
||||
setFetchDirection(direction: Integer): void;
|
||||
setFetchSize(rows: Integer): void;
|
||||
setFloat(parameterIndex: Integer, x: Number): void;
|
||||
setInt(parameterIndex: Integer, x: Integer): void;
|
||||
setLong(parameterIndex: Integer, x: Integer): void;
|
||||
setMaxFieldSize(max: Integer): void;
|
||||
setMaxRows(max: Integer): void;
|
||||
setNClob(parameterIndex: Integer, x: JdbcClob): void;
|
||||
setNString(parameterIndex: Integer, x: string): void;
|
||||
setNull(parameterIndex: Integer, sqlType: Integer): void;
|
||||
setNull(parameterIndex: Integer, sqlType: Integer, typeName: string): void;
|
||||
setObject(index: Integer, x: Object): void;
|
||||
setObject(parameterIndex: Integer, x: Object, targetSqlType: Integer): void;
|
||||
setObject(parameterIndex: Integer, x: Object, targetSqlType: Integer, scaleOrLength: Integer): void;
|
||||
setPoolable(poolable: boolean): void;
|
||||
setQueryTimeout(seconds: Integer): void;
|
||||
setRef(parameterIndex: Integer, x: JdbcRef): void;
|
||||
setRowId(parameterIndex: Integer, x: JdbcRowId): void;
|
||||
setSQLXML(parameterIndex: Integer, x: JdbcSQLXML): void;
|
||||
setShort(parameterIndex: Integer, x: Integer): void;
|
||||
setString(parameterIndex: Integer, x: string): void;
|
||||
setTime(parameterIndex: Integer, x: JdbcTime): void;
|
||||
setTime(parameterIndex: Integer, x: JdbcTime, timeZone: string): void;
|
||||
setTimestamp(parameterIndex: Integer, x: JdbcTimestamp): void;
|
||||
setTimestamp(parameterIndex: Integer, x: JdbcTimestamp, timeZone: string): void;
|
||||
setURL(parameterIndex: Integer, x: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Ref. For documentation of this class, see java.sql.Ref.
|
||||
*/
|
||||
export interface JdbcRef {
|
||||
getBaseTypeName(): string;
|
||||
getObject(): Object;
|
||||
setObject(object: Object): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC ResultSet. For documentation of this class, see java.sql.ResultSet.
|
||||
*/
|
||||
export interface JdbcResultSet {
|
||||
absolute(row: Integer): boolean;
|
||||
afterLast(): void;
|
||||
beforeFirst(): void;
|
||||
cancelRowUpdates(): void;
|
||||
clearWarnings(): void;
|
||||
close(): void;
|
||||
deleteRow(): void;
|
||||
findColumn(columnLabel: string): Integer;
|
||||
first(): boolean;
|
||||
getArray(columnIndex: Integer): JdbcArray;
|
||||
getArray(columnLabel: string): JdbcArray;
|
||||
getBigDecimal(columnIndex: Integer): BigNumber;
|
||||
getBigDecimal(columnLabel: string): BigNumber;
|
||||
getBlob(columnIndex: Integer): JdbcBlob;
|
||||
getBlob(columnLabel: string): JdbcBlob;
|
||||
getBoolean(columnIndex: Integer): boolean;
|
||||
getBoolean(columnLabel: string): boolean;
|
||||
getByte(columnIndex: Integer): Byte;
|
||||
getByte(columnLabel: string): Byte;
|
||||
getBytes(columnIndex: Integer): Byte[];
|
||||
getBytes(columnLabel: string): Byte[];
|
||||
getClob(columnIndex: Integer): JdbcClob;
|
||||
getClob(columnLabel: string): JdbcClob;
|
||||
getConcurrency(): Integer;
|
||||
getCursorName(): string;
|
||||
getDate(columnIndex: Integer): JdbcDate;
|
||||
getDate(columnIndex: Integer, timeZone: string): JdbcDate;
|
||||
getDate(columnLabel: string): JdbcDate;
|
||||
getDate(columnLabel: string, timeZone: string): JdbcDate;
|
||||
getDouble(columnIndex: Integer): Number;
|
||||
getDouble(columnLabel: string): Number;
|
||||
getFetchDirection(): Integer;
|
||||
getFetchSize(): Integer;
|
||||
getFloat(columnIndex: Integer): Number;
|
||||
getFloat(columnLabel: string): Number;
|
||||
getHoldability(): Integer;
|
||||
getInt(columnIndex: Integer): Integer;
|
||||
getInt(columnLabel: string): Integer;
|
||||
getLong(columnIndex: Integer): Integer;
|
||||
getLong(columnLabel: string): Integer;
|
||||
getMetaData(): JdbcResultSetMetaData;
|
||||
getNClob(columnIndex: Integer): JdbcClob;
|
||||
getNClob(columnLabel: string): JdbcClob;
|
||||
getNString(columnIndex: Integer): string;
|
||||
getNString(columnLabel: string): string;
|
||||
getObject(columnIndex: Integer): Object;
|
||||
getObject(columnLabel: string): Object;
|
||||
getRef(columnIndex: Integer): JdbcRef;
|
||||
getRef(columnLabel: string): JdbcRef;
|
||||
getRow(): Integer;
|
||||
getRowId(columnIndex: Integer): JdbcRowId;
|
||||
getRowId(columnLabel: string): JdbcRowId;
|
||||
getSQLXML(columnIndex: Integer): JdbcSQLXML;
|
||||
getSQLXML(columnLabel: string): JdbcSQLXML;
|
||||
getShort(columnIndex: Integer): Integer;
|
||||
getShort(columnLabel: string): Integer;
|
||||
getStatement(): JdbcStatement;
|
||||
getString(columnIndex: Integer): string;
|
||||
getString(columnLabel: string): string;
|
||||
getTime(columnIndex: Integer): JdbcTime;
|
||||
getTime(columnIndex: Integer, timeZone: string): JdbcTime;
|
||||
getTime(columnLabel: string): JdbcTime;
|
||||
getTime(columnLabel: string, timeZone: string): JdbcTime;
|
||||
getTimestamp(columnIndex: Integer): JdbcTimestamp;
|
||||
getTimestamp(columnIndex: Integer, timeZone: string): JdbcTimestamp;
|
||||
getTimestamp(columnLabel: string): JdbcTimestamp;
|
||||
getTimestamp(columnLabel: string, timeZone: string): JdbcTimestamp;
|
||||
getType(): Integer;
|
||||
getURL(columnIndex: Integer): string;
|
||||
getURL(columnLabel: string): string;
|
||||
getWarnings(): String[];
|
||||
insertRow(): void;
|
||||
isAfterLast(): boolean;
|
||||
isBeforeFirst(): boolean;
|
||||
isClosed(): boolean;
|
||||
isFirst(): boolean;
|
||||
isLast(): boolean;
|
||||
last(): boolean;
|
||||
moveToCurrentRow(): void;
|
||||
moveToInsertRow(): void;
|
||||
next(): boolean;
|
||||
previous(): boolean;
|
||||
refreshRow(): void;
|
||||
relative(rows: Integer): boolean;
|
||||
rowDeleted(): boolean;
|
||||
rowInserted(): boolean;
|
||||
rowUpdated(): boolean;
|
||||
setFetchDirection(direction: Integer): void;
|
||||
setFetchSize(rows: Integer): void;
|
||||
updateArray(columnIndex: Integer, x: JdbcArray): void;
|
||||
updateArray(columnLabel: string, x: JdbcArray): void;
|
||||
updateBigDecimal(columnIndex: Integer, x: BigNumber): void;
|
||||
updateBigDecimal(columnLabel: string, x: BigNumber): void;
|
||||
updateBlob(columnIndex: Integer, x: JdbcBlob): void;
|
||||
updateBlob(columnLabel: string, x: JdbcBlob): void;
|
||||
updateBoolean(columnIndex: Integer, x: boolean): void;
|
||||
updateBoolean(columnLabel: string, x: boolean): void;
|
||||
updateByte(columnIndex: Integer, x: Byte): void;
|
||||
updateByte(columnLabel: string, x: Byte): void;
|
||||
updateBytes(columnIndex: Integer, x: Byte[]): void;
|
||||
updateBytes(columnLabel: string, x: Byte[]): void;
|
||||
updateClob(columnIndex: Integer, x: JdbcClob): void;
|
||||
updateClob(columnLabel: string, x: JdbcClob): void;
|
||||
updateDate(columnIndex: Integer, x: JdbcDate): void;
|
||||
updateDate(columnLabel: string, x: JdbcDate): void;
|
||||
updateDouble(columnIndex: Integer, x: Number): void;
|
||||
updateDouble(columnLabel: string, x: Number): void;
|
||||
updateFloat(columnIndex: Integer, x: Number): void;
|
||||
updateFloat(columnLabel: string, x: Number): void;
|
||||
updateInt(columnIndex: Integer, x: Integer): void;
|
||||
updateInt(columnLabel: string, x: Integer): void;
|
||||
updateLong(columnIndex: Integer, x: Integer): void;
|
||||
updateLong(columnLabel: string, x: Integer): void;
|
||||
updateNClob(columnIndex: Integer, x: JdbcClob): void;
|
||||
updateNClob(columnLabel: string, x: JdbcClob): void;
|
||||
updateNString(columnIndex: Integer, x: string): void;
|
||||
updateNString(columnLabel: string, x: string): void;
|
||||
updateNull(columnIndex: Integer): void;
|
||||
updateNull(columnLabel: string): void;
|
||||
updateObject(columnIndex: Integer, x: Object): void;
|
||||
updateObject(columnIndex: Integer, x: Object, scaleOrLength: Integer): void;
|
||||
updateObject(columnLabel: string, x: Object): void;
|
||||
updateObject(columnLabel: string, x: Object, scaleOrLength: Integer): void;
|
||||
updateRef(columnIndex: Integer, x: JdbcRef): void;
|
||||
updateRef(columnLabel: string, x: JdbcRef): void;
|
||||
updateRow(): void;
|
||||
updateRowId(columnIndex: Integer, x: JdbcRowId): void;
|
||||
updateRowId(columnLabel: string, x: JdbcRowId): void;
|
||||
updateSQLXML(columnIndex: Integer, x: JdbcSQLXML): void;
|
||||
updateSQLXML(columnLabel: string, x: JdbcSQLXML): void;
|
||||
updateShort(columnIndex: Integer, x: Integer): void;
|
||||
updateShort(columnLabel: string, x: Integer): void;
|
||||
updateString(columnIndex: Integer, x: string): void;
|
||||
updateString(columnLabel: string, x: string): void;
|
||||
updateTime(columnIndex: Integer, x: JdbcTime): void;
|
||||
updateTime(columnLabel: string, x: JdbcTime): void;
|
||||
updateTimestamp(columnIndex: Integer, x: JdbcTimestamp): void;
|
||||
updateTimestamp(columnLabel: string, x: JdbcTimestamp): void;
|
||||
wasNull(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC ResultSetMetaData. For documentation of this class, see
|
||||
* java.sql.ResultSetMetaData.
|
||||
*/
|
||||
export interface JdbcResultSetMetaData {
|
||||
getCatalogName(column: Integer): string;
|
||||
getColumnClassName(column: Integer): string;
|
||||
getColumnCount(): Integer;
|
||||
getColumnDisplaySize(column: Integer): Integer;
|
||||
getColumnLabel(column: Integer): string;
|
||||
getColumnName(column: Integer): string;
|
||||
getColumnType(column: Integer): Integer;
|
||||
getColumnTypeName(column: Integer): string;
|
||||
getPrecision(column: Integer): Integer;
|
||||
getScale(column: Integer): Integer;
|
||||
getSchemaName(column: Integer): string;
|
||||
getTableName(column: Integer): string;
|
||||
isAutoIncrement(column: Integer): boolean;
|
||||
isCaseSensitive(column: Integer): boolean;
|
||||
isCurrency(column: Integer): boolean;
|
||||
isDefinitelyWritable(column: Integer): boolean;
|
||||
isNullable(column: Integer): Integer;
|
||||
isReadOnly(column: Integer): boolean;
|
||||
isSearchable(column: Integer): boolean;
|
||||
isSigned(column: Integer): boolean;
|
||||
isWritable(column: Integer): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC RowId. For documentation of this class, see java.sql.RowId.
|
||||
*/
|
||||
export interface JdbcRowId {
|
||||
getBytes(): Byte[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC SQLXML. For documentation of this class, see java.sql.SQLXML.
|
||||
*/
|
||||
export interface JdbcSQLXML {
|
||||
free(): void;
|
||||
getString(): string;
|
||||
setString(value: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Savepoint. For documentation of this class, see java.sql.Savepoint.
|
||||
* See also
|
||||
*
|
||||
* Savepoint
|
||||
*/
|
||||
export interface JdbcSavepoint {
|
||||
getSavepointId(): Integer;
|
||||
getSavepointName(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Statement. For documentation of this class, see java.sql.Statement.
|
||||
*/
|
||||
export interface JdbcStatement {
|
||||
addBatch(sql: string): void;
|
||||
cancel(): void;
|
||||
clearBatch(): void;
|
||||
clearWarnings(): void;
|
||||
close(): void;
|
||||
execute(sql: string): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): boolean;
|
||||
execute(sql: string, columnNames: String[]): boolean;
|
||||
executeBatch(): Integer[];
|
||||
executeQuery(sql: string): JdbcResultSet;
|
||||
executeUpdate(sql: string): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, autoGeneratedKeys: Integer, sql_: string, columnIndexes: Integer[]): Integer;
|
||||
executeUpdate(sql: string, columnNames: String[]): Integer;
|
||||
getConnection(): JdbcConnection;
|
||||
getFetchDirection(): Integer;
|
||||
getFetchSize(): Integer;
|
||||
getGeneratedKeys(): JdbcResultSet;
|
||||
getMaxFieldSize(): Integer;
|
||||
getMaxRows(): Integer;
|
||||
getMoreResults(): boolean;
|
||||
getMoreResults(current: Integer): boolean;
|
||||
getQueryTimeout(): Integer;
|
||||
getResultSet(): JdbcResultSet;
|
||||
getResultSetConcurrency(): Integer;
|
||||
getResultSetHoldability(): Integer;
|
||||
getResultSetType(): Integer;
|
||||
getUpdateCount(): Integer;
|
||||
getWarnings(): String[];
|
||||
isClosed(): boolean;
|
||||
isPoolable(): boolean;
|
||||
setCursorName(name: string): void;
|
||||
setEscapeProcessing(enable: boolean): void;
|
||||
setFetchDirection(direction: Integer): void;
|
||||
setFetchSize(rows: Integer): void;
|
||||
setMaxFieldSize(max: Integer): void;
|
||||
setMaxRows(max: Integer): void;
|
||||
setPoolable(poolable: boolean): void;
|
||||
setQueryTimeout(seconds: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Struct. For documentation of this class, see java.sql.Struct.
|
||||
*/
|
||||
export interface JdbcStruct {
|
||||
getAttributes(): Object[];
|
||||
getSQLTypeName(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Time. For documentation of this class, see java.sql.Time.
|
||||
*/
|
||||
export interface JdbcTime {
|
||||
after(when: JdbcTime): boolean;
|
||||
before(when: JdbcTime): boolean;
|
||||
getHours(): Integer;
|
||||
getMinutes(): Integer;
|
||||
getSeconds(): Integer;
|
||||
getTime(): Integer;
|
||||
setHours(hours: Integer): void;
|
||||
setMinutes(minutes: Integer): void;
|
||||
setSeconds(seconds: Integer): void;
|
||||
setTime(milliseconds: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDBC Timestamp. For documentation of this class, see java.sql.Timestamp.
|
||||
*/
|
||||
export interface JdbcTimestamp {
|
||||
after(when: JdbcTimestamp): boolean;
|
||||
before(when: JdbcTimestamp): boolean;
|
||||
getDate(): Integer;
|
||||
getHours(): Integer;
|
||||
getMinutes(): Integer;
|
||||
getMonth(): Integer;
|
||||
getNanos(): Integer;
|
||||
getSeconds(): Integer;
|
||||
getTime(): Integer;
|
||||
getYear(): Integer;
|
||||
setDate(date: Integer): void;
|
||||
setHours(hours: Integer): void;
|
||||
setMinutes(minutes: Integer): void;
|
||||
setMonth(month: Integer): void;
|
||||
setNanos(nanoseconds: Integer): void;
|
||||
setSeconds(seconds: Integer): void;
|
||||
setTime(milliseconds: Integer): void;
|
||||
setYear(year: Integer): void;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var Jdbc: GoogleAppsScript.JDBC.Jdbc;
|
||||
@@ -0,0 +1,25 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Language {
|
||||
/**
|
||||
* The Language service provides scripts a way to compute automatic translations of text.
|
||||
*
|
||||
* // The code below will write "Esta es una prueba" to the log.
|
||||
* var spanish = LanguageApp.translate('This is a test', 'en', 'es');
|
||||
* Logger.log(spanish);
|
||||
*/
|
||||
export interface LanguageApp {
|
||||
translate(text: string, sourceLanguage: string, targetLanguage: string): string;
|
||||
translate(text: string, sourceLanguage: string, targetLanguage: string, advancedArgs: Object): string;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var LanguageApp: GoogleAppsScript.Language.LanguageApp;
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Lock {
|
||||
/**
|
||||
* A representation of a mutual-exclusion lock.
|
||||
*
|
||||
* This class allows scripts to make sure that only one instance of the script is executing a given
|
||||
* section of code at a time. This is particularly useful for callbacks and triggers, where a user
|
||||
* action may cause changes to a shared resource and you want to ensure that aren't collisions.
|
||||
*
|
||||
* The following examples shows how to use a lock in a form submit handler.
|
||||
*
|
||||
* // Generates a unique ticket number for every form submission.
|
||||
* function onFormSubmit(e) {
|
||||
* var targetCell = e.range.offset(0, e.range.getNumColumns(), 1, 1);
|
||||
*
|
||||
* // Get a script lock, because we're about to modify a shared resource.
|
||||
* var lock = LockService.getScriptLock();
|
||||
* // Wait for up to 30 seconds for other processes to finish.
|
||||
* lock.waitLock(30000);
|
||||
*
|
||||
* var ticketNumber = Number(ScriptProperties.getProperty('lastTicketNumber')) + 1;
|
||||
* ScriptProperties.setProperty('lastTicketNumber', ticketNumber);
|
||||
*
|
||||
* // Release the lock so that other processes can continue.
|
||||
* lock.releaseLock();
|
||||
*
|
||||
* targetCell.setValue(ticketNumber);
|
||||
* }
|
||||
*
|
||||
* lastTicketNumber
|
||||
* ScriptProperties
|
||||
*/
|
||||
export interface Lock {
|
||||
hasLock(): boolean;
|
||||
releaseLock(): void;
|
||||
tryLock(timeoutInMillis: Integer): boolean;
|
||||
waitLock(timeoutInMillis: Integer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents concurrent access to sections of code. This can be useful when you have multiple users
|
||||
* or processes modifying a shared resource and want to prevent collisions.
|
||||
*/
|
||||
export interface LockService {
|
||||
getDocumentLock(): Lock;
|
||||
getScriptLock(): Lock;
|
||||
getUserLock(): Lock;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var LockService: GoogleAppsScript.Lock.LockService;
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Mail {
|
||||
/**
|
||||
* Sends email.
|
||||
*
|
||||
* This service allows users to send emails with complete control over the
|
||||
* content of the email. Unlike GmailApp, MailApp's sole purpose is sending email. MailApp cannot
|
||||
* access a user's Gmail inbox.
|
||||
*
|
||||
* Changes to scripts written using GmailApp are more likely to trigger a re-authorization
|
||||
* request from a user than MailApp scripts.
|
||||
*/
|
||||
export interface MailApp {
|
||||
getRemainingDailyQuota(): Integer;
|
||||
sendEmail(message: Object): void;
|
||||
sendEmail(recipient: string, subject: string, body: string): void;
|
||||
sendEmail(recipient: string, subject: string, body: string, options: Object): void;
|
||||
sendEmail(to: string, replyTo: string, subject: string, body: string): void;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var MailApp: GoogleAppsScript.Mail.MailApp;
|
||||
+319
@@ -0,0 +1,319 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Maps {
|
||||
/**
|
||||
* An enum representing the types of restrictions to avoid when finding directions.
|
||||
*/
|
||||
export enum Avoid { TOLLS, HIGHWAYS }
|
||||
|
||||
/**
|
||||
* An enum representing the named colors available to use in map images.
|
||||
*/
|
||||
export enum Color { BLACK, BROWN, GREEN, PURPLE, YELLOW, BLUE, GRAY, ORANGE, RED, WHITE }
|
||||
|
||||
/**
|
||||
* Allows for the retrieval of directions between locations.
|
||||
*
|
||||
* The example below shows how you can use this class to get the directions from Times Square to
|
||||
* Central Park, stopping first at Lincoln Center, plot the locations and path on a map,
|
||||
* and send the map in an email.
|
||||
*
|
||||
* // Get the directions.
|
||||
* var directions = Maps.newDirectionFinder()
|
||||
* .setOrigin('Times Square, New York, NY')
|
||||
* .addWaypoint('Lincoln Center, New York, NY')
|
||||
* .setDestination('Central Park, New York, NY')
|
||||
* .setMode(Maps.DirectionFinder.Mode.DRIVING)
|
||||
* .getDirections();
|
||||
* var route = directions.routes[0];
|
||||
*
|
||||
* // Set up marker styles.
|
||||
* var markerSize = Maps.StaticMap.MarkerSize.MID;
|
||||
* var markerColor = Maps.StaticMap.Color.GREEN
|
||||
* var markerLetterCode = 'A'.charCodeAt();
|
||||
*
|
||||
* // Add markers to the map.
|
||||
* var map = Maps.newStaticMap();
|
||||
* for (var i = 0; i < route.legs.length; i++) {
|
||||
* var leg = route.legs[i];
|
||||
* if (i == 0) {
|
||||
* // Add a marker for the start location of the first leg only.
|
||||
* map.setMarkerStyle(markerSize, markerColor, String.fromCharCode(markerLetterCode));
|
||||
* map.addMarker(leg.start_location.lat, leg.start_location.lng);
|
||||
* markerLetterCode++;
|
||||
* }
|
||||
* map.setMarkerStyle(markerSize, markerColor, String.fromCharCode(markerLetterCode));
|
||||
* map.addMarker(leg.end_location.lat, leg.end_location.lng);
|
||||
* markerLetterCode++;
|
||||
* }
|
||||
*
|
||||
* // Add a path for the entire route.
|
||||
* map.addPath(route.overview_polyline.points);
|
||||
*
|
||||
* // Send the map in an email.
|
||||
* var toAddress = Session.getActiveUser().getEmail();
|
||||
* MailApp.sendEmail(toAddress, 'Directions', 'Please open: ' + map.getMapUrl(), {
|
||||
* htmlBody: 'See below.<br/><img src="cid:mapImage">',
|
||||
* inlineImages: {
|
||||
* mapImage: Utilities.newBlob(map.getMapImage(), 'image/png')
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* See also
|
||||
*
|
||||
* Google Directions API
|
||||
*/
|
||||
export interface DirectionFinder {
|
||||
addWaypoint(latitude: Number, longitude: Number): DirectionFinder;
|
||||
addWaypoint(address: string): DirectionFinder;
|
||||
clearWaypoints(): DirectionFinder;
|
||||
getDirections(): Object;
|
||||
setAlternatives(useAlternatives: boolean): DirectionFinder;
|
||||
setArrive(time: Date): DirectionFinder;
|
||||
setAvoid(avoid: string): DirectionFinder;
|
||||
setDepart(time: Date): DirectionFinder;
|
||||
setDestination(latitude: Number, longitude: Number): DirectionFinder;
|
||||
setDestination(address: string): DirectionFinder;
|
||||
setLanguage(language: string): DirectionFinder;
|
||||
setMode(mode: string): DirectionFinder;
|
||||
setOptimizeWaypoints(optimizeOrder: boolean): DirectionFinder;
|
||||
setOrigin(latitude: Number, longitude: Number): DirectionFinder;
|
||||
setOrigin(address: string): DirectionFinder;
|
||||
setRegion(region: string): DirectionFinder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of enums used by DirectionFinder.
|
||||
*/
|
||||
export interface DirectionFinderEnums {
|
||||
Avoid: Avoid
|
||||
Mode: Mode
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for the sampling of elevations at particular locations.
|
||||
*
|
||||
* The example below shows how you can use this class to determine the highest point along the route
|
||||
* from Denver to Grand Junction in Colorado, plot it on a map, and save the map to Google Drive.
|
||||
*
|
||||
* // Get directions from Denver to Grand Junction.
|
||||
* var directions = Maps.newDirectionFinder()
|
||||
* .setOrigin('Denver, CO')
|
||||
* .setDestination('Grand Junction, CO')
|
||||
* .setMode(Maps.DirectionFinder.Mode.DRIVING)
|
||||
* .getDirections();
|
||||
* var route = directions.routes[0];
|
||||
*
|
||||
* // Get elevation samples along the route.
|
||||
* var numberOfSamples = 30;
|
||||
* var response = Maps.newElevationSampler()
|
||||
* .samplePath(route.overview_polyline.points, numberOfSamples)
|
||||
*
|
||||
* // Determine highest point.
|
||||
* var maxElevation = Number.MIN_VALUE;
|
||||
* var highestPoint = null;
|
||||
* for (var i = 0; i < response.results.length; i++) {
|
||||
* var sample = response.results[i];
|
||||
* if (sample.elevation > maxElevation) {
|
||||
* maxElevation = sample.elevation;
|
||||
* highestPoint = sample.location;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Add the path and marker to a map.
|
||||
* var map = Maps.newStaticMap()
|
||||
* .addPath(route.overview_polyline.points)
|
||||
* .addMarker(highestPoint.lat, highestPoint.lng);
|
||||
*
|
||||
* // Save the map to your drive
|
||||
* DocsList.createFile(Utilities.newBlob(map.getMapImage(), 'image/png', 'map.png'));
|
||||
*
|
||||
* See also
|
||||
*
|
||||
* Google Elevation API
|
||||
*/
|
||||
export interface ElevationSampler {
|
||||
sampleLocation(latitude: Number, longitude: Number): Object;
|
||||
sampleLocations(points: Number[]): Object;
|
||||
sampleLocations(encodedPolyline: string): Object;
|
||||
samplePath(points: Number[], numSamples: Integer): Object;
|
||||
samplePath(encodedPolyline: string, numSamples: Integer): Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the format of the map image.
|
||||
* See also
|
||||
*
|
||||
* Google Static Maps API
|
||||
*/
|
||||
export enum Format { PNG, PNG8, PNG32, GIF, JPG, JPG_BASELINE }
|
||||
|
||||
/**
|
||||
* Allows for the conversion between an address and geographical coordinates.
|
||||
*
|
||||
* The example below shows how you can use this class find the top nine matches for the location
|
||||
* "Main St" in Colorado, add them to a map, and then embed it in a new Google Doc.
|
||||
*
|
||||
* // Find the best matches for "Main St" in Colorado.
|
||||
* var response = Maps.newGeocoder()
|
||||
* // The latitudes and longitudes of southwest and northeast corners of Colorado, respectively.
|
||||
* .setBounds(36.998166, -109.045486, 41.001666,-102.052002)
|
||||
* .geocode('Main St');
|
||||
*
|
||||
* // Create a Google Doc and map.
|
||||
* var doc = DocumentApp.create('My Map');
|
||||
* var map = Maps.newStaticMap();
|
||||
*
|
||||
* // Add each result to the map and doc.
|
||||
* for (var i = 0; i < response.results.length && i < 9; i++) {
|
||||
* var result = response.results[i];
|
||||
* map.setMarkerStyle(null, null, i + 1);
|
||||
* map.addMarker(result.geometry.location.lat, result.geometry.location.lng);
|
||||
* doc.appendListItem(result.formatted_address);
|
||||
* }
|
||||
*
|
||||
* // Add the finished map to the doc.
|
||||
* doc.appendImage(Utilities.newBlob(map.getMapImage(), 'image/png'));
|
||||
*
|
||||
* See also
|
||||
*
|
||||
* Google Geocoding API
|
||||
*/
|
||||
export interface Geocoder {
|
||||
geocode(address: string): Object;
|
||||
reverseGeocode(latitude: Number, longitude: Number): Object;
|
||||
reverseGeocode(swLatitude: Number, swLongitude: Number, neLatitude: Number, neLongitude: Number): Object;
|
||||
setBounds(swLatitude: Number, swLongitude: Number, neLatitude: Number, neLongitude: Number): Geocoder;
|
||||
setLanguage(language: string): Geocoder;
|
||||
setRegion(region: string): Geocoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for direction finding, geocoding, elevation sampling and the creation of static map
|
||||
* images.
|
||||
*/
|
||||
export interface Maps {
|
||||
DirectionFinder: DirectionFinderEnums
|
||||
StaticMap: StaticMapEnums
|
||||
decodePolyline(polyline: string): Number[];
|
||||
encodePolyline(points: Number[]): string;
|
||||
newDirectionFinder(): DirectionFinder;
|
||||
newElevationSampler(): ElevationSampler;
|
||||
newGeocoder(): Geocoder;
|
||||
newStaticMap(): StaticMap;
|
||||
setAuthentication(clientId: string, signingKey: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the size of a marker added to a map.
|
||||
* See also
|
||||
*
|
||||
* Google Static Maps API
|
||||
*/
|
||||
export enum MarkerSize { TINY, MID, SMALL }
|
||||
|
||||
/**
|
||||
* An enum representing the mode of travel to use when finding directions.
|
||||
*/
|
||||
export enum Mode { DRIVING, WALKING, BICYCLING, TRANSIT }
|
||||
|
||||
/**
|
||||
* Allows for the creation and decoration of static map images.
|
||||
*
|
||||
* The example below shows how you can use this class to create a map of New York City's Theatre
|
||||
* District, including nearby train stations, and display it in a simple web app.
|
||||
*
|
||||
* function doGet(event) {
|
||||
* // Create a map centered on Times Square.
|
||||
* var map = Maps.newStaticMap()
|
||||
* .setSize(600, 600)
|
||||
* .setCenter('Times Square, New York, NY');
|
||||
*
|
||||
* // Add markers for the nearbye train stations.
|
||||
* map.setMarkerStyle(Maps.StaticMap.MarkerSize.MID, Maps.StaticMap.Color.RED, 'T');
|
||||
* map.addMarker('Grand Central Station, New York, NY');
|
||||
* map.addMarker('Penn Station, New York, NY');
|
||||
*
|
||||
* // Show the boundaries of the Theatre District.
|
||||
* var corners = [
|
||||
* '8th Ave & 53rd St, New York, NY',
|
||||
* '6th Ave & 53rd St, New York, NY',
|
||||
* '6th Ave & 40th St, New York, NY',
|
||||
* '8th Ave & 40th St, New York, NY'
|
||||
* ];
|
||||
* map.setPathStyle(4, Maps.StaticMap.Color.BLACK, Maps.StaticMap.Color.BLUE);
|
||||
* map.beginPath();
|
||||
* for (var i = 0; i < corners.length; i++) {
|
||||
* map.addAddress(corners[i]);
|
||||
* }
|
||||
*
|
||||
* // Create the user interface and add the map image.
|
||||
* var app = UiApp.createApplication().setTitle('NYC Theatre District');
|
||||
* app.add(app.createImage(map.getMapUrl()));
|
||||
* return app;
|
||||
* }
|
||||
*
|
||||
* See also
|
||||
*
|
||||
* Google Static Maps API
|
||||
*/
|
||||
export interface StaticMap {
|
||||
addAddress(address: string): StaticMap;
|
||||
addMarker(latitude: Number, longitude: Number): StaticMap;
|
||||
addMarker(address: string): StaticMap;
|
||||
addPath(points: Number[]): StaticMap;
|
||||
addPath(polyline: string): StaticMap;
|
||||
addPoint(latitude: Number, longitude: Number): StaticMap;
|
||||
addVisible(latitude: Number, longitude: Number): StaticMap;
|
||||
addVisible(address: string): StaticMap;
|
||||
beginPath(): StaticMap;
|
||||
clearMarkers(): StaticMap;
|
||||
clearPaths(): StaticMap;
|
||||
clearVisibles(): StaticMap;
|
||||
endPath(): StaticMap;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getMapImage(): Byte[];
|
||||
getMapUrl(): string;
|
||||
setCenter(latitude: Number, longitude: Number): StaticMap;
|
||||
setCenter(address: string): StaticMap;
|
||||
setCustomMarkerStyle(imageUrl: string, useShadow: boolean): StaticMap;
|
||||
setFormat(format: string): StaticMap;
|
||||
setLanguage(language: string): StaticMap;
|
||||
setMapType(mapType: string): StaticMap;
|
||||
setMarkerStyle(size: string, color: string, label: string): StaticMap;
|
||||
setMobile(useMobileTiles: boolean): StaticMap;
|
||||
setPathStyle(weight: Integer, color: string, fillColor: string): StaticMap;
|
||||
setSize(width: Integer, height: Integer): StaticMap;
|
||||
setZoom(zoom: Integer): StaticMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of enums used by StaticMap.
|
||||
*/
|
||||
export interface StaticMapEnums {
|
||||
Color: Color
|
||||
Format: Format
|
||||
MarkerSize: MarkerSize
|
||||
Type: Type
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum representing the type of map to render.
|
||||
* See also
|
||||
*
|
||||
* Google Static Maps API
|
||||
*/
|
||||
export enum Type { ROADMAP, SATELLITE, TERRAIN, HYBRID }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var Maps: GoogleAppsScript.Maps.Maps;
|
||||
@@ -0,0 +1,228 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Optimization {
|
||||
/**
|
||||
* Object storing a linear constraint of the form lowerBound ≤ Sum(a(i) x(i)) ≤ upperBound
|
||||
* where lowerBound and upperBound are constants, a(i) are constant
|
||||
* coefficients and x(i) are variables (unknowns).
|
||||
*
|
||||
* The example below creates one variable x with values between 0 and 5 and
|
||||
* creates the constraint 0 ≤ 2 * x ≤ 5. This is done by first creating a constraint with
|
||||
* the lower bound 5 and upper bound 5. Then the coefficient for variable x
|
||||
* in this constraint is set to 2.
|
||||
*
|
||||
* var engine = LinearOptimizationService.createEngine();
|
||||
* // Create a variable so we can add it to the constraint
|
||||
* engine.addVariable('x', 0, 5);
|
||||
* // Create a linear constraint with the bounds 0 and 10
|
||||
* var constraint = engine.addConstraint(0, 10);
|
||||
* // Set the coefficient of the variable in the constraint. The constraint is now:
|
||||
* // 0 <= 2 * x <= 5
|
||||
* constraint.setCoefficient('x', 2);
|
||||
*/
|
||||
export interface LinearOptimizationConstraint {
|
||||
setCoefficient(variableName: string, coefficient: Number): LinearOptimizationConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* The engine used to model and solve a linear program. The example below solves the following
|
||||
* linear program:
|
||||
*
|
||||
* Two variables, x and y:
|
||||
*
|
||||
* 0 ≤ x ≤ 10
|
||||
*
|
||||
* 0 ≤ y ≤ 5
|
||||
*
|
||||
* Constraints:
|
||||
*
|
||||
* 0 ≤ 2 * x + 5 * y ≤ 10
|
||||
*
|
||||
* 0 ≤ 10 * x + 3 * y ≤ 20
|
||||
*
|
||||
* Objective:
|
||||
* Maximize x + y
|
||||
*
|
||||
* var engine = LinearOptimizationService.createEngine();
|
||||
*
|
||||
* // Add variables, constraints and define the objective with addVariable(), addConstraint(), etc
|
||||
* // Add two variables, 0 <= x <= 10 and 0 <= y <= 5
|
||||
* engine.addVariable('x', 0, 10);
|
||||
* engine.addVariable('y', 0, 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 2 * x + 5 * y <= 10
|
||||
* var constraint = engine.addConstraint(0, 10);
|
||||
* constraint.setCoefficient('x', 2);
|
||||
* constraint.setCoefficient('y', 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 10 * x + 3 * y <= 20
|
||||
* var constraint = engine.addConstraint(0, 20);
|
||||
* constraint.setCoefficient('x', 10);
|
||||
* constraint.setCoefficient('y', 3);
|
||||
*
|
||||
* // Set the objective to be x + y
|
||||
* engine.setObjectiveCoefficient('x', 1);
|
||||
* engine.setObjectiveCoefficient('y', 1);
|
||||
*
|
||||
* // Engine should maximize the objective
|
||||
* engine.setMaximization();
|
||||
*
|
||||
* // Solve the linear program
|
||||
* var solution = engine.solve();
|
||||
* if (!solution.isValid()) {
|
||||
* Logger.log('No solution ' + solution.getStatus());
|
||||
* } else {
|
||||
* Logger.log('Value of x: ' + solution.getVariableValue('x'));
|
||||
* Logger.log('Value of y: ' + solution.getVariableValue('y'));
|
||||
* }
|
||||
*/
|
||||
export interface LinearOptimizationEngine {
|
||||
addConstraint(lowerBound: Number, upperBound: Number): LinearOptimizationConstraint;
|
||||
addVariable(name: string, lowerBound: Number, upperBound: Number): LinearOptimizationEngine;
|
||||
addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType): LinearOptimizationEngine;
|
||||
setMaximization(): LinearOptimizationEngine;
|
||||
setMinimization(): LinearOptimizationEngine;
|
||||
setObjectiveCoefficient(variableName: string, coefficient: Number): LinearOptimizationEngine;
|
||||
solve(): LinearOptimizationSolution;
|
||||
solve(seconds: Number): LinearOptimizationSolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* The linear optimization service, used to model and solve linear and mixed-integer linear
|
||||
* programs. The example below solves the following linear program:
|
||||
*
|
||||
* Two variables, x and y:
|
||||
*
|
||||
* 0 ≤ x ≤ 10
|
||||
*
|
||||
* 0 ≤ y ≤ 5
|
||||
*
|
||||
* Constraints:
|
||||
*
|
||||
* 0 ≤ 2 * x + 5 * y ≤ 10
|
||||
*
|
||||
* 0 ≤ 10 * x + 3 * y ≤ 20
|
||||
*
|
||||
* Objective:
|
||||
* Maximize x + y
|
||||
*
|
||||
* var engine = LinearOptimizationService.createEngine();
|
||||
*
|
||||
* // Add variables, constraints and define the objective using addVariable(), addConstraint(), etc.
|
||||
* // Add two variables, 0 <= x <= 10 and 0 <= y <= 5
|
||||
* engine.addVariable('x', 0, 10);
|
||||
* engine.addVariable('y', 0, 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 2 * x + 5 * y <= 10
|
||||
* var constraint = engine.addConstraint(0, 10);
|
||||
* constraint.setCoefficient('x', 2);
|
||||
* constraint.setCoefficient('y', 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 10 * x + 3 * y <= 20
|
||||
* var constraint = engine.addConstraint(0, 20);
|
||||
* constraint.setCoefficient('x', 10);
|
||||
* constraint.setCoefficient('y', 3);
|
||||
*
|
||||
* // Set the objective to be x + y
|
||||
* engine.setObjectiveCoefficient('x', 1);
|
||||
* engine.setObjectiveCoefficient('y', 1);
|
||||
*
|
||||
* // Engine should maximize the objective.
|
||||
* engine.setMaximization();
|
||||
*
|
||||
* // Solve the linear program
|
||||
* var solution = engine.solve();
|
||||
* if (!solution.isValid()) {
|
||||
* Logger.log('No solution ' + solution.getStatus());
|
||||
* } else {
|
||||
* Logger.log('Value of x: ' + solution.getVariableValue('x'));
|
||||
* Logger.log('Value of y: ' + solution.getVariableValue('y'));
|
||||
* }
|
||||
*/
|
||||
export interface LinearOptimizationService {
|
||||
Status: Status
|
||||
VariableType: VariableType
|
||||
createEngine(): LinearOptimizationEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* The solution of a linear program. The example below solves the following linear program:
|
||||
*
|
||||
* Two variables, x and y:
|
||||
*
|
||||
* 0 ≤ x ≤ 10
|
||||
*
|
||||
* 0 ≤ y ≤ 5
|
||||
*
|
||||
* Constraints:
|
||||
*
|
||||
* 0 ≤ 2 * x + 5 * y ≤ 10
|
||||
*
|
||||
* 0 ≤ 10 * x + 3 * y ≤ 20
|
||||
*
|
||||
* Objective:
|
||||
* Maximize x + y
|
||||
*
|
||||
* var engine = LinearOptimizationService.createEngine();
|
||||
*
|
||||
* // Add variables, constraints and define the objective with addVariable(), addConstraint(), etc.
|
||||
* // Add two variables, 0 <= x <= 10 and 0 <= y <= 5
|
||||
* engine.addVariable('x', 0, 10);
|
||||
* engine.addVariable('y', 0, 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 2 * x + 5 * y <= 10
|
||||
* var constraint = engine.addConstraint(0, 10);
|
||||
* constraint.setCoefficient('x', 2);
|
||||
* constraint.setCoefficient('y', 5);
|
||||
*
|
||||
* // Create the constraint: 0 <= 10 * x + 3 * y <= 20
|
||||
* var constraint = engine.addConstraint(0, 20);
|
||||
* constraint.setCoefficient('x', 10);
|
||||
* constraint.setCoefficient('y', 3);
|
||||
*
|
||||
* // Set the objective to be x + y
|
||||
* engine.setObjectiveCoefficient('x', 1);
|
||||
* engine.setObjectiveCoefficient('y', 1);
|
||||
*
|
||||
* // Engine should maximize the objective
|
||||
* engine.setMaximization();
|
||||
*
|
||||
* // Solve the linear program
|
||||
* var solution = engine.solve();
|
||||
* if (!solution.isValid()) {
|
||||
* Logger.log('No solution ' + solution.getStatus());
|
||||
* } else {
|
||||
* Logger.log('Objective value: ' + solution.getObjectiveValue());
|
||||
* Logger.log('Value of x: ' + solution.getVariableValue('x'));
|
||||
* Logger.log('Value of y: ' + solution.getVariableValue('y'));
|
||||
* }
|
||||
*/
|
||||
export interface LinearOptimizationSolution {
|
||||
getObjectiveValue(): Number;
|
||||
getStatus(): Status;
|
||||
getVariableValue(variableName: string): Number;
|
||||
isValid(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of the solution. Before solving a problem the status will be NOT_SOLVED;
|
||||
* afterwards it will take any of the other values depending if it successfully found a solution and
|
||||
* if the solution is optimal.
|
||||
*/
|
||||
export enum Status { OPTIMAL, FEASIBLE, INFEASIBLE, UNBOUNDED, ABNORMAL, MODEL_INVALID, NOT_SOLVED }
|
||||
|
||||
/**
|
||||
* Type of variables created by the engine.
|
||||
*/
|
||||
export enum VariableType { INTEGER, CONTINUOUS }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var LinearOptimizationService: GoogleAppsScript.Optimization.LinearOptimizationService;
|
||||
@@ -0,0 +1,91 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Properties {
|
||||
/**
|
||||
* The properties object acts as the interface to access user, document, or script properties.
|
||||
* The specific property type depends on which of the three methods of
|
||||
* PropertiesService the script called:
|
||||
* PropertiesService.getDocumentProperties(),
|
||||
* PropertiesService.getUserProperties(), or
|
||||
* PropertiesService.getScriptProperties(). Properties cannot be shared between scripts. For
|
||||
* more information about property types, see the
|
||||
* guide to the Properties service.
|
||||
*/
|
||||
export interface Properties {
|
||||
deleteAllProperties(): Properties;
|
||||
deleteProperty(key: string): Properties;
|
||||
getKeys(): String[];
|
||||
getProperties(): Object;
|
||||
getProperty(key: string): string;
|
||||
setProperties(properties: Object): Properties;
|
||||
setProperties(properties: Object, deleteAllOthers: boolean): Properties;
|
||||
setProperty(key: string, value: string): Properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows scripts to store simple data in key-value pairs scoped to one script, one user of a
|
||||
* script, or one document in which an add-on is used. Properties cannot be shared between scripts.
|
||||
* For more information about when to use each type of property, see the
|
||||
* guide to the Properties service.
|
||||
*
|
||||
* // Sets three properties of different types.
|
||||
* var documentProperties = PropertiesService.getDocumentProperties();
|
||||
* var scriptProperties = PropertiesService.getScriptProperties();
|
||||
* var userProperties = PropertiesService.getUserProperties();
|
||||
*
|
||||
* documentProperties.setProperty('DAYS_TO_FETCH', '5');
|
||||
* scriptProperties.setProperty('SERVER_URL', 'http://www.example.com/MyWeatherService/');
|
||||
* userProperties.setProperty('DISPLAY_UNITS', 'metric');
|
||||
*/
|
||||
export interface PropertiesService {
|
||||
getDocumentProperties(): Properties;
|
||||
getScriptProperties(): Properties;
|
||||
getUserProperties(): Properties;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Deprecated. This class is deprecated and should not be used in new scripts.
|
||||
* Script Properties are key-value pairs stored by a script in a persistent store. Script Properties
|
||||
* are scoped per script, regardless of which user runs the script.
|
||||
*/
|
||||
export interface ScriptProperties {
|
||||
deleteAllProperties(): ScriptProperties;
|
||||
deleteProperty(key: string): ScriptProperties;
|
||||
getKeys(): String[];
|
||||
getProperties(): Object;
|
||||
getProperty(key: string): string;
|
||||
setProperties(properties: Object): ScriptProperties;
|
||||
setProperties(properties: Object, deleteAllOthers: boolean): ScriptProperties;
|
||||
setProperty(key: string, value: string): ScriptProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Deprecated. This class is deprecated and should not be used in new scripts.
|
||||
* User Properties are key-value pairs unique to a user. User Properties are scoped per user; any
|
||||
* script running under the identity of a user can access User Properties for that user only.
|
||||
*/
|
||||
export interface UserProperties {
|
||||
deleteAllProperties(): UserProperties;
|
||||
deleteProperty(key: string): UserProperties;
|
||||
getKeys(): String[];
|
||||
getProperties(): Object;
|
||||
getProperty(key: string): string;
|
||||
setProperties(properties: Object): UserProperties;
|
||||
setProperties(properties: Object, deleteAllOthers: boolean): UserProperties;
|
||||
setProperty(key: string, value: string): UserProperties;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var PropertiesService: GoogleAppsScript.Properties.PropertiesService;
|
||||
declare var ScriptProperties: GoogleAppsScript.Properties.ScriptProperties;
|
||||
declare var UserProperties: GoogleAppsScript.Properties.UserProperties;
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
/// <reference path="google-apps-script.document.d.ts" />
|
||||
/// <reference path="google-apps-script.forms.d.ts" />
|
||||
/// <reference path="google-apps-script.spreadsheet.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Script {
|
||||
/**
|
||||
* An enumeration that identifies which categories of authorized services Apps Script
|
||||
* is able to execute through a triggered function. These values are exposed in
|
||||
* triggered functions as the authMode
|
||||
* property of the event parameter, e. For
|
||||
* more information, see the
|
||||
* guide to the authorization lifecycle for add-ons.
|
||||
*
|
||||
* function onOpen(e) {
|
||||
* var menu = SpreadsheetApp.getUi().createAddonMenu();
|
||||
* if (e && e.authMode == ScriptApp.AuthMode.NONE) {
|
||||
* // Add a normal menu item (works in all authorization modes).
|
||||
* menu.addItem('Start workflow', 'startWorkflow');
|
||||
* } else {
|
||||
* // Add a menu item based on properties (doesn't work in AuthMode.NONE).
|
||||
* var properties = PropertiesService.getDocumentProperties();
|
||||
* var workflowStarted = properties.getProperty('workflowStarted');
|
||||
* if (workflowStarted) {
|
||||
* menu.addItem('Check workflow status', 'checkWorkflow');
|
||||
* } else {
|
||||
* menu.addItem('Start workflow', 'startWorkflow');
|
||||
* }
|
||||
* // Record analytics.
|
||||
* UrlFetchApp.fetch('http://www.example.com/analytics?event=open');
|
||||
* }
|
||||
* menu.addToUi();
|
||||
* }
|
||||
*/
|
||||
export enum AuthMode { NONE, CUSTOM_FUNCTION, LIMITED, FULL }
|
||||
|
||||
/**
|
||||
* An object used to determine whether the user needs to authorize this script to use
|
||||
* one or more services, and to provide the URL for an authorization dialog. If the script
|
||||
* is published as an add-on that uses
|
||||
* installable triggers, this information
|
||||
* can be used to control access to sections of code for which the user lacks the necessary
|
||||
* authorization. Alternately, the add-on can ask the user to open the URL for the
|
||||
* authorization dialog to resolve the problem.
|
||||
*
|
||||
* This object is returned by
|
||||
* ScriptApp.getAuthorizationInfo(authMode). In almost all cases,
|
||||
* scripts should call
|
||||
* ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL), since no other
|
||||
* authorization mode requires that users grant authorization.
|
||||
*/
|
||||
export interface AuthorizationInfo {
|
||||
getAuthorizationStatus(): AuthorizationStatus;
|
||||
getAuthorizationUrl(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration denoting the authorization status of a script.
|
||||
*/
|
||||
export enum AuthorizationStatus { REQUIRED, NOT_REQUIRED }
|
||||
|
||||
/**
|
||||
* A builder for clock triggers.
|
||||
*/
|
||||
export interface ClockTriggerBuilder {
|
||||
after(durationMilliseconds: Integer): ClockTriggerBuilder;
|
||||
at(date: Date): ClockTriggerBuilder;
|
||||
atDate(year: Integer, month: Integer, day: Integer): ClockTriggerBuilder;
|
||||
atHour(hour: Integer): ClockTriggerBuilder;
|
||||
create(): Trigger;
|
||||
everyDays(n: Integer): ClockTriggerBuilder;
|
||||
everyHours(n: Integer): ClockTriggerBuilder;
|
||||
everyMinutes(n: Integer): ClockTriggerBuilder;
|
||||
everyWeeks(n: Integer): ClockTriggerBuilder;
|
||||
inTimezone(timezone: string): ClockTriggerBuilder;
|
||||
nearMinute(minute: Integer): ClockTriggerBuilder;
|
||||
onMonthDay(day: Integer): ClockTriggerBuilder;
|
||||
onWeekDay(day: Base.Weekday): ClockTriggerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for document triggers.
|
||||
*/
|
||||
export interface DocumentTriggerBuilder {
|
||||
create(): Trigger;
|
||||
onOpen(): DocumentTriggerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration denoting the type of triggered event.
|
||||
*/
|
||||
export enum EventType { CLOCK, ON_OPEN, ON_EDIT, ON_FORM_SUBMIT, ON_CHANGE }
|
||||
|
||||
/**
|
||||
* A builder for form triggers.
|
||||
*/
|
||||
export interface FormTriggerBuilder {
|
||||
create(): Trigger;
|
||||
onFormSubmit(): FormTriggerBuilder;
|
||||
onOpen(): FormTriggerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration that indicates how the script came to be installed as an add-on for the
|
||||
* current user.
|
||||
*/
|
||||
export enum InstallationSource { APPS_MARKETPLACE_DOMAIN_ADD_ON, NONE, WEB_STORE_ADD_ON }
|
||||
|
||||
/**
|
||||
* Access and manipulate script publishing and triggers. This class allows users to create script
|
||||
* triggers and control publishing the script as a service.
|
||||
*/
|
||||
export interface ScriptApp {
|
||||
AuthMode: AuthMode
|
||||
AuthorizationStatus: AuthorizationStatus
|
||||
EventType: EventType
|
||||
InstallationSource: InstallationSource
|
||||
TriggerSource: TriggerSource
|
||||
WeekDay: Base.Weekday
|
||||
deleteTrigger(trigger: Trigger): void;
|
||||
getAuthorizationInfo(authMode: AuthMode): AuthorizationInfo;
|
||||
getInstallationSource(): InstallationSource;
|
||||
getOAuthToken(): string;
|
||||
getProjectKey(): string;
|
||||
getProjectTriggers(): Trigger[];
|
||||
getService(): Service;
|
||||
getUserTriggers(document: Document.Document): Trigger[];
|
||||
getUserTriggers(form: Forms.Form): Trigger[];
|
||||
getUserTriggers(spreadsheet: Spreadsheet.Spreadsheet): Trigger[];
|
||||
invalidateAuth(): void;
|
||||
newStateToken(): StateTokenBuilder;
|
||||
newTrigger(functionName: string): TriggerBuilder;
|
||||
getScriptTriggers(): Trigger[];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export enum Service { MYSELF, DOMAIN, ALL }
|
||||
|
||||
/**
|
||||
* Builder for spreadsheet triggers.
|
||||
*/
|
||||
export interface SpreadsheetTriggerBuilder {
|
||||
create(): Trigger;
|
||||
onChange(): SpreadsheetTriggerBuilder;
|
||||
onEdit(): SpreadsheetTriggerBuilder;
|
||||
onFormSubmit(): SpreadsheetTriggerBuilder;
|
||||
onOpen(): SpreadsheetTriggerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows scripts to create state tokens that can be used in callback APIs (like OAuth flows).
|
||||
*
|
||||
* // Reusable function to generate a callback URL, assuming the script has been published as a
|
||||
* // web app (necessary to obtain the URL programmatically). If the script has not been published
|
||||
* // as a web app, set `var url` in the first line to the URL of your script project (which
|
||||
* // cannot be obtained programmatically).
|
||||
* function getCallbackURL(callbackFunction){
|
||||
* var url = ScriptApp.getService().getUrl(); // Ends in /exec (for a web app)
|
||||
* url = url.slice(0, -4) + 'usercallback?state='; // Change /exec to /usercallback
|
||||
* var stateToken = ScriptApp.newStateToken()
|
||||
* .withMethod(callbackFunction)
|
||||
* .withTimeout(120)
|
||||
* .createToken();
|
||||
* return url + stateToken;
|
||||
* }
|
||||
*/
|
||||
export interface StateTokenBuilder {
|
||||
createToken(): string;
|
||||
withArgument(name: string, value: string): StateTokenBuilder;
|
||||
withMethod(method: string): StateTokenBuilder;
|
||||
withTimeout(seconds: Integer): StateTokenBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* A script trigger.
|
||||
*/
|
||||
export interface Trigger {
|
||||
getEventType(): EventType;
|
||||
getHandlerFunction(): string;
|
||||
getTriggerSource(): TriggerSource;
|
||||
getTriggerSourceId(): string;
|
||||
getUniqueId(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic builder for script triggers.
|
||||
*/
|
||||
export interface TriggerBuilder {
|
||||
forDocument(document: Document.Document): DocumentTriggerBuilder;
|
||||
forDocument(key: string): DocumentTriggerBuilder;
|
||||
forForm(form: Forms.Form): FormTriggerBuilder;
|
||||
forForm(key: string): FormTriggerBuilder;
|
||||
forSpreadsheet(sheet: Spreadsheet.Spreadsheet): SpreadsheetTriggerBuilder;
|
||||
forSpreadsheet(key: string): SpreadsheetTriggerBuilder;
|
||||
timeBased(): ClockTriggerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration denoting the source of the event that causes the trigger to fire.
|
||||
*/
|
||||
export enum TriggerSource { SPREADSHEETS, CLOCK, FORMS, DOCUMENTS }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var ScriptApp: GoogleAppsScript.Script.ScriptApp;
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Sites {
|
||||
/**
|
||||
* A Sites Attachment such as a file attached to a page.
|
||||
*
|
||||
* Note that an Attachment is a Blob and can be used anywhere Blob input is expected.
|
||||
*
|
||||
* var filesPage = SitesApp.getSite('example.com', 'mysite').getChildByName("files");
|
||||
* var attachments = filesPage.getAttachments();
|
||||
*
|
||||
* // DocsList.createFile accepts a blob input. Since an Attachment is just a blob, we can
|
||||
* // just pass it directly to that method
|
||||
* var file = DocsList.createFile(attachments[0]);
|
||||
*/
|
||||
export interface Attachment {
|
||||
deleteAttachment(): void;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getAttachmentType(): AttachmentType;
|
||||
getBlob(): Base.Blob;
|
||||
getContentType(): string;
|
||||
getDatePublished(): Date;
|
||||
getDescription(): string;
|
||||
getLastUpdated(): Date;
|
||||
getParent(): Page;
|
||||
getTitle(): string;
|
||||
getUrl(): string;
|
||||
setContentType(contentType: string): Attachment;
|
||||
setDescription(description: string): Attachment;
|
||||
setFrom(blob: Base.BlobSource): Attachment;
|
||||
setParent(parent: Page): Attachment;
|
||||
setTitle(title: string): Attachment;
|
||||
setUrl(url: string): Attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typesafe enum for sites attachment type.
|
||||
*/
|
||||
export enum AttachmentType { WEB, HOSTED }
|
||||
|
||||
/**
|
||||
* A Sites Column - a column from a Sites List page.
|
||||
*/
|
||||
export interface Column {
|
||||
deleteColumn(): void;
|
||||
getName(): string;
|
||||
getParent(): Page;
|
||||
setName(name: string): Column;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Comment attached to any Sites page.
|
||||
*/
|
||||
export interface Comment {
|
||||
deleteComment(): void;
|
||||
getAuthorEmail(): string;
|
||||
getAuthorName(): string;
|
||||
getContent(): string;
|
||||
getDatePublished(): Date;
|
||||
getLastUpdated(): Date;
|
||||
getParent(): Page;
|
||||
setContent(content: string): Comment;
|
||||
setParent(parent: Page): Comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Sites ListItem - a list element from a Sites List page.
|
||||
*/
|
||||
export interface ListItem {
|
||||
deleteListItem(): void;
|
||||
getDatePublished(): Date;
|
||||
getLastUpdated(): Date;
|
||||
getParent(): Page;
|
||||
getValueByIndex(index: Integer): string;
|
||||
getValueByName(name: string): string;
|
||||
setParent(parent: Page): ListItem;
|
||||
setValueByIndex(index: Integer, value: string): ListItem;
|
||||
setValueByName(name: string, value: string): ListItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Page on a Google Site.
|
||||
*/
|
||||
export interface Page {
|
||||
addColumn(name: string): Column;
|
||||
addHostedAttachment(blob: Base.BlobSource): Attachment;
|
||||
addHostedAttachment(blob: Base.BlobSource, description: string): Attachment;
|
||||
addListItem(values: String[]): ListItem;
|
||||
addWebAttachment(title: string, description: string, url: string): Attachment;
|
||||
createAnnouncement(title: string, html: string): Page;
|
||||
createAnnouncement(title: string, html: string, asDraft: boolean): Page;
|
||||
createAnnouncementsPage(title: string, name: string, html: string): Page;
|
||||
createFileCabinetPage(title: string, name: string, html: string): Page;
|
||||
createListPage(title: string, name: string, html: string, columnNames: String[]): Page;
|
||||
createPageFromTemplate(title: string, name: string, template: Page): Page;
|
||||
createWebPage(title: string, name: string, html: string): Page;
|
||||
deletePage(): void;
|
||||
getAllDescendants(): Page[];
|
||||
getAllDescendants(options: Object): Page[];
|
||||
getAnnouncements(): Page[];
|
||||
getAnnouncements(optOptions: Object): Page[];
|
||||
getAttachments(): Attachment[];
|
||||
getAttachments(optOptions: Object): Attachment[];
|
||||
getAuthors(): String[];
|
||||
getChildByName(name: string): Page;
|
||||
getChildren(): Page[];
|
||||
getChildren(options: Object): Page[];
|
||||
getColumns(): Column[];
|
||||
getComments(): Comment[];
|
||||
getComments(optOptions: Object): Comment[];
|
||||
getDatePublished(): Date;
|
||||
getHtmlContent(): string;
|
||||
getIsDraft(): boolean;
|
||||
getLastEdited(): Date;
|
||||
getLastUpdated(): Date;
|
||||
getListItems(): ListItem[];
|
||||
getListItems(optOptions: Object): ListItem[];
|
||||
getName(): string;
|
||||
getPageType(): PageType;
|
||||
getParent(): Page;
|
||||
getTextContent(): string;
|
||||
getTitle(): string;
|
||||
getUrl(): string;
|
||||
isDeleted(): boolean;
|
||||
isTemplate(): boolean;
|
||||
publishAsTemplate(name: string): Page;
|
||||
search(query: string): Page[];
|
||||
search(query: string, options: Object): Page[];
|
||||
setHtmlContent(html: string): Page;
|
||||
setIsDraft(draft: boolean): Page;
|
||||
setName(name: string): Page;
|
||||
setParent(parent: Page): Page;
|
||||
setTitle(title: string): Page;
|
||||
addComment(content: string): Comment;
|
||||
getPageName(): string;
|
||||
getSelfLink(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typesafe enum for sites page type.
|
||||
*/
|
||||
export enum PageType { WEB_PAGE, LIST_PAGE, ANNOUNCEMENT, ANNOUNCEMENTS_PAGE, FILE_CABINET_PAGE }
|
||||
|
||||
/**
|
||||
* An object representing a Google Site.
|
||||
*/
|
||||
export interface Site {
|
||||
addEditor(emailAddress: string): Site;
|
||||
addEditor(user: Base.User): Site;
|
||||
addEditors(emailAddresses: String[]): Site;
|
||||
addOwner(email: string): Site;
|
||||
addOwner(user: Base.User): Site;
|
||||
addViewer(emailAddress: string): Site;
|
||||
addViewer(user: Base.User): Site;
|
||||
addViewers(emailAddresses: String[]): Site;
|
||||
createAnnouncementsPage(title: string, name: string, html: string): Page;
|
||||
createFileCabinetPage(title: string, name: string, html: string): Page;
|
||||
createListPage(title: string, name: string, html: string, columnNames: String[]): Page;
|
||||
createPageFromTemplate(title: string, name: string, template: Page): Page;
|
||||
createWebPage(title: string, name: string, html: string): Page;
|
||||
getAllDescendants(): Page[];
|
||||
getAllDescendants(options: Object): Page[];
|
||||
getChildByName(name: string): Page;
|
||||
getChildren(): Page[];
|
||||
getChildren(options: Object): Page[];
|
||||
getEditors(): Base.User[];
|
||||
getName(): string;
|
||||
getOwners(): Base.User[];
|
||||
getSummary(): string;
|
||||
getTemplates(): Page[];
|
||||
getTheme(): string;
|
||||
getTitle(): string;
|
||||
getUrl(): string;
|
||||
getViewers(): Base.User[];
|
||||
removeEditor(emailAddress: string): Site;
|
||||
removeEditor(user: Base.User): Site;
|
||||
removeOwner(email: string): Site;
|
||||
removeOwner(user: Base.User): Site;
|
||||
removeViewer(emailAddress: string): Site;
|
||||
removeViewer(user: Base.User): Site;
|
||||
search(query: string): Page[];
|
||||
search(query: string, options: Object): Page[];
|
||||
setSummary(summary: string): Site;
|
||||
setTheme(theme: string): Site;
|
||||
setTitle(title: string): Site;
|
||||
addCollaborator(email: string): Site;
|
||||
addCollaborator(user: Base.User): Site;
|
||||
createAnnouncement(title: string, html: string, parent: Page): Page;
|
||||
createComment(inReplyTo: string, html: string, parent: Page): Comment;
|
||||
createListItem(html: string, columnNames: String[], values: String[], parent: Page): ListItem;
|
||||
createWebAttachment(title: string, url: string, parent: Page): Attachment;
|
||||
deleteSite(): void;
|
||||
getAnnouncements(): Page[];
|
||||
getAnnouncementsPages(): Page[];
|
||||
getAttachments(): Attachment[];
|
||||
getCollaborators(): Base.User[];
|
||||
getComments(): Comment[];
|
||||
getFileCabinetPages(): Page[];
|
||||
getListItems(): ListItem[];
|
||||
getListPages(): Page[];
|
||||
getSelfLink(): string;
|
||||
getSiteName(): string;
|
||||
getWebAttachments(): Attachment[];
|
||||
getWebPages(): Page[];
|
||||
removeCollaborator(email: string): Site;
|
||||
removeCollaborator(user: Base.User): Site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and access Google Sites.
|
||||
*/
|
||||
export interface SitesApp {
|
||||
AttachmentType: AttachmentType
|
||||
PageType: PageType
|
||||
copySite(domain: string, name: string, title: string, summary: string, site: Site): Site;
|
||||
createSite(domain: string, name: string, title: string, summary: string): Site;
|
||||
getActivePage(): Page;
|
||||
getActiveSite(): Site;
|
||||
getAllSites(domain: string): Site[];
|
||||
getAllSites(domain: string, start: Integer, max: Integer): Site[];
|
||||
getPageByUrl(url: string): Page;
|
||||
getSite(name: string): Site;
|
||||
getSite(domain: string, name: string): Site;
|
||||
getSiteByUrl(url: string): Site;
|
||||
getSites(): Site[];
|
||||
getSites(start: Integer, max: Integer): Site[];
|
||||
getSites(domain: string): Site[];
|
||||
getSites(domain: string, start: Integer, max: Integer): Site[];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var SitesApp: GoogleAppsScript.Sites.SitesApp;
|
||||
@@ -0,0 +1,918 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.charts.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
/// <reference path="google-apps-script.drive.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Spreadsheet {
|
||||
/**
|
||||
* The chart's position within a sheet. Can be updated using the EmbeddedChart.modify()
|
||||
* function.
|
||||
*
|
||||
* chart = chart.modify().setPosition(5, 5, 0, 0).build();
|
||||
* sheet.updateChart(chart);
|
||||
*/
|
||||
export interface ContainerInfo {
|
||||
getAnchorColumn(): Integer;
|
||||
getAnchorRow(): Integer;
|
||||
getOffsetX(): Integer;
|
||||
getOffsetY(): Integer;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows users to access existing data-validation rules. To create a new rule, see
|
||||
* SpreadsheetApp.newDataValidation(), DataValidationBuilder, and
|
||||
* Range.setDataValidation(rule).
|
||||
*
|
||||
* // Log information about the data-validation rule for cell A1.
|
||||
* var cell = SpreadsheetApp.getActive().getRange('A1');
|
||||
* var rule = cell.getDataValidation();
|
||||
* if (rule != null) {
|
||||
* var criteria = rule.getCriteriaType();
|
||||
* var args = rule.getCriteriaValues();
|
||||
* Logger.log('The data-validation rule is %s %s', criteria, args);
|
||||
* } else {
|
||||
* Logger.log('The cell does not have a data-validation rule.')
|
||||
* }
|
||||
*/
|
||||
export interface DataValidation {
|
||||
copy(): DataValidationBuilder;
|
||||
getAllowInvalid(): boolean;
|
||||
getCriteriaType(): DataValidationCriteria;
|
||||
getCriteriaValues(): Object[];
|
||||
getHelpText(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for data-validation rules.
|
||||
*
|
||||
* // Set the data validation for cell A1 to require a value from B1:B10.
|
||||
* var cell = SpreadsheetApp.getActive().getRange('A1');
|
||||
* var range = SpreadsheetApp.getActive().getRange('B1:B10');
|
||||
* var rule = SpreadsheetApp.newDataValidation().requireValueInRange(range).build();
|
||||
* cell.setDataValidation(rule);
|
||||
*/
|
||||
export interface DataValidationBuilder {
|
||||
build(): DataValidation;
|
||||
copy(): DataValidationBuilder;
|
||||
getAllowInvalid(): boolean;
|
||||
getCriteriaType(): DataValidationCriteria;
|
||||
getCriteriaValues(): Object[];
|
||||
getHelpText(): string;
|
||||
requireDate(): DataValidationBuilder;
|
||||
requireDateAfter(date: Date): DataValidationBuilder;
|
||||
requireDateBefore(date: Date): DataValidationBuilder;
|
||||
requireDateBetween(start: Date, end: Date): DataValidationBuilder;
|
||||
requireDateEqualTo(date: Date): DataValidationBuilder;
|
||||
requireDateNotBetween(start: Date, end: Date): DataValidationBuilder;
|
||||
requireDateOnOrAfter(date: Date): DataValidationBuilder;
|
||||
requireDateOnOrBefore(date: Date): DataValidationBuilder;
|
||||
requireFormulaSatisfied(formula: string): DataValidationBuilder;
|
||||
requireNumberBetween(start: Number, end: Number): DataValidationBuilder;
|
||||
requireNumberEqualTo(number: Number): DataValidationBuilder;
|
||||
requireNumberGreaterThan(number: Number): DataValidationBuilder;
|
||||
requireNumberGreaterThanOrEqualTo(number: Number): DataValidationBuilder;
|
||||
requireNumberLessThan(number: Number): DataValidationBuilder;
|
||||
requireNumberLessThanOrEqualTo(number: Number): DataValidationBuilder;
|
||||
requireNumberNotBetween(start: Number, end: Number): DataValidationBuilder;
|
||||
requireNumberNotEqualTo(number: Number): DataValidationBuilder;
|
||||
requireTextContains(text: string): DataValidationBuilder;
|
||||
requireTextDoesNotContain(text: string): DataValidationBuilder;
|
||||
requireTextEqualTo(text: string): DataValidationBuilder;
|
||||
requireTextIsEmail(): DataValidationBuilder;
|
||||
requireTextIsUrl(): DataValidationBuilder;
|
||||
requireValueInList(values: String[]): DataValidationBuilder;
|
||||
requireValueInList(values: String[], showDropdown: boolean): DataValidationBuilder;
|
||||
requireValueInRange(range: Range): DataValidationBuilder;
|
||||
requireValueInRange(range: Range, showDropdown: boolean): DataValidationBuilder;
|
||||
setAllowInvalid(allowInvalidData: boolean): DataValidationBuilder;
|
||||
setHelpText(helpText: string): DataValidationBuilder;
|
||||
withCriteria(criteria: DataValidationCriteria, args: Object[]): DataValidationBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration representing the data-validation criteria that can be set on a range.
|
||||
*
|
||||
* // Change existing data-validation rules that require a date in 2013 to require a date in 2014.
|
||||
* var oldDates = [new Date('1/1/2013'), new Date('12/31/2013')];
|
||||
* var newDates = [new Date('1/1/2014'), new Date('12/31/2014')];
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var range = sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns());
|
||||
* var rules = range.getDataValidations();
|
||||
*
|
||||
* for (var i = 0; i < rules.length; i++) {
|
||||
* for (var j = 0; j < rules[i].length; j++) {
|
||||
* var rule = rules[i][j];
|
||||
*
|
||||
* if (rule != null) {
|
||||
* var criteria = rule.getCriteriaType();
|
||||
* var args = rule.getCriteriaValues();
|
||||
*
|
||||
* if (criteria == SpreadsheetApp.DataValidationCriteria.DATE_BETWEEN
|
||||
* && args[0].getTime() == oldDates[0].getTime()
|
||||
* && args[1].getTime() == oldDates[1].getTime()) {
|
||||
* // Create a builder from the existing rule, then change the dates.
|
||||
* rules[i][j] = rule.copy().withCriteria(criteria, newDates).build();
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* range.setDataValidations(rules);
|
||||
*/
|
||||
export enum DataValidationCriteria { DATE_AFTER, DATE_BEFORE, DATE_BETWEEN, DATE_EQUAL_TO, DATE_IS_VALID_DATE, DATE_NOT_BETWEEN, DATE_ON_OR_AFTER, DATE_ON_OR_BEFORE, NUMBER_BETWEEN, NUMBER_EQUAL_TO, NUMBER_GREATER_THAN, NUMBER_GREATER_THAN_OR_EQUAL_TO, NUMBER_LESS_THAN, NUMBER_LESS_THAN_OR_EQUAL_TO, NUMBER_NOT_BETWEEN, NUMBER_NOT_EQUAL_TO, TEXT_CONTAINS, TEXT_DOES_NOT_CONTAIN, TEXT_EQUAL_TO, TEXT_IS_VALID_EMAIL, TEXT_IS_VALID_URL, VALUE_IN_LIST, VALUE_IN_RANGE, CUSTOM_FORMULA }
|
||||
|
||||
/**
|
||||
* Builder for area charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedAreaChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
reverseCategories(): EmbeddedAreaChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedAreaChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedAreaChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedAreaChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPointStyle(style: Charts.PointStyle): EmbeddedAreaChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setRange(start: Number, end: Number): EmbeddedAreaChartBuilder;
|
||||
setStacked(): EmbeddedAreaChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedAreaChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
setXAxisTitle(title: string): EmbeddedAreaChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
setYAxisTitle(title: string): EmbeddedAreaChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
|
||||
useLogScale(): EmbeddedAreaChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for bar charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedBarChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
reverseCategories(): EmbeddedBarChartBuilder;
|
||||
reverseDirection(): EmbeddedBarChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedBarChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedBarChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedBarChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setRange(start: Number, end: Number): EmbeddedBarChartBuilder;
|
||||
setStacked(): EmbeddedBarChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedBarChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
setXAxisTitle(title: string): EmbeddedBarChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
setYAxisTitle(title: string): EmbeddedBarChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
|
||||
useLogScale(): EmbeddedBarChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a chart that has been embedded into a Spreadsheet.
|
||||
*
|
||||
* This example shows how to modify an existing chart:
|
||||
*
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var range = sheet.getRange("A2:B8")
|
||||
* var chart = sheet.getCharts()[0];
|
||||
* chart = chart.modify()
|
||||
* .addRange(range)
|
||||
* .setOption('title', 'Updated!')
|
||||
* .setOption('animation.duration', 500)
|
||||
* .setPosition(2,2,0,0)
|
||||
* .build();
|
||||
* sheet.updateChart(chart);
|
||||
*
|
||||
* This example shows how to create a new chart:
|
||||
*
|
||||
* function newChart(range, sheet) {
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var chartBuilder = sheet.newChart();
|
||||
* chartBuilder.addRange(range)
|
||||
* .setChartType(Charts.ChartType.LINE)
|
||||
* .setOption('title', 'My Line Chart!');
|
||||
* sheet.insertChart(chartBuilder.build());
|
||||
* }
|
||||
*/
|
||||
export interface EmbeddedChart {
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getContainerInfo(): ContainerInfo;
|
||||
getId(): string;
|
||||
getOptions(): Charts.ChartOptions;
|
||||
getRanges(): Range[];
|
||||
getType(): string;
|
||||
modify(): EmbeddedChartBuilder;
|
||||
setId(id: string): Charts.Chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* This builder allows you to edit an EmbeddedChart. Make sure to call
|
||||
* sheet.updateChart(builder.build()) to save your changes.
|
||||
*
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var range = sheet.getRange("A1:B8");
|
||||
* var chart = sheet.getCharts()[0];
|
||||
* chart = chart.modify()
|
||||
* .addRange(range)
|
||||
* .setOption('title', 'Updated!')
|
||||
* .setOption('animation.duration', 500)
|
||||
* .setPosition(2,2,0,0)
|
||||
* .build();
|
||||
* sheet.updateChart(chart);
|
||||
*/
|
||||
export interface EmbeddedChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for column charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedColumnChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
reverseCategories(): EmbeddedColumnChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedColumnChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedColumnChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedColumnChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setRange(start: Number, end: Number): EmbeddedColumnChartBuilder;
|
||||
setStacked(): EmbeddedColumnChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedColumnChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
setXAxisTitle(title: string): EmbeddedColumnChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
setYAxisTitle(title: string): EmbeddedColumnChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
|
||||
useLogScale(): EmbeddedColumnChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for line charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedLineChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
reverseCategories(): EmbeddedLineChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedLineChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedLineChartBuilder;
|
||||
setCurveStyle(style: Charts.CurveStyle): EmbeddedLineChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedLineChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPointStyle(style: Charts.PointStyle): EmbeddedLineChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setRange(start: Number, end: Number): EmbeddedLineChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedLineChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
setXAxisTitle(title: string): EmbeddedLineChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
setYAxisTitle(title: string): EmbeddedLineChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
|
||||
useLogScale(): EmbeddedLineChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for pie charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedPieChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
reverseCategories(): EmbeddedPieChartBuilder;
|
||||
set3D(): EmbeddedPieChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedPieChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedPieChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedPieChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedPieChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedPieChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedPieChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for scatter charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedScatterChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
setBackgroundColor(cssValue: string): EmbeddedScatterChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setColors(cssValues: String[]): EmbeddedScatterChartBuilder;
|
||||
setLegendPosition(position: Charts.Position): EmbeddedScatterChartBuilder;
|
||||
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPointStyle(style: Charts.PointStyle): EmbeddedScatterChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
setTitle(chartTitle: string): EmbeddedScatterChartBuilder;
|
||||
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
setXAxisLogScale(): EmbeddedScatterChartBuilder;
|
||||
setXAxisRange(start: Number, end: Number): EmbeddedScatterChartBuilder;
|
||||
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
setXAxisTitle(title: string): EmbeddedScatterChartBuilder;
|
||||
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
setYAxisLogScale(): EmbeddedScatterChartBuilder;
|
||||
setYAxisRange(start: Number, end: Number): EmbeddedScatterChartBuilder;
|
||||
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
setYAxisTitle(title: string): EmbeddedScatterChartBuilder;
|
||||
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for table charts. For more details, see the Gviz
|
||||
* documentation.
|
||||
*/
|
||||
export interface EmbeddedTableChartBuilder {
|
||||
addRange(range: Range): EmbeddedChartBuilder;
|
||||
asAreaChart(): EmbeddedAreaChartBuilder;
|
||||
asBarChart(): EmbeddedBarChartBuilder;
|
||||
asColumnChart(): EmbeddedColumnChartBuilder;
|
||||
asLineChart(): EmbeddedLineChartBuilder;
|
||||
asPieChart(): EmbeddedPieChartBuilder;
|
||||
asScatterChart(): EmbeddedScatterChartBuilder;
|
||||
asTableChart(): EmbeddedTableChartBuilder;
|
||||
build(): EmbeddedChart;
|
||||
enablePaging(enablePaging: boolean): EmbeddedTableChartBuilder;
|
||||
enablePaging(pageSize: Integer): EmbeddedTableChartBuilder;
|
||||
enablePaging(pageSize: Integer, startPage: Integer): EmbeddedTableChartBuilder;
|
||||
enableRtlTable(rtlEnabled: boolean): EmbeddedTableChartBuilder;
|
||||
enableSorting(enableSorting: boolean): EmbeddedTableChartBuilder;
|
||||
getChartType(): Charts.ChartType;
|
||||
getContainer(): ContainerInfo;
|
||||
getRanges(): Range[];
|
||||
removeRange(range: Range): EmbeddedChartBuilder;
|
||||
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
|
||||
setFirstRowNumber(number: Integer): EmbeddedTableChartBuilder;
|
||||
setInitialSortingAscending(column: Integer): EmbeddedTableChartBuilder;
|
||||
setInitialSortingDescending(column: Integer): EmbeddedTableChartBuilder;
|
||||
setOption(option: string, value: Object): EmbeddedChartBuilder;
|
||||
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
|
||||
showRowNumberColumn(showRowNumber: boolean): EmbeddedTableChartBuilder;
|
||||
useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful
|
||||
* Protection class instead. Although this class is deprecated, it will remain
|
||||
* available for compatibility with the older version of Sheets.
|
||||
* Access and modify protected sheets in the older version of Google Sheets.
|
||||
*/
|
||||
export interface PageProtection {
|
||||
addUser(email: string): void;
|
||||
getUsers(): String[];
|
||||
isProtected(): boolean;
|
||||
removeUser(user: string): void;
|
||||
setProtected(protection: boolean): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access and modify protected ranges and sheets. A protected range can protect either a static
|
||||
* range of cells or a named range. A protected sheet may include unprotected regions. For
|
||||
* spreadsheets created with the older version of Google Sheets, use the PageProtection
|
||||
* class instead.
|
||||
*
|
||||
* // Protect range A1:B10, then remove all other users from the list of editors.
|
||||
* var ss = SpreadsheetApp.getActive();
|
||||
* var range = ss.getRange('A1:B10');
|
||||
* var protection = range.protect().setDescription('Sample protected range');
|
||||
*
|
||||
* // Ensure the current user is an editor before removing others. Otherwise, if the user's edit
|
||||
* // permission comes from a group, the script will throw an exception upon removing the group.
|
||||
* var me = Session.getEffectiveUser();
|
||||
* protection.addEditor(me);
|
||||
* protection.removeEditors(protection.getEditors());
|
||||
* if (protection.canDomainEdit()) {
|
||||
* protection.setDomainEdit(false);
|
||||
* }
|
||||
*
|
||||
* // Remove all range protections in the spreadsheet that the user has permission to edit.
|
||||
* var ss = SpreadsheetApp.getActive();
|
||||
* var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
|
||||
* for (var i = 0; i < protections.length; i++) {
|
||||
* var protection = protections[i];
|
||||
* if (protection.canEdit()) {
|
||||
* protection.remove();
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Protect the active sheet, then remove all other users from the list of editors.
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var protection = sheet.protect().setDescription('Sample protected sheet');
|
||||
*
|
||||
* // Ensure the current user is an editor before removing others. Otherwise, if the user's edit
|
||||
* // permission comes from a group, the script will throw an exception upon removing the group.
|
||||
* var me = Session.getEffectiveUser();
|
||||
* protection.addEditor(me);
|
||||
* protection.removeEditors(protection.getEditors());
|
||||
* if (protection.canDomainEdit()) {
|
||||
* protection.setDomainEdit(false);
|
||||
* }
|
||||
*/
|
||||
export interface Protection {
|
||||
addEditor(emailAddress: string): Protection;
|
||||
addEditor(user: Base.User): Protection;
|
||||
addEditors(emailAddresses: String[]): Protection;
|
||||
canDomainEdit(): boolean;
|
||||
canEdit(): boolean;
|
||||
getDescription(): string;
|
||||
getEditors(): Base.User[];
|
||||
getProtectionType(): ProtectionType;
|
||||
getRange(): Range;
|
||||
getRangeName(): string;
|
||||
getUnprotectedRanges(): Range[];
|
||||
isWarningOnly(): boolean;
|
||||
remove(): void;
|
||||
removeEditor(emailAddress: string): Protection;
|
||||
removeEditor(user: Base.User): Protection;
|
||||
removeEditors(emailAddresses: String[]): Protection;
|
||||
setDescription(description: string): Protection;
|
||||
setDomainEdit(editable: boolean): Protection;
|
||||
setRange(range: Range): Protection;
|
||||
setRangeName(rangeName: string): Protection;
|
||||
setUnprotectedRanges(ranges: Range[]): Protection;
|
||||
setWarningOnly(warningOnly: boolean): Protection;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration representing the parts of a spreadsheet that can be protected from edits.
|
||||
*
|
||||
* // Remove all range protections in the spreadsheet that the user has permission to edit.
|
||||
* var ss = SpreadsheetApp.getActive();
|
||||
* var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
|
||||
* for (var i = 0; i < protections.length; i++) {
|
||||
* var protection = protections[i];
|
||||
* if (protection.canEdit()) {
|
||||
* protection.remove();
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Removes sheet protection from the active sheet, if the user has permission to edit it.
|
||||
* var sheet = SpreadsheetApp.getActiveSheet();
|
||||
* var protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
|
||||
* if (protection && protection.canEdit()) {
|
||||
* protection.remove();
|
||||
* }
|
||||
*/
|
||||
export enum ProtectionType { RANGE, SHEET }
|
||||
|
||||
/**
|
||||
* Access and modify spreadsheet ranges.
|
||||
*
|
||||
* This class allows users to access and modify ranges in Google Sheets. A range can be
|
||||
* a single cell in a sheet or a range of cells in a sheet.
|
||||
*/
|
||||
export interface Range {
|
||||
activate(): Range;
|
||||
breakApart(): Range;
|
||||
canEdit(): boolean;
|
||||
clear(): Range;
|
||||
clear(options: Object): Range;
|
||||
clearContent(): Range;
|
||||
clearDataValidations(): Range;
|
||||
clearFormat(): Range;
|
||||
clearNote(): Range;
|
||||
copyFormatToRange(gridId: Integer, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
|
||||
copyFormatToRange(sheet: Sheet, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
|
||||
copyTo(destination: Range): void;
|
||||
copyTo(destination: Range, options: Object): void;
|
||||
copyValuesToRange(gridId: Integer, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
|
||||
copyValuesToRange(sheet: Sheet, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
|
||||
getA1Notation(): string;
|
||||
getBackground(): string;
|
||||
getBackgrounds(): String[][];
|
||||
getCell(row: Integer, column: Integer): Range;
|
||||
getColumn(): Integer;
|
||||
getDataSourceUrl(): string;
|
||||
getDataTable(): Charts.DataTable;
|
||||
getDataTable(firstRowIsHeader: boolean): Charts.DataTable;
|
||||
getDataValidation(): DataValidation;
|
||||
getDataValidations(): DataValidation[][];
|
||||
getFontColor(): string;
|
||||
getFontColors(): String[][];
|
||||
getFontFamilies(): String[][];
|
||||
getFontFamily(): string;
|
||||
getFontLine(): string;
|
||||
getFontLines(): String[][];
|
||||
getFontSize(): Integer;
|
||||
getFontSizes(): Integer[][];
|
||||
getFontStyle(): string;
|
||||
getFontStyles(): String[][];
|
||||
getFontWeight(): string;
|
||||
getFontWeights(): String[][];
|
||||
getFormula(): string;
|
||||
getFormulaR1C1(): string;
|
||||
getFormulas(): String[][];
|
||||
getFormulasR1C1(): String[][];
|
||||
getGridId(): Integer;
|
||||
getHeight(): Integer;
|
||||
getHorizontalAlignment(): string;
|
||||
getHorizontalAlignments(): String[][];
|
||||
getLastColumn(): Integer;
|
||||
getLastRow(): Integer;
|
||||
getNote(): string;
|
||||
getNotes(): String[][];
|
||||
getNumColumns(): Integer;
|
||||
getNumRows(): Integer;
|
||||
getNumberFormat(): string;
|
||||
getNumberFormats(): String[][];
|
||||
getRow(): Integer;
|
||||
getRowIndex(): Integer;
|
||||
getSheet(): Sheet;
|
||||
getValue(): Object;
|
||||
getValues(): Object[][];
|
||||
getVerticalAlignment(): string;
|
||||
getVerticalAlignments(): String[][];
|
||||
getWidth(): Integer;
|
||||
getWrap(): boolean;
|
||||
getWraps(): Boolean[][];
|
||||
isBlank(): boolean;
|
||||
isEndColumnBounded(): boolean;
|
||||
isEndRowBounded(): boolean;
|
||||
isStartColumnBounded(): boolean;
|
||||
isStartRowBounded(): boolean;
|
||||
merge(): Range;
|
||||
mergeAcross(): Range;
|
||||
mergeVertically(): Range;
|
||||
moveTo(target: Range): void;
|
||||
offset(rowOffset: Integer, columnOffset: Integer): Range;
|
||||
offset(rowOffset: Integer, columnOffset: Integer, numRows: Integer): Range;
|
||||
offset(rowOffset: Integer, columnOffset: Integer, numRows: Integer, numColumns: Integer): Range;
|
||||
protect(): Protection;
|
||||
setBackground(color: string): Range;
|
||||
setBackgroundRGB(red: Integer, green: Integer, blue: Integer): Range;
|
||||
setBackgrounds(color: String[][]): Range;
|
||||
setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean): Range;
|
||||
setDataValidation(rule: DataValidation): Range;
|
||||
setDataValidations(rules: DataValidation[][]): Range;
|
||||
setFontColor(color: string): Range;
|
||||
setFontColors(colors: Object[][]): Range;
|
||||
setFontFamilies(fontFamilies: Object[][]): Range;
|
||||
setFontFamily(fontFamily: string): Range;
|
||||
setFontLine(fontLine: string): Range;
|
||||
setFontLines(fontLines: Object[][]): Range;
|
||||
setFontSize(size: Integer): Range;
|
||||
setFontSizes(sizes: Object[][]): Range;
|
||||
setFontStyle(fontStyle: string): Range;
|
||||
setFontStyles(fontStyles: Object[][]): Range;
|
||||
setFontWeight(fontWeight: string): Range;
|
||||
setFontWeights(fontWeights: Object[][]): Range;
|
||||
setFormula(formula: string): Range;
|
||||
setFormulaR1C1(formula: string): Range;
|
||||
setFormulas(formulas: String[][]): Range;
|
||||
setFormulasR1C1(formulas: String[][]): Range;
|
||||
setHorizontalAlignment(alignment: string): Range;
|
||||
setHorizontalAlignments(alignments: Object[][]): Range;
|
||||
setNote(note: string): Range;
|
||||
setNotes(notes: Object[][]): Range;
|
||||
setNumberFormat(numberFormat: string): Range;
|
||||
setNumberFormats(numberFormats: Object[][]): Range;
|
||||
setValue(value: Object): Range;
|
||||
setValues(values: Object[][]): Range;
|
||||
setVerticalAlignment(alignment: string): Range;
|
||||
setVerticalAlignments(alignments: Object[][]): Range;
|
||||
setWrap(isWrapEnabled: boolean): Range;
|
||||
setWraps(isWrapEnabled: Object[][]): Range;
|
||||
sort(sortSpecObj: Object): Range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access and modify spreadsheet sheets. Common operations
|
||||
* are renaming a sheet and accessing range objects from the sheet.
|
||||
*/
|
||||
export interface Sheet {
|
||||
activate(): Sheet;
|
||||
appendRow(rowContents: Object[]): Sheet;
|
||||
autoResizeColumn(columnPosition: Integer): Sheet;
|
||||
clear(): Sheet;
|
||||
clear(options: Object): Sheet;
|
||||
clearContents(): Sheet;
|
||||
clearFormats(): Sheet;
|
||||
clearNotes(): Sheet;
|
||||
copyTo(spreadsheet: Spreadsheet): Sheet;
|
||||
deleteColumn(columnPosition: Integer): Sheet;
|
||||
deleteColumns(columnPosition: Integer, howMany: Integer): void;
|
||||
deleteRow(rowPosition: Integer): Sheet;
|
||||
deleteRows(rowPosition: Integer, howMany: Integer): void;
|
||||
getActiveCell(): Range;
|
||||
getActiveRange(): Range;
|
||||
getCharts(): EmbeddedChart[];
|
||||
getColumnWidth(columnPosition: Integer): Integer;
|
||||
getDataRange(): Range;
|
||||
getFrozenColumns(): Integer;
|
||||
getFrozenRows(): Integer;
|
||||
getIndex(): Integer;
|
||||
getLastColumn(): Integer;
|
||||
getLastRow(): Integer;
|
||||
getMaxColumns(): Integer;
|
||||
getMaxRows(): Integer;
|
||||
getName(): string;
|
||||
getParent(): Spreadsheet;
|
||||
getProtections(type: ProtectionType): Protection[];
|
||||
getRange(row: Integer, column: Integer): Range;
|
||||
getRange(row: Integer, column: Integer, numRows: Integer): Range;
|
||||
getRange(row: Integer, column: Integer, numRows: Integer, numColumns: Integer): Range;
|
||||
getRange(a1Notation: string): Range;
|
||||
getRowHeight(rowPosition: Integer): Integer;
|
||||
getSheetId(): Integer;
|
||||
getSheetName(): string;
|
||||
getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][];
|
||||
hideColumn(column: Range): void;
|
||||
hideColumns(columnIndex: Integer): void;
|
||||
hideColumns(columnIndex: Integer, numColumns: Integer): void;
|
||||
hideRow(row: Range): void;
|
||||
hideRows(rowIndex: Integer): void;
|
||||
hideRows(rowIndex: Integer, numRows: Integer): void;
|
||||
hideSheet(): Sheet;
|
||||
insertChart(chart: EmbeddedChart): void;
|
||||
insertColumnAfter(afterPosition: Integer): Sheet;
|
||||
insertColumnBefore(beforePosition: Integer): Sheet;
|
||||
insertColumns(columnIndex: Integer): void;
|
||||
insertColumns(columnIndex: Integer, numColumns: Integer): void;
|
||||
insertColumnsAfter(afterPosition: Integer, howMany: Integer): Sheet;
|
||||
insertColumnsBefore(beforePosition: Integer, howMany: Integer): Sheet;
|
||||
insertImage(blob: Base.Blob, column: Integer, row: Integer): void;
|
||||
insertImage(blob: Base.Blob, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
|
||||
insertImage(url: string, column: Integer, row: Integer): void;
|
||||
insertImage(url: string, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
|
||||
insertRowAfter(afterPosition: Integer): Sheet;
|
||||
insertRowBefore(beforePosition: Integer): Sheet;
|
||||
insertRows(rowIndex: Integer): void;
|
||||
insertRows(rowIndex: Integer, numRows: Integer): void;
|
||||
insertRowsAfter(afterPosition: Integer, howMany: Integer): Sheet;
|
||||
insertRowsBefore(beforePosition: Integer, howMany: Integer): Sheet;
|
||||
isSheetHidden(): boolean;
|
||||
newChart(): EmbeddedChartBuilder;
|
||||
protect(): Protection;
|
||||
removeChart(chart: EmbeddedChart): void;
|
||||
setActiveRange(range: Range): Range;
|
||||
setActiveSelection(range: Range): Range;
|
||||
setActiveSelection(a1Notation: string): Range;
|
||||
setColumnWidth(columnPosition: Integer, width: Integer): Sheet;
|
||||
setFrozenColumns(columns: Integer): void;
|
||||
setFrozenRows(rows: Integer): void;
|
||||
setName(name: string): Sheet;
|
||||
setRowHeight(rowPosition: Integer, height: Integer): Sheet;
|
||||
showColumns(columnIndex: Integer): void;
|
||||
showColumns(columnIndex: Integer, numColumns: Integer): void;
|
||||
showRows(rowIndex: Integer): void;
|
||||
showRows(rowIndex: Integer, numRows: Integer): void;
|
||||
showSheet(): Sheet;
|
||||
sort(columnPosition: Integer): Sheet;
|
||||
sort(columnPosition: Integer, ascending: boolean): Sheet;
|
||||
unhideColumn(column: Range): void;
|
||||
unhideRow(row: Range): void;
|
||||
updateChart(chart: EmbeddedChart): void;
|
||||
getSheetProtection(): PageProtection;
|
||||
setSheetProtection(permissions: PageProtection): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows users to access and modify Google Sheets files. Common operations are adding
|
||||
* new sheets and adding collaborators.
|
||||
*/
|
||||
export interface Spreadsheet {
|
||||
addEditor(emailAddress: string): Spreadsheet;
|
||||
addEditor(user: Base.User): Spreadsheet;
|
||||
addEditors(emailAddresses: String[]): Spreadsheet;
|
||||
addMenu(name: string, subMenus: Object[]): void;
|
||||
addViewer(emailAddress: string): Spreadsheet;
|
||||
addViewer(user: Base.User): Spreadsheet;
|
||||
addViewers(emailAddresses: String[]): Spreadsheet;
|
||||
appendRow(rowContents: Object[]): Sheet;
|
||||
autoResizeColumn(columnPosition: Integer): Sheet;
|
||||
copy(name: string): Spreadsheet;
|
||||
deleteActiveSheet(): Sheet;
|
||||
deleteColumn(columnPosition: Integer): Sheet;
|
||||
deleteColumns(columnPosition: Integer, howMany: Integer): void;
|
||||
deleteRow(rowPosition: Integer): Sheet;
|
||||
deleteRows(rowPosition: Integer, howMany: Integer): void;
|
||||
deleteSheet(sheet: Sheet): void;
|
||||
duplicateActiveSheet(): Sheet;
|
||||
getActiveCell(): Range;
|
||||
getActiveRange(): Range;
|
||||
getActiveSheet(): Sheet;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getColumnWidth(columnPosition: Integer): Integer;
|
||||
getDataRange(): Range;
|
||||
getEditors(): Base.User[];
|
||||
getFormUrl(): string;
|
||||
getFrozenColumns(): Integer;
|
||||
getFrozenRows(): Integer;
|
||||
getId(): string;
|
||||
getLastColumn(): Integer;
|
||||
getLastRow(): Integer;
|
||||
getName(): string;
|
||||
getNumSheets(): Integer;
|
||||
getOwner(): Base.User;
|
||||
getProtections(type: ProtectionType): Protection[];
|
||||
getRange(a1Notation: string): Range;
|
||||
getRangeByName(name: string): Range;
|
||||
getRowHeight(rowPosition: Integer): Integer;
|
||||
getSheetByName(name: string): Sheet;
|
||||
getSheetId(): Integer;
|
||||
getSheetName(): string;
|
||||
getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][];
|
||||
getSheets(): Sheet[];
|
||||
getSpreadsheetLocale(): string;
|
||||
getSpreadsheetTimeZone(): string;
|
||||
getUrl(): string;
|
||||
getViewers(): Base.User[];
|
||||
hideColumn(column: Range): void;
|
||||
hideRow(row: Range): void;
|
||||
insertColumnAfter(afterPosition: Integer): Sheet;
|
||||
insertColumnBefore(beforePosition: Integer): Sheet;
|
||||
insertColumnsAfter(afterPosition: Integer, howMany: Integer): Sheet;
|
||||
insertColumnsBefore(beforePosition: Integer, howMany: Integer): Sheet;
|
||||
insertImage(blob: Base.Blob, column: Integer, row: Integer): void;
|
||||
insertImage(blob: Base.Blob, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
|
||||
insertImage(url: string, column: Integer, row: Integer): void;
|
||||
insertImage(url: string, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
|
||||
insertRowAfter(afterPosition: Integer): Sheet;
|
||||
insertRowBefore(beforePosition: Integer): Sheet;
|
||||
insertRowsAfter(afterPosition: Integer, howMany: Integer): Sheet;
|
||||
insertRowsBefore(beforePosition: Integer, howMany: Integer): Sheet;
|
||||
insertSheet(): Sheet;
|
||||
insertSheet(sheetIndex: Integer): Sheet;
|
||||
insertSheet(sheetIndex: Integer, options: Object): Sheet;
|
||||
insertSheet(options: Object): Sheet;
|
||||
insertSheet(sheetName: string): Sheet;
|
||||
insertSheet(sheetName: string, sheetIndex: Integer): Sheet;
|
||||
insertSheet(sheetName: string, sheetIndex: Integer, options: Object): Sheet;
|
||||
insertSheet(sheetName: string, options: Object): Sheet;
|
||||
moveActiveSheet(pos: Integer): void;
|
||||
removeEditor(emailAddress: string): Spreadsheet;
|
||||
removeEditor(user: Base.User): Spreadsheet;
|
||||
removeMenu(name: string): void;
|
||||
removeNamedRange(name: string): void;
|
||||
removeViewer(emailAddress: string): Spreadsheet;
|
||||
removeViewer(user: Base.User): Spreadsheet;
|
||||
rename(newName: string): void;
|
||||
renameActiveSheet(newName: string): void;
|
||||
setActiveRange(range: Range): Range;
|
||||
setActiveSelection(range: Range): Range;
|
||||
setActiveSelection(a1Notation: string): Range;
|
||||
setActiveSheet(sheet: Sheet): Sheet;
|
||||
setColumnWidth(columnPosition: Integer, width: Integer): Sheet;
|
||||
setFrozenColumns(columns: Integer): void;
|
||||
setFrozenRows(rows: Integer): void;
|
||||
setNamedRange(name: string, range: Range): void;
|
||||
setRowHeight(rowPosition: Integer, height: Integer): Sheet;
|
||||
setSpreadsheetLocale(locale: string): void;
|
||||
setSpreadsheetTimeZone(timezone: string): void;
|
||||
show(userInterface: Object): void;
|
||||
sort(columnPosition: Integer): Sheet;
|
||||
sort(columnPosition: Integer, ascending: boolean): Sheet;
|
||||
toast(msg: string): void;
|
||||
toast(msg: string, title: string): void;
|
||||
toast(msg: string, title: string, timeoutSeconds: Number): void;
|
||||
unhideColumn(column: Range): void;
|
||||
unhideRow(row: Range): void;
|
||||
updateMenu(name: string, subMenus: Object[]): void;
|
||||
getSheetProtection(): PageProtection;
|
||||
isAnonymousView(): boolean;
|
||||
isAnonymousWrite(): boolean;
|
||||
setAnonymousAccess(anonymousReadAllowed: boolean, anonymousWriteAllowed: boolean): void;
|
||||
setSheetProtection(permissions: PageProtection): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows users to open Google Sheets files and to create new ones. This class is
|
||||
* the parent class for the Spreadsheet service.
|
||||
*/
|
||||
export interface SpreadsheetApp {
|
||||
DataValidationCriteria: DataValidationCriteria
|
||||
ProtectionType: ProtectionType
|
||||
create(name: string): Spreadsheet;
|
||||
create(name: string, rows: Integer, columns: Integer): Spreadsheet;
|
||||
flush(): void;
|
||||
getActive(): Spreadsheet;
|
||||
getActiveRange(): Range;
|
||||
getActiveSheet(): Sheet;
|
||||
getActiveSpreadsheet(): Spreadsheet;
|
||||
getUi(): Base.Ui;
|
||||
newDataValidation(): DataValidationBuilder;
|
||||
open(file: Drive.File): Spreadsheet;
|
||||
openById(id: string): Spreadsheet;
|
||||
openByUrl(url: string): Spreadsheet;
|
||||
setActiveRange(range: Range): Range;
|
||||
setActiveSheet(sheet: Sheet): Sheet;
|
||||
setActiveSpreadsheet(newActiveSpreadsheet: Spreadsheet): void;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var SpreadsheetApp: GoogleAppsScript.Spreadsheet.SpreadsheetApp;
|
||||
@@ -0,0 +1,12 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
type BigNumber = any;
|
||||
type Byte = number;
|
||||
type Integer = number;
|
||||
type Char = string;
|
||||
type JdbcSQL_XML = any;
|
||||
}
|
||||
+3628
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module URL_Fetch {
|
||||
/**
|
||||
* This class allows users to access specific information on HTTP responses.
|
||||
* See also
|
||||
*
|
||||
* UrlFetchApp
|
||||
*/
|
||||
export interface HTTPResponse {
|
||||
getAllHeaders(): Object;
|
||||
getAs(contentType: string): Base.Blob;
|
||||
getBlob(): Base.Blob;
|
||||
getContent(): Byte[];
|
||||
getContentText(): string;
|
||||
getContentText(charset: string): string;
|
||||
getHeaders(): Object;
|
||||
getResponseCode(): Integer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Deprecated. This class is deprecated and should not be used in new scripts.
|
||||
* Represents configuration settings for an OAuth-enabled remote service.
|
||||
* See also
|
||||
*
|
||||
* UrlFetchApp
|
||||
*/
|
||||
export interface OAuthConfig {
|
||||
getAccessTokenUrl(): string;
|
||||
getAuthorizationUrl(): string;
|
||||
getMethod(): string;
|
||||
getParamLocation(): string;
|
||||
getRequestTokenUrl(): string;
|
||||
getServiceName(): string;
|
||||
setAccessTokenUrl(url: string): void;
|
||||
setAuthorizationUrl(url: string): void;
|
||||
setConsumerKey(consumerKey: string): void;
|
||||
setConsumerSecret(consumerSecret: string): void;
|
||||
setMethod(method: string): void;
|
||||
setParamLocation(location: string): void;
|
||||
setRequestTokenUrl(url: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch resources and communicate with other hosts over the Internet.
|
||||
*
|
||||
* This service allows scripts to communicate with other applications or access other resources on
|
||||
* the web by fetching URLs. A script can use the URL Fetch service to issue HTTP and HTTPS requests
|
||||
* and receive responses. The URL Fetch service uses Google's network infrastructure for efficiency
|
||||
* and scaling purposes.
|
||||
* See also
|
||||
*
|
||||
* OAuthConfig
|
||||
*
|
||||
* HTTPResponse
|
||||
*/
|
||||
export interface UrlFetchApp {
|
||||
fetch(url: string): HTTPResponse;
|
||||
fetch(url: string, params: Object): HTTPResponse;
|
||||
getRequest(url: string): Object;
|
||||
getRequest(url: string, params: Object): Object;
|
||||
addOAuthService(serviceName: string): OAuthConfig;
|
||||
removeOAuthService(serviceName: string): void;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var UrlFetchApp: GoogleAppsScript.URL_Fetch.UrlFetchApp;
|
||||
@@ -0,0 +1,76 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
/// <reference path="google-apps-script.base.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module Utilities {
|
||||
/**
|
||||
* A typesafe enum for character sets.
|
||||
*/
|
||||
export enum Charset { US_ASCII, UTF_8 }
|
||||
|
||||
/**
|
||||
* Selector of Digest algorithm
|
||||
*/
|
||||
export enum DigestAlgorithm { MD2, MD5, SHA_1, SHA_256, SHA_384, SHA_512 }
|
||||
|
||||
/**
|
||||
* Selector of MAC algorithm
|
||||
*/
|
||||
export enum MacAlgorithm { HMAC_MD5, HMAC_SHA_1, HMAC_SHA_256, HMAC_SHA_384, HMAC_SHA_512 }
|
||||
|
||||
/**
|
||||
* This service provides utilities for string encoding/decoding, date formatting, JSON manipulation,
|
||||
* and other miscellaneous tasks.
|
||||
*/
|
||||
export interface Utilities {
|
||||
Charset: Charset
|
||||
DigestAlgorithm: DigestAlgorithm
|
||||
MacAlgorithm: MacAlgorithm
|
||||
base64Decode(encoded: string): Byte[];
|
||||
base64Decode(encoded: string, charset: Charset): Byte[];
|
||||
base64DecodeWebSafe(encoded: string): Byte[];
|
||||
base64DecodeWebSafe(encoded: string, charset: Charset): Byte[];
|
||||
base64Encode(data: Byte[]): string;
|
||||
base64Encode(data: string): string;
|
||||
base64Encode(data: string, charset: Charset): string;
|
||||
base64EncodeWebSafe(data: Byte[]): string;
|
||||
base64EncodeWebSafe(data: string): string;
|
||||
base64EncodeWebSafe(data: string, charset: Charset): string;
|
||||
computeDigest(algorithm: DigestAlgorithm, value: string): Byte[];
|
||||
computeDigest(algorithm: DigestAlgorithm, value: string, charset: Charset): Byte[];
|
||||
computeHmacSha256Signature(value: string, key: string): Byte[];
|
||||
computeHmacSha256Signature(value: string, key: string, charset: Charset): Byte[];
|
||||
computeHmacSignature(algorithm: MacAlgorithm, value: string, key: string): Byte[];
|
||||
computeHmacSignature(algorithm: MacAlgorithm, value: string, key: string, charset: Charset): Byte[];
|
||||
computeRsaSha256Signature(value: string, key: string): Byte[];
|
||||
computeRsaSha256Signature(value: string, key: string, charset: Charset): Byte[];
|
||||
formatDate(date: Date, timeZone: string, format: string): string;
|
||||
formatString(template: string, ...args: Object[]): string;
|
||||
newBlob(data: Byte[]): Base.Blob;
|
||||
newBlob(data: Byte[], contentType: string): Base.Blob;
|
||||
newBlob(data: Byte[], contentType: string, name: string): Base.Blob;
|
||||
newBlob(data: string): Base.Blob;
|
||||
newBlob(data: string, contentType: string): Base.Blob;
|
||||
newBlob(data: string, contentType: string, name: string): Base.Blob;
|
||||
parseCsv(csv: string): String[][];
|
||||
parseCsv(csv: string, delimiter: Char): String[][];
|
||||
sleep(milliseconds: Integer): void;
|
||||
unzip(blob: Base.BlobSource): Base.Blob[];
|
||||
zip(blobs: Base.BlobSource[]): Base.Blob;
|
||||
zip(blobs: Base.BlobSource[], name: string): Base.Blob;
|
||||
jsonParse(jsonString: string): Object;
|
||||
jsonStringify(obj: Object): string;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var Charset: GoogleAppsScript.Utilities.Charset;
|
||||
declare var DigestAlgorithm: GoogleAppsScript.Utilities.DigestAlgorithm;
|
||||
declare var MacAlgorithm: GoogleAppsScript.Utilities.MacAlgorithm;
|
||||
declare var Utilities: GoogleAppsScript.Utilities.Utilities;
|
||||
@@ -0,0 +1,347 @@
|
||||
// Type definitions for Google Apps Script 2015-11-12
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="google-apps-script.types.d.ts" />
|
||||
|
||||
declare module GoogleAppsScript {
|
||||
export module XML_Service {
|
||||
/**
|
||||
* A representation of an XML attribute.
|
||||
*
|
||||
* // Reads the first and last name of each person and adds a new attribute with the full name.
|
||||
* var xml = '<roster>'
|
||||
* + '<person first="John" last="Doe"/>'
|
||||
* + '<person first="Mary" last="Smith"/>'
|
||||
* + '</roster>';
|
||||
* var document = XmlService.parse(xml);
|
||||
* var people = document.getRootElement().getChildren('person');
|
||||
* for (var i = 0; i < people.length; i++) {
|
||||
* var person = people[i];
|
||||
* var firstName = person.getAttribute('first').getValue();
|
||||
* var lastName = person.getAttribute('last').getValue();
|
||||
* person.setAttribute('full', firstName + ' ' + lastName);
|
||||
* }
|
||||
* xml = XmlService.getPrettyFormat().format(document);
|
||||
* Logger.log(xml);
|
||||
*/
|
||||
export interface Attribute {
|
||||
getName(): string;
|
||||
getNamespace(): Namespace;
|
||||
getValue(): string;
|
||||
setName(name: string): Attribute;
|
||||
setNamespace(namespace: Namespace): Attribute;
|
||||
setValue(value: string): Attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML CDATASection node.
|
||||
*
|
||||
* // Create and log an XML document that shows how special characters like '<', '>', and '&' are
|
||||
* // stored in a CDATASection node as compared to in a Text node.
|
||||
* var illegalCharacters = '<em>The Amazing Adventures of Kavalier & Clay</em>';
|
||||
* var cdata = XmlService.createCdata(illegalCharacters);
|
||||
* var text = XmlService.createText(illegalCharacters);
|
||||
* var root = XmlService.createElement('root').addContent(cdata).addContent(text);
|
||||
* var document = XmlService.createDocument(root);
|
||||
* var xml = XmlService.getPrettyFormat().format(document);
|
||||
* Logger.log(xml);
|
||||
*/
|
||||
export interface Cdata {
|
||||
append(text: string): Text;
|
||||
detach(): Content;
|
||||
getParentElement(): Element;
|
||||
getText(): string;
|
||||
getValue(): string;
|
||||
setText(text: string): Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML Comment node.
|
||||
*/
|
||||
export interface Comment {
|
||||
detach(): Content;
|
||||
getParentElement(): Element;
|
||||
getText(): string;
|
||||
getValue(): string;
|
||||
setText(text: string): Comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of a generic XML node.
|
||||
* Implementing classes
|
||||
*
|
||||
* NameBrief description
|
||||
*
|
||||
* CdataA representation of an XML CDATASection node.
|
||||
*
|
||||
* CommentA representation of an XML Comment node.
|
||||
*
|
||||
* DocTypeA representation of an XML DocumentType node.
|
||||
*
|
||||
* ElementA representation of an XML Element node.
|
||||
*
|
||||
* EntityRefA representation of an XML EntityReference node.
|
||||
*
|
||||
* ProcessingInstructionA representation of an XML ProcessingInstruction node.
|
||||
*
|
||||
* TextA representation of an XML Text node.
|
||||
*/
|
||||
export interface Content {
|
||||
asCdata(): Cdata;
|
||||
asComment(): Comment;
|
||||
asDocType(): DocType;
|
||||
asElement(): Element;
|
||||
asEntityRef(): EntityRef;
|
||||
asProcessingInstruction(): ProcessingInstruction;
|
||||
asText(): Text;
|
||||
detach(): Content;
|
||||
getParentElement(): Element;
|
||||
getType(): ContentType;
|
||||
getValue(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration representing the types of XML content nodes.
|
||||
*/
|
||||
export enum ContentType { CDATA, COMMENT, DOCTYPE, ELEMENT, ENTITYREF, PROCESSINGINSTRUCTION, TEXT }
|
||||
|
||||
/**
|
||||
* A representation of an XML DocumentType node.
|
||||
*/
|
||||
export interface DocType {
|
||||
detach(): Content;
|
||||
getElementName(): string;
|
||||
getInternalSubset(): string;
|
||||
getParentElement(): Element;
|
||||
getPublicId(): string;
|
||||
getSystemId(): string;
|
||||
getValue(): string;
|
||||
setElementName(name: string): DocType;
|
||||
setInternalSubset(data: string): DocType;
|
||||
setPublicId(id: string): DocType;
|
||||
setSystemId(id: string): DocType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML document.
|
||||
*/
|
||||
export interface Document {
|
||||
addContent(content: Content): Document;
|
||||
addContent(index: Integer, content: Content): Document;
|
||||
cloneContent(): Content[];
|
||||
detachRootElement(): Element;
|
||||
getAllContent(): Content[];
|
||||
getContent(index: Integer): Content;
|
||||
getContentSize(): Integer;
|
||||
getDescendants(): Content[];
|
||||
getDocType(): DocType;
|
||||
getRootElement(): Element;
|
||||
hasRootElement(): boolean;
|
||||
removeContent(): Content[];
|
||||
removeContent(content: Content): boolean;
|
||||
removeContent(index: Integer): Content;
|
||||
setDocType(docType: DocType): Document;
|
||||
setRootElement(element: Element): Document;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML Element node.
|
||||
*
|
||||
* // Adds up the values listed in a sample XML document and adds a new element with the total.
|
||||
* var xml = '<things>'
|
||||
* + '<plates>12</plates>'
|
||||
* + '<bowls>18</bowls>'
|
||||
* + '<cups>25</cups>'
|
||||
* + '</things>';
|
||||
* var document = XmlService.parse(xml);
|
||||
* var root = document.getRootElement();
|
||||
* var items = root.getChildren();
|
||||
* var total = 0;
|
||||
* for (var i = 0; i < items.length; i++) {
|
||||
* total += Number(items[i].getText());
|
||||
* }
|
||||
* var totalElement = XmlService.createElement('total').setText(total);
|
||||
* root.addContent(totalElement);
|
||||
* xml = XmlService.getPrettyFormat().format(document);
|
||||
* Logger.log(xml);
|
||||
*/
|
||||
export interface Element {
|
||||
addContent(content: Content): Element;
|
||||
addContent(index: Integer, content: Content): Element;
|
||||
cloneContent(): Content[];
|
||||
detach(): Content;
|
||||
getAllContent(): Content[];
|
||||
getAttribute(name: string): Attribute;
|
||||
getAttribute(name: string, namespace: Namespace): Attribute;
|
||||
getAttributes(): Attribute[];
|
||||
getChild(name: string): Element;
|
||||
getChild(name: string, namespace: Namespace): Element;
|
||||
getChildText(name: string): string;
|
||||
getChildText(name: string, namespace: Namespace): string;
|
||||
getChildren(): Element[];
|
||||
getChildren(name: string): Element[];
|
||||
getChildren(name: string, namespace: Namespace): Element[];
|
||||
getContent(index: Integer): Content;
|
||||
getContentSize(): Integer;
|
||||
getDescendants(): Content[];
|
||||
getDocument(): Document;
|
||||
getName(): string;
|
||||
getNamespace(): Namespace;
|
||||
getNamespace(prefix: string): Namespace;
|
||||
getParentElement(): Element;
|
||||
getQualifiedName(): string;
|
||||
getText(): string;
|
||||
getValue(): string;
|
||||
isAncestorOf(other: Element): boolean;
|
||||
isRootElement(): boolean;
|
||||
removeAttribute(attribute: Attribute): boolean;
|
||||
removeAttribute(attributeName: string): boolean;
|
||||
removeAttribute(attributeName: string, namespace: Namespace): boolean;
|
||||
removeContent(): Content[];
|
||||
removeContent(content: Content): boolean;
|
||||
removeContent(index: Integer): Content;
|
||||
setAttribute(attribute: Attribute): Element;
|
||||
setAttribute(name: string, value: string): Element;
|
||||
setAttribute(name: string, value: string, namespace: Namespace): Element;
|
||||
setName(name: string): Element;
|
||||
setNamespace(namespace: Namespace): Element;
|
||||
setText(text: string): Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML EntityReference node.
|
||||
*/
|
||||
export interface EntityRef {
|
||||
detach(): Content;
|
||||
getName(): string;
|
||||
getParentElement(): Element;
|
||||
getPublicId(): string;
|
||||
getSystemId(): string;
|
||||
getValue(): string;
|
||||
setName(name: string): EntityRef;
|
||||
setPublicId(id: string): EntityRef;
|
||||
setSystemId(id: string): EntityRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* A formatter for outputting an XML document, with three pre-defined formats that can be further
|
||||
* customized.
|
||||
*
|
||||
* // Log an XML document with specified formatting options.
|
||||
* var xml = '<root><a><b>Text!</b><b>More text!</b></a></root>';
|
||||
* var document = XmlService.parse(xml);
|
||||
* var output = XmlService.getCompactFormat()
|
||||
* .setLineSeparator('\n')
|
||||
* .setEncoding('UTF-8')
|
||||
* .setIndent(' ')
|
||||
* .format(document);
|
||||
* Logger.log(output);
|
||||
*/
|
||||
export interface Format {
|
||||
format(document: Document): string;
|
||||
format(element: Element): string;
|
||||
setEncoding(encoding: string): Format;
|
||||
setIndent(indent: string): Format;
|
||||
setLineSeparator(separator: string): Format;
|
||||
setOmitDeclaration(omitDeclaration: boolean): Format;
|
||||
setOmitEncoding(omitEncoding: boolean): Format;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML namespace.
|
||||
*/
|
||||
export interface Namespace {
|
||||
getPrefix(): string;
|
||||
getURI(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML ProcessingInstruction node.
|
||||
*/
|
||||
export interface ProcessingInstruction {
|
||||
detach(): Content;
|
||||
getData(): string;
|
||||
getParentElement(): Element;
|
||||
getTarget(): string;
|
||||
getValue(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A representation of an XML Text node.
|
||||
*/
|
||||
export interface Text {
|
||||
append(text: string): Text;
|
||||
detach(): Content;
|
||||
getParentElement(): Element;
|
||||
getText(): string;
|
||||
getValue(): string;
|
||||
setText(text: string): Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* This service allows scripts to parse, navigate, and programmatically create XML documents.
|
||||
*
|
||||
* // Log the title and labels for the first page of blog posts on the Google Apps Developer blog.
|
||||
* function parseXml() {
|
||||
* var url = 'http://googleappsdeveloper.blogspot.com/atom.xml';
|
||||
* var xml = UrlFetchApp.fetch(url).getContentText();
|
||||
* var document = XmlService.parse(xml);
|
||||
* var root = document.getRootElement();
|
||||
* var atom = XmlService.getNamespace('http://www.w3.org/2005/Atom');
|
||||
*
|
||||
* var entries = document.getRootElement().getChildren('entry', atom);
|
||||
* for (var i = 0; i < entries.length; i++) {
|
||||
* var title = entries[i].getChild('title', atom).getText();
|
||||
* var categoryElements = entries[i].getChildren('category', atom);
|
||||
* var labels = [];
|
||||
* for (var j = 0; j < categoryElements.length; j++) {
|
||||
* labels.push(categoryElements[j].getAttribute('term').getValue());
|
||||
* }
|
||||
* Logger.log('%s (%s)', title, labels.join(', '));
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Create and log an XML representation of the threads in your Gmail inbox.
|
||||
* function createXml() {
|
||||
* var root = XmlService.createElement('threads');
|
||||
* var threads = GmailApp.getInboxThreads();
|
||||
* for (var i = 0; i < threads.length; i++) {
|
||||
* var child = XmlService.createElement('thread')
|
||||
* .setAttribute('messageCount', threads[i].getMessageCount())
|
||||
* .setAttribute('isUnread', threads[i].isUnread())
|
||||
* .setText(threads[i].getFirstMessageSubject());
|
||||
* root.addContent(child);
|
||||
* }
|
||||
* var document = XmlService.createDocument(root);
|
||||
* var xml = XmlService.getPrettyFormat().format(document);
|
||||
* Logger.log(xml);
|
||||
* }
|
||||
*/
|
||||
export interface XmlService {
|
||||
ContentTypes: ContentType
|
||||
createCdata(text: string): Cdata;
|
||||
createComment(text: string): Comment;
|
||||
createDocType(elementName: string): DocType;
|
||||
createDocType(elementName: string, systemId: string): DocType;
|
||||
createDocType(elementName: string, publicId: string, systemId: string): DocType;
|
||||
createDocument(): Document;
|
||||
createDocument(rootElement: Element): Document;
|
||||
createElement(name: string): Element;
|
||||
createElement(name: string, namespace: Namespace): Element;
|
||||
createText(text: string): Text;
|
||||
getCompactFormat(): Format;
|
||||
getNamespace(uri: string): Namespace;
|
||||
getNamespace(prefix: string, uri: string): Namespace;
|
||||
getNoNamespace(): Namespace;
|
||||
getPrettyFormat(): Format;
|
||||
getRawFormat(): Format;
|
||||
getXmlNamespace(): Namespace;
|
||||
parse(xml: string): Document;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
declare var XmlService: GoogleAppsScript.XML_Service.XmlService;
|
||||
@@ -483,6 +483,36 @@ declare module gapi.drive.realtime {
|
||||
saveAs(fileId:string) : void;
|
||||
|
||||
}
|
||||
|
||||
// INCOMPLETE
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Error
|
||||
export class Error { }
|
||||
|
||||
// Complete
|
||||
// Opens the debugger application on the current page. The debugger shows all realtime documents that the
|
||||
// page has loaded and is able to view, edit and debug all aspects of each realtime document.
|
||||
export function debug() : void;
|
||||
|
||||
/* Creates a new file with fake network communications. This file will not talk to the server and will only
|
||||
exist in memory for as long as the browser session persists.
|
||||
https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime#.newInMemoryDocument
|
||||
@Param opt_onLoaded {function(non-null gapi.drive.realtime.Document)}
|
||||
A callback that will be called when the realtime document is ready. The created or opened realtime document
|
||||
object will be passed to this function.
|
||||
|
||||
@Param opt_initializerFn {function(non-null gapi.drive.realtime.Model)}
|
||||
An optional initialization function that will be called before onLoaded only the first time that the document
|
||||
is loaded. The document's gapi.drive.realtime.Model object will be passed to this function.
|
||||
|
||||
@Param opt_errorFn {function(non-null gapi.drive.realtime.Error)}
|
||||
An optional error handling function that will be called if an error occurs while the document is being
|
||||
loaded or edited. A gapi.drive.realtime.Error object describing the error will be passed to this function.
|
||||
*/
|
||||
export function newInMemoryDocument(
|
||||
opt_onLoaded? : (d:Document) => void,
|
||||
opt_initializerFn? : (m:Model) => void,
|
||||
opt_errorFn? : (e:gapi.drive.realtime.Error) => void
|
||||
) : Document;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+1
@@ -1338,6 +1338,7 @@ declare module google.maps {
|
||||
lightness?: number;
|
||||
saturation?: number;
|
||||
visibility?: string;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
/***** Layers *****/
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="graham_scan.d.ts" />
|
||||
|
||||
// Based on the README.MD
|
||||
|
||||
//Create a new instance.
|
||||
var convexHull = new ConvexHullGrahamScan();
|
||||
|
||||
//add points (needs to be done for each point, a foreach loop on the input array can be used.)
|
||||
convexHull.addPoint(1, 2);
|
||||
|
||||
//getHull() returns the array of points that make up the convex hull.
|
||||
var hullPoints = convexHull.getHull();
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for graham_scan v1.0.2
|
||||
// Project: https://github.com/brian3kb/graham_scan_js
|
||||
// Definitions by: Harm Berntsen <https://github.com/hberntsen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare class ConvexHullGrahamScan {
|
||||
addPoint(x: number, y: number): void;
|
||||
getHull(): {x: number, y: number}[];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<script>
|
||||
function myFunction {
|
||||
document.getElementById("demo").innerHTML = "Hello JavaScript!";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<b>bold</b>
|
||||
</p>
|
||||
<p>
|
||||
<i>italic</i>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="html-to-text.d.ts" />
|
||||
|
||||
import * as htmlToText from 'html-to-text';
|
||||
|
||||
let htmlOptions: HtmlToTextOptions = {
|
||||
wordwrap: null,
|
||||
tables: true,
|
||||
hideLinkHrefIfSameAsText: true,
|
||||
ignoreImage: true
|
||||
};
|
||||
|
||||
|
||||
function callback(err: string, result: string) {
|
||||
console.log(`callback called with result ${result}`);
|
||||
}
|
||||
|
||||
console.log("Processing file with default options");
|
||||
htmlToText.fromFile("h2t-test.html", callback);
|
||||
|
||||
console.log("Processing file with custom options");
|
||||
htmlToText.fromFile("h2t-test.html", htmlOptions, callback);
|
||||
|
||||
let htmlString = "<p><b>bold</b></p><p><i>italic</i></p>";
|
||||
console.log("Processing string with default options");
|
||||
console.log(htmlToText.fromString(htmlString));
|
||||
|
||||
console.log("Processing string with custom options");
|
||||
console.log(htmlToText.fromString(htmlString, htmlOptions));
|
||||
|
||||
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
// Type definitions for html-to-text v1.4.0
|
||||
// Project: https://github.com/werk85/node-html-to-text
|
||||
// Definitions by: Eryk Warren <https://github.com/erykwarren/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/html-to-text
|
||||
|
||||
interface HtmlToTextStatic {
|
||||
/**
|
||||
* Convert html content of file to text
|
||||
*
|
||||
* @param file String with the path of the html file to convert
|
||||
* @param options Hash of options
|
||||
* @param callback Function with signature function(err, result) called when the conversion is completed
|
||||
*
|
||||
*/
|
||||
fromFile(file: string, options: HtmlToTextOptions, callback: Function): void;
|
||||
|
||||
/**
|
||||
* Convert html content of file to text with the default options.
|
||||
*
|
||||
* @param file String with the path of the html file to convert
|
||||
* @param callback Function with signature function(err, result) called when the conversion is completed
|
||||
*
|
||||
*/
|
||||
fromFile(file: string, callback: Function): void;
|
||||
|
||||
/**
|
||||
* Convert html string to text
|
||||
*
|
||||
* @param file String with the path of the html file to convert
|
||||
* @param options Hash of options
|
||||
*
|
||||
* @return String with the converted text.
|
||||
*/
|
||||
fromString(str: string, options?: HtmlToTextOptions): string;
|
||||
}
|
||||
|
||||
interface HtmlToTextOptions {
|
||||
/**
|
||||
* Defines after how many chars a line break should follow in p elements.
|
||||
* Set to null or false to disable word-wrapping. Default: 80
|
||||
*/
|
||||
wordwrap?: number;
|
||||
|
||||
/**
|
||||
* Allows to select certain tables by the class or id attribute from the HTML
|
||||
* document. This is necessary because the majority of HTML E-Mails uses a
|
||||
* table based layout. Prefix your table selectors with an . for the class
|
||||
* and with a # for the id attribute. All other tables are ignored.
|
||||
* You can assign true to this attribute to select all tables. Default: []
|
||||
*/
|
||||
tables?: Array<string> | boolean;
|
||||
|
||||
/**
|
||||
* By default links are translated the following
|
||||
* <a href='link'>text</a> => becomes => text [link].
|
||||
* If this option is set to true and link and text are the same,
|
||||
* [link] will be hidden and only text visible.
|
||||
*/
|
||||
hideLinkHrefIfSameAsText?: boolean;
|
||||
|
||||
/**
|
||||
* Allows you to specify the server host for href attributes, where the links start at the root (/).
|
||||
* For example, linkHrefBaseUrl = 'http://asdf.com' and <a href='/dir/subdir'>...</a>
|
||||
* the link in the text will be http://asdf.com/dir/subdir.
|
||||
* Keep in mind that linkHrefBaseUrl shouldn't end with a /.
|
||||
*/
|
||||
linkHrefBaseUrl?: string;
|
||||
|
||||
/**
|
||||
* Ignore all document links if true.
|
||||
*/
|
||||
ignoreHref?: boolean;
|
||||
|
||||
/**
|
||||
* Ignore all document images if true.
|
||||
*/
|
||||
ignoreImage?: boolean;
|
||||
}
|
||||
|
||||
declare module "html-to-text" {
|
||||
export = htmlToText;
|
||||
}
|
||||
|
||||
declare var htmlToText: HtmlToTextStatic;
|
||||
Vendored
+4
@@ -106,6 +106,10 @@ interface ColorboxSettings {
|
||||
*/
|
||||
close?: string;
|
||||
/**
|
||||
* Set to false to remove the close button.
|
||||
*/
|
||||
closeButton?: boolean;
|
||||
/**
|
||||
* Error message given when ajax content for a given URL cannot be loaded.
|
||||
*/
|
||||
xhrError?: string;
|
||||
|
||||
@@ -13,10 +13,67 @@ var options: GridsterOptions = {
|
||||
x: wgd.row,
|
||||
y: wgd.col
|
||||
};
|
||||
}
|
||||
},
|
||||
widget_base_dimensions: [100, 100]
|
||||
};
|
||||
|
||||
var gridster: Gridster = $('.gridster ul').gridster(options).data('gridster');
|
||||
gridster.add_widget('<li class="new">The HTML of the widget...</li>', 2, 1);
|
||||
gridster.remove_widget($('gridster li').eq(3).get(0));
|
||||
var json = gridster.serialize<SerializeData>();
|
||||
|
||||
var coords: GridsterCoords = gridster.get_highest_occupied_cell();
|
||||
var position = coords.col + coords.row;
|
||||
|
||||
options.widget_base_dimensions = [100, 200];
|
||||
gridster.resize_widget_dimensions(options);
|
||||
|
||||
gridster.set_widget_min_size(0, [1, 2]);
|
||||
|
||||
function noOptions() {
|
||||
var grid: Gridster = $('.gridster ul').gridster().data('gridster')
|
||||
}
|
||||
|
||||
function widgetSelectorHTMLElements() {
|
||||
var opts: GridsterOptions = {
|
||||
widget_selector: $('.gridster ul li').get()
|
||||
};
|
||||
|
||||
var grid: Gridster = $('.gridster ul').gridster(opts).data('gridster')
|
||||
}
|
||||
|
||||
function widgetSelectorString() {
|
||||
var opts: GridsterOptions = {
|
||||
widget_selector: '.gridster ul li'
|
||||
};
|
||||
|
||||
var grid: Gridster = $('.gridster ul').gridster(opts).data('gridster')
|
||||
}
|
||||
|
||||
function withNamespace() {
|
||||
var grid: Gridster = $('.gridster ul').gridster({
|
||||
namespace: 'custom-gridster'
|
||||
}).data('gridster')
|
||||
}
|
||||
|
||||
function withStylesheet() {
|
||||
var grid: Gridster = $('.gridster ul').gridster({
|
||||
autogenerate_stylesheet: false
|
||||
}).data('gridster')
|
||||
}
|
||||
|
||||
function withResize() {
|
||||
var grid: Gridster = $('.gridster ul').gridster({
|
||||
resize: {
|
||||
enabled: true,
|
||||
axes: ['both'],
|
||||
handle_append_to: 'li .handle-container',
|
||||
handle_class: '.handle',
|
||||
max_size: [5, 5],
|
||||
min_size: [1, 1],
|
||||
resize: (event: Event, ui: GridsterUi, $el: JQuery) => {},
|
||||
start: (event: Event, ui: { helper: JQuery; }, $el: JQuery) => {},
|
||||
stop: (event: Event, ui: { helper: JQuery; }, $el: JQuery) => {},
|
||||
}
|
||||
}).data('gridster')
|
||||
}
|
||||
|
||||
Vendored
+65
-9
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jQuery.gridster 0.1.0
|
||||
// Type definitions for jQuery.gridster 0.5.6
|
||||
// Project: https://github.com/jbaldwin/gridster
|
||||
// Definitions by: Josh Baldwin <https://github.com/jbaldwin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -32,13 +32,26 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface GridsterDraggable {
|
||||
items: any;
|
||||
distance: number;
|
||||
limit: boolean;
|
||||
offset_left: number;
|
||||
drag: (event: Event, ui: GridsterUi) => void;
|
||||
start: (event: Event, ui: { helper: JQuery; }) => void;
|
||||
stop: (event: Event, ui: { helper: JQuery; }) => void;
|
||||
items?: any;
|
||||
distance?: number;
|
||||
limit?: boolean;
|
||||
offset_left?: number;
|
||||
handle?: string;
|
||||
drag?: (event: Event, ui: GridsterUi) => void;
|
||||
start?: (event: Event, ui: { helper: JQuery; }) => void;
|
||||
stop?: (event: Event, ui: { helper: JQuery; }) => void;
|
||||
}
|
||||
|
||||
interface GridsterResizable {
|
||||
enabled?: boolean;
|
||||
axes?: string[];
|
||||
handle_append_to?: string;
|
||||
handle_class?: string;
|
||||
max_size?: number[];
|
||||
min_size?: number[];
|
||||
resize?: (event: Event, ui: GridsterUi, $el: JQuery) => void;
|
||||
start?: (event: Event, ui: { helper: JQuery; }, $el: JQuery) => void;
|
||||
stop?: (event: Event, ui: { helper: JQuery; }, $el: JQuery) => void;
|
||||
}
|
||||
|
||||
interface GridsterUi {
|
||||
@@ -78,7 +91,7 @@ interface GridsterOptions {
|
||||
* Type => HTMLElement[]
|
||||
* Default = 'li'
|
||||
**/
|
||||
widget_selector?: any;
|
||||
widget_selector?: string|HTMLElement[];
|
||||
|
||||
/**
|
||||
* Margin between widgets. The first index for the horizontal margin (left, right) and the second for the vertical margin (top, bottom).
|
||||
@@ -154,6 +167,21 @@ interface GridsterOptions {
|
||||
* An object with all options for Draggable class you want to overwrite. @see GridsterDraggable or docs for more info.
|
||||
**/
|
||||
draggable?: GridsterDraggable;
|
||||
|
||||
/**
|
||||
* A string to differentiate one gridster from another
|
||||
**/
|
||||
namespace?: string;
|
||||
|
||||
/**
|
||||
* A boolean to specify if the stylesheet should be generated or not
|
||||
**/
|
||||
autogenerate_stylesheet?: boolean;
|
||||
|
||||
/**
|
||||
* An object with all options for Resizable class you want to overwrite. @see GridsterResizable or docs for more info.
|
||||
**/
|
||||
resize?: GridsterResizable;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
@@ -189,6 +217,12 @@ interface Gridster {
|
||||
**/
|
||||
add_widget(html: JQuery, size_x?: number, size_y?: number, col?: number, row?: number): JQuery;
|
||||
|
||||
/**
|
||||
* Get the highest occupied cell.
|
||||
* @return Returns the farthest position {row: number, col: number} occupied in the grid.
|
||||
**/
|
||||
get_highest_occupied_cell(): GridsterCoords;
|
||||
|
||||
/**
|
||||
* Change the size of a widget.
|
||||
* @param $widget The jQuery wrapped HTMLElement that represents the widget is going to be resized.
|
||||
@@ -199,6 +233,14 @@ interface Gridster {
|
||||
**/
|
||||
resize_widget($widget: JQuery, size_x?: number, size_y?: number, callback?: (size_x: number, size_y: number) => void): JQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Resize all the widgets in the grid.
|
||||
* @param options The options to use to resize the widgets.
|
||||
* @return Returns the instance of the Gridster class.
|
||||
**/
|
||||
resize_widget_dimensions(options: GridsterOptions): Gridster;
|
||||
|
||||
/**
|
||||
* Remove a widget from the grid.
|
||||
* @param el The jQuery wrapped HTMLElement you want to remove.
|
||||
@@ -223,6 +265,14 @@ interface Gridster {
|
||||
**/
|
||||
remove_widget(el: JQuery, callback: (el: HTMLElement) => void): Gridster;
|
||||
|
||||
/**
|
||||
* Resize a widget in the grid.
|
||||
* @param widget The index of the widget to be resized.
|
||||
* @param size An array representing the size (x, y) to set on the widget.
|
||||
* @return Returns the instance of the Gridster class.
|
||||
**/
|
||||
set_widget_min_size(widget: number, size: number[]): Gridster;
|
||||
|
||||
/**
|
||||
* Returns a serialized array of the widgets in the grid.
|
||||
* @param $widgets The collection of jQuery wrap ed HTMLElements you want to serialize. If no argument is passed a l widgets will be serialized.
|
||||
@@ -247,4 +297,10 @@ interface Gridster {
|
||||
* @return Returns the instance of the Gridster class.
|
||||
**/
|
||||
disable(): Gridster;
|
||||
|
||||
/**
|
||||
* Returns the options used to initialize the grid
|
||||
* @return Returns the options used to initialize the grid
|
||||
**/
|
||||
options: GridsterOptions;
|
||||
}
|
||||
|
||||
Vendored
+5
-9
@@ -13,16 +13,12 @@ declare module JSData {
|
||||
}
|
||||
|
||||
interface DS {
|
||||
|
||||
bindAll<T>(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T>)=>void):Function;
|
||||
|
||||
bindOne<T>(resourceName:string, id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function;
|
||||
bindAll<T>(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T & DSInstanceShorthands<T>>)=>void):Function;
|
||||
bindOne<T>(resourceName:string, id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T & DSInstanceShorthands<T>)=>void):Function;
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> {
|
||||
|
||||
bindAll<T>(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T>)=>void):Function;
|
||||
|
||||
bindOne<T>(id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function;
|
||||
bindAll(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T & DSInstanceShorthands<T>>)=>void):Function;
|
||||
bindOne(id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T & DSInstanceShorthands<T>)=>void):Function;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ ADocument.inject({ id: 5, author: 'John' });
|
||||
ADocument.inject({ id: 6, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.updateAll<{ id?: number; author: string; }>(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated documents have NOT been injected into the data store because we bypassed the data store
|
||||
@@ -37,7 +37,7 @@ adapter.updateAll<{ id?: number; author: string; }>(ADocument, { author: 'Johnny
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.updateAll<{ id?: number; author: string; }>({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated documents have been injected into the data store
|
||||
|
||||
Vendored
+6
-2
@@ -6,7 +6,7 @@
|
||||
/// <reference path="../js-data/js-data.d.ts" />
|
||||
|
||||
declare module JSData {
|
||||
|
||||
|
||||
interface DSHttpAdapterOptions {
|
||||
serialize?: (resourceName:string, data:any)=>any;
|
||||
deserialize?: (resourceName:string, data:any)=>any;
|
||||
@@ -37,4 +37,8 @@ declare module JSData {
|
||||
}
|
||||
}
|
||||
|
||||
declare var DSHttpAdapter:JSData.DSHttpAdapter;
|
||||
declare var DSHttpAdapter:JSData.DSHttpAdapter;
|
||||
|
||||
declare module 'js-data-http' {
|
||||
export = DSHttpAdapter;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/// <reference path="js-data.d.ts" />
|
||||
/// <reference path="../js-data-http/js-data-http.d.ts" />
|
||||
|
||||
import JSData = require('js-data');
|
||||
//TODO
|
||||
//import DSRedisAdapter = require('js-data-redis')
|
||||
import DSHttpAdapter = require('js-data-http')
|
||||
var store = new JSData.DS();
|
||||
|
||||
// register and use http by default for async operations
|
||||
//TODO
|
||||
//store.registerAdapter('redis', new DSRedisAdapter(), {default: true});
|
||||
store.registerAdapter('redis', new DSHttpAdapter(), {default: true});
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource('user');
|
||||
|
||||
User.find(1).then(function (user: any) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
});
|
||||
|
||||
+78
-20
@@ -11,7 +11,7 @@ interface IUser {
|
||||
}
|
||||
|
||||
interface IUserWithMethod extends IUser {
|
||||
fullName?: () => string;
|
||||
fullName:()=>string;
|
||||
}
|
||||
|
||||
interface IUserWithComputedProperty extends IUser {
|
||||
@@ -20,10 +20,6 @@ interface IUserWithComputedProperty extends IUser {
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
// register and use http by default for async operations
|
||||
//TODO
|
||||
//store.registerAdapter('http', new DSHttpAdapter(), {default: true});
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource<IUser>('user');
|
||||
|
||||
@@ -31,12 +27,12 @@ User.find(1).then(function (user:IUser) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
|
||||
var user:IUser = User.createInstance<IUser>({name: 'John'});
|
||||
var user:IUser = User.createInstance({name: 'John'});
|
||||
|
||||
var store = new JSData.DS();
|
||||
var User = store.defineResource('user');
|
||||
var user:IUser = User.inject<IUser>({id: 1, name: 'John'});
|
||||
var user2:IUser = User.inject<IUser>({id: 1, age: 30});
|
||||
var User2 = store.defineResource('user');
|
||||
var user:IUser = User2.inject({id: 1, name: 'John'});
|
||||
var user2:IUser = User2.inject({id: 1, age: 30});
|
||||
|
||||
user; // User { id: 1, name: 'John', age: 30 }
|
||||
user2; // User { id: 1, name: 'John', age: 30 }
|
||||
@@ -70,7 +66,7 @@ User.create({
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var UserWithMethod = store.defineResource<IUserWithMethod>({
|
||||
var UserWithMethodResource = store.defineResource<IUserWithMethod>({
|
||||
name: 'user',
|
||||
methods: {
|
||||
fullName: function () {
|
||||
@@ -79,7 +75,7 @@ var UserWithMethod = store.defineResource<IUserWithMethod>({
|
||||
}
|
||||
});
|
||||
|
||||
var userWithMethod = UserWithMethod.createInstance<IUserWithMethod>({first: 'John', last: 'Anderson'});
|
||||
var userWithMethod = UserWithMethodResource.createInstance({first: 'John', last: 'Anderson'});
|
||||
|
||||
userWithMethod.fullName(); // "John Anderson"
|
||||
|
||||
@@ -102,7 +98,7 @@ var UserWithComputedProperty = store.defineResource<IUserWithComputedProperty>({
|
||||
}
|
||||
});
|
||||
|
||||
var userWithComputedProperty:IUserWithComputedProperty = UserWithComputedProperty.inject<IUserWithComputedProperty>({
|
||||
var userWithComputedProperty:IUserWithComputedProperty = UserWithComputedProperty.inject({
|
||||
id: 1,
|
||||
first: 'John',
|
||||
last: 'Anderson'
|
||||
@@ -284,7 +280,7 @@ Post.filter({
|
||||
limit: PAGE_SIZE
|
||||
});
|
||||
|
||||
var User = store.defineResource({
|
||||
var User3 = store.defineResource({
|
||||
name: 'user',
|
||||
relations: {
|
||||
hasMany: {
|
||||
@@ -362,7 +358,7 @@ User.find(10).then(function (user:IUser) {
|
||||
user.comments; // undefined
|
||||
user.profile; // undefined
|
||||
|
||||
User.loadRelations(user, ['comment', 'profile']).then(function (user:IUser) {
|
||||
User.loadRelations(user.id, ['comment', 'profile']).then(function (user:IUser) {
|
||||
user.comments; // array
|
||||
user.profile; // object
|
||||
});
|
||||
@@ -403,24 +399,24 @@ OtherOtherComment.update(1, {content: 'stuff'}, {params: {postId: false}}); // P
|
||||
|
||||
var store = new JSData.DS({
|
||||
// set the default
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
beforeCreate: function (resource:JSData.DSResourceDefinition<any>, data:any, cb:(err:Error, returnData:any)=>void) {
|
||||
// do something general
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
var User = store.defineResource({
|
||||
var User4 = store.defineResource({
|
||||
name: 'user',
|
||||
// set just for this resource
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
beforeCreate: function (resource:JSData.DSResourceDefinition<any>, data:any, cb:(err:Error, returnData:any)=>void) {
|
||||
// do something more specific to "users"
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
User.create({name: 'John'}, {
|
||||
User4.create({name: 'John'}, {
|
||||
// set just for this method call
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
beforeCreate: function (resource:JSData.DSResourceDefinition<any>, data:any, cb:(err:Error, returnData:any)=>void) {
|
||||
// do something specific for this method call
|
||||
cb(null, data);
|
||||
}
|
||||
@@ -521,4 +517,66 @@ var store = new JSData.DS();
|
||||
|
||||
var myResourceDefinition = store.defineResource<MyResourceDefinition>('myResource');
|
||||
|
||||
myResourceDefinition = store.definitions.myResource;
|
||||
myResourceDefinition = store.definitions.myResource;
|
||||
|
||||
/**
|
||||
* Custom action on datastore resource
|
||||
*/
|
||||
|
||||
interface Resource {
|
||||
someProp:string;
|
||||
}
|
||||
|
||||
interface ActionsForResource {
|
||||
myAction:JSData.DSActionFn;
|
||||
myOtherAction:JSData.DSActionFn;
|
||||
}
|
||||
|
||||
var myOtherAction:JSData.DSActionConfig = {
|
||||
method: 'GET',
|
||||
endpoint: 'goHere'
|
||||
};
|
||||
|
||||
var customActionResource = store.defineResource<Resource, ActionsForResource>({
|
||||
name: 'actionResource',
|
||||
actions: {
|
||||
myAction: {
|
||||
method: 'POST'
|
||||
},
|
||||
myOtherAction: myOtherAction
|
||||
}
|
||||
});
|
||||
|
||||
customActionResource.myAction<number>(3).then((result)=>{
|
||||
|
||||
var theCustomResult:number = result;
|
||||
});
|
||||
|
||||
customActionResource.myOtherAction<void>(2, {data:'blub'}).then(()=>{
|
||||
// success
|
||||
});
|
||||
|
||||
customActionResource.find(1).then((result)=>{
|
||||
|
||||
var aProperty = result.someProp;
|
||||
});
|
||||
|
||||
/**
|
||||
* Instance shorthands
|
||||
*/
|
||||
|
||||
var customActionResourceInstance = customActionResource.get(1);
|
||||
|
||||
customActionResourceInstance.DSCompute();
|
||||
customActionResourceInstance.DSChanges();
|
||||
customActionResourceInstance.DSChangeHistory();
|
||||
customActionResourceInstance.DSHasChanges();
|
||||
customActionResourceInstance.DSLastModified();
|
||||
customActionResourceInstance.DSLastSaved();
|
||||
customActionResourceInstance.DSPrevious();
|
||||
customActionResourceInstance.DSCreate();
|
||||
customActionResourceInstance.DSDestroy();
|
||||
customActionResourceInstance.DSLoadRelations('myRelation');
|
||||
customActionResourceInstance.DSRefresh();
|
||||
customActionResourceInstance.DSSave();
|
||||
customActionResourceInstance.DSUpdate();
|
||||
|
||||
Vendored
+206
-162
@@ -1,4 +1,4 @@
|
||||
// Type definitions for JSData v1.5.4
|
||||
// Type definitions for JSData v2.8.0
|
||||
// Project: https://github.com/js-data/js-data
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -7,135 +7,66 @@
|
||||
// js-data module (js-data.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// defining what exists in JSData and how it looks
|
||||
declare module JSData {
|
||||
|
||||
interface JSDataPromise<R> {
|
||||
then<U>(onFulfilled?:(value:R) => U | JSDataPromise<U>, onRejected?:(error:any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
then<U>(onFulfilled?: (value: R) => U | JSDataPromise<U>, onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
catch<U>(onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
catch<U>(onRejected?:(error:any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
// enhanced with finally
|
||||
finally<U>(finallyCb?:() => U):JSDataPromise<U>;
|
||||
}
|
||||
|
||||
//TODO switch to class again when typescript supports open ended class declaration
|
||||
interface DS {
|
||||
|
||||
new(config?:DSConfiguration):DS;
|
||||
|
||||
// rather undocumented
|
||||
errors:DSErrors;
|
||||
|
||||
// those are objects containing the defined resources and adapters
|
||||
definitions:any;
|
||||
adapters:any;
|
||||
|
||||
defaults:DSConfiguration;
|
||||
|
||||
// async
|
||||
create<T>(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
destroyAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
find<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
findAll<T>(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
loadRelations<T>(resourceName:string, idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
update<T>(resourceName:string, id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(resourceName:string, attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
reap(resourceName:string, options?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
save<T>(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
|
||||
// sync
|
||||
changeHistory(resourceName:string, id?:string | number):Array<Object>;
|
||||
changes(resourceName:string, id:string | number):Object;
|
||||
compute<T>(resourceName:string, idOrInstance:number | string | Object ):T;
|
||||
createInstance<T>(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T;
|
||||
defineResource<T>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T>;
|
||||
digest():void;
|
||||
eject<T>(resourceName:string, id:string | number, options?:DSConfiguration):T;
|
||||
ejectAll<T>(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
filter<T>(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
get<T>(resourceName:string, id:string | number, options?:DSConfiguration):T;
|
||||
getAll<T>(resourceName:string, ids?:Array<string | number>):Array<T>;
|
||||
hasChanges(resourceName:string, id:string | number):boolean;
|
||||
inject<T>(resourceName:string, attrs:T, options?:DSConfiguration):T;
|
||||
inject<T>(resourceName:string, items:Array<T>, options?:DSConfiguration):Array<T>;
|
||||
is(resourceName:string, object:Object): boolean;
|
||||
lastModified(resourceName:string, id?:string | number):number; // timestamp
|
||||
lastSaved(resourceName:string, id?:string | number):number; // timestamp
|
||||
link<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
linkAll<T>(resourceName:string, params:DSFilterParams, relations?:Array<string>):T;
|
||||
linkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
previous<T>(resourceName:string, id:string | number):T;
|
||||
unlinkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
|
||||
registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void;
|
||||
}
|
||||
|
||||
interface DSConfiguration extends IDSResourceLifecycleEventHandlers {
|
||||
actions?: Object;
|
||||
allowSimpleWhere?: boolean;
|
||||
basePath?: string;
|
||||
bypassCache?: boolean;
|
||||
cacheResponse?: boolean;
|
||||
clearEmptyQueries?:boolean;
|
||||
debug?:boolean;
|
||||
defaultAdapter?: string;
|
||||
defaultFilter?: (collection:Array<any>, resourceName:string, params:DSFilterParams, options:DSConfiguration)=>Array<any>;
|
||||
defaultFilter?: (collection:Array<any>, resourceName:string, params:DSFilterArg, options:DSConfiguration)=>Array<any>;
|
||||
defaultValues?:Object;
|
||||
eagerEject?: boolean;
|
||||
// TODO enable when eagerInject in DS#create is implemented
|
||||
//eagerInject?: boolean;
|
||||
endpoint?: string;
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
fallbackAdapters?: Array<string>;
|
||||
findAllFallbackAdapters?: Array<string>;
|
||||
findAllStrategy?: string;
|
||||
findBelongsTo?: boolean;
|
||||
findFallbackAdapters?: Array<string>;
|
||||
findHasOne?: boolean;
|
||||
findHasMany?: boolean;
|
||||
findInverseLinks?: boolean;
|
||||
findStrategy?: string
|
||||
findStrictCache?:boolean;
|
||||
idAttribute?: string;
|
||||
ignoredChanges?: Array<RegExp | string>;
|
||||
// TODO ignoreMissing is undocumented
|
||||
//ignoreMissing: boolean;
|
||||
ignoreMissing?: boolean;
|
||||
instanceEvents?:boolean;
|
||||
keepChangeHistory?: boolean;
|
||||
loadFromServer?: boolean;
|
||||
log?: boolean | ((message?: any, ...optionalParams: any[])=> void);
|
||||
linkRelations?:boolean;
|
||||
log?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
maxAge?: number;
|
||||
notify?: boolean;
|
||||
omit?:Array<string|RegExp>;
|
||||
onConflict?:string; // "merge"(default) or "replace"
|
||||
reapAction?: string;
|
||||
reapInterval?: number;
|
||||
relationsEnumerable?:boolean;
|
||||
resetHistoryOnInject?: boolean;
|
||||
returnMeta?:boolean;
|
||||
scopes?:Object;
|
||||
strategy?: string;
|
||||
upsert?: boolean;
|
||||
useClass?: boolean;
|
||||
useFilter?: boolean;
|
||||
}
|
||||
|
||||
interface DSAdapterOperationConfiguration extends DSConfiguration {
|
||||
adapter?: string;
|
||||
bypassCache?: boolean;
|
||||
cacheResponse?: boolean;
|
||||
findStrategy?: string;
|
||||
findFallbackAdapters?: string[];
|
||||
strategy?: string;
|
||||
fallbackAdapters?: string[];
|
||||
|
||||
params: {
|
||||
[paramName: string]: string | number | boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface DSSaveConfiguration extends DSAdapterOperationConfiguration {
|
||||
changesOnly?: boolean;
|
||||
watchChanges?:boolean;
|
||||
}
|
||||
|
||||
interface DSResourceDefinitionConfiguration extends DSConfiguration {
|
||||
name: string;
|
||||
computed?: any;
|
||||
meta?:any;
|
||||
methods?: any;
|
||||
name: string;
|
||||
relations?: {
|
||||
hasMany?: Object;
|
||||
hasOne?: Object;
|
||||
@@ -143,46 +74,6 @@ declare module JSData {
|
||||
};
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration {
|
||||
|
||||
//async
|
||||
create<T>(attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
destroyAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
find<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
findAll<T>(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
loadRelations<T>(idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
update<T>(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(attrs:Object, params?:DSFilterParams & T, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
reap(resourceNametions?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
save<T>(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
|
||||
// sync
|
||||
changeHistory(id?:string | number):Array<Object>;
|
||||
changes(id:string | number):Object;
|
||||
compute<T>(idOrInstance:number | string | Object ):T;
|
||||
createInstance<T>(attrs?:T, options?:DSAdapterOperationConfiguration):T;
|
||||
digest():void;
|
||||
eject<T>(id:string | number, options?:DSConfiguration):T;
|
||||
ejectAll<T>(params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
filter<T>(params: DSFilterParams, options?: DSConfiguration): Array<T>;
|
||||
filter<T>(params: DSFilterParamsForAllowSimpleWhere, options?: DSConfiguration): Array<T>;
|
||||
get<T>(id:string | number, options?:DSConfiguration):T;
|
||||
getAll<T>(ids?:Array<string | number>):Array<T>;
|
||||
hasChanges(id:string | number):boolean;
|
||||
inject<T>(attrs:T, options?:DSConfiguration):T;
|
||||
inject<T>(items:Array<T>, options?:DSConfiguration):Array<T>;
|
||||
is(object:Object): boolean;
|
||||
lastModified(id?:string | number):number; // timestamp
|
||||
lastSaved(id?:string | number):number; // timestamp
|
||||
link<T>(id:string | number, relations?:Array<string>):T;
|
||||
linkAll<T>(params:DSFilterParams, relations?:Array<string>):T;
|
||||
linkInverse<T>(id:string | number, relations?:Array<string>):T;
|
||||
previous<T>(id:string | number):T;
|
||||
unlinkInverse<T>(id:string | number, relations?:Array<string>):T;
|
||||
}
|
||||
|
||||
interface DSFilterParams {
|
||||
where?: Object;
|
||||
|
||||
@@ -195,49 +86,188 @@ declare module JSData {
|
||||
sort?: string | Array<string> | Array<Array<string>>;
|
||||
}
|
||||
|
||||
interface DSFilterParamsForAllowSimpleWhere {
|
||||
[key: string]: string | number;
|
||||
type DSFilterArg = DSFilterParams | Object;
|
||||
|
||||
interface DSAdapterOperationConfiguration extends DSConfiguration {
|
||||
adapter?: string;
|
||||
params?: {
|
||||
[paramName: string]: string | number | boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface DSSaveConfiguration extends DSAdapterOperationConfiguration {
|
||||
changesOnly?: boolean;
|
||||
}
|
||||
|
||||
interface DSCollection<T> extends Array<T> {
|
||||
fetch(params?:DSFilterArg, options?:DSConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
params:DSFilterArg;
|
||||
resourceName:string;
|
||||
}
|
||||
|
||||
interface DS {
|
||||
new(config?:DSConfiguration):DS;
|
||||
|
||||
// rather undocumented
|
||||
errors:DSErrors;
|
||||
|
||||
// those are objects containing the defined resources and adapters
|
||||
definitions:any;
|
||||
adapters:any;
|
||||
|
||||
defaults:DSConfiguration;
|
||||
|
||||
changeHistory(resourceName:string, id:string | number):Array<Object>;
|
||||
changes(resourceName:string, id:string | number, options?:{ignoredChanges:Array<string|RegExp>}):Object;
|
||||
clear<T>():Array<T & DSInstanceShorthands<T>>;
|
||||
compute<T>(resourceName:string, idOrInstance:number | string | T):T & DSInstanceShorthands<T>;
|
||||
create<T>(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
createCollection<T>(resourceName:string, array?:Array<T>, params?:DSFilterArg, options?:DSConfiguration):DSCollection<T & DSInstanceShorthands<T>>;
|
||||
createInstance<T>(resourceName:string, attrs?:Object, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
destroyAll(resourceName:string, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
digest():void;
|
||||
eject<T>(resourceName:string, id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
ejectAll<T>(resourceName:string, params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
filter<T>(resourceName:string, params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
find<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
findAll<T>(resourceName:string, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
get<T>(resourceName:string, id:string | number):T & DSInstanceShorthands<T>;
|
||||
getAll<T>(resourceName:string, ids?:Array<string | number>):Array<T & DSInstanceShorthands<T>>;
|
||||
hasChanges(resourceName:string, id:string | number):boolean;
|
||||
inject<TInject, U>(resourceName:string, attrs:TInject, options?:DSConfiguration):U & DSInstanceShorthands<U>;
|
||||
inject<TInject, U>(resourceName:string, items:Array<TInject>, options?:DSConfiguration):Array<U & DSInstanceShorthands<U>>;
|
||||
is(resourceName:string, object:Object): boolean;
|
||||
lastModified(resourceName:string, id?:string | number):number; // timestamp
|
||||
lastSaved(resourceName:string, id?:string | number):number; // timestamp
|
||||
loadRelations<T>(resourceName:string, idOrInstance:string | number, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
previous<T>(resourceName:string, id:string | number):T & DSInstanceShorthands<T>;
|
||||
reap(resourceName:string):JSDataPromise<void>;
|
||||
refresh<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
refreshAll<T>(resourceName:string, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
revert<T>(resourceName:string, id:string | number):T & DSInstanceShorthands<T>;
|
||||
save<T>(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
update<T>(resourceName:string, id:string | number, attrs:Object, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
updateAll<T>(resourceName:string, attrs:Object, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
|
||||
defineResource<T>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T>;
|
||||
defineResource<T, TActions>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T> & TActions;
|
||||
registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void;
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration {
|
||||
changeHistory(id:string | number):Array<Object>;
|
||||
changes(id:string | number, options?:{ignoredChanges:Array<string|RegExp>}):Object;
|
||||
clear():Array<T & DSInstanceShorthands<T>>;
|
||||
compute(idOrInstance:number | string | T):T & DSInstanceShorthands<T>;
|
||||
create(attrs:Object, options?:DSConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
createCollection(array?:Array<T>, params?:DSFilterArg, options?:DSConfiguration):DSCollection<T & DSInstanceShorthands<T>>;
|
||||
createInstance(attrs?:Object, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
destroyAll(params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
digest():void;
|
||||
eject(id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
ejectAll(params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
filter(params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
find(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
findAll(params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
get(id:string | number):T & DSInstanceShorthands<T>;
|
||||
getAll(ids?:Array<string | number>):Array<T & DSInstanceShorthands<T>>;
|
||||
hasChanges(id:string | number):boolean;
|
||||
inject<TInject>(attrs:TInject, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
inject<TInject>(items:Array<TInject>, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
is(object:Object): boolean;
|
||||
lastModified(id?:string | number):number; // timestamp
|
||||
lastSaved(id?:string | number):number; // timestamp
|
||||
loadRelations(idOrInstance:string | number, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
previous(id:string | number):T & DSInstanceShorthands<T>;
|
||||
reap():JSDataPromise<void>;
|
||||
refresh(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
refreshAll(params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
revert(id:string | number):T & DSInstanceShorthands<T>;
|
||||
save(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
update(id:string | number, attrs:Object, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
updateAll(attrs:Object, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
}
|
||||
|
||||
// cannot specify T at interface level because the interface is used as generic constraint itself which ends up being recursive
|
||||
export interface DSInstanceShorthands<T> {
|
||||
DSCompute():void;
|
||||
DSRefresh(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSSave(options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSUpdate(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSDestroy(options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
DSCreate(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSLoadRelations(relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSChangeHistory():Array<Object>;
|
||||
DSChanges():Object;
|
||||
DSHasChanges():boolean;
|
||||
DSLastModified():number; // timestamp
|
||||
DSLastSaved():number; // timestamp
|
||||
DSPrevious():T & DSInstanceShorthands<T>;
|
||||
DSRevert():T & DSInstanceShorthands<T>;
|
||||
}
|
||||
|
||||
type DSSyncLifecycleHookHandler = (resource:DSResourceDefinition<any>, data:any) => void;
|
||||
type DSAsyncLifecycleHookHandler = (resource:DSResourceDefinition<any>, data:any) => JSDataPromise<any>;
|
||||
type DSAsyncLifecycleHookHandlerCb = (resource:DSResourceDefinition<any>, data:any, cb:(err:Error, data:any)=>void) => void
|
||||
|
||||
interface IDSResourceLifecycleValidateEventHandlers {
|
||||
beforeValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
validate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
beforeValidate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
validate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
afterValidate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateEventHandlers {
|
||||
beforeCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateInstanceEventHandlers {
|
||||
beforeCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
afterCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
beforeCreate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
afterCreate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleUpdateEventHandlers {
|
||||
beforeUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
beforeUpdate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
afterUpdate?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleDestroyEventHandlers {
|
||||
beforeDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
beforeDestroy?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
afterDestroy?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateInstanceEventHandlers {
|
||||
beforeCreateInstance?: DSSyncLifecycleHookHandler;
|
||||
afterCreateInstance?: DSSyncLifecycleHookHandler;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleInjectEventHandlers {
|
||||
beforeInject?: (resourceName:string, data:any)=>void;
|
||||
afterInject?: (resourceName:string, data:any)=>void;
|
||||
beforeInject?: DSSyncLifecycleHookHandler;
|
||||
afterInject?: DSSyncLifecycleHookHandler;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEjectEventHandlers {
|
||||
beforeEject?: (resourceName:string, data:any)=>void;
|
||||
afterEject?: (resourceName:string, data:any)=>void;
|
||||
beforeEject?: DSSyncLifecycleHookHandler;
|
||||
afterEject?: DSSyncLifecycleHookHandler;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleReapEventHandlers {
|
||||
beforeReap?: (resourceName:string, data:any)=>void;
|
||||
afterReap?: (resourceName:string, data:any)=>void;
|
||||
beforeReap?: DSSyncLifecycleHookHandler;
|
||||
afterReap?: DSSyncLifecycleHookHandler;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleFindEventHandlers {
|
||||
afterFind?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleFindAllEventHandlers {
|
||||
afterFindAll?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleLoadRelationsEventHandlers {
|
||||
afterLoadRelations?: DSAsyncLifecycleHookHandler | DSAsyncLifecycleHookHandlerCb;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateCollectionEventHandlers {
|
||||
beforeCreateCollection?: DSSyncLifecycleHookHandler;
|
||||
afterCreateCollection?: DSSyncLifecycleHookHandler;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEventHandlers extends IDSResourceLifecycleCreateEventHandlers,
|
||||
@@ -247,8 +277,11 @@ declare module JSData {
|
||||
IDSResourceLifecycleDestroyEventHandlers,
|
||||
IDSResourceLifecycleInjectEventHandlers,
|
||||
IDSResourceLifecycleEjectEventHandlers,
|
||||
IDSResourceLifecycleReapEventHandlers {
|
||||
|
||||
IDSResourceLifecycleReapEventHandlers,
|
||||
IDSResourceLifecycleFindEventHandlers,
|
||||
IDSResourceLifecycleFindAllEventHandlers,
|
||||
IDSResourceLifecycleLoadRelationsEventHandlers,
|
||||
IDSResourceLifecycleCreateCollectionEventHandlers {
|
||||
}
|
||||
|
||||
// errors
|
||||
@@ -271,19 +304,31 @@ declare module JSData {
|
||||
|
||||
// DSAdapter interface
|
||||
interface IDSAdapter {
|
||||
create<T>(config:DSResourceDefinition<T>, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
create(config:DSResourceDefinition<any>, attrs:Object, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
destroy<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<any>;
|
||||
destroy(config:DSResourceDefinition<any>, id:string | number, options?:DSConfiguration):JSDataPromise<void>;
|
||||
destroyAll(config:DSResourceDefinition<any>, params:DSFilterArg, options?:DSConfiguration):JSDataPromise<void>;
|
||||
|
||||
destroyAll<T>(config:DSResourceDefinition<T>, params:DSFilterParams, options?:DSConfiguration):JSDataPromise<any>;
|
||||
find(config:DSResourceDefinition<any>, id:string | number, options?:DSConfiguration):JSDataPromise<any>;
|
||||
findAll(config:DSResourceDefinition<any>, params?:DSFilterArg, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
find<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<T>;
|
||||
update(config:DSResourceDefinition<any>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<any>;
|
||||
updateAll(config:DSResourceDefinition<any>, attrs:Object, params?:DSFilterArg, options?:DSConfiguration):JSDataPromise<any>;
|
||||
}
|
||||
|
||||
findAll<T>(config:DSResourceDefinition<T>, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise<T>;
|
||||
// Custom action config
|
||||
interface DSActionConfig {
|
||||
adapter?: string;
|
||||
endpoint?: string;
|
||||
pathname?: string;
|
||||
method?: string;
|
||||
}
|
||||
|
||||
update<T>(config:DSResourceDefinition<T>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams & T, options?:DSConfiguration):JSDataPromise<T[]>;
|
||||
// Custom action method definition
|
||||
// options are passed to adapter.HTTP() method-call, js-data-http adapter by default uses AXIOS but can also be $http in case of angular
|
||||
// or a custom adapter implementation. The adapter can be set via the DSActionConfig.
|
||||
interface DSActionFn {
|
||||
<T>(id:string | number, options?:Object):JSDataPromise<T>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +340,5 @@ declare var JSData:{
|
||||
|
||||
//Support node require
|
||||
declare module 'js-data' {
|
||||
|
||||
export = JSData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
/// <reference path="js-data-1.5.4.d.ts" />
|
||||
|
||||
interface IUser {
|
||||
id?: number;
|
||||
name?: string;
|
||||
age?: number;
|
||||
first?: string;
|
||||
last?: string;
|
||||
comments?:Array<any>;
|
||||
profile?:any;
|
||||
}
|
||||
|
||||
interface IUserWithMethod {
|
||||
fullName:()=>string;
|
||||
}
|
||||
|
||||
interface IUserWithComputedProperty extends IUser {
|
||||
fullName?: string;
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource<IUser>('user');
|
||||
|
||||
User.find(1).then(function (user:IUser) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
|
||||
var user:IUser = User.createInstance({name: 'John'});
|
||||
|
||||
var store = new JSData.DS();
|
||||
var User2 = store.defineResource('user');
|
||||
var user:IUser = User2.inject({id: 1, name: 'John'});
|
||||
var user2:IUser = User2.inject({id: 1, age: 30});
|
||||
|
||||
user; // User { id: 1, name: 'John', age: 30 }
|
||||
user2; // User { id: 1, name: 'John', age: 30 }
|
||||
User.get(1); // User { id: 1, name: 'John', age: 30 }
|
||||
user === user2; // true
|
||||
user === User.get(1); // true
|
||||
user2 === User.get(1); // true
|
||||
|
||||
var store = new JSData.DS({
|
||||
// set a default lifecycle hook
|
||||
afterCreate: function () {
|
||||
}
|
||||
});
|
||||
|
||||
var User = store.defineResource<IUser>({
|
||||
name: 'user',
|
||||
// override the hook for this resource
|
||||
afterCreate: function () {
|
||||
}
|
||||
});
|
||||
|
||||
User.create({
|
||||
name: 'john'
|
||||
}, {
|
||||
// override the hook just for this method call
|
||||
afterCreate: function () {
|
||||
}
|
||||
}).then(()=> {
|
||||
|
||||
});
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var UserWithMethodResource = store.defineResource<IUserWithMethod>({
|
||||
name: 'user',
|
||||
methods: {
|
||||
fullName: function () {
|
||||
return this.first + ' ' + this.last;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var userWithMethod = UserWithMethodResource.createInstance({first: 'John', last: 'Anderson'});
|
||||
|
||||
userWithMethod.fullName(); // "John Anderson"
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var UserWithComputedProperty = store.defineResource<IUserWithComputedProperty>({
|
||||
name: 'user',
|
||||
computed: {
|
||||
// each function's argument list defines the fields
|
||||
// that the computed property depends on
|
||||
fullName: ['first', 'last', function (first:string, last:string) {
|
||||
return first + ' ' + last;
|
||||
}],
|
||||
// shortand, use the array syntax above if you want
|
||||
// you computed properties to work after you've
|
||||
// minified your code. Shorthand style won't work when minified
|
||||
initials: function (first:string, last:string) {
|
||||
return first.toUpperCase()[0] + '. ' + last.toUpperCase()[0] + '.';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var userWithComputedProperty:IUserWithComputedProperty = UserWithComputedProperty.inject({
|
||||
id: 1,
|
||||
first: 'John',
|
||||
last: 'Anderson'
|
||||
});
|
||||
|
||||
userWithComputedProperty.fullName; // "John Anderson"
|
||||
|
||||
userWithComputedProperty.first = 'Fred';
|
||||
|
||||
// js-data relies on dirty-checking, so the
|
||||
// computed property (probably) hasn't been updated yet
|
||||
userWithComputedProperty.fullName; // "John Anderson"
|
||||
|
||||
// If your browser supports Object.observe this will have no effect
|
||||
// otherwise it will trigger the dirty-checking
|
||||
store.digest();
|
||||
|
||||
userWithComputedProperty.fullName; // "Fred Anderson"
|
||||
|
||||
interface IComment {
|
||||
comments?: any;
|
||||
profile?: any;
|
||||
}
|
||||
|
||||
var aComment:JSData.DSResourceDefinition<IComment> = store.defineResource<IComment>('comment');
|
||||
|
||||
// Get all comments where comment.userId == 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'==': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId == 5
|
||||
aComment.filter({
|
||||
userId: 5
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId === 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'===': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId != 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'!=': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId !== 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'!==': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age > 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'>': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age >= 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'>=': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age < 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'<': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name is in "John Anderson"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'in': 'John Anderson'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.role is in ["admin", "owner"]
|
||||
User.filter({
|
||||
where: {
|
||||
role: {
|
||||
'in': ['admin', 'owner']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name is NOT in "John Anderson"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'notIn': 'John Anderson'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.role is NOT in ["admin", "owner"]
|
||||
User.filter({
|
||||
where: {
|
||||
role: {
|
||||
'notIn': ['admin', 'owner']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name contains "John"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'contains': 'John'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.roles contains "admin"
|
||||
User.filter({
|
||||
where: {
|
||||
roles: {
|
||||
'contains': 'admin'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Sorts users by age in ascending order
|
||||
User.filter({
|
||||
orderBy: 'age'
|
||||
});
|
||||
|
||||
// Sorts users by age in descending order
|
||||
User.filter({
|
||||
orderBy: ['age', 'DESC']
|
||||
});
|
||||
|
||||
// Sorts users by age in descending order and then sort by name in ascending order to break a tie
|
||||
User.filter({
|
||||
orderBy: [
|
||||
['age', 'DESC'],
|
||||
['name', 'ASC']
|
||||
]
|
||||
});
|
||||
|
||||
var PAGE_SIZE = 20;
|
||||
var currentPage = 1;
|
||||
|
||||
interface IPost {
|
||||
|
||||
}
|
||||
|
||||
var Post:JSData.DSResourceDefinition<IPost>;
|
||||
|
||||
// Grab the first "page" of posts
|
||||
Post.filter({
|
||||
offset: PAGE_SIZE * (currentPage - 1),
|
||||
limit: PAGE_SIZE
|
||||
});
|
||||
|
||||
var User3 = store.defineResource({
|
||||
name: 'user',
|
||||
relations: {
|
||||
hasMany: {
|
||||
comment: {
|
||||
localField: 'comments',
|
||||
foreignKey: 'userId'
|
||||
}
|
||||
},
|
||||
hasOne: {
|
||||
profile: {
|
||||
localField: 'profile',
|
||||
foreignKey: 'userId'
|
||||
}
|
||||
},
|
||||
belongsTo: {
|
||||
organization: {
|
||||
localKey: 'organizationId',
|
||||
localField: 'organization',
|
||||
|
||||
// if you add this to a belongsTo relation
|
||||
// then js-data will attempt to use
|
||||
// a nested url structure, e.g. /organization/15/user/4
|
||||
parent: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Organization = store.defineResource({
|
||||
name: 'organization',
|
||||
relations: {
|
||||
hasMany: {
|
||||
// this is an example of multiple relations
|
||||
// of the same type to the same resource
|
||||
user: [
|
||||
{
|
||||
localField: 'users',
|
||||
foreignKey: 'organizationId'
|
||||
},
|
||||
{
|
||||
localField: 'owners',
|
||||
foreignKey: 'organizationId'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Profile = store.defineResource({
|
||||
name: 'profile',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
user: {
|
||||
localField: 'user',
|
||||
localKey: 'userId'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var OtherComment = store.defineResource<IComment>({
|
||||
name: 'comment',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
user: {
|
||||
localField: 'user',
|
||||
localKey: 'userId'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
User.find(10).then(function (user:IUser) {
|
||||
// let's assume the server only returned the user
|
||||
user.comments; // undefined
|
||||
user.profile; // undefined
|
||||
|
||||
User.loadRelations(user, ['comment', 'profile']).then(function (user:IUser) {
|
||||
user.comments; // array
|
||||
user.profile; // object
|
||||
});
|
||||
});
|
||||
|
||||
var OtherOtherComment = store.defineResource<IComment>({
|
||||
name: 'comment',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
post: {
|
||||
parent: true,
|
||||
localKey: 'postId',
|
||||
localField: 'post'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The comment isn't in the data store yet, so js-data wouldn't know
|
||||
// what the id of the parent "post" would be, so we pass it in manually
|
||||
OtherOtherComment.find(5, {params: {postId: 4}}); // GET /post/4/comment/5
|
||||
|
||||
// vs
|
||||
|
||||
var promise = OtherOtherComment.find(5); // GET /comment/5
|
||||
|
||||
promise.then().catch().finally();
|
||||
|
||||
OtherOtherComment.inject(<IComment>{id: 1, postId: 2});
|
||||
|
||||
// We don't have to provide the parentKey here
|
||||
// because js-data found it in the comment
|
||||
OtherOtherComment.update(1, {content: 'stuff'}); // PUT /post/2/comment/1
|
||||
|
||||
// If you don't want the nested for just one of the calls then
|
||||
// you can do the following:
|
||||
OtherOtherComment.update(1, {content: 'stuff'}, {params: {postId: false}}); // PUT /comment/1
|
||||
|
||||
var store = new JSData.DS({
|
||||
// set the default
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something general
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
var User4 = store.defineResource({
|
||||
name: 'user',
|
||||
// set just for this resource
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something more specific to "users"
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
User4.create({name: 'John'}, {
|
||||
// set just for this method call
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something specific for this method call
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
module CustomAdapterTest {
|
||||
|
||||
class MyCustomAdapter implements JSData.IDSAdapter {
|
||||
|
||||
// All of the methods shown here must return a promise
|
||||
|
||||
// "definition" is a resource defintion that would
|
||||
// be returned by DS#defineResource
|
||||
|
||||
// "options" would be the options argument that
|
||||
// was passed into the DS method that is calling
|
||||
// the adapter method
|
||||
|
||||
create(definition:JSData.DSResourceDefinition<any>, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the created item
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
find(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found item
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
findAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
update(definition:JSData.DSResourceDefinition<any>, id:any, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
updateAll(definition:JSData.DSResourceDefinition<any>, attrs:Object, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroy(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroyAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
store.registerAdapter('mca', new MyCustomAdapter(), {default: true});
|
||||
// the data store will now use your custom adapter by default
|
||||
}
|
||||
|
||||
/**
|
||||
* showing the use of open ended interface to realize typings
|
||||
* on the Datastore.definitions object where all resource definitions
|
||||
* are saved.
|
||||
*/
|
||||
|
||||
interface MyCustomDataStore {
|
||||
|
||||
myResource: JSData.DSResourceDefinition<MyResourceDefinition>
|
||||
}
|
||||
|
||||
interface MyResourceDefinition {
|
||||
|
||||
}
|
||||
|
||||
module JSData {
|
||||
|
||||
interface DS {
|
||||
|
||||
definitions: MyCustomDataStore;
|
||||
}
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var myResourceDefinition = store.defineResource<MyResourceDefinition>('myResource');
|
||||
|
||||
myResourceDefinition = store.definitions.myResource;
|
||||
|
||||
/**
|
||||
* Custom action on datastore resource
|
||||
*/
|
||||
|
||||
interface Resource {
|
||||
someProp:string;
|
||||
}
|
||||
|
||||
interface ActionsForResource {
|
||||
myAction:JSData.DSActionFn;
|
||||
myOtherAction:JSData.DSActionFn;
|
||||
}
|
||||
|
||||
var myOtherAction:JSData.DSActionConfig = {
|
||||
method: 'GET',
|
||||
endpoint: 'goHere'
|
||||
};
|
||||
|
||||
var resourceWithCustomActions = store.defineResource<Resource, ActionsForResource>({
|
||||
name: 'actionResource',
|
||||
actions: {
|
||||
myAction: {
|
||||
method: 'POST'
|
||||
},
|
||||
myOtherAction: myOtherAction
|
||||
}
|
||||
});
|
||||
|
||||
resourceWithCustomActions.myAction<number>(3).then((result)=>{
|
||||
|
||||
var theCustomResult:number = result;
|
||||
});
|
||||
|
||||
resourceWithCustomActions.myOtherAction<void>(2, {data:'blub'}).then(()=>{
|
||||
// success
|
||||
});
|
||||
|
||||
resourceWithCustomActions.find(1).then((result)=>{
|
||||
|
||||
var aProperty = result.someProp;
|
||||
});
|
||||
|
||||
/**
|
||||
* Instance shorthands
|
||||
*/
|
||||
|
||||
var customActionResourceInstance = resourceWithCustomActions.get(1);
|
||||
|
||||
customActionResourceInstance.DSCompute();
|
||||
customActionResourceInstance.DSChanges();
|
||||
customActionResourceInstance.DSChangeHistory();
|
||||
customActionResourceInstance.DSHasChanges();
|
||||
customActionResourceInstance.DSLastModified();
|
||||
customActionResourceInstance.DSLastSaved();
|
||||
customActionResourceInstance.DSPrevious();
|
||||
customActionResourceInstance.DSCreate();
|
||||
customActionResourceInstance.DSDestroy();
|
||||
customActionResourceInstance.DSLink();
|
||||
customActionResourceInstance.DSLinkInverse();
|
||||
customActionResourceInstance.DSLoadRelations('myRelation');
|
||||
customActionResourceInstance.DSRefresh();
|
||||
customActionResourceInstance.DSSave();
|
||||
customActionResourceInstance.DSUnlinkInverse();
|
||||
customActionResourceInstance.DSUpdate();
|
||||
Vendored
+317
@@ -0,0 +1,317 @@
|
||||
// Type definitions for JSData v1.5.4
|
||||
// Project: https://github.com/js-data/js-data
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// js-data module (js-data.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// defining what exists in JSData and how it looks
|
||||
declare module JSData {
|
||||
|
||||
interface JSDataPromise<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | JSDataPromise<U>, onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
// enhanced with finally
|
||||
finally<U>(finallyCb?:() => U):JSDataPromise<U>;
|
||||
}
|
||||
|
||||
interface DS {
|
||||
|
||||
new(config?:DSConfiguration):DS;
|
||||
|
||||
// rather undocumented
|
||||
errors:DSErrors;
|
||||
|
||||
// those are objects containing the defined resources and adapters
|
||||
definitions:any;
|
||||
adapters:any;
|
||||
|
||||
defaults:DSConfiguration;
|
||||
|
||||
// async
|
||||
create<T>(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
destroyAll(resourceName:string, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
find<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
findAll<T>(resourceName:string, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
loadRelations<T>(resourceName:string, idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
update<T>(resourceName:string, id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
updateAll<T>(resourceName:string, attrs:Object, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
reap(resourceName:string, options?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
save<T>(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
|
||||
// sync
|
||||
changeHistory(resourceName:string, id?:string | number):Array<Object>;
|
||||
changes(resourceName:string, id:string | number):Object;
|
||||
compute(resourceName:string, idOrInstance:number | string | Object ):void;
|
||||
createInstance<T>(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T & DSInstanceShorthands<T>;
|
||||
digest():void;
|
||||
eject<T>(resourceName:string, id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
ejectAll<T>(resourceName:string, params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
filter<T>(resourceName:string, params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
get<T>(resourceName:string, id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
getAll<T>(resourceName:string, ids?:Array<string | number>):Array<T & DSInstanceShorthands<T>>;
|
||||
hasChanges(resourceName:string, id:string | number):boolean;
|
||||
inject<T>(resourceName:string, item:T, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
inject<T>(resourceName:string, items:Array<T>, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
is(resourceName:string, object:Object): boolean;
|
||||
lastModified(resourceName:string, id?:string | number):number; // timestamp
|
||||
lastSaved(resourceName:string, id?:string | number):number; // timestamp
|
||||
link<T>(resourceName:string, id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
linkAll<T>(resourceName:string, params:DSFilterArg, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
linkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
previous<T>(resourceName:string, id:string | number):T & DSInstanceShorthands<T>;
|
||||
revert<T>(resourceName:string, id:string | number):T & DSInstanceShorthands<T>;
|
||||
unlinkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
|
||||
defineResource<T>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T>;
|
||||
defineResource<T, TActions>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T> & TActions;
|
||||
registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void;
|
||||
}
|
||||
|
||||
interface DSConfiguration extends IDSResourceLifecycleEventHandlers {
|
||||
actions?: Object;
|
||||
allowSimpleWhere?: boolean;
|
||||
basePath?: string;
|
||||
bypassCache?: boolean;
|
||||
cacheResponse?: boolean;
|
||||
defaultAdapter?: string;
|
||||
defaultFilter?: (collection:Array<any>, resourceName:string, params:DSFilterArg, options:DSConfiguration)=>Array<any>;
|
||||
eagerEject?: boolean;
|
||||
endpoint?: string;
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
fallbackAdapters?: Array<string>;
|
||||
findAllFallbackAdapters?: Array<string>;
|
||||
findAllStrategy?: string;
|
||||
findBelongsTo?: boolean;
|
||||
findFallbackAdapters?: Array<string>;
|
||||
findHasOne?: boolean;
|
||||
findHasMany?: boolean;
|
||||
findInverseLinks?: boolean;
|
||||
findStrategy?: string
|
||||
idAttribute?: string;
|
||||
ignoredChanges?: Array<RegExp | string>;
|
||||
keepChangeHistory?: boolean;
|
||||
loadFromServer?: boolean;
|
||||
log?: boolean | ((message?: any, ...optionalParams: any[])=> void);
|
||||
maxAge?: number;
|
||||
notify?: boolean;
|
||||
reapAction?: string;
|
||||
reapInterval?: number;
|
||||
resetHistoryOnInject?: boolean;
|
||||
strategy?: string;
|
||||
upsert?: boolean;
|
||||
useClass?: boolean;
|
||||
useFilter?: boolean;
|
||||
}
|
||||
|
||||
interface DSAdapterOperationConfiguration extends DSConfiguration {
|
||||
adapter?: string;
|
||||
params?: {
|
||||
[paramName: string]: string | number | boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface DSSaveConfiguration extends DSAdapterOperationConfiguration {
|
||||
changesOnly?: boolean;
|
||||
}
|
||||
|
||||
interface DSResourceDefinitionConfiguration extends DSConfiguration {
|
||||
name: string;
|
||||
computed?: any;
|
||||
methods?: any;
|
||||
relations?: {
|
||||
hasMany?: Object;
|
||||
hasOne?: Object;
|
||||
belongsTo?: Object;
|
||||
};
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration {
|
||||
|
||||
//async
|
||||
create<TInject>(attrs:TInject, options?:DSConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
destroyAll(params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
find(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
findAll(params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
loadRelations(idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
update(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
updateAll(attrs:Object, params?:DSFilterArg, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T & DSInstanceShorthands<T>>>;
|
||||
reap(options?:DSConfiguration):JSDataPromise<void>;
|
||||
refresh(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
save(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
|
||||
// sync
|
||||
changeHistory(id?:string | number):Array<Object>;
|
||||
changes(id:string | number):Object;
|
||||
compute(idOrInstance:number | string | Object ):void;
|
||||
createInstance<TInject>(attrs?:TInject, options?:DSAdapterOperationConfiguration):T & DSInstanceShorthands<T>;
|
||||
digest():void;
|
||||
eject(id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
ejectAll(params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
filter(params:DSFilterArg, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
get(id:string | number, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
getAll(ids?:Array<string | number>):Array<T & DSInstanceShorthands<T>>;
|
||||
hasChanges(id:string | number):boolean;
|
||||
inject(item:T, options?:DSConfiguration):T & DSInstanceShorthands<T>;
|
||||
inject(items:Array<T>, options?:DSConfiguration):Array<T & DSInstanceShorthands<T>>;
|
||||
is(object:Object): boolean;
|
||||
lastModified(id?:string | number):number; // timestamp
|
||||
lastSaved(id?:string | number):number; // timestamp
|
||||
link(id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
linkAll(params:DSFilterArg, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
linkInverse(id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
previous(id:string | number):T & DSInstanceShorthands<T>;
|
||||
unlinkInverse(id:string | number, relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
}
|
||||
|
||||
export interface DSInstanceShorthands<T> {
|
||||
DSCompute():void;
|
||||
DSRefresh(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSSave(options?:DSSaveConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSUpdate(options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSDestroy(options?:DSAdapterOperationConfiguration):JSDataPromise<void>;
|
||||
DSCreate(options?:DSConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSLoadRelations(relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T & DSInstanceShorthands<T>>;
|
||||
DSChangeHistory():Array<Object>;
|
||||
DSChanges():Object;
|
||||
DSHasChanges():boolean;
|
||||
DSLastModified():number; // timestamp
|
||||
DSLastSaved():number; // timestamp
|
||||
DSLink(relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
DSLinkInverse(relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
DSPrevious():T & DSInstanceShorthands<T>;
|
||||
DSUnlinkInverse(relations?:Array<string>):T & DSInstanceShorthands<T>;
|
||||
}
|
||||
|
||||
interface DSFilterParams {
|
||||
where?: Object;
|
||||
|
||||
limit?: number;
|
||||
|
||||
skip?: number;
|
||||
offset?: number;
|
||||
|
||||
orderBy?: string | Array<string> | Array<Array<string>>;
|
||||
sort?: string | Array<string> | Array<Array<string>>;
|
||||
}
|
||||
|
||||
type DSFilterArg = DSFilterParams | Object;
|
||||
|
||||
interface IDSResourceLifecycleValidateEventHandlers {
|
||||
beforeValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
validate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateEventHandlers {
|
||||
beforeCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateInstanceEventHandlers {
|
||||
beforeCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
afterCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleUpdateEventHandlers {
|
||||
beforeUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleDestroyEventHandlers {
|
||||
beforeDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleInjectEventHandlers {
|
||||
beforeInject?: (resourceName:string, data:any)=>void;
|
||||
afterInject?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEjectEventHandlers {
|
||||
beforeEject?: (resourceName:string, data:any)=>void;
|
||||
afterEject?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleReapEventHandlers {
|
||||
beforeReap?: (resourceName:string, data:any)=>void;
|
||||
afterReap?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEventHandlers extends IDSResourceLifecycleCreateEventHandlers,
|
||||
IDSResourceLifecycleCreateInstanceEventHandlers,
|
||||
IDSResourceLifecycleValidateEventHandlers,
|
||||
IDSResourceLifecycleUpdateEventHandlers,
|
||||
IDSResourceLifecycleDestroyEventHandlers,
|
||||
IDSResourceLifecycleInjectEventHandlers,
|
||||
IDSResourceLifecycleEjectEventHandlers,
|
||||
IDSResourceLifecycleReapEventHandlers {
|
||||
|
||||
}
|
||||
|
||||
// errors
|
||||
interface DSErrors {
|
||||
|
||||
// types
|
||||
IllegalArgumentError:DSError;
|
||||
IA:DSError;
|
||||
RuntimeError:DSError;
|
||||
R:DSError;
|
||||
NonexistentResourceError:DSError;
|
||||
NER:DSError;
|
||||
}
|
||||
|
||||
interface DSError extends Error {
|
||||
new (message?:string):DSError;
|
||||
message: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// DSAdapter interface
|
||||
interface IDSAdapter {
|
||||
create<T>(config:DSResourceDefinition<T>, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
destroy<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
destroyAll<T>(config:DSResourceDefinition<T>, params:DSFilterArg, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
find<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
findAll<T>(config:DSResourceDefinition<T>, params?:DSFilterArg, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
update<T>(config:DSResourceDefinition<T>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterArg, options?:DSConfiguration):JSDataPromise<T>;
|
||||
}
|
||||
|
||||
// Custom action config
|
||||
interface DSActionConfig {
|
||||
adapter?: string;
|
||||
endpoint?: string;
|
||||
pathname?: string;
|
||||
method?: string;
|
||||
}
|
||||
|
||||
// Custom action method definition
|
||||
// options are passed to adapter.HTTP() method-call, js-data-http adapter by default uses AXIOS but can also be $http in case of angular
|
||||
// or a custom adapter implementation. The adapter can be set via the DSActionConfig.
|
||||
interface DSActionFn {
|
||||
<T>(id:string | number, options?:Object):JSDataPromise<T>
|
||||
}
|
||||
}
|
||||
|
||||
// declaring the existing global js object
|
||||
declare var JSData:{
|
||||
DS: JSData.DS;
|
||||
DSErrors: JSData.DSErrors;
|
||||
};
|
||||
|
||||
//Support node require
|
||||
declare module 'js-data' {
|
||||
|
||||
export = JSData;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="js-data-1.5.4.d.ts" />
|
||||
|
||||
import JSData = require('js-data');
|
||||
var store = new JSData.DS();
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource('user');
|
||||
|
||||
User.find(1).then(function (user: any) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
/// <reference path="jsnlog.d.ts" />
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// JL
|
||||
|
||||
var traceLevel: number = JL.getTraceLevel();
|
||||
var debugLevel: number = JL.getDebugLevel();
|
||||
var infoLevel: number = JL.getInfoLevel();
|
||||
var warnLevel: number = JL.getWarnLevel();
|
||||
var errorLevel: number = JL.getErrorLevel();
|
||||
var fatalLevel: number = JL.getFatalLevel();
|
||||
|
||||
JL.setOptions({
|
||||
enabled: true,
|
||||
maxMessages: 5,
|
||||
defaultAjaxUrl: '/jsnlog.logger',
|
||||
clientIP: '0.0.0.0',
|
||||
requestId: 'a reuest id',
|
||||
defaultBeforeSend: null
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Ajax Appender
|
||||
|
||||
var ajaxAppender1: JSNLog.JSNLogAjaxAppender = JL.createAjaxAppender('ajaxAppender');
|
||||
|
||||
ajaxAppender1.setOptions({
|
||||
level: 5000,
|
||||
ipRegex: 'a regex',
|
||||
userAgentRegex: 'a user agent string',
|
||||
disallow: 'regex matching suppressed messages',
|
||||
sendWithBufferLevel: 5000,
|
||||
storeInBufferLevel: 2000,
|
||||
bufferSize: 10,
|
||||
batchSize: 2,
|
||||
url: '/jsnlog.logger',
|
||||
beforeSend: null
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Console Appender
|
||||
|
||||
var consoleAppender1: JSNLog.JSNLogConsoleAppender = JL.createConsoleAppender('consoleAppender');
|
||||
|
||||
consoleAppender1.setOptions({
|
||||
level: 5000,
|
||||
ipRegex: 'a regex',
|
||||
userAgentRegex: 'a user agent string',
|
||||
disallow: 'regex matching suppressed messages',
|
||||
sendWithBufferLevel: 5000,
|
||||
storeInBufferLevel: 2000,
|
||||
bufferSize: 10,
|
||||
batchSize: 2
|
||||
});
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Loggers
|
||||
|
||||
var logger1: JSNLog.JSNLogLogger = JL('mylogger');
|
||||
|
||||
var exception = {};
|
||||
|
||||
logger1.trace('log message').debug({ x: 1, y: 2});
|
||||
logger1.info(function() { return 5; });
|
||||
logger1.warn('log message');
|
||||
logger1.error('log message');
|
||||
logger1.fatal('log message');
|
||||
logger1.fatalException('log message', exception);
|
||||
logger1.log(4000, 'log message', exception);
|
||||
|
||||
logger1.setOptions({
|
||||
level: 5000,
|
||||
ipRegex: 'a regex',
|
||||
userAgentRegex: 'a user agent string',
|
||||
disallow: 'regex matching suppressed messages',
|
||||
appenders: [ ajaxAppender1, consoleAppender1 ],
|
||||
onceOnly: [ 'regex1', 'regex2' ]
|
||||
});
|
||||
|
||||
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
// Type definitions for JSNLog v2.11.0+
|
||||
// Project: https://github.com/mperdeck/jsnlog.js
|
||||
// Definitions by: Mattijs Perdeck <https://github.com/mperdeck>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// -------------------------------
|
||||
// Full documentation is at
|
||||
// http://jsnlog.com
|
||||
// -------------------------------
|
||||
|
||||
/**
|
||||
* Copyright 2015 Mattijs Perdeck.
|
||||
*
|
||||
* This project is licensed under the MIT license.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Declarations of all interfaces and ambient objects, except for JL itself.
|
||||
// Provides strong typing in both jsnlog.ts itself and in TypeScript programs that use
|
||||
// JSNLog.
|
||||
|
||||
declare module JSNLog {
|
||||
|
||||
interface JSNLogOptions {
|
||||
enabled?: boolean;
|
||||
maxMessages?: number;
|
||||
defaultAjaxUrl?: string;
|
||||
clientIP?: string;
|
||||
requestId?: string;
|
||||
defaultBeforeSend?: (xhr: XMLHttpRequest) => void;
|
||||
}
|
||||
|
||||
interface JSNLogFilterOptions {
|
||||
level?: number;
|
||||
ipRegex?: string;
|
||||
userAgentRegex?: string;
|
||||
disallow?: string;
|
||||
}
|
||||
|
||||
interface JSNLogLoggerOptions extends JSNLogFilterOptions {
|
||||
appenders?: JSNLogAppender[];
|
||||
onceOnly?: string[];
|
||||
}
|
||||
|
||||
// Base for all appender options types
|
||||
interface JSNLogAppenderOptions extends JSNLogFilterOptions {
|
||||
sendWithBufferLevel?: number;
|
||||
storeInBufferLevel?: number;
|
||||
bufferSize?: number;
|
||||
batchSize?: number;
|
||||
}
|
||||
|
||||
interface JSNLogAjaxAppenderOptions extends JSNLogAppenderOptions {
|
||||
url?: string;
|
||||
beforeSend?: (xhr: XMLHttpRequest) => void;
|
||||
}
|
||||
|
||||
interface JSNLogLogger {
|
||||
setOptions(options: JSNLogLoggerOptions): JSNLogLogger;
|
||||
|
||||
trace(logObject: any): JSNLogLogger;
|
||||
debug(logObject: any): JSNLogLogger;
|
||||
info(logObject: any): JSNLogLogger;
|
||||
warn(logObject: any): JSNLogLogger;
|
||||
error(logObject: any): JSNLogLogger;
|
||||
fatal(logObject: any): JSNLogLogger;
|
||||
fatalException(logObject: any, e: any): JSNLogLogger;
|
||||
log(level: number, logObject: any, e?: any): JSNLogLogger;
|
||||
}
|
||||
|
||||
interface JSNLogAppender {
|
||||
setOptions(options: JSNLogAppenderOptions): JSNLogAppender;
|
||||
}
|
||||
|
||||
interface JSNLogAjaxAppender extends JSNLogAppender {
|
||||
setOptions(options: JSNLogAjaxAppenderOptions): JSNLogAjaxAppender;
|
||||
}
|
||||
|
||||
interface JSNLogConsoleAppender extends JSNLogAppender {
|
||||
}
|
||||
|
||||
interface JSNLogStatic {
|
||||
(loggerName?: string): JSNLogLogger;
|
||||
|
||||
setOptions(options: JSNLogOptions): JSNLogStatic;
|
||||
createAjaxAppender(appenderName: string): JSNLogAjaxAppender;
|
||||
createConsoleAppender(appenderName: string): JSNLogConsoleAppender;
|
||||
|
||||
getTraceLevel(): number;
|
||||
getDebugLevel(): number;
|
||||
getInfoLevel(): number;
|
||||
getWarnLevel(): number;
|
||||
getErrorLevel(): number;
|
||||
getFatalLevel(): number;
|
||||
}
|
||||
}
|
||||
|
||||
declare function __jsnlog_configure(jsnlog: JSNLog.JSNLogStatic): void;
|
||||
|
||||
|
||||
// Ambient declaration of the JL object itself
|
||||
|
||||
declare var JL: JSNLog.JSNLogStatic;
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+6
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for jsUri 1.3+
|
||||
// Project: https://github.com/derek-watson/jsUri
|
||||
// Definitions by: Chris Charabaruk <http://github.com/coldacid>
|
||||
// Definitions by: Chris Charabaruk <http://github.com/coldacid>, Florian Wagner <http://github.com/flqw>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module jsuri {
|
||||
@@ -135,5 +135,9 @@ declare module jsuri {
|
||||
declare type Uri = jsuri.Uri;
|
||||
|
||||
declare module 'jsuri' {
|
||||
export = Uri;
|
||||
export = jsuri.Uri;
|
||||
}
|
||||
|
||||
declare module 'jsUri' {
|
||||
export = jsuri.Uri;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,26 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="kendo-ui.d.ts" />
|
||||
|
||||
var is = {
|
||||
string: (msg: string) => {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// TreeView
|
||||
$(() => {
|
||||
var treeview = <kendo.ui.TreeView>$("#treeview").data("kendoTreeView");
|
||||
|
||||
is.string(treeview.text("#foo"));
|
||||
|
||||
treeview.text("#foo", "bar");
|
||||
});
|
||||
|
||||
// Window
|
||||
$(() => {
|
||||
var window = <kendo.ui.Window>$("#window").data("kendoWindow");
|
||||
|
||||
var dom = $("<em>Foo</em>");
|
||||
|
||||
window.content(dom);
|
||||
});
|
||||
|
||||
Vendored
+4196
-2094
File diff suppressed because it is too large
Load Diff
Vendored
+5
@@ -4176,6 +4176,11 @@ declare namespace L {
|
||||
* When this option is set, the TileLayer only loads tiles that are in the given geographical bounds.
|
||||
*/
|
||||
bounds?: LatLngBounds;
|
||||
|
||||
/**
|
||||
* Custom keys may be specified in TileLayerOptions so they can be used in a provided URL template.
|
||||
*/
|
||||
[additionalKeys: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -205,9 +205,9 @@ declare module linq {
|
||||
}
|
||||
|
||||
interface OrderedEnumerable<T> extends Enumerable<T> {
|
||||
ThenBy(keySelector: ($) => T): OrderedEnumerable<T>;
|
||||
ThenBy(keySelector: ($: T) => any): OrderedEnumerable<T>;
|
||||
ThenBy(keySelector: string): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: ($) => T): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: ($: T) => any): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: string): OrderedEnumerable<T>;
|
||||
}
|
||||
|
||||
|
||||
+1077
-194
File diff suppressed because it is too large
Load Diff
Vendored
+1091
-534
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,15 @@ log.setLevel(0, false);
|
||||
log.setLevel("error");
|
||||
log.setLevel("error", false);
|
||||
|
||||
log.setLevel(log.levels.WARN);
|
||||
log.setLevel(log.levels.WARN, false);
|
||||
log.setLevel(LogLevel.WARN);
|
||||
log.setLevel(LogLevel.WARN, false);
|
||||
|
||||
var logLevel = log.getLevel();
|
||||
|
||||
var testLogger = log.getLogger("TestLogger");
|
||||
|
||||
testLogger.setLevel(logLevel);
|
||||
testLogger.warn("logging test");
|
||||
|
||||
var logging = log.noConflict();
|
||||
|
||||
|
||||
Vendored
+139
-96
@@ -1,101 +1,144 @@
|
||||
// Type definitions for loglevel 1.3.1
|
||||
// Type definitions for loglevel 1.4.0
|
||||
// Project: https://github.com/pimterry/loglevel
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>, Florian Wagner <https://github.com/flqw/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module loglevel {
|
||||
|
||||
/**
|
||||
* Log levels
|
||||
*/
|
||||
export enum levels {
|
||||
TRACE = 0,
|
||||
DEBUG = 1,
|
||||
INFO = 2,
|
||||
WARN = 3,
|
||||
ERROR = 4,
|
||||
SILENT = 5
|
||||
}
|
||||
|
||||
/**
|
||||
* Output trace message to console.
|
||||
* This will also include a full stack trace
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
export function trace(msg:any):void;
|
||||
|
||||
/**
|
||||
* Output debug message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
export function debug(msg:any):void;
|
||||
|
||||
/**
|
||||
* Output info message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
export function info(msg:any):void;
|
||||
|
||||
/**
|
||||
* Output warn message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
export function warn(msg:any):void;
|
||||
|
||||
/**
|
||||
* Output error message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
export function error(msg:any):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level 0=trace to 5=silent
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
|
||||
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
export function setLevel(level:number, persist?:boolean):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level as a string, like 'error' (case-insensitive)
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
|
||||
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
export function setLevel(level:string, persist?:boolean):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level as the value from the enum
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
|
||||
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
export function setLevel(level:levels, persist?:boolean):void;
|
||||
|
||||
/**
|
||||
* If you're using another JavaScript library that exposes a 'log' global, you can run into conflicts with loglevel.
|
||||
* Similarly to jQuery, you can solve this by putting loglevel into no-conflict mode immediately after it is loaded
|
||||
* onto the page. This resets to 'log' global to its value before loglevel was loaded (typically undefined), and
|
||||
* returns the loglevel object, which you can then bind to another name yourself.
|
||||
*/
|
||||
export function noConflict():any;
|
||||
/**
|
||||
* Log levels
|
||||
*/
|
||||
declare const enum LogLevel {
|
||||
TRACE = 0,
|
||||
DEBUG = 1,
|
||||
INFO = 2,
|
||||
WARN = 3,
|
||||
ERROR = 4,
|
||||
SILENT = 5
|
||||
}
|
||||
|
||||
declare var log:typeof loglevel;
|
||||
interface Log {
|
||||
|
||||
/**
|
||||
* Output trace message to console.
|
||||
* This will also include a full stack trace
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
trace(...msg : any[]):void;
|
||||
|
||||
/**
|
||||
* Output debug message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
debug(...msg : any[]):void;
|
||||
|
||||
/**
|
||||
* Output info message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
info(...msg : any[]):void;
|
||||
|
||||
/**
|
||||
* Output warn message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
warn(...msg : any[]):void;
|
||||
|
||||
/**
|
||||
* Output error message to console including appropriate icons
|
||||
*
|
||||
* @param msg any data to log to the console
|
||||
*/
|
||||
error(...msg : any[]):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level 0=trace to 5=silent
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling
|
||||
* back to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
setLevel(level : LogLevel, persist? : boolean):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level as a string, like 'error' (case-insensitive)
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling
|
||||
* back to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
setLevel(level : string, persist? : boolean):void;
|
||||
|
||||
|
||||
/**
|
||||
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
|
||||
* or log.error("something") will output messages, but log.info("something") will not.
|
||||
*
|
||||
* @param level as the value from the enum
|
||||
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling
|
||||
* back to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
|
||||
* false as the optional 'persist' second argument, persistence will be skipped.
|
||||
*/
|
||||
setLevel(level : LogLevel, persist? : boolean):void;
|
||||
|
||||
/**
|
||||
* If you're using another JavaScript library that exposes a 'log' global, you can run into conflicts with loglevel.
|
||||
* Similarly to jQuery, you can solve this by putting loglevel into no-conflict mode immediately after it is loaded
|
||||
* onto the page. This resets to 'log' global to its value before loglevel was loaded (typically undefined), and
|
||||
* returns the loglevel object, which you can then bind to another name yourself.
|
||||
*/
|
||||
noConflict():any;
|
||||
|
||||
/**
|
||||
* Returns the current logging level, as a value from the enum.
|
||||
* It's very unlikely you'll need to use this for normal application logging; it's provided partly to help plugin
|
||||
* development, and partly to let you optimize logging code as below, where debug data is only generated if the
|
||||
* level is set such that it'll actually be logged. This probably doesn't affect you, unless you've run profiling
|
||||
* on your code and you have hard numbers telling you that your log data generation is a real performance problem.
|
||||
*/
|
||||
getLevel():LogLevel;
|
||||
|
||||
/**
|
||||
* This sets the current log level only if one has not been persisted and can’t be loaded. This is useful when
|
||||
* initializing scripts; if a developer or user has previously called setLevel(), this won’t alter their settings.
|
||||
* For example, your application might set the log level to error in a production environment, but when debugging
|
||||
* an issue, you might call setLevel("trace") on the console to see all the logs. If that error setting was set
|
||||
* using setDefaultLevel(), it will still say as trace on subsequent page loads and refreshes instead of resetting
|
||||
* to error.
|
||||
*
|
||||
* The level argument takes is the same values that you might pass to setLevel(). Levels set using
|
||||
* setDefaultLevel() never persist to subsequent page loads.
|
||||
*
|
||||
* @param level as the value from the enum
|
||||
*/
|
||||
setDefaultLevel(level : LogLevel):void;
|
||||
|
||||
/**
|
||||
* This gets you a new logger object that works exactly like the root log object, but can have its level and
|
||||
* logging methods set independently. All loggers must have a name (which is a non-empty string). Calling
|
||||
* getLogger() multiple times with the same name will return an identical logger object.
|
||||
* In large applications, it can be incredibly useful to turn logging on and off for particular modules as you are
|
||||
* working with them. Using the getLogger() method lets you create a separate logger for each part of your
|
||||
* application with its own logging level. Likewise, for small, independent modules, using a named logger instead
|
||||
* of the default root logger allows developers using your module to selectively turn on deep, trace-level logging
|
||||
* when trying to debug problems, while logging only errors or silencing logging altogether under normal
|
||||
* circumstances.
|
||||
* @param name The name of the produced logger
|
||||
*/
|
||||
getLogger(name : String):Log;
|
||||
|
||||
}
|
||||
|
||||
declare var log : Log;
|
||||
|
||||
declare module "loglevel" {
|
||||
export = log;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ function main(): void {
|
||||
addColumn('deadline', lf.Type.DATE_TIME).
|
||||
addColumn('done', lf.Type.BOOLEAN).
|
||||
addPrimaryKey(['id'], false).
|
||||
addIndex('idxDeadline', ['deadline'], false, lf.Order.DESC);
|
||||
addIndex('idxDeadline', ['deadline'], false, lf.Order.DESC).
|
||||
addNullable(['deadline']).
|
||||
addUnique('uq_description', ['description']);
|
||||
|
||||
var todoDb: lf.Database = null;
|
||||
var itemSchema: lf.schema.Table = null;
|
||||
|
||||
Vendored
+2
-2
@@ -199,11 +199,11 @@ declare module lf {
|
||||
addIndex(
|
||||
name: string, columns: Array<string>|Array<IndexedColumn>,
|
||||
unique?: boolean, order?: Order): TableBuilder
|
||||
addNullable(columns: Array<Column>): TableBuilder
|
||||
addNullable(columns: Array<string>): TableBuilder
|
||||
addPrimaryKey(
|
||||
columns: Array<string>|Array<IndexedColumn>,
|
||||
autoInc?: boolean): TableBuilder
|
||||
addUnique(name: string, columns: Array<Column>): TableBuilder
|
||||
addUnique(name: string, columns: Array<string>): TableBuilder
|
||||
}
|
||||
|
||||
function create(dbName: string, dbVersion: number): Builder
|
||||
|
||||
@@ -0,0 +1,468 @@
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='material-ui-0.12.1.d.ts' />
|
||||
|
||||
import * as React from "react/addons";
|
||||
import Checkbox = require("material-ui/lib/checkbox");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
import IconButton = require("material-ui/lib/icon-button");
|
||||
import FlatButton = require("material-ui/lib/flat-button");
|
||||
import Avatar = require("material-ui/lib/avatar");
|
||||
import FontIcon = require("material-ui/lib/font-icon");
|
||||
import Typography = require("material-ui/lib/styles/typography");
|
||||
import RaisedButton = require("material-ui/lib/raised-button");
|
||||
import FloatingActionButton = require("material-ui/lib/floating-action-button");
|
||||
import Card = require("material-ui/lib/card/card");
|
||||
import CardHeader = require("material-ui/lib/card/card-header");
|
||||
import CardText = require("material-ui/lib/card/card-text");
|
||||
import CardActions = require("material-ui/lib/card/card-actions");
|
||||
import Dialog = require("material-ui/lib/dialog");
|
||||
import DropDownMenu = require("material-ui/lib/drop-down-menu");
|
||||
import RadioButtonGroup = require("material-ui/lib/radio-button-group");
|
||||
import RadioButton = require("material-ui/lib/radio-button");
|
||||
import Toggle = require("material-ui/lib/toggle");
|
||||
import TextField = require("material-ui/lib/text-field");
|
||||
import SelectField = require("material-ui/lib/select-field");
|
||||
import IconMenu = require("material-ui/lib/menus/icon-menu");
|
||||
import Menu = require('material-ui/lib/menus/menu');
|
||||
import MenuItem = require('material-ui/lib/menus/menu-item');
|
||||
import MenuDivider = require('material-ui/lib/menus/menu-divider');
|
||||
import ThemeManager = require('material-ui/lib/styles/theme-manager');
|
||||
|
||||
import NavigationClose = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/navigation/close", but they aren't defined yet.
|
||||
import FileFolder = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/file/folder", but they aren't defined yet.
|
||||
import ToggleStar = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star", but they aren't defined yet.
|
||||
import ActionGrade = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/action/grade", but they aren't defined yet.
|
||||
import ToggleStarBorder = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star-border", but they aren't defined yet.
|
||||
import ArrowDropRight = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star-border", but they aren't defined yet.
|
||||
|
||||
type CheckboxProps = __MaterialUI.CheckboxProps;
|
||||
type MuiTheme = __MaterialUI.Styles.MuiTheme;
|
||||
type TouchTapEvent = __MaterialUI.TouchTapEvent;
|
||||
|
||||
class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin {
|
||||
|
||||
// injected with mixin
|
||||
linkState: <T>(key: string) => React.ReactLink<T>;
|
||||
dialog: Dialog;
|
||||
|
||||
private touchTapEventHandler(e: TouchTapEvent) {
|
||||
this.dialog.show();
|
||||
}
|
||||
private formEventHandler(e: React.FormEvent) {
|
||||
}
|
||||
private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
// "http://material-ui.com/#/customization/themes"
|
||||
let muiTheme: MuiTheme = ThemeManager.getMuiTheme({
|
||||
palette: {
|
||||
accent1Color: Colors.cyan100
|
||||
},
|
||||
spacing: {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/customization/inline-styles"
|
||||
let element: React.ReactElement<any>;
|
||||
element = <Checkbox
|
||||
id="checkboxId1"
|
||||
name="checkboxName1"
|
||||
value="checkboxValue1"
|
||||
label="went for a run today"
|
||||
style={{
|
||||
width: '50%',
|
||||
margin: '0 auto'
|
||||
}}
|
||||
iconStyle={{
|
||||
fill: '#FF4081'
|
||||
}}/>
|
||||
element = React.createElement<CheckboxProps>(Checkbox, {
|
||||
id: "checkboxId1", name: "checkboxName1", value: "checkboxValue1", label: "went for a run today", style: {
|
||||
width: '50%',
|
||||
margin: '0 auto'
|
||||
}, iconStyle: {
|
||||
fill: '#FF4081'
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/components/appbar"
|
||||
element = <AppBar
|
||||
title="Title"
|
||||
iconClassNameRight="muidocs-icon-navigation-expand-more" />
|
||||
element = <AppBar
|
||||
title="Title"
|
||||
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
|
||||
iconElementRight={<FlatButton label="Save" />} />;
|
||||
|
||||
// "http://material-ui.com/#/components/avatars"
|
||||
//image avatar
|
||||
element = <Avatar src="images/uxceo-128.jpg" />;
|
||||
//SvgIcon avatar
|
||||
element = <Avatar icon={<FileFolder />} />;
|
||||
//SvgIcon avatar with custom colors
|
||||
element = <Avatar
|
||||
icon={<FileFolder />}
|
||||
color={Colors.orange200}
|
||||
backgroundColor={Colors.pink400} />;
|
||||
//FontIcon avatar
|
||||
element = <Avatar
|
||||
icon={
|
||||
<FontIcon className="muidocs-icon-communication-voicemail" />
|
||||
} />;
|
||||
//FontIcon avatar with custom colors
|
||||
element = <Avatar
|
||||
icon={<FontIcon className="muidocs-icon-communication-voicemail" />}
|
||||
color={Colors.blue300}
|
||||
backgroundColor={Colors.indigo900} />;
|
||||
//Letter avatar
|
||||
element = <Avatar>A</Avatar>;
|
||||
//Letter avatar with custom colors
|
||||
element = <Avatar
|
||||
color={Colors.deepOrange300}
|
||||
backgroundColor={Colors.purple500}>
|
||||
</Avatar>
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/buttons"
|
||||
element = <FlatButton linkButton={true} href="https://github.com/callemall/material-ui" secondary={true} label="GitHub">
|
||||
<FontIcon style={{ color: Typography.textFullWhite }} className="muidocs-icon-custom-github"/>
|
||||
</FlatButton>;
|
||||
element = <RaisedButton linkButton={true} href="https://github.com/callemall/material-ui" secondary={true} label="GitHub">
|
||||
<FontIcon style={{ color: Typography.textFullWhite }} className="muidocs-icon-custom-github"/>
|
||||
</RaisedButton>;
|
||||
element = <FloatingActionButton secondary={true} mini={true} linkButton={true}
|
||||
href="https://github.com/callemall/material-ui" >
|
||||
<ToggleStar />
|
||||
</FloatingActionButton>;
|
||||
|
||||
// "http://material-ui.com/#/components/cards"
|
||||
element = <Card initiallyExpanded={true}>
|
||||
<CardHeader
|
||||
title="Title"
|
||||
subtitle="Subtitle"
|
||||
avatar={<Avatar style={{ color: 'red' }}>A</Avatar>}
|
||||
showExpandableButton={true}>
|
||||
</CardHeader>
|
||||
<CardText expandable={true}>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
</CardText>
|
||||
<CardActions expandable={true}>
|
||||
<FlatButton label="Action1"/>
|
||||
<FlatButton label="Action2"/>
|
||||
</CardActions>
|
||||
<CardText expandable={true}>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
</CardText>
|
||||
</Card>;
|
||||
|
||||
// "http://material-ui.com/#/components/date-picker"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/dialog"
|
||||
let standardActions = [
|
||||
{ text: 'Cancel' },
|
||||
{ text: 'Submit', onTouchTap: this.touchTapEventHandler, ref: 'submit' }
|
||||
];
|
||||
|
||||
element = <Dialog
|
||||
title="Dialog With Standard Actions"
|
||||
actions={standardActions}
|
||||
actionFocus="submit"
|
||||
modal={true}>
|
||||
The actions in this window are created from the json that's passed in.
|
||||
</Dialog>;
|
||||
|
||||
//Custom Actions
|
||||
let customActions = [
|
||||
<FlatButton
|
||||
label="Cancel"
|
||||
secondary={true}
|
||||
onTouchTap={this.touchTapEventHandler} />,
|
||||
<FlatButton
|
||||
label="Submit"
|
||||
primary={true}
|
||||
onTouchTap={this.touchTapEventHandler} />
|
||||
];
|
||||
|
||||
element = <Dialog
|
||||
title="Dialog With Custom Actions"
|
||||
actions={customActions}
|
||||
modal={false}
|
||||
autoDetectWindowHeight={true}
|
||||
autoScrollBodyContent={true}>
|
||||
The actions in this window were passed in as an array of react objects.
|
||||
</Dialog>;
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/dropdown-menu"
|
||||
let menuItems = [
|
||||
{ payload: '1', text: 'Never' },
|
||||
{ payload: '2', text: 'Every Night' },
|
||||
{ payload: '3', text: 'Weeknights' },
|
||||
{ payload: '4', text: 'Weekends' },
|
||||
{ payload: '5', text: 'Weekly' },
|
||||
];
|
||||
element = <DropDownMenu menuItems={menuItems} />;
|
||||
|
||||
// "http://material-ui.com/#/components/icons"
|
||||
element = <FontIcon className= "material-icons" color= { Colors.red500 } > home</FontIcon>;
|
||||
|
||||
// "http://material-ui.com/#/components/icon-buttons"
|
||||
//Method 1: muidocs-icon-github is defined in a style sheet.
|
||||
element = <IconButton iconClassName="muidocs-icon-custom-github" tooltip="GitHub"/>;
|
||||
//Method 2: ActionGrade is a component created using mui.SvgIcon.
|
||||
element = <IconButton tooltip= "Star" touch= { true}>
|
||||
<ActionGrade/>
|
||||
</IconButton >;
|
||||
//Method 3: Manually creating a mui.FontIcon component within IconButton
|
||||
element = <IconButton tooltip= "Sort" disabled= {true}>
|
||||
<FontIcon className="muidocs-icon-custom-sort"/>
|
||||
</IconButton>;
|
||||
//Method 4: Using Google material-icons
|
||||
element = <IconButton iconClassName="material-icons" tooltipPosition="bottom-center"
|
||||
tooltip="Sky">settings_system_daydream</IconButton>;
|
||||
|
||||
// "http://material-ui.com/#/components/icon-menus"
|
||||
element = <IconMenu iconButtonElement={<IconButton />}>
|
||||
<MenuItem primaryText="Refresh" />
|
||||
<MenuItem primaryText="Send feedback" />
|
||||
<MenuItem primaryText="Settings" />
|
||||
<MenuItem primaryText="Help" />
|
||||
<MenuItem primaryText="Sign out" />
|
||||
</IconMenu>;
|
||||
|
||||
// "http://material-ui.com/#/components/left-nav"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/lists"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/menus"
|
||||
element = <Menu>
|
||||
<MenuItem primaryText="Maps" />
|
||||
<MenuItem primaryText="Books" />
|
||||
<MenuItem primaryText="Flights" />
|
||||
<MenuItem primaryText="Apps" />
|
||||
</Menu>;
|
||||
element = <Menu desktop={true} width={320}>
|
||||
<MenuItem primaryText="Bold" secondaryText="⌘B" />
|
||||
<MenuItem primaryText="Italic" secondaryText="⌘I" />
|
||||
<MenuItem primaryText="Underline" secondaryText="⌘U" />
|
||||
<MenuItem primaryText="Strikethrough" secondaryText="Alt+Shift+5" />
|
||||
<MenuItem primaryText="Superscript" secondaryText="⌘." />
|
||||
<MenuItem primaryText="Subscript" secondaryText="⌘," />
|
||||
<MenuDivider />
|
||||
<MenuItem primaryText="Paragraph styles" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Align" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Line spacing" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Numbered list" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="List options" rightIcon={<ArrowDropRight />} />
|
||||
<MenuDivider />
|
||||
<MenuItem primaryText="Clear formatting" secondaryText="⌘/" />
|
||||
</Menu>;
|
||||
|
||||
// "http://material-ui.com/#/components/paper"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/progress"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/refresh-indicator"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/sliders"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/switches"
|
||||
element = <Checkbox
|
||||
name="checkboxName2"
|
||||
value="checkboxValue2"
|
||||
label="fed the dog"
|
||||
defaultChecked={true}/>;
|
||||
element = <Checkbox
|
||||
name = "checkboxName3"
|
||||
value = "checkboxValue3"
|
||||
label = "built a house on the moon"
|
||||
disabled = {true}/>;
|
||||
element = <Checkbox
|
||||
name="checkboxName4"
|
||||
value="checkboxValue4"
|
||||
checkedIcon={<ToggleStar />}
|
||||
unCheckedIcon={<ToggleStarBorder />}
|
||||
label="custom icon" />;
|
||||
|
||||
element = <RadioButtonGroup name="shipSpeed" defaultSelected="not_light">
|
||||
<RadioButton
|
||||
value="light"
|
||||
label="prepare for light speed"
|
||||
style={{ marginBottom: 16 }} />;
|
||||
<RadioButton
|
||||
value="not_light"
|
||||
label="light speed too slow"
|
||||
style={{ marginBottom: 16 }}/>;
|
||||
<RadioButton
|
||||
value="ludicrous"
|
||||
label="go to ludicrous speed"
|
||||
style={{ marginBottom: 16 }}
|
||||
disabled={true}/>
|
||||
</RadioButtonGroup>;
|
||||
|
||||
element = <Toggle
|
||||
name="toggleName1"
|
||||
value="toggleValue1"
|
||||
label="activate thrusters"/>;
|
||||
|
||||
element = <Toggle
|
||||
name = "toggleName2"
|
||||
value = "toggleValue2"
|
||||
label = "auto-pilot"
|
||||
defaultToggled = { true}/>;
|
||||
|
||||
element = <Toggle
|
||||
name="toggleName3"
|
||||
value="toggleValue3"
|
||||
label="initiate self-destruct sequence"
|
||||
disabled={true}/>;
|
||||
|
||||
// "http://material-ui.com/#/components/snackbar"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/table"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/tabs"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/text-fields"
|
||||
element = <TextField
|
||||
hintText="Hint Text" />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
defaultValue="Default Value" />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
value = { "value" }
|
||||
underlineStyle = {{ borderColor: Colors.green500 }}
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Custom Underline Focus Color"
|
||||
underlineFocusStyle={{ borderColor: Colors.amber900 }} />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
valueLink = { this.linkState<string>('valueLinkValue') } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text (MultiLine)"
|
||||
multiLine={true} />;
|
||||
element = <TextField
|
||||
hintText = "The hint text can be as long as you want, it will wrap."
|
||||
multiLine = { true} />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
errorText="The error text can be as long as you want, it will wrap." />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
errorText = { "error text" }
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text (custom error color)"
|
||||
errorText={"error text"}
|
||||
errorStyle={{ color: 'orange' }}
|
||||
onChange={ this.formEventHandler }
|
||||
defaultValue="Custom error color" />;
|
||||
element = <TextField
|
||||
hintText = "Disabled Hint Text"
|
||||
disabled = { true} />;
|
||||
element = <TextField
|
||||
hintText="Disabled Hint Text"
|
||||
disabled={true}
|
||||
defaultValue="Disabled With Value" />;
|
||||
|
||||
//Select Fields
|
||||
let arbitraryArrayMenuItems = [
|
||||
{
|
||||
id: 0,
|
||||
name: "zero",
|
||||
},
|
||||
];
|
||||
element = <SelectField
|
||||
value = { 0 }
|
||||
onChange = { this.selectFieldChangeHandler }
|
||||
hintText = "Hint Text"
|
||||
menuItems = { menuItems } />;
|
||||
element = <SelectField
|
||||
valueLink={this.linkState('selectValueLinkValue') }
|
||||
floatingLabelText="Float Label Text"
|
||||
valueMember="id"
|
||||
displayMember="name"
|
||||
menuItems={arbitraryArrayMenuItems} />;
|
||||
element = <SelectField
|
||||
valueLink = { this.linkState('selectValueLinkValue2') }
|
||||
floatingLabelText = "Float Custom Label Text"
|
||||
floatingLabelStyle = {{ color: "red" }}
|
||||
valueMember = "id"
|
||||
displayMember = "name"
|
||||
menuItems = { arbitraryArrayMenuItems } />;
|
||||
element = <SelectField
|
||||
value={0}
|
||||
onChange={ this.selectFieldChangeHandler }
|
||||
menuItems={arbitraryArrayMenuItems} />;
|
||||
|
||||
//Floating Hint Text Labels
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
floatingLabelText = "Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
defaultValue="Default Value"
|
||||
floatingLabelText="Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
value = { "value" }
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
floatingLabelText="Floating Label Text"
|
||||
valueLink={this.linkState<string>('floatingValueLinkValue') } />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text (MultiLine)"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
multiLine = { true} />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
errorText={"floating text"}
|
||||
floatingLabelText="Floating Label Text"
|
||||
onChange={this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
errorText = { "error text" }
|
||||
defaultValue = "abc"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Disabled Hint Text"
|
||||
disabled={true}
|
||||
floatingLabelText="Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText = "Disabled Hint Text"
|
||||
disabled = { true}
|
||||
defaultValue = "Disabled With Value"
|
||||
floatingLabelText = "Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText="Password Field"
|
||||
floatingLabelText="Password"
|
||||
type="password" />;
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/time-picker"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/toolbars"
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
+2249
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,9 @@ import Menu = require('material-ui/lib/menus/menu');
|
||||
import MenuItem = require('material-ui/lib/menus/menu-item');
|
||||
import MenuDivider = require('material-ui/lib/menus/menu-divider');
|
||||
import ThemeManager = require('material-ui/lib/styles/theme-manager');
|
||||
import GridList = require('material-ui/lib/grid-list/grid-list');
|
||||
import GridTile = require('material-ui/lib/grid-list/grid-tile');
|
||||
|
||||
|
||||
import NavigationClose = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/navigation/close", but they aren't defined yet.
|
||||
import FileFolder = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/file/folder", but they aren't defined yet.
|
||||
@@ -458,12 +461,29 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
hintText="Password Field"
|
||||
floatingLabelText="Password"
|
||||
type="password" />;
|
||||
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/time-picker"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/toolbars"
|
||||
|
||||
// "http://material-ui.com/#/components/grid-list"
|
||||
element = <GridList
|
||||
cols={3}
|
||||
padding={50}
|
||||
cellHeight={200} />;
|
||||
|
||||
element = <GridTile
|
||||
title="GridTileTitle"
|
||||
actionIcon={<h1>GridTile</h1>}
|
||||
actionPosition="left"
|
||||
titlePosition="top"
|
||||
titleBackground="rgba(0, 0, 0, 0.4)"
|
||||
cols={2}
|
||||
rows={1} >
|
||||
<h1>Children are Required!</h1>
|
||||
</GridTile>;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
Vendored
+49
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for material-ui v0.12.1
|
||||
// Type definitions for material-ui v0.13.1
|
||||
// Project: https://github.com/callemall/material-ui
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>, Oliver Herrmann <https://github.com/herrmanno>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../react/react.d.ts' />
|
||||
@@ -71,6 +71,9 @@ declare module "material-ui" {
|
||||
export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; // require('material-ui/lib/toolbar/toolbar-title');
|
||||
export import Tooltip = __MaterialUI.Tooltip; // require('material-ui/lib/tooltip');
|
||||
export import Utils = __MaterialUI.Utils; // require('material-ui/lib/utils/');
|
||||
|
||||
export import GridList = __MaterialUI.GridList.GridList; // require('material-ui/lib/gridlist/grid-list');
|
||||
export import GridTile = __MaterialUI.GridList.GridTile; // require('material-ui/lib/gridlist/grid-tile');
|
||||
|
||||
// export type definitions
|
||||
export type TouchTapEvent = __MaterialUI.TouchTapEvent;
|
||||
@@ -1120,6 +1123,7 @@ declare namespace __MaterialUI {
|
||||
tabItemContainerStyle?: React.CSSProperties;
|
||||
tabWidth?: number;
|
||||
value?: string | number;
|
||||
tabTemplate?: __React.ComponentClass<any>;
|
||||
|
||||
onChange?: (value: string | number, e: React.FormEvent, tab: Tab) => void;
|
||||
}
|
||||
@@ -1240,6 +1244,10 @@ declare namespace __MaterialUI {
|
||||
defaultTime?: Date;
|
||||
format?: string;
|
||||
pedantic?: boolean;
|
||||
style?: __React.CSSProperties;
|
||||
textFieldStye?: __React.CSSProperties;
|
||||
autoOk?: boolean;
|
||||
openDialog?: () => void;
|
||||
onFocus?: React.FocusEventHandler;
|
||||
onTouchTap?: TouchTapEventHandler;
|
||||
onChange?: (e: any, time: Date) => void;
|
||||
@@ -1266,6 +1274,7 @@ declare namespace __MaterialUI {
|
||||
underlineFocusStyle?: React.CSSProperties;
|
||||
underlineDisabledStyle?: React.CSSProperties;
|
||||
type?: string;
|
||||
hintStyle?: React.CSSProperties;
|
||||
|
||||
disabled?: boolean;
|
||||
isRtl?: boolean;
|
||||
@@ -1470,6 +1479,34 @@ declare namespace __MaterialUI {
|
||||
export class MenuDivider extends React.Component<MenuDividerProps, {}>{
|
||||
}
|
||||
}
|
||||
|
||||
namespace GridList {
|
||||
|
||||
interface GridListProps extends React.Props<GridList> {
|
||||
cols?: number;
|
||||
padding?: number;
|
||||
cellHeight?: number;
|
||||
}
|
||||
|
||||
export class GridList extends React.Component<GridListProps, {}>{
|
||||
}
|
||||
|
||||
interface GridTileProps extends React.Props<GridTile> {
|
||||
title?: string;
|
||||
subtitle?: __React.ReactNode;
|
||||
titlePosition?: string; //"top"|"bottom"
|
||||
titleBackground?: string;
|
||||
actionIcon?: __React.ReactElement<any>;
|
||||
actionPosition?: string; //"left"|"right"
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
rootClass?: string | __React.Component<any,any>;
|
||||
}
|
||||
|
||||
export class GridTile extends React.Component<GridTileProps, {}>{
|
||||
}
|
||||
|
||||
}
|
||||
} // __MaterialUI
|
||||
|
||||
declare module 'material-ui/lib/app-bar' {
|
||||
@@ -1952,6 +1989,16 @@ declare module "material-ui/lib/menus/menu-divider" {
|
||||
export = MenuDivider;
|
||||
}
|
||||
|
||||
declare module "material-ui/lib/grid-list/grid-list" {
|
||||
import GridList = __MaterialUI.GridList.GridList;
|
||||
export = GridList;
|
||||
}
|
||||
|
||||
declare module "material-ui/lib/grid-list/grid-tile" {
|
||||
import GridTile = __MaterialUI.GridList.GridTile;
|
||||
export = GridTile;
|
||||
}
|
||||
|
||||
declare module "material-ui/lib/styles/colors" {
|
||||
import Colors = __MaterialUI.Styles.Colors;
|
||||
export = Colors;
|
||||
|
||||
@@ -0,0 +1,581 @@
|
||||
/// <reference path="mathjs.d.ts" />
|
||||
|
||||
|
||||
/*
|
||||
Basic usage examples
|
||||
*/
|
||||
(function(){
|
||||
// functions and constants
|
||||
math.round(math.e, 3); // 2.718
|
||||
math.atan2(3, -3) / math.pi; // 0.75
|
||||
math.log(10000, 10); // 4
|
||||
math.sqrt(-4); // 2i
|
||||
math.pow([[-1, 2], [3, 1]], 2); // [[7, 0], [0, 7]]
|
||||
|
||||
// expressions
|
||||
math.eval('1.2 * (2 + 4.5)'); // 7.8
|
||||
math.eval('5.08 cm to inch'); // 2 inch
|
||||
math.eval('sin(45 deg) ^ 2'); // 0.5
|
||||
math.eval('9 / 3 + 2i'); // 3 + 2i
|
||||
math.eval('det([-1, 2; 3, 1])'); // -7
|
||||
|
||||
// chained operations
|
||||
var a = math.chain(3)
|
||||
.add(4)
|
||||
.multiply(2)
|
||||
.done(); // 14
|
||||
|
||||
// mixed use of different data types in functions
|
||||
console.log('mixed use of data types');
|
||||
math.add(4, [5, 6]); // number + Array, [9, 10]
|
||||
math.multiply(math.unit('5 mm'), 3); // Unit * number, 15 mm
|
||||
math.subtract([2, 3, 4], 5); // Array - number, [-3, -2, -1]
|
||||
math.add(math.matrix([2, 3]), [4, 5]); // Matrix + Array, [6, 8]
|
||||
}());
|
||||
|
||||
|
||||
/*
|
||||
Bignumbers examples
|
||||
*/
|
||||
(function() {
|
||||
// configure the default type of numbers as BigNumbers
|
||||
math.config({
|
||||
number: 'bignumber', // Default type of number:
|
||||
// 'number' (default), 'bignumber', or 'fraction'
|
||||
precision: 20 // Number of significant digits for BigNumbers
|
||||
});
|
||||
|
||||
console.log('round-off errors with numbers');
|
||||
math.add(0.1, 0.2); // number, 0.30000000000000004
|
||||
math.divide(0.3, 0.2); // number, 1.4999999999999998
|
||||
console.log();
|
||||
|
||||
console.log('no round-off errors with BigNumbers');
|
||||
math.add(math.bignumber(0.1), math.bignumber(0.2)); // BigNumber, 0.3
|
||||
math.divide(math.bignumber(0.3), math.bignumber(0.2)); // BigNumber, 1.5
|
||||
console.log();
|
||||
|
||||
console.log('create BigNumbers from strings when exceeding the range of a number');
|
||||
math.bignumber(1.2e+500); // BigNumber, Infinity WRONG
|
||||
math.bignumber('1.2e+500'); // BigNumber, 1.2e+500
|
||||
console.log();
|
||||
|
||||
// one can work conveniently with BigNumbers using the expression parser.
|
||||
// note though that BigNumbers are only supported in arithmetic functions
|
||||
console.log('use BigNumbers in the expression parser');
|
||||
math.eval('0.1 + 0.2'); // BigNumber, 0.3
|
||||
math.eval('0.3 / 0.2'); // BigNumber, 1.5
|
||||
console.log();
|
||||
}());
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Chaining examples
|
||||
*/
|
||||
(function() {
|
||||
// create a chained operation using the function `chain(value)`
|
||||
// end a chain using done(). Let's calculate (3 + 4) * 2
|
||||
var a = math.chain(3)
|
||||
.add(4)
|
||||
.multiply(2)
|
||||
.done(); // 14
|
||||
|
||||
// Another example, calculate square(sin(pi / 4))
|
||||
var b = math.chain(math.pi)
|
||||
.divide(4)
|
||||
.sin()
|
||||
.square()
|
||||
.done(); // 0.5
|
||||
|
||||
// A chain has a few special methods: done, toString, valueOf, get, and set.
|
||||
// these are demonstrated in the following examples
|
||||
|
||||
// toString will return a string representation of the chain's value
|
||||
var chain = math.chain(2).divide(3);
|
||||
var str = chain.toString(); // "0.6666666666666666"
|
||||
|
||||
// a chain has a function .valueOf(), which returns the value hold by the chain.
|
||||
// This allows using it in regular operations. The function valueOf() acts the
|
||||
// same as function done().
|
||||
chain.valueOf(); // 0.66666666666667
|
||||
|
||||
|
||||
// the function subset can be used to get or replace sub matrices
|
||||
var array = [[1, 2], [3, 4]];
|
||||
var v = math.chain(array)
|
||||
.subset(math.index(1, 0))
|
||||
.done(); // 3
|
||||
|
||||
var m = math.chain(array)
|
||||
.subset(math.index(0, 0), 8)
|
||||
.multiply(3)
|
||||
.done(); // [[24, 6], [9, 12]]
|
||||
}());
|
||||
|
||||
|
||||
/*
|
||||
Complex numbers examples
|
||||
*/
|
||||
(function(){
|
||||
var a = math.complex(2, 3); // 2 + 3i
|
||||
|
||||
// read the real and complex parts of the complex number
|
||||
a.re; // 2
|
||||
a.im; // 3
|
||||
|
||||
// clone a complex value
|
||||
var clone = a.clone(); // 2 + 3i
|
||||
|
||||
// adjust the complex value
|
||||
a.re = 5; // 5 + 3i
|
||||
|
||||
// create a complex number by providing a string with real and complex parts
|
||||
var b = math.complex('3 - 7i'); // 3 - 7i
|
||||
console.log();
|
||||
|
||||
// perform operations with complex numbers
|
||||
console.log('perform operations');
|
||||
math.add(a, b); // 8 - 4i
|
||||
math.multiply(a, b); // 36 - 26i
|
||||
math.sin(a); // -9.6541254768548 + 2.8416922956064i
|
||||
|
||||
// some operations will return a complex number depending on the arguments
|
||||
math.sqrt(4); // 2
|
||||
math.sqrt(-4); // 2i
|
||||
|
||||
// create a complex number from polar coordinates
|
||||
console.log('create complex numbers with polar coordinates');
|
||||
var c = math.complex({r: math.sqrt(2), phi: math.pi / 4}); // 1 + i
|
||||
|
||||
// get polar coordinates of a complex number
|
||||
var d = math.complex(3, 4);
|
||||
d.toPolar(); // { r: 5, phi: 0.9272952180016122 }
|
||||
}());
|
||||
|
||||
|
||||
/*
|
||||
Expressions examples
|
||||
*/
|
||||
(function() {
|
||||
// 1. using the function math.eval
|
||||
//
|
||||
// Function `eval` accepts a single expression or an array with
|
||||
// expressions as first argument, and has an optional second argument
|
||||
// containing a scope with variables and functions. The scope is a regular
|
||||
// JavaScript Object. The scope will be used to resolve symbols, and to write
|
||||
// assigned variables or function.
|
||||
console.log('1. USING FUNCTION MATH.EVAL');
|
||||
|
||||
// evaluate expressions
|
||||
console.log('\nevaluate expressions');
|
||||
math.eval('sqrt(3^2 + 4^2)'); // 5
|
||||
math.eval('sqrt(-4)'); // 2i
|
||||
math.eval('2 inch to cm'); // 5.08 cm
|
||||
math.eval('cos(45 deg)'); // 0.70711
|
||||
|
||||
// evaluate multiple expressions at once
|
||||
console.log('\nevaluate multiple expressions at once');
|
||||
math.eval([
|
||||
'f = 3',
|
||||
'g = 4',
|
||||
'f * g'
|
||||
]); // [3, 4, 12]
|
||||
|
||||
// provide a scope (just a regular JavaScript Object)
|
||||
console.log('\nevaluate expressions providing a scope with variables and functions');
|
||||
var scope: any = {
|
||||
a: 3,
|
||||
b: 4
|
||||
};
|
||||
|
||||
// variables can be read from the scope
|
||||
math.eval('a * b', scope); // 12
|
||||
|
||||
// variable assignments are written to the scope
|
||||
math.eval('c = 2.3 + 4.5', scope); // 6.8
|
||||
scope.c; // 6.8
|
||||
|
||||
// scope can contain both variables and functions
|
||||
scope["hello"] = function (name: string) {
|
||||
return 'hello, ' + name + '!';
|
||||
};
|
||||
math.eval('hello("hero")', scope); // "hello, hero!"
|
||||
|
||||
// define a function as an expression
|
||||
var f = math.eval('f(x) = x ^ a', scope);
|
||||
f(2); // 8
|
||||
scope.f(2); // 8
|
||||
|
||||
|
||||
|
||||
// 2. using function math.parse
|
||||
//
|
||||
// Function `math.parse` parses expressions into a node tree. The syntax is
|
||||
// similar to function `math.eval`.
|
||||
// Function `parse` accepts a single expression or an array with
|
||||
// expressions as first argument. The function returns a node tree, which
|
||||
// then can be compiled against math, and then evaluated against an (optional
|
||||
// scope. This scope is a regular JavaScript Object. The scope will be used
|
||||
// to resolve symbols, and to write assigned variables or function.
|
||||
console.log('\n2. USING FUNCTION MATH.PARSE');
|
||||
|
||||
// parse an expression
|
||||
console.log('\nparse an expression into a node tree');
|
||||
var node1 = math.parse('sqrt(3^2 + 4^2)');
|
||||
node1.toString(); // "sqrt((3 ^ 2) + (4 ^ 2))"
|
||||
|
||||
// compile and evaluate the compiled code
|
||||
// you could also do this in two steps: node1.compile().eval()
|
||||
node1.eval(); // 5
|
||||
|
||||
// provide a scope
|
||||
console.log('\nprovide a scope');
|
||||
var node2 = math.parse('x^a');
|
||||
var code2 = node2.compile();
|
||||
node2.toString(); // "x ^ a"
|
||||
var scope: any = {
|
||||
x: 3,
|
||||
a: 2
|
||||
};
|
||||
code2.eval(scope); // 9
|
||||
|
||||
// change a value in the scope and re-evaluate the node
|
||||
scope.a = 3;
|
||||
code2.eval(scope); // 27
|
||||
|
||||
|
||||
// 3. using function math.compile
|
||||
//
|
||||
// Function `math.compile` compiles expressions into a node tree. The syntax is
|
||||
// similar to function `math.eval`.
|
||||
// Function `compile` accepts a single expression or an array with
|
||||
// expressions as first argument, and returns an object with a function eval
|
||||
// to evaluate the compiled expression. On evaluation, an optional scope can
|
||||
// be provided. This scope will be used to resolve symbols, and to write
|
||||
// assigned variables or function.
|
||||
console.log('\n3. USING FUNCTION MATH.COMPILE');
|
||||
|
||||
// parse an expression
|
||||
console.log('\ncompile an expression');
|
||||
var code3 = math.compile('sqrt(3^2 + 4^2)');
|
||||
|
||||
// evaluate the compiled code
|
||||
code3.eval(); // 5
|
||||
|
||||
// provide a scope for the variable assignment
|
||||
console.log('\nprovide a scope');
|
||||
var code2 = math.compile('a = a + 3');
|
||||
var scope: any = {
|
||||
a: 7
|
||||
};
|
||||
code2.eval(scope);
|
||||
scope.a; // 10
|
||||
|
||||
|
||||
// 4. using a parser
|
||||
//
|
||||
// In addition to the static functions `math.eval` and `math.parse`, math.js
|
||||
// contains a parser with functions `eval` and `parse`, which automatically
|
||||
// keeps a scope with assigned variables in memory. The parser also contains
|
||||
// some convenience methods to get, set, and remove variables from memory.
|
||||
console.log('\n4. USING A PARSER');
|
||||
var parser = math.parser();
|
||||
|
||||
// evaluate with parser
|
||||
console.log('\nevaluate expressions');
|
||||
parser.eval('sqrt(3^2 + 4^2)'); // 5
|
||||
parser.eval('sqrt(-4)'); // 2i
|
||||
parser.eval('2 inch to cm'); // 5.08 cm
|
||||
parser.eval('cos(45 deg)'); // 0.70711
|
||||
|
||||
// define variables and functions
|
||||
console.log('\ndefine variables and functions');
|
||||
parser.eval('x = 7 / 2'); // 3.5
|
||||
parser.eval('x + 3'); // 6.5
|
||||
parser.eval('f(x, y) = x^y'); // f(x, y)
|
||||
parser.eval('f(2, 3)'); // 8
|
||||
|
||||
// manipulate matrices
|
||||
// Note that matrix indexes in the expression parser are one-based with the
|
||||
// upper-bound included. On a JavaScript level however, math.js uses zero-based
|
||||
// indexes with an excluded upper-bound.
|
||||
console.log('\nmanipulate matrices');
|
||||
parser.eval('k = [1, 2; 3, 4]'); // [[1, 2], [3, 4]]
|
||||
parser.eval('l = zeros(2, 2)'); // [[0, 0], [0, 0]]
|
||||
parser.eval('l[1, 1:2] = [5, 6]'); // [[5, 6], [0, 0]]
|
||||
parser.eval('l[2, :] = [7, 8]'); // [[5, 6], [7, 8]]
|
||||
parser.eval('m = k * l'); // [[19, 22], [43, 50]]
|
||||
parser.eval('n = m[2, 1]'); // 43
|
||||
parser.eval('n = m[:, 1]'); // [[19], [43]]
|
||||
|
||||
// get and set variables and functions
|
||||
console.log('\nget and set variables and function in the scope of the parser');
|
||||
var x = parser.get('x');
|
||||
console.log('x =', x); // x = 7
|
||||
var f = parser.get('f');
|
||||
console.log('f =', math.format(f)); // f = f(x, y)
|
||||
var g = f(3, 3);
|
||||
console.log('g =', g); // g = 27
|
||||
|
||||
parser.set('h', 500);
|
||||
parser.eval('h / 2'); // 250
|
||||
parser.set('hello', function (name: string) {
|
||||
return 'hello, ' + name + '!';
|
||||
});
|
||||
parser.eval('hello("hero")'); // "hello, hero!"
|
||||
|
||||
// clear defined functions and variables
|
||||
parser.clear();
|
||||
}());
|
||||
|
||||
|
||||
/*
|
||||
Fractions examples
|
||||
*/
|
||||
(function(){
|
||||
// configure the default type of numbers as Fractions
|
||||
math.config({
|
||||
number: 'fraction' // Default type of number:
|
||||
// 'number' (default), 'bignumber', or 'fraction'
|
||||
});
|
||||
|
||||
console.log('basic usage');
|
||||
math.fraction(0.125); // Fraction, 1/8
|
||||
math.fraction(0.32); // Fraction, 8/25
|
||||
math.fraction('1/3'); // Fraction, 1/3
|
||||
math.fraction('0.(3)'); // Fraction, 1/3
|
||||
math.fraction(2, 3); // Fraction, 2/3
|
||||
math.fraction('0.(285714)'); // Fraction, 2/7
|
||||
console.log();
|
||||
|
||||
console.log('round-off errors with numbers');
|
||||
math.add(0.1, 0.2); // number, 0.30000000000000004
|
||||
math.divide(0.3, 0.2); // number, 1.4999999999999998
|
||||
console.log();
|
||||
|
||||
console.log('no round-off errors with fractions :)');
|
||||
math.add(math.fraction(0.1), math.fraction(0.2)); // Fraction, 3/10
|
||||
math.divide(math.fraction(0.3), math.fraction(0.2)); // Fraction, 3/2
|
||||
console.log();
|
||||
|
||||
console.log('represent an infinite number of repeating digits');
|
||||
math.fraction('1/3'); // Fraction, 0.(3)
|
||||
math.fraction('2/7'); // Fraction, 0.(285714)
|
||||
math.fraction('23/11'); // Fraction, 2.(09)
|
||||
console.log();
|
||||
|
||||
// one can work conveniently with fractions using the expression parser.
|
||||
// note though that Fractions are only supported by basic arithmetic functions
|
||||
console.log('use fractions in the expression parser');
|
||||
math.eval('0.1 + 0.2'); // Fraction, 3/10
|
||||
math.eval('0.3 / 0.2'); // Fraction, 3/2
|
||||
math.eval('23 / 11'); // Fraction, 23/11
|
||||
console.log();
|
||||
|
||||
// output formatting
|
||||
console.log('output formatting of fractions');
|
||||
var a = math.fraction('2/3');
|
||||
console.log(math.format(a)); // Fraction, 2/3
|
||||
console.log(math.format(a, {fraction: 'ratio'})); // Fraction, 2/3
|
||||
console.log(math.format(a, {fraction: 'decimal'})); // Fraction, 0.(6)
|
||||
console.log(a.toString()); // Fraction, 0.(6)
|
||||
console.log();
|
||||
}());
|
||||
|
||||
/*
|
||||
Matrices examples
|
||||
*/
|
||||
(function() {
|
||||
// create matrices and arrays. a matrix is just a wrapper around an Array,
|
||||
// providing some handy utilities.
|
||||
console.log('create a matrix');
|
||||
var a = math.matrix([1, 4, 9, 16, 25]); // [1, 4, 9, 16, 25]
|
||||
var b = math.matrix(math.ones([2, 3])); // [[1, 1, 1], [1, 1, 1]]
|
||||
b.size(); // [2, 3]
|
||||
|
||||
// the Array data of a Matrix can be retrieved using valueOf()
|
||||
var array = a.valueOf(); // [1, 4, 9, 16, 25]
|
||||
|
||||
// Matrices can be cloned
|
||||
var clone = a.clone(); // [1, 4, 9, 16, 25]
|
||||
console.log();
|
||||
|
||||
// perform operations with matrices
|
||||
console.log('perform operations');
|
||||
math.sqrt(a); // [1, 2, 3, 4, 5]
|
||||
var c = [1, 2, 3, 4, 5];
|
||||
math.factorial(c); // [1, 2, 6, 24, 120]
|
||||
console.log();
|
||||
|
||||
// create and manipulate matrices. Arrays and Matrices can be used mixed.
|
||||
console.log('manipulate matrices');
|
||||
var d = [[1, 2], [3, 4]]; // [[1, 2], [3, 4]]
|
||||
var e = math.matrix([[5, 6], [1, 1]]); // [[5, 6], [1, 1]]
|
||||
|
||||
// set a submatrix.
|
||||
// Matrix indexes are zero-based.
|
||||
e.subset(math.index(1, [0, 1]), [[7, 8]]); // [[5, 6], [7, 8]]
|
||||
var f = math.multiply(d, e); // [[19, 22], [43, 50]]
|
||||
var g = f.subset(math.index(1, 0)); // 43
|
||||
console.log();
|
||||
|
||||
// get a sub matrix
|
||||
// Matrix indexes are zero-based.
|
||||
console.log('get a sub matrix');
|
||||
var h = math.diag(math.range(1,4)); // [[1, 0, 0], [0, 2, 0], [0, 0, 3]]
|
||||
h.subset( math.index([1, 2], [1, 2])); // [[2, 0], [0, 3]]
|
||||
var i = math.range(1,6); // [1, 2, 3, 4, 5]
|
||||
i.subset(math.index(math.range(1,4))); // [2, 3, 4]
|
||||
console.log();
|
||||
|
||||
|
||||
// resize a multi dimensional matrix
|
||||
console.log('resizing a matrix');
|
||||
var j = math.matrix();
|
||||
var defaultValue = 0;
|
||||
j.resize([2, 2, 2], defaultValue); // [[[0, 0], [0, 0]], [[0, 0], [0, 0]]]
|
||||
j.size(); // [2, 2, 2]
|
||||
j.resize([2, 2]); // [[0, 0], [0, 0]]
|
||||
j.size(); // [2, 2]
|
||||
console.log();
|
||||
|
||||
// setting a value outside the matrices range will resize the matrix.
|
||||
// new elements will be initialized with zero.
|
||||
console.log('set a value outside a matrices range');
|
||||
var k = math.matrix();
|
||||
k.subset(math.index(2), 6); // [0, 0, 6]
|
||||
console.log();
|
||||
|
||||
console.log('set a value outside a matrices range, leaving new entries uninitialized');
|
||||
var m = math.matrix();
|
||||
defaultValue = math.uninitialized;
|
||||
m.subset(math.index(2), 6, defaultValue); // [undefined, undefined, 6]
|
||||
console.log();
|
||||
|
||||
// create ranges
|
||||
console.log('create ranges');
|
||||
math.range(1, 6); // [1, 2, 3, 4, 5]
|
||||
math.range(0, 18, 3); // [0, 3, 6, 9, 12, 15]
|
||||
math.range('2:-1:-3'); // [2, 1, 0, -1, -2]
|
||||
math.factorial(math.range('1:6')); // [1, 2, 6, 24, 120]
|
||||
console.log();
|
||||
}());
|
||||
|
||||
/*
|
||||
Sparse matrices examples
|
||||
*/
|
||||
(function() {
|
||||
// create a sparse matrix
|
||||
console.log('creating a 1000x1000 sparse matrix...');
|
||||
var a = math.eye(1000, 1000, 'sparse');
|
||||
|
||||
// do operations with a sparse matrix
|
||||
console.log('doing some operations on the sparse matrix...');
|
||||
var b = math.multiply(a, a);
|
||||
var c = math.multiply(b, math.complex(2, 2));
|
||||
var d = math.transpose(c);
|
||||
var e = math.multiply(d, a);
|
||||
|
||||
// we will not print the output, but doing the same operations
|
||||
// with a dense matrix are very slow, try it for yourself.
|
||||
console.log('already done');
|
||||
console.log('now try this with a dense matrix :)');
|
||||
}());
|
||||
|
||||
/*
|
||||
Units examples
|
||||
*/
|
||||
(function() {
|
||||
// units can be created by providing a value and unit name, or by providing
|
||||
// a string with a valued unit.
|
||||
console.log('create units');
|
||||
var a = math.unit(45, 'cm'); // 450 mm
|
||||
var b = math.unit('0.1m'); // 100 mm
|
||||
console.log();
|
||||
|
||||
// units can be added, subtracted, and multiplied or divided by numbers and by other units
|
||||
console.log('perform operations');
|
||||
math.add(a, b); // 0.55 m
|
||||
math.multiply(b, 2); // 200 mm
|
||||
math.divide(math.unit('1 m'), math.unit('1 s')); // 1 m / s
|
||||
math.pow(math.unit('12 in'), 3); // 1728 in^3
|
||||
console.log();
|
||||
|
||||
// units can be converted to a specific type, or to a number
|
||||
console.log('convert to another type or to a number');
|
||||
b.to('cm'); // 10 cm Alternatively: math.to(b, 'cm')
|
||||
math.to(b, 'inch'); // 3.9370... inch
|
||||
b.toNumber('cm'); // 10
|
||||
math.number(b, 'cm'); // 10
|
||||
console.log();
|
||||
|
||||
// the expression parser supports units too
|
||||
console.log('parse expressions');
|
||||
math.eval('2 inch to cm'); // 5.08 cm
|
||||
math.eval('cos(45 deg)'); // 0.70711...
|
||||
math.eval('90 km/h to m/s'); // 25 m / s
|
||||
console.log();
|
||||
|
||||
// convert a unit to a number
|
||||
// A second parameter with the unit for the exported number must be provided
|
||||
math.eval('number(5 cm, mm)'); // number, 50
|
||||
console.log();
|
||||
|
||||
// simplify units
|
||||
console.log('simplify units');
|
||||
math.eval('100000 N / m^2'); // 100 kPa
|
||||
math.eval('9.81 m/s^2 * 100 kg * 40 m'); // 39.24 kJ
|
||||
console.log();
|
||||
|
||||
// example engineering calculations
|
||||
console.log('compute molar volume of ideal gas at 65 Fahrenheit, 14.7 psi in L/mol');
|
||||
var Rg = math.unit('8.314 N m / (mol K)');
|
||||
var T = math.unit('65 degF');
|
||||
var P = math.unit('14.7 psi');
|
||||
var v = math.divide(math.multiply(Rg, T), P);
|
||||
console.log('gas constant (Rg) = ', format(Rg));
|
||||
console.log('P = ' + format(P));
|
||||
console.log('T = ' + format(T));
|
||||
console.log('v = Rg * T / P = ' + format(math.to(v, 'L/mol'))); // 23.910... L / mol
|
||||
console.log();
|
||||
|
||||
console.log('compute speed of fluid flowing out of hole in a container');
|
||||
var g = math.unit('9.81 m / s^2');
|
||||
var h = math.unit('1 m');
|
||||
var v2 = math.pow(math.multiply(2, math.multiply(g, h)), 0.5); // Can also use math.sqrt
|
||||
console.log('g = ' + format(g));
|
||||
console.log('h = ' + format(h));
|
||||
console.log('v = (2 g h) ^ 0.5 = ' + format(v2)); // 4.429... m / s
|
||||
console.log();
|
||||
|
||||
console.log('electrical power consumption:');
|
||||
var expr = '460 V * 20 A * 30 days to kWh';
|
||||
console.log(expr + ' = ' + math.eval(expr)); // 6624 kWh
|
||||
console.log();
|
||||
|
||||
console.log('circuit design:');
|
||||
var expr = '24 V / (6 mA)';
|
||||
console.log(expr + ' = ' + math.eval(expr)); // 4 kohm
|
||||
console.log();
|
||||
|
||||
console.log('operations on arrays:');
|
||||
var B = math.eval('[1, 0, 0] T');
|
||||
var v3 = math.eval('[0, 1, 0] m/s');
|
||||
var q = math.eval('1 C');
|
||||
var F = math.multiply(q, math.cross(v3, B));
|
||||
console.log('B (magnetic field strength) = ' + format(B)); // [1 T, 0 T, 0 T]
|
||||
console.log('v (particle velocity) = ' + format(v3)); // [0 m / s, 1 m / s, 0 m / s]
|
||||
console.log('q (particle charge) = ' + format(q)); // 1 C
|
||||
console.log('F (force) = q (v cross B) = ' + format(F)); // [0 N, 0 N, -1 N]
|
||||
|
||||
/**
|
||||
* Helper function to format an output a value.
|
||||
* @param {*} value
|
||||
* @return {string} Returns the formatted value
|
||||
*/
|
||||
function format (value: any): string {
|
||||
var precision = 14;
|
||||
return math.format(value, precision);
|
||||
}
|
||||
}());
|
||||
Vendored
+2138
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
/// <reference path="datepicker.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
function smoketest($cordovaDatePicker: IDatePickerService, isIos: boolean) {
|
||||
|
||||
// minDate is a Date object for iOS and a millisecond precision unix timestamp
|
||||
// for Android, so you need to account for that when using the plugin. Also,
|
||||
// on Android, only the date is enforced (time is not).
|
||||
// - from https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
|
||||
var minDate = isIos ? new Date() : (new Date()).valueOf();
|
||||
|
||||
var options: DatePickerOptions = {
|
||||
date: new Date(),
|
||||
mode: 'date',
|
||||
minDate: minDate,
|
||||
maxDate: '',
|
||||
allowOldDates: true,
|
||||
allowFutureDates: false,
|
||||
doneButtonLabel: 'DONE',
|
||||
doneButtonColor: '#F2F3F4',
|
||||
cancelButtonLabel: 'CANCEL',
|
||||
cancelButtonColor: '#000000',
|
||||
androidTheme: AndroidTheme.HoloDark
|
||||
};
|
||||
|
||||
$cordovaDatePicker.show(options).then(function(date) {
|
||||
alert(date);
|
||||
});
|
||||
};
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for ngCordova datepicker plugin
|
||||
// Project: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
|
||||
// Definitions by: Jacques Kang <https://www.linkedin.com/in/jacqueskang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
|
||||
export enum AndroidTheme {
|
||||
Traditional = 1,
|
||||
HoloDark = 2,
|
||||
HoloLight = 3,
|
||||
DeviceDefaultDark = 4,
|
||||
DeviceDefaultLight = 5
|
||||
}
|
||||
|
||||
export interface DatePickerOptions {
|
||||
mode?: string;
|
||||
date?: Date | string | number;
|
||||
minDate?: Date | string | number;
|
||||
maxDate?: Date | string | number;
|
||||
titleText?: string;
|
||||
okText?: string;
|
||||
cancelText?: string;
|
||||
todayText?: string;
|
||||
nowText?: string;
|
||||
is24Hour?: boolean;
|
||||
androidTheme?: AndroidTheme;
|
||||
allowOldDates?: boolean;
|
||||
allowFutureDates?: boolean;
|
||||
doneButtonLabel?: string;
|
||||
doneButtonColor?: string;
|
||||
cancelButtonLabel?: string;
|
||||
cancelButtonColor?: string;
|
||||
x?: number;
|
||||
y?: number;
|
||||
minuteInterval?: number;
|
||||
popoverArrowDirection?: string;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface IDatePickerService {
|
||||
show(options?: DatePickerOptions): ng.IPromise<Date>;
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -12,3 +12,4 @@
|
||||
/// <reference path="deviceMotion.d.ts"/>
|
||||
/// <reference path="deviceOrientation.d.ts"/>
|
||||
/// <reference path="appAvailability.d.ts"/>
|
||||
/// <reference path="datepicker.d.ts"/>
|
||||
|
||||
@@ -7,15 +7,21 @@ Note: This must be compiled with the target set to ES6
|
||||
The content of index.io.js could be something like
|
||||
|
||||
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
import { AppRegistry } from 'react-native'
|
||||
import Welcome from './gen/Welcome'
|
||||
import { AppRegistry } from 'react-native'
|
||||
import Welcome from './gen/Welcome'
|
||||
|
||||
AppRegistry.registerComponent('MopNative', () => Welcome);
|
||||
AppRegistry.registerComponent('MopNative', () => Welcome);
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
NOTE: I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript
|
||||
If you are in a hurry for the latest definitions, or are looking for typescript examples,
|
||||
check https://github.com/bgrieder/RNTSExplorer
|
||||
|
||||
*/
|
||||
|
||||
///<reference path="../react-native/react-native.d.ts" />
|
||||
|
||||
|
||||
Vendored
+979
-272
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -52,6 +52,7 @@ declare module RefluxCore {
|
||||
function createActions(definition: ActionsDefinition): any;
|
||||
function createActions(definitions: string[]): any;
|
||||
|
||||
function connect(store: Store, key?: string):void;
|
||||
function listenTo(store: Store, handler: string):void;
|
||||
function setState(state: any):void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="scalike.d.ts" />
|
||||
|
||||
import {Optional, Some, None, Try, Right, Left, Either, Future} from "scalike";
|
||||
|
||||
// Optional
|
||||
Optional(1).map(x => x + 1); // Some(2)
|
||||
Optional(null).map(x => x + 1); // None
|
||||
Optional(undefined).map(x => x + 1); // None
|
||||
Optional(1).flatMap(x => Some(x + 1)).fold(0, x => x + 1); // 3
|
||||
|
||||
// Try
|
||||
function something() { return 1; }
|
||||
Try(something); // Success(1)
|
||||
function throwError() { throw new Error; }
|
||||
Try(throwError); // Failure(Error)
|
||||
Try(() => 1).map(x => x + 1); // Success(2)
|
||||
|
||||
// Either
|
||||
function validate(x: number): Either<string, number> {
|
||||
return x !== 1 ? Left<string, number>('this is not 1') : Right<string, number>(x);
|
||||
}
|
||||
validate(1).right().getOrElse(0); // 1
|
||||
validate(2).left().getOrElse("err"); // "this is not 1"
|
||||
|
||||
// Future
|
||||
Future(something).map(x => x + 1); // Future(2)
|
||||
Future.successful(1).value; // Optional(Success(1)
|
||||
const fu = Future(something);
|
||||
Future.sequence([fu, fu, fu]); // Future([1, 1, 1])
|
||||
Vendored
+271
@@ -0,0 +1,271 @@
|
||||
// Type definitions for scalike API
|
||||
// Project: https://github.com/ryoppy/scalike-typescript
|
||||
// Definitions by: ryoppy <https://github.com/ryoppy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
declare module scalike {
|
||||
|
||||
export interface Either<A, B> {
|
||||
value: A | B;
|
||||
isLeft: boolean;
|
||||
isRight: boolean;
|
||||
left(): LeftProjection<A, B>;
|
||||
right(): RightProjection<A, B>;
|
||||
fold<X>(fa: (a: A) => X, fb: (b: B) => X): X;
|
||||
swap(): Either<B, A>;
|
||||
}
|
||||
export function Right<A, B>(b: B): Either<A, B>;
|
||||
export function Left<A, B>(a: A): Either<A, B>;
|
||||
export class LeftProjection<A, B> {
|
||||
private self;
|
||||
constructor(self: Either<A, B>);
|
||||
toString(): string;
|
||||
get(): A;
|
||||
foreach(f: (a: A) => void): void;
|
||||
getOrElse<X extends A>(x: X): A;
|
||||
forall(f: (a: A) => boolean): boolean;
|
||||
exists(f: (a: A) => boolean): boolean;
|
||||
filter(f: (a: A) => boolean): Optional<Either<A, B>>;
|
||||
map<X>(f: (a: A) => X): Either<X | A, B>;
|
||||
flatMap<X>(f: (a: A) => Either<X, B>): Either<X | A, B>;
|
||||
toOptional(): Optional<A>;
|
||||
}
|
||||
export class RightProjection<A, B> {
|
||||
private self;
|
||||
constructor(self: Either<A, B>);
|
||||
toString(): string;
|
||||
get(): B;
|
||||
foreach(f: (b: B) => void): void;
|
||||
getOrElse<X extends B>(x: X): B;
|
||||
forall(f: (b: B) => boolean): boolean;
|
||||
exists(f: (b: B) => boolean): boolean;
|
||||
filter(f: (b: B) => boolean): Optional<Either<A, B>>;
|
||||
map<X>(f: (b: B) => X): Either<A, X | B>;
|
||||
flatMap<X>(f: (a: B) => Either<A, X>): Either<A, X | B>;
|
||||
toOptional(): Optional<B>;
|
||||
}
|
||||
|
||||
export interface Optional<A> {
|
||||
isEmpty: boolean;
|
||||
nonEmpty: boolean;
|
||||
get(): A;
|
||||
getOrElse<B extends A>(a: B): A;
|
||||
map<B>(f: (a: A) => B): Optional<B>;
|
||||
fold<B>(ifEmpty: B, f: (a: A) => B): B;
|
||||
flatten(): Optional<A>;
|
||||
filter(f: (a: A) => boolean): Optional<A>;
|
||||
contains<B extends A>(b: B): boolean;
|
||||
exists(f: (a: A) => boolean): boolean;
|
||||
forall(f: (a: A) => boolean): boolean;
|
||||
flatMap<B>(f: (a: A) => Optional<B>): Optional<B>;
|
||||
foreach(f: (a: A) => void): void;
|
||||
orElse<B extends A>(ob: Optional<B>): Optional<A>;
|
||||
apply1<B, C>(ob: Optional<B>, f: (a: A, b: B) => C): Optional<C>;
|
||||
apply2<B, C, D>(ob: Optional<B>, oc: Optional<C>, f: (a: A, b: B, c: C) => D): Optional<D>;
|
||||
chain<B>(ob: Optional<B>): OptionalBuilder1<A, B>;
|
||||
}
|
||||
export const None: Optional<any>;
|
||||
export function Optional<A>(a: A): Optional<A>;
|
||||
export function Some<A>(a: A): Optional<A>;
|
||||
export class OptionalBuilder1<A, B> {
|
||||
private oa;
|
||||
private ob;
|
||||
constructor(oa: Optional<A>, ob: Optional<B>);
|
||||
run<C>(f: (a: A, b: B) => C): Optional<C>;
|
||||
chain<C>(oc: Optional<C>): OptionalBuilder2<A, B, C>;
|
||||
}
|
||||
export class OptionalBuilder2<A, B, C> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
constructor(oa: Optional<A>, ob: Optional<B>, oc: Optional<C>);
|
||||
run<D>(f: (a: A, b: B, c: C) => D): Optional<D>;
|
||||
chain<D>(od: Optional<D>): OptionalBuilder3<A, B, C, D>;
|
||||
}
|
||||
export class OptionalBuilder3<A, B, C, D> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
constructor(oa: Optional<A>, ob: Optional<B>, oc: Optional<C>, od: Optional<D>);
|
||||
run<E>(f: (a: A, b: B, c: C, d: D) => E): Optional<E>;
|
||||
chain<E>(oe: Optional<E>): OptionalBuilder4<A, B, C, D, E>;
|
||||
}
|
||||
export class OptionalBuilder4<A, B, C, D, E> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
constructor(oa: Optional<A>, ob: Optional<B>, oc: Optional<C>, od: Optional<D>, oe: Optional<E>);
|
||||
run<F>(f: (a: A, b: B, c: C, d: D, e: E) => F): Optional<F>;
|
||||
chain<F>(of: Optional<F>): OptionalBuilder5<A, B, C, D, E, F>;
|
||||
}
|
||||
export class OptionalBuilder5<A, B, C, D, E, F> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
private of;
|
||||
constructor(oa: Optional<A>, ob: Optional<B>, oc: Optional<C>, od: Optional<D>, oe: Optional<E>, of: Optional<F>);
|
||||
run<G>(f: (a: A, b: B, c: C, d: D, e: E, f: F) => G): Optional<G>;
|
||||
}
|
||||
|
||||
export interface Try<A> {
|
||||
isSuccess: boolean;
|
||||
isFailure: boolean;
|
||||
get(): A;
|
||||
getError(): Error;
|
||||
fold<B>(fe: (e: Error) => B, ff: (a: A) => B): B;
|
||||
getOrElse<B extends A>(a: B): A;
|
||||
orElse<B extends A>(a: Try<B>): Try<A>;
|
||||
foreach<B>(f: (a: A) => void): void;
|
||||
flatMap<B>(f: (a: A) => Try<B>): Try<B>;
|
||||
map<B>(f: (a: A) => B): Try<B>;
|
||||
filter(f: (a: A) => boolean): Try<A>;
|
||||
toOptional(): Optional<A>;
|
||||
failed(): Try<A>;
|
||||
transform<B>(fs: (a: A) => Try<B>, ff: (e: Error) => Try<B>): Try<B>;
|
||||
recover<B extends A>(f: (e: Error) => Optional<Try<B>>): Try<A>;
|
||||
apply1<B, C>(ob: Try<B>, f: (a: A, b: B) => C): Try<C>;
|
||||
apply2<B, C, D>(ob: Try<B>, oc: Try<C>, f: (a: A, b: B, c: C) => D): Try<D>;
|
||||
chain<B>(ob: Try<B>): TryBuilder1<A, B>;
|
||||
}
|
||||
export function Try<A>(f: () => A): Try<A>;
|
||||
export function Success<A>(a: A): Try<A>;
|
||||
export function Failure<A>(e: Error): Try<A>;
|
||||
|
||||
export class TryBuilder1<A, B> {
|
||||
private oa;
|
||||
private ob;
|
||||
constructor(oa: Try<A>, ob: Try<B>);
|
||||
run<C>(f: (a: A, b: B) => C): Try<C>;
|
||||
chain<C>(oc: Try<C>): TryBuilder2<A, B, C>;
|
||||
}
|
||||
export class TryBuilder2<A, B, C> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
constructor(oa: Try<A>, ob: Try<B>, oc: Try<C>);
|
||||
run<D>(f: (a: A, b: B, c: C) => D): Try<D>;
|
||||
chain<D>(od: Try<D>): TryBuilder3<A, B, C, D>;
|
||||
}
|
||||
export class TryBuilder3<A, B, C, D> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
constructor(oa: Try<A>, ob: Try<B>, oc: Try<C>, od: Try<D>);
|
||||
run<E>(f: (a: A, b: B, c: C, d: D) => E): Try<E>;
|
||||
chain<E>(oe: Try<E>): TryBuilder4<A, B, C, D, E>;
|
||||
}
|
||||
export class TryBuilder4<A, B, C, D, E> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
constructor(oa: Try<A>, ob: Try<B>, oc: Try<C>, od: Try<D>, oe: Try<E>);
|
||||
run<F>(f: (a: A, b: B, c: C, d: D, e: E) => F): Try<F>;
|
||||
chain<F>(of: Try<F>): TryBuilder5<A, B, C, D, E, F>;
|
||||
}
|
||||
export class TryBuilder5<A, B, C, D, E, F> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
private of;
|
||||
constructor(oa: Try<A>, ob: Try<B>, oc: Try<C>, od: Try<D>, oe: Try<E>, of: Try<F>);
|
||||
run<G>(f: (a: A, b: B, c: C, d: D, e: E, f: F) => G): Try<G>;
|
||||
}
|
||||
|
||||
export interface Future<A> {
|
||||
getPromise(): Promise<A>;
|
||||
onComplete<B>(f: (t: Try<A>) => B): void;
|
||||
isCompleted(): boolean;
|
||||
value(): Optional<Try<A>>;
|
||||
failed(): Future<Error>;
|
||||
foreach<B>(f: (a: A) => B): void;
|
||||
transform<B>(f: (t: Try<A>) => Try<B>): Future<B>;
|
||||
transform1<B>(fs: (a: A) => B, ff: (e: Error) => Error): Future<B>;
|
||||
transformWith<B>(f: (t: Try<A>) => Future<B>): Future<B>;
|
||||
map<B>(f: (a: A) => B): Future<B>;
|
||||
flatMap<B>(f: (a: A) => Future<B>): Future<B>;
|
||||
filter(f: (a: A) => boolean): Future<A>;
|
||||
recover<B extends A>(f: (e: Error) => Optional<B>): Future<A>;
|
||||
recoverWith<B extends A>(f: (e: Error) => Optional<Future<B>>): Future<A>;
|
||||
zip<B>(fu: Future<B>): Future<[A, B]>;
|
||||
zipWith<B, C>(fu: Future<B>, f: (a: A, b: B) => C): Future<C>;
|
||||
fallbackTo<B extends A>(fu: Future<B>): Future<A>;
|
||||
andThen<B>(f: (t: Try<A>) => B): Future<A>;
|
||||
apply1<B, C>(ob: Future<B>, f: (a: A, b: B) => C): Future<C>;
|
||||
apply2<B, C, D>(ob: Future<B>, oc: Future<C>, f: (a: A, b: B, c: C) => D): Future<D>;
|
||||
chain<B>(ob: Future<B>): FutureBuilder1<A, B>;
|
||||
}
|
||||
export function Future<A>(f: Promise<A> | (() => A)): Future<A>;
|
||||
export namespace Future {
|
||||
function fromPromise<A>(p: Promise<A>): Future<A>;
|
||||
function unit(): Future<void>;
|
||||
function failed<A>(e: Error): Future<A>;
|
||||
function successful<A>(a: A): Future<A>;
|
||||
function fromTry<A>(t: Try<A>): Future<A>;
|
||||
function sequence<A>(fus: Array<Future<A>>): Future<Array<A>>;
|
||||
function firstCompletedOf<A>(fus: Array<Future<A>>): Future<A>;
|
||||
function find<A>(fus: Array<Future<A>>, f: (a: A) => boolean): Future<Optional<A>>;
|
||||
function foldLeft<A, B>(fu: Array<Future<A>>, zero: B, f: (b: B, a: A) => B): Future<B>;
|
||||
function reduceLeft<A, B>(fu: Array<Future<A>>, f: (b: B, a: A) => B): Future<B>;
|
||||
function traverse<A, B>(fu: Array<A>, f: (a: A) => Future<B>): Future<Array<B>>;
|
||||
}
|
||||
export class FutureBuilder1<A, B> {
|
||||
private oa;
|
||||
private ob;
|
||||
constructor(oa: Future<A>, ob: Future<B>);
|
||||
run<C>(f: (a: A, b: B) => C): Future<C>;
|
||||
chain<C>(oc: Future<C>): FutureBuilder2<A, B, C>;
|
||||
}
|
||||
export class FutureBuilder2<A, B, C> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
constructor(oa: Future<A>, ob: Future<B>, oc: Future<C>);
|
||||
run<D>(f: (a: A, b: B, c: C) => D): Future<D>;
|
||||
chain<D>(od: Future<D>): FutureBuilder3<A, B, C, D>;
|
||||
}
|
||||
export class FutureBuilder3<A, B, C, D> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
constructor(oa: Future<A>, ob: Future<B>, oc: Future<C>, od: Future<D>);
|
||||
run<E>(f: (a: A, b: B, c: C, d: D) => E): Future<E>;
|
||||
chain<E>(oe: Future<E>): FutureBuilder4<A, B, C, D, E>;
|
||||
}
|
||||
export class FutureBuilder4<A, B, C, D, E> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
constructor(oa: Future<A>, ob: Future<B>, oc: Future<C>, od: Future<D>, oe: Future<E>);
|
||||
run<F>(f: (a: A, b: B, c: C, d: D, e: E) => F): Future<F>;
|
||||
chain<F>(of: Future<F>): FutureBuilder5<A, B, C, D, E, F>;
|
||||
}
|
||||
export class FutureBuilder5<A, B, C, D, E, F> {
|
||||
private oa;
|
||||
private ob;
|
||||
private oc;
|
||||
private od;
|
||||
private oe;
|
||||
private of;
|
||||
constructor(oa: Future<A>, ob: Future<B>, oc: Future<C>, od: Future<D>, oe: Future<E>, of: Future<F>);
|
||||
run<G>(f: (a: A, b: B, c: C, d: D, e: E, f: F) => G): Future<G>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "scalike" {
|
||||
export = scalike
|
||||
}
|
||||
Vendored
+1
@@ -264,6 +264,7 @@ declare module Snap {
|
||||
undrag(onMove: (dx: number, dy: number, event: MouseEvent) => void,
|
||||
onStart: (x: number, y: number, event: MouseEvent) => void,
|
||||
onEnd: (event: MouseEvent) => void): Snap.Element;
|
||||
undrag(): Snap.Element;
|
||||
}
|
||||
|
||||
export interface Fragment {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path="srp.d.ts" />
|
||||
|
||||
var srp = require('srp');
|
||||
|
||||
|
||||
// Test the `params` variable.
|
||||
var params = srp.params['1024'];
|
||||
|
||||
|
||||
// Test the `genKey` function.
|
||||
srp.genKey(function (err: Error, buf: Buffer): void {});
|
||||
srp.genKey(16, function (err: Error, buf: Buffer): void {});
|
||||
|
||||
|
||||
// Test the `computeVerifier` function.
|
||||
var salt = new Buffer('deadbeef', 'hex');
|
||||
var identifier = new Buffer('AzureDiamond');
|
||||
var password = new Buffer('hunter2');
|
||||
|
||||
var verifier = srp.computeVerifier(params, salt, identifier, password);
|
||||
|
||||
|
||||
// Test the `Client` class.
|
||||
var secret1 = new Buffer(32);
|
||||
var client = new srp.Client(params, salt, identifier, password, secret1);
|
||||
|
||||
|
||||
// Test the `Server` class.
|
||||
var secret2 = new Buffer(32);
|
||||
var server = new srp.Server(params, verifier, secret2);
|
||||
|
||||
|
||||
// Test handshake protocol.
|
||||
var A = client.computeA();
|
||||
server.setA(A);
|
||||
|
||||
var B = server.computeB();
|
||||
client.setB(B);
|
||||
|
||||
var M1 = client.computeM1();
|
||||
var M2 = server.checkM1(M1);
|
||||
client.checkM2(M2);
|
||||
|
||||
client.computeK();
|
||||
server.computeK();
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// Type definitions for node-srp
|
||||
// Project: https://github.com/mozilla/node-srp
|
||||
// Definitions by: Pat Smuk <https://github.com/Patman64>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bignum/bignum.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace SRP {
|
||||
export interface Params {
|
||||
N_length_bits: number;
|
||||
N: BigNum;
|
||||
g: BigNum;
|
||||
hash: string;
|
||||
}
|
||||
|
||||
export var params: {
|
||||
[bits: string]: Params;
|
||||
};
|
||||
|
||||
/**
|
||||
* The verifier is calculated as described in Section 3 of [SRP-RFC].
|
||||
* We give the algorithm here for convenience.
|
||||
*
|
||||
* The verifier (v) is computed based on the salt (s), user name (I),
|
||||
* password (P), and group parameters (N, g).
|
||||
*
|
||||
* x = H(s | H(I | ":" | P))
|
||||
* v = g^x % N
|
||||
*
|
||||
* @param {Params} params group parameters, with .N, .g, .hash
|
||||
* @param {Buffer} salt salt
|
||||
* @param {Buffer} I user identity
|
||||
* @param {Buffer} P user password
|
||||
*
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
export function computeVerifier(params: Params, salt: Buffer, I: Buffer, P: Buffer): Buffer;
|
||||
|
||||
/**
|
||||
* Generate a random key.
|
||||
*
|
||||
* @param {number} bytes length of key (default=32)
|
||||
* @param {function} callback function to call with err,key
|
||||
*/
|
||||
export function genKey(bytes: number, callback: (error: Error, key: Buffer) => void): void;
|
||||
|
||||
/**
|
||||
* Generate a random 32-byte key.
|
||||
*
|
||||
* @param {function} callback function to call with err,key
|
||||
*/
|
||||
export function genKey(callback: (error: Error, key: Buffer) => void): void;
|
||||
|
||||
export class Client {
|
||||
constructor(params: Params, salt: Buffer, identity: Buffer, password: Buffer, secret1: Buffer);
|
||||
computeA(): Buffer;
|
||||
setB(B: Buffer): void;
|
||||
computeM1(): Buffer;
|
||||
checkM2(M2: Buffer): void;
|
||||
computeK(): Buffer;
|
||||
}
|
||||
|
||||
export class Server {
|
||||
constructor(params: Params, verifier: Buffer, secret2: Buffer);
|
||||
computeB(): Buffer;
|
||||
setA(A: Buffer): void;
|
||||
checkM1(M1: Buffer): Buffer;
|
||||
computeK(): Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "srp" {
|
||||
export = SRP;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user